Android Kernel compilation

Source: Internet
Author: User



Description:

I use the cross-compiler tool that comes with Android 4.2.2. If it is installed using the host system, I think it should be possible. But it hasn't been tested. Because the Android source code is already self-brought, most of the time, you do not need to install the host system's cross-compilation tool.

Android comes with two sets of cross-compilation tools, located in the Prebuilts/gcc/linux-x86/arm directory:
1. arm-eabi-4.6
2. arm-linux-androideabi-4.6

The difference between the two is that the latter is newer than the former and has some new features. The actual test shows that all can be used to compile the kernel. It seems that the latter is more used in the NDK. and contains some specific modifications for Android.

For how to compile Android kernel (the default is to compile the Android emulator), the documentation is located under the Android source code
External/qemu/docs/android-kernel. Txt. We can refer to it.

Environment Preparation:

1. Add the path of the cross-compilation tool chain to the system path

Add the following statement to the ~/.BASHRC (please adjust the path according to your actual situation):

Export path= $PATH: ~/android_4.2.2_r1.2/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin

2. Re-login to the terminal or use source ~/.BASHRC.

3. Execute ARM-EABI-GCC--version at the command line, if there is no error message, the configuration is complete.

Compile:

Go to Google to download the latest kernel code. Assuming the goldfish directory is placed, execute the following command compilation (assuming your simulator is ARMV7, your build workstation has 8 cores);
CD Goldfish
Export cross_compile=arm-eabi-
Export Arch=arm
Export Subarch=arm
Make Goldfish_armv7_defconfig
Make-j8

If there is no error in the compilation process, then the last compiled Arch/arm/boot/zimage, which is the kernel we want, can be used for testing.

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.