5 AndroidLinux內核源代碼下載與編譯
5.1 下載源碼與編譯
從http://releases.linaro.org/12.10/android/leb-panda/下載linaro_kernel_build_cmds.sh。
linaro_kernel_build_cmds.sh腳本實現的功能是:
1、 download the kernel下載內核源碼。
2、 download the kernel config下載內核配置文件。
3、 build the code編譯源代碼。
5.2 問題
出現的問題:
build linux kernel的錯誤
cc1: error: unrecognizedcommand line option "-mlittle-endian"
cc1: error: unrecognizedcommand line option "-mapcs"
cc1: error: unrecognizedcommand line option "-mno-sched-prolog"
cc1: error: unrecognizedcommand line option "-mabi=aapcs-linux"
cc1: error: unrecognizedcommand line option "-mno-thumb-interwork"
arch/arm/kernel/asm-offsets.c:1:error: bad value (armv5t) for -march= switch
arch/arm/kernel/asm-offsets.c:1:error: bad value (strongarm) for -mtune= switch
原因是CROSS_COMPILER路徑沒有設置正確。
解決方法:打開linaro_kernel_build_cmds.sh腳本找到如下代碼
# build the code
#CROSS_COMPILE=`whicharm-linux-gnueabi-gcc |sed -e 's,gcc,,'`
//Richard:老的無法識別交叉工具鏈,可註釋掉。
CROSS_COMPILE=/data/smbshare/richard/source_code/android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
//Richard:再編譯改爲對應android源代碼中的交叉工具鏈“CROSS_COMPILE=~/<android source>/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-”。
5.3 生成的映像
生成的內核映像:在”.\linaro-kernel\out\arch\arm\boot”中找Image uImage zImage映像文件。