Open-Source space: Cross-compiling of Linux kernel (2.6.22.6)

Source: Internet
Author: User
Article title: open-source space: Cross-compiling Linux kernel (2.6.22.6 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Before compiling the kernel, you should at least look at the README file under the source code root directory, and refer to some other materials to understand the basic conditions and environment required for compiling a kernel, as well as the basic steps.

The cross compiler I use is arm-iwmmxt-linux-gnueabi-gcc (4.2.1) and the kernel version I choose is the Linux-2.6.22.6. The following operations are performed as normal users:

(1) make mrproper

Check whether the kernel source code tree is "clean" before Compilation. this is required.

(2) make ARCH = arm CROSS_COMPILE = arm-iwmmxt-linux-gnueabi-menuconfig

Configure the kernel. 2.6 The Kernel already supports xconfig and gconfig for the graphic interface. However, menuconfig is recommended for easier configuration. Select the mainstone Development board with PXA270 processor as the target system for testing (Intel HCDDBBVA0 Development Platform), and streamline unnecessary options and modules.

For the relationship between the target system name and the specific development board in the kernel configuration options, you can view the arch/arm/mach-pxa/Kconfig file.

After the configuration is complete, select Save. by default, the current configuration will be saved to the. config file. you can also specify a file name such as test. config. you can load the corresponding configuration in the next configuration.

(3) make ARCH = arm CROSS_COMPILE = arm-iwmmxt-linux-gnueabi-compile the kernel.

The error "undefined reference to 'RTC _ lock'" in nvram. c may occur. The solution is: in nvram. "# include" in c, modify include/linux/mc146818rtc. H file, where the conditional compilation option "# ifdef _ KERNEL __...... # Endif "removed.

After compilation, run the "echo $?" command? "Check whether the compilation is completed normally. the correct result is 0.

At this time, the vmlinux (non-compressed kernel in ELF format) and the corresponding symbol table File System. map are generated in the top-level Directory of the kernel source code tree, which can be directly downloaded to the memory for debugging. In addition, arch/arm/boot/compressed/vmlinux (ELF compressed kernel) and arch/arm/boot/zImage (compressed kernel image file) are generated ).

View the vmlinux file information as follows:

[Effeconwong @ localhost linux-2.6.22.6] $ file vmlinux: ELF 32-bit LSB executable, arm, version 1 (SYSV), statically linked, not stripped

(4) make ARCH = arm CROSS_COMPILE = arm-iwmmxt-linux-gnueabi-INSTALL_MOD_PATH =$ {TESTROOTFS} modules_install

Install the kernel module. First define a $ {TESTROOTFS} and install the module here.

(5) install the kernel.

A) cp vmlinux ${TESTROOTFS}/boot/vmlinux-2.6.22.6 B) cp System. map $ {TESTROOTFS}/boot/System. map-2.6.22.6 c) cp. config ${TESTROOTFS}/boot/config-2.6.22.6

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.