Linux Open source module porting Overview and cross-compiling cross-platform porting summary--excerpt from "Embedded Linux driver template explaining and project practice"

Source: Internet
Author: User

This digest is "Developing and debugging Skills" in the book "Embedded Linux driver template explaining and project practice".

The power of Linux is that there are many open source projects that can be used, and often many requirements can be quickly solved by looking for relevant open source modules. One of the key points to apply these open source modules to embedded is to cross-compile the open source project using the cross-compilation tool.

Depending on the situation, the download of open source projects in the organization there are many situations, where the various situations are categorized.

1. The downloaded open source package could not find makefile

For this open source package is usually organized in a configure way, the first step is to use the Configure in the package to generate the makefile file. For example, porting 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 automatically.

Step three, make to compile.

Fourth step, make install installation. The target file or library that is ultimately required under the specified installation path.

Fifth step, in order to verify that the resulting file is used to see if the obtained files are embedded in the CPU can be performed.

2. Some source package download after decompression has makefile, at the same time there are CC options, this situation is relatively simple, just modify the CC and other options.

For example, to transplant goahead onto a single board, unzip the makefile after the modification:

CC = ARM-LINUX-GCC

AR = Arm-linux-ar

Then make compiles.

If you have cross_compile in makefile, you can also modify the cross-compilation tool.

3. There is makefile but can not find CC or cross_compile case.

This situation is compiled with make cross= arm-linux-.

The above only summarizes the common situation of cross-compilation, regardless of what is compiled will need to use the file tool to confirm whether cross-compilation is successful, can be executed on the corresponding CPU. Being good at using open source software for cross-compiling porting can quickly implement many functions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.