先看 build_kernel.sh:
default config 是 bpi_defconfig 或 sun7i_bpi_android_defconfig
內容很無聊,就 make clean,然後到 lichee 下 run build.sh
lichee/build.sh:
buidroot/scripts/mkcommon.sh $@
所以 mkcommon.sh:
好像是真正的 master build script
整理一下:
scripts/build_kernel.sh
lichee/build.sh -p sun7i_android
lichee/buildroot/scripts/mkcommon.sh $@
所以其實只有到 lichee 下, run buildroot/scripts/mkcommon.sh -p sun7i_android
用了一個 google code: shflags.
這是用來使用 argument 的。
以下面這行為例:
DEFINE_string 'platform' 'sun7i' 'platform to build, e.g. sun7i' 'p'
意思是:argument 中有 -n 選項,是 platform 變數,default value 是 sun7i, 說明是 "platform to build, e.g. sun7i
所有的 build script 選項:
DEFINE_string 'platform' 'sun7i' 'platform to build, e.g. sun7i' 'p'
DEFINE_string 'kernel' '3.4' 'kernel to build, e.g. 3.3' 'k'
DEFINE_string 'board' '' 'board to build, e.g. evb' 'b'
DEFINE_string 'module' '' 'module to build, e.g. buildroot, kernel, uboot, clean' 'm'
DEFINE_boolean 'independent' false 'output build to independent directory' 'i'
回到 script, 只有一個 option: '-p sun7i_android'
所以:
FLAGS_platform = sun7i_android
FLAGS_kernel = 3.4
FLAGS_board =
FLAGS_module =
FLAGS_independent = false
接著看..
然後利用字串處理符號 (ref: http://tldp.org/LDP/abs/html/string-manipulation.html ) :
chip=${FLAGS_platform%%_*} 切掉 _以後的部份
platform=${FLAGS_platform##*_} 取出 _之前的部份
kernel=${FLAGS_kernel}
board=${FLAGS_board}
module=${FLAGS_module}
所以..
chip = sun7i
platform = android
kernel = 3.4
board =
module -
所以是 run :
init_outdir
mklichee
build kernel..
結果出現 error:
make: Entering directory `/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali'
/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4
make -C DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump CONFIG=ca8-virtex820-m400-1 BUILD=release KDIR=/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4
make[1]: Entering directory `/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump'
make -C /home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4 M=/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump modules
make[2]: Entering directory `/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4'
CC [M] /home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/common/ump_kernel_common.o
arm-linux-gnueabi-gcc: error: directory: No such file or directory
arm-linux-gnueabi-gcc: error: directory": No such file or directory
make[3]: *** [/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/common/ump_kernel_common.o] Error 1
make[2]: *** [_module_/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump] Error 2
make[2]: Leaving directory `/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump'
make: *** [build] Error 2
make: Leaving directory `/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali'
因為 kernel build 減少了 message 輸出,所以不知道那裡出問題。
先把 message 打開...
ref: https://www.kernel.org/doc/readme/README
- Verbose kernel compile/build output:
Normally, the kernel build system runs in a fairly quiet mode (but not
totally silent). However, sometimes you or other kernel developers need
to see compile, link, or other commands exactly as they are executed.
For this, use "verbose" build mode. This is done by inserting
"V=1" in the "make" command. E.g.:
make V=1 all
To have the build system also tell the reason for the rebuild of each
target, use "V=2". The default is "V=0".
就是去把 compile 加上 option "V=1".
這個build module 的script 是...
lichee/linux-3.4/scripts/build_sun7i_android.sh
所以在 mali 加上 V=1
diff --git a/lichee/linux-3.4/scripts/build_sun7i_android.sh b/lichee/linux-3.4/scripts/build_sun7i_android.sh
index 1c0eae2..45beab3 100755
--- a/lichee/linux-3.4/scripts/build_sun7i_android.sh
+++ b/lichee/linux-3.4/scripts/build_sun7i_android.sh
@@ -135,7 +135,7 @@ build_modules()
(
export LANG=en_US.UTF-8
unset LANGUAGE
- make -C modules/mali LICHEE_MOD_DIR=${LICHEE_MOD_DIR} LICHEE_KDIR=${LICHEE_KDIR} \
+ make -C modules/mali LICHEE_MOD_DIR=${LICHEE_MOD_DIR} LICHEE_KDIR=${LICHEE_KDIR} V=1 \
install
)
build 的結果是..
make: Entering directory `/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali'
/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4
make -C DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump CONFIG=ca8-virtex820-m400-1 BUILD=release KDIR=/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4
make[1]: Entering directory `/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump'
make -C /home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4 M=/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump modules
make[2]: Entering directory `/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo; \
echo " ERROR: Kernel configuration is invalid."; \
echo " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo; \
/bin/false)
mkdir -p /home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/.tmp_versions ;
rm -f /home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/.tmp_versions/*
make -f scripts/Makefile.build obj=/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump
arm-linux-gnueabi-gcc -Wp,-MD,
/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/common/.ump_kernel_common.o.d
-nostdinc -isystem /home/charles-chang/sd/BPiA4.2.2/lichee/out/android/common/buildroot/external-toolchain/bin/../lib/gcc/arm-linux-gnueabi/4.6.3/include
-I/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/arch/arm/include
-Iarch/arm/include/generated -Iinclude
-include /home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/include/linux/kconfig.h
-D__KERNEL__ -mlittle-endian -Iarch/arm/mach-sun7i/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -fno-dwarf2-cfi-asm
-fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=7 -march=armv7-a
-msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls
-g -femit-struct-debug-baseonly -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack
-DSVN_REV=Unversioned directory -DSVN_REV_STRING=\"Unversioned directory\"
-I/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump
-I/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/common
-I/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/linux
-I/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/../mali/common
-I/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/../mali/linux
-I/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/../../ump/include/ump
-DMALI_STATE_TRACKING=0 -I/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/linux/license/gpl
-DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(ump_kernel_common)" -D"KBUILD_MODNAME=KBUILD_STR(ump)" -c
-o /home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/common/.tmp_ump_kernel_common.o
/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/common/ump_kernel_common.c
arm-linux-gnueabi-gcc: error: directory: No such file or directory
arm-linux-gnueabi-gcc: error: directory": No such file or directory
make[3]: *** [/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/common/ump_kernel_common.o] Error 1
make[2]: *** [_module_/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump] Error 2
make[2]: Leaving directory `/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump'
make: *** [build] Error 2
make: Leaving directory `/home/charles-chang/sd/BPiA4.2.2/lichee/linux-3.4/modules/mali'
所以問題就出在..
-DSVN_REV=Unversioned directory
其中 Unversioned directory 沒有用 " " 刮起來,directory 被認為是 compile object...
ref: https://github.com/Pivosgroup/buildroot-linux-kernel/commit/1524a2dc8bfbee683384996f434a2a991416c1df
這裡有一樣的問題。
說明這個 SVN_REV 是用 svnversion 輸出的 svn 版本。
如果這個 folder 不是 svn control, svnversion 就會顯示 exported.
SVN_REV := $(shell ((svnversion | grep -qv exported && echo -n 'Revision: ' && svnversion) || git svn info | sed -e 's/$$$$/M/' | grep '^Revision: ' || echo ${MALI_RELEASE_NAME}) 2>/dev/null | sed -e 's/^Revision: //')
其中的..
svnversion | grep -qv exported
其中的 grep -qv exported 就是剔除 包含 "exported" 的 pattern.
本意是剔除沒有 svn control 的 folder, 因為svnversion 會顯示 "exported".
但是 svn 在1.7 版以後,改為顯示 "Unversioned directory".
所以上面的 rule 就 fail.
要改成:
svnversion | grep -Eqv "exported|Unversioned directory"
同時剔除 exported 和 Unversioned directory 才行。