Android 4.0 x86 Linux3.0.8內核編譯簡介/Compile kernel for Android-x86


原文鏈接:http://www.cnblogs.com/sunshinewill/archive/2012/05/26/2519504.html

$ . build/envsetup.sh
$ lunch xxx-eng
$ make -C kernel O=$OUT/obj/kernel ARCH=x86 menuconfig

xxx是選擇的目標版本,不推薦在kernel目錄通過make menuconfig直接進行內核編譯。

 

根據自己CPU,電源管理接口,總線,設備等情況進行選擇,或使用默認config文件。

可能會出現無法正常顯示,在開機啟動后使用內核指令nomodeset 或xforcevesa解決顯卡驅動問題。

保存該config文件命名為my_deconfig,使用該文件編譯項目源代碼生成定制后的鏡像文件(xxx為目標版本):

$ make iso_img TARGET_PRODUCT=xxx TARGET_KERNEL_CONFIG= my_defconfig

或生成內核二進制文件

$ make kernel TARGET_PRODUCT=generic_x86

最終二進制文件將被生成在out/target/product/generic_x86/kernel 內核模塊被放在out/target/product/generic_x86/system/lib/modules/ 最終目標文件out/target/product/generic_x86/generic_x86.iso 將包括修改后的kernel、相關模塊等文件。

來源:www.android-x86.org

 

 

Compile kernel for Android-x86

Build the default kernel

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

$ make iso_img TARGET_PRODUCT=generic_x86

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 inout/target/product/generic_x86/kernel, and the modules is put underout/target/product/generic_x86/system/lib/modules/. The final targetout/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 bykernel.

$ make kernel TARGET_PRODUCT=generic_x86

Build the target kernel

Since donut-x86 we have supported multiple targets, e.g.,  eeepctegav2, ... Each target may has its customized kernel config located in its device definition directory. When you choose a target (by specifying  TARGET_PRODUCT or  lunchcommand, see  GetSourceCode for details.), the customized kernel config of this target will be used to build the kernel image.

Build a customized kernel

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 ismy_defconfig)

make iso_img TARGET_PRODUCT=eeepc TARGET_KERNEL_CONFIG=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)

Customize the kernel configuration

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)

$ . build/envsetup.sh
$ lunch xxx-eng
$ make -C kernel O=$OUT/obj/kernel ARCH=x86 menuconfig

where xxx is a target you chosen. Then copy $OUT/obj/kernel/.config tocustom_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):

$ make -C kernel distclean
$ rm -rf $OUT/obj/kernel

Use a prebuilt kernel

If you have a workable prebuilt kernel binary for your hardware, you can generate the iso with it:

$ make iso_img TARGET_PRODUCT=eeepc TARGET_PREBUILT_KERNEL=<path to the prebuilt kernel>

Compile kernel for ARM

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
$ git checkout x86/android-goldfish-2.6.29
$ cd ..
$ make kernel TARGET_KERNEL_CONFIG=goldfish_defconfig TARGET_NO_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.

來源:www.android-x86.org

http://www.cnblogs.com/sunshinewill/archive/2012/05/26/2519504.html

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM