The previous article recorded the Android source code compilation process: http://blog.csdn.net/jiguangcanhen/article/details/42081229
But we are in the process of compiling, using Google to compile our kernel source code, location:/prebuilt/android-arm/kernel/kernel-qemu
So how do we compile our own kernel source?
First download Kernel source code: Kernel source code
After downloading the kernel source code, I then the Android source kernel folder, set up a folder Private_guo, and then put the downloaded folder into it.
Enter the root directory of the kernel source:/usr/local/android/android_2.3.7/kernel/private_guo/kernel
Modify Makefile file: sudo gedit Makefile
After that, you can execute the compile command, and this time your shell should be in the root directory of the kernel source code:
Make Goldfish_defconfig
Make
You will then find an error:
I can't find the arm-eabi-gcc .
Then download this tool: Http://pan.baidu.com/s/1eQ3WSU2
You can also go to git and get it: https://github.com/android/platform_prebuilt/tree/master/linux-x86/toolchain/arm-eabi-4.4.3
I am here to provide the whole prebuild, everyone just get inside the platform_prebuilt-master\linux-x86\toolchain\arm-eabi-4.4.3 on it.
Then put it into the/usr/lib, then you can configure the environment variables.
sudo gedit/etc/profile
Then add the/usr/lib/arm-eabi-4.4.3/lib in the Classpath
Add/usr/lib/arm-eabi-4.4.3/bin in Path
Then execute the source/etc/profile to apply the environment variable (lazy restart).
In this way, the above compile command is executed again, and an error is found at this time:
Include/asm is a directory but a symlink was expected
This is also very simple: the Linux/include/asm folder is created during kernel compilation, the result is a link to the folder Asm-arm, indicating that the platform of the system is arm architecture, and before compiling the system kernel, there is no ASM this link, so, during the compilation process , the file name conflicts with the ASM folder name when the link was created, and an error occurred.
After that, execute the compile command again:
Objcopy Arch/arm/boot/zimage appears
Kernel:arch/arm/boot/zimage is ready
This means that the compilation was successful.
Here's how to start the simulator with us:
Export path= $PATH:/usr/local/android/android2.3.7/out/host/linux-x86/bin
Export Android_product_out=/usr/local/android/android_2.3.7/out/target/product/generic
Emulator-kernel./kernel/private_guo/kernel/arch/arm/boot/zimage
After a while, our simulator starts up:
OK, so our kernel is compiled. Good luck!
Android Kernel compilation