普通步骤是:用来编译整个Android源码
source build/envsetup.sh lunch sabresd_6dq-user make -j20
不过每次这样太繁琐,下面来单独编译kernel分析:在上面make之后的日志中
No private recovery resources for TARGET_DEVICE sabresd_6dq make -C kernel_imx imx_v7_android_defconfig ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi- LOADADDR=0x10008000 KCFLAGS=-mno-android //编译生成zImage make[1]: Entering directory `/home/hejin/myandroid/kernel_imx' # # configuration written to .config # make[1]: Leaving directory `/home/hejin/myandroid/kernel_imx' install -D kernel_imx/.config out/target/product/sabresd_6dq/.config make -C kernel_imx -j20 uImage ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi- LOADADDR=0x10008000 KCFLAGS=-mno-android //编译生成uImage make[1]: Entering directory `/home/hejin/myandroid/kernel_imx' scripts/kconfig/conf --silentoldconfig Kconfig make[1]: Leaving directory `/home/hejin/myandroid/kernel_imx' make[1]: Entering directory `/home/hejin/myandroid/kernel_imx' CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CC scripts/mod/empty.o CC scripts/mod/devicetable-offsets.s MKELF scripts/mod/elfconfig.h
编译:
1. 根据上面导出环境变量
export ARCH=arm
export CROSS_COMPILE=~/myandroid/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi-
2. 编译
make savedefconfig //将当前的.config生成defconfig make imx_v7_android_defconfig //重新生成.config echo $CROSS_COMPILE //make all -j20 >> ~/debug.txt //生成zImage
make -j20 uImage LOADADDR=0x10008000 KCFLAGS=-mno-android //生成uImage,暂时不清楚为何
接着编译bootimg (uImagel 和ramdisk):
source build/envsetup.sh lunch sabresd_6dq-user
make bootimage