by Chih-Wei Huang (cwhuang) 2009/07/13
This article describes an extra feature of the build system of android-x86 project. That is, the ability to build kernel and modules by a predefined or customized config during the building process.
We have modify the Android build system to compile a kernel image on-fly. You need to use our repository to get this feature. Read the article GetSourceCode for details.
The prebuilt kernel binary for x86 target is removed. Instead, we put a default config for android-x86 in kernel/arch/x86/configs/. To build a kernel image from this config, run
By specifying the TARGET_PRODUCT to generic_x86, the build system automatically selects the config android-x86_defconfig to compile the kernel binary and its modules. The binary will finally be generated in out/target/product/generic_x86/kernel, and the modules is put under out/target/product/generic_x86/system/lib/modules/. The final target out/target/product/generic_x86/generic_x86.iso will contain the kernel binary and its modules.
You may build the kernel and its modules alone, by replacing the goal iso_img by kernel.
GetSourceCode for details.), the customized kernel config of this target will be used to build the kernel image.
Suppose you already have a workable kernel config for you hardware, it's easy to tell the build system to use your config to build the iso. Just put your config file to kernel/arch/x86/configs/, and run (suppose the name of your config is my_defconfig)
Note you cannot use a kernel config from a normal linux distribution (e.g, ubuntu) for android-x86. You need to enable android kernel features to make it work. See Documentation/android.txt for a list of required configuration options for a kernel to support an Android system. (but removes arm specific options for android-x86, e.g., PMEM)
It is never advisable to edit the kernel config file directly, as it may generate faulty configuration (dependencies not met etc.). The correct way to customize the kernel config is (on the top of android-x86 tree)
where xxx is a target you chosen. Then copy $OUT/obj/kernel/.config to custom_kernel_config_location.
DO NOT issue make menuconfig in the kernel/ directory directly. If you do so, the build rules may be broken. In this case, try this way to recover it (on the top of android-x86 tree):
If you have a workable prebuilt kernel binary for your hardware, you can generate the iso with it:
The kernel build system can also be used to compile kernel for ARM. For example, to compile kernel 2.6.29 for the goldfish CPU of the arm emulator, run
$ cd kernel
The kernel binary will be generated in out/target/product/generic/kernel.
Set TARGET_NO_KERNEL to be empty is important, otherwise the kernel building steps will be skipped.