内核的编译脚本如下: - build_kernel()
- {
- # Compiler kernel
- cd ${BS_DIR_TOP}/kernel || return 1 //进入内核目录
- make ${BS_CONFIG_KERNEL} || return 1 //配置内核
- make -j${threads} || return 1 //编译内核
-
- # Copy zImage to release directory
- cp -v ${BS_DIR_TOP}/kernel/arch/arm/boot/zImage ${BS_DIR_RELEASE} //将生成的内核映像zImage拷贝到out/release目录
- echo "^_^ kernel path: ${BS_DIR_RELEASE}/zImage" //打印编译成功的提示信息
- return 0
- }
复制代码脚本中BS_CONFIG_KERNEL被声明为x4412_android_defconfig,它将被关联到kernel\arch\arm\configs\ x4412_android_defconfig文件。紧接着执行make指令编译内核。后面的-j${threads}表示使用多核编译,其中threads通过如下方式获取当前编译的PC机CPU核的个数: threads=$(grep processor /proc/cpuinfo | awk'{field=$NF};END{print field+1}') 编译完成后,将zImage文件拷贝到out/release目录。
|