zlsh00 2008-07-09
以下是如何编译AndroidkernelzImage的步骤,我翻译一下而已.
我是用VMWare的ubuntu8.04来编译的,基本上没遇到什么问题.
在Linux的环境下:
建立目录:
mkdir~/android-kernel
cdandroid-kernel
下载源代码,大概有280MB,慢慢等哈~~~(当然你要先安装git)
gitclonegit://git.linuxtogo.org/home/groups/mobile-linux/kernel.git
类似的屏幕信息:
InitializedemptyGitrepositoryin/home/user/android-kernel/kernel/.git/
remote:Countingobjects:908251,done.
remote:Compressingobjects:100%(153970/153970),done.
remote:Total908251(delta755115),reused906063(delta753016)
Receivingobjects:100%(908251/908251),281.86MiB|292KiB/s,done.
Resolvingdeltas:100%(755115/755115),done.
Checkingoutfiles:100%(22584/22584),done.
然后去到htc-msmbranch:
cdkernel
gitcheckout-bhtc-msmorigin/htc-msm
屏幕信息:
Branchhtc-msmsetuptotrackremotebranchrefs/remotes/origin/htc-msm.
Switchedtoanewbranch"htc-msm"
下载ARM的toolchain,大概64MB左右,下到~/android-kernel:
下载:http://www.codesourcery.com/gnu_toolchains/arm/portal/package2549/public/arm-none-linux-gnueabi/arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
cd~/android-kernel
tarxjfarm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
编译kernel
准备缺省的Kaiser配置文件.config:
cd~/android-kernel/kernel
makehtckaiser_defconfigARCH=arm
然后编译zImage:
exportPATH=~/android-kernel/arm-2008q1/bin:$PATH
makezImageARCH=armCROSS_COMPILE=arm-none-linux-gnueabi-
编译好的在:~/android-kernel/kernel/arch/arm/boot/zImage
如果你的机器是多核的,可以编译的时候用-j<cores/cpus_number>来加速:
比如,双核的可以:
make-j2zImageARCH=armCROSS_COMPILE=arm-none-linux-gnueabi-
本人亲自编译几次,没有遇到大问题,就是第一次还没安装git,呵呵,整个流程还是挺容易的.