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.