1. Download Kernel Source: https://android.googlesource.com/kernel/goldfish/
Download goldfish-android-goldfish-3.4.tar.gz (I am the source of Android4.4)
2. Create a new kernel folder in the Android source directory
$ mkdir Kernel
Unzip goldfish-android-goldfish-3.4.tar.gz to kernel folder
3. Export the cross-compilation tool directory to the $PATH environment variable.
$ VI ~/.BASHRC
Input content: Export path= $PATH: ~/android/4.4/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin
4. Modify the makefile file to find these two lines:
ARCH = $ (subarch)
Cross_compile = $ (config_cross_compile: "%" =%)
Comment out and then change to
#ARCH? = $ (Subarch)
#CROSS_COMPILE = $ (config_cross_compile: "%" =%)
ARCH? = Arm
Cross_compile? = arm-eabi-
5. $ make Goldfish_armv7_defconfig
$ make-j8
After compiling, the Zimage kernel file will be generated in the Kernel/arch/arm/boot directory.
6. Run the emulator with your own compiled kernel:
[Email protected]:~/android/4.4$ emulator-partition-size 1024-kernel/kernel/arch/arm/boot/zimage-system./out/ Target/product/generic/system.img-data./out/target/product/generic/userdata.img-ramdisk./out/target/product/ Generic/ramdisk.img
Android4.4 compiling a custom kernel