This article extracts the "Embedded Linux Drive template simplicity and engineering practice" a book "Development and commissioning technology."
Linux is powerful, there are so many open source projects can be used. It is often very much needed to be defined as a high-speed solution by finding the relevant source module. Make these open source modules embedded. Cross-Compile the open source project.
According to the detailed situation. The downloaded open source project has a lot of organizational situations, where various situations are categorized.
1. The downloaded open source package could not find makefile
For such open source packages are generally organized in a configure way, the first step is to use the Configure in the package to generate makefile files. For example, transplant module-init-tools-3.2:
CC=ARM-LINUX-GCC./configure--prefix=/my_depmod--without-gun-ld--host=arm-linux
Specify the cross-compilation tool before./configure, specify the installation path to/my_depmod, and the following options are CPU-dependent.
Each option can be viewed through the./configure–help.
The second step, after generating makefile, opens makefile to see:
prefix =/home/xlong.lin/workspace/sample/module-init-tools-3.2/my_depmode
CC = ARM-LINUX-GCC
The corresponding cross-compilation makefile has been generated on its own initiative.
Step three, make to compile.
Fourth step, make install installation.
The target file or library that is finally required under the specified installation path.
Fifth step, in order to confirm. Use file to see if the resulting file is capable of running in an embedded CPU.
2. Some source code packages downloaded after the decompression of makefile, the same time there are CC options, this is relatively simple situation. Just change the CC and other options to do so.
Like what. Transplant the goahead onto a single board. After decompression, change in makefile:
CC = ARM-LINUX-GCC
AR = Arm-linux-ar
Then make compile it.
Suppose that there are cross_compile in the makefile as well as changing the cross-compiler tool.
3. There is makefile but can not find CC or cross_compile situation.
This situation is compiled with make cross= arm-linux-.
The above summarizes only the cross-compilation of common situations. Either way, it is necessary to use the file tool to verify that cross-compilation is successful and that it is sufficient to run on the appropriate CPU. The ability to use cross-compiler porting of open source software can achieve very high-speed multi-purpose.
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
Linux Open source Module migration Overview and cross-compilation cross-platform porting summary-from "Embedded Linux Drive template simplicity and engineering practice"