Cross-Compiling of Embedded Linux kernel-2.6.26-based

Source: Internet
Author: User
Cross-compiling of the embedded Linux kernel-Based on 2.6.26-general Linux technology-Linux programming and kernel information. For more information, see the following. Author: yuhunter test environment: Fedora 9 Linux 2.6.26/gcc 4.3.0/arm-linux-gcc 3.4.1

This article describes how to build an embedded Linux Kernel on each platform on the x86 platform. To complete this step, you must first confirm that there is a corresponding cross-compilation toolchain. The tool chain can be compiled by yourself, but we do not recommend this for beginners. There are many excellent tool chains compiled on the Internet. This article uses compiling the kernel on the ARM platform as an example. The basic steps of other platforms are not very different. To display the newest, kernel 2.6.26 is also used.

First, you must obtain the latest kernel version. You can download the 2.6.26 Kernel on ftp.kernel.org. Extract the corresponding kernel package:

For linux-2.6.26.tar.gz
Tar zxvf linux-2.6.26.tar.gz

For linux-2.6.26.tar.bz2
Tar xjvf linux-2.6.26.tar.bz2

And enter the linux-2.6.26 folder.
If the kernel code 2.6.26 already exists on the machine, you can also use it directly, but to clear the legacy of the last compilation, you can
Make distclean

After the backup is complete, we start to configure the kernel. When compiling the kernel on the local machine, we can directly make menuconfig and so on to generate the. config file based on the current Kernel configuration of our machine. But it is of course very difficult for embedded systems. Thanks to linux, it supports hundreds of platforms. Default configuration files are available for different platforms. For the arm we use, you can see it in the/arch/arm/configs folder.
We should choose based on the platform we use. If PXA270 is used, you can select em_x270_defconfig. Run
Make ARCH = arm CROSS_COMPILE = arm-linux-em_x270_defconfig

The two macros ARCH and CROSS_COMPILE we use refer to the architecture we selected (linux lists the supported architectures in the kernel code tree arch folder) and the prefix of the cross compiler.

Then you can run it again.
Make menucnfig
.

After that, it is compiled. For embedded systems, most of them are compiled into image files. Here we compile them into zImage.
Make ARCH = arm CROSS_COMPILE = arm-linux-zImage

If a module is selected
Make ARCH = arm CROSS_COMPILE = arm-linux-modules

And
Make ARCH = arm CROSS_COMPILE = arm-linux-INSTALL_MOD_PATH = Modules_install

Macro INSTALL_MOD_PATH is the root directory of the module installation. Here we select the path of the parasitic file system we have prepared for the embedded system. The default path is the root directory of the Local Machine (I .e /), if this macro is set, the module is installed in the large/lib/modules folder, which is sometimes disastrous.

This is done, isn't it missing? We almost forgot the compiled zImage. Where is he? In general, it is in the linux-2.6.26/arch/$ ARCH/boot, this is in the linux-2.6.26/arch/arm/boot to find him, a look at the size of 1.5 MB. How can it become smaller? The key is to make menucnfig, which is the technical requirement.
Related Article

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.