forked from rock64-linux/build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mk-kernel.sh
executable file
·49 lines (37 loc) · 1.03 KB
/
mk-kernel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash -e
LOCALPATH=$(pwd)
OUT=${LOCALPATH}/out
EXTLINUXPATH=${LOCALPATH}/build/extlinux
BOARD=$1
finish() {
echo -e "\e[31m MAKE KERNEL IMAGE FAILED.\e[0m"
exit -1
}
trap finish ERR
if [ $# != 1 ]; then
BOARD=rk3288-evb
fi
[ ! -d ${OUT} ] && mkdir ${OUT}
[ ! -d ${OUT}/kernel ] && mkdir ${OUT}/kernel
source $LOCALPATH/build/board_configs.sh $BOARD
if [ $? -ne 0 ]; then
exit
fi
echo -e "\e[36m Building kernel for ${BOARD} board! \e[0m"
echo -e "\e[36m Using ${DEFCONFIG} \e[0m"
cd ${LOCALPATH}/kernel
make ${DEFCONFIG}
make -j8
cd ${LOCALPATH}
if [ "${ARCH}" == "arm" ]; then
cp ${LOCALPATH}/kernel/arch/arm/boot/zImage ${OUT}/kernel/
cp ${LOCALPATH}/kernel/arch/arm/boot/dts/${DTB} ${OUT}/kernel/
else
cp ${LOCALPATH}/kernel/arch/arm64/boot/Image ${OUT}/kernel/
cp ${LOCALPATH}/kernel/arch/arm64/boot/dts/rockchip/${DTB} ${OUT}/kernel/
fi
# Change extlinux.conf according board
sed -e "s,fdt .*,fdt /$DTB,g" \
-i ${EXTLINUXPATH}/${CHIP}.conf
./build/mk-image.sh -c ${CHIP} -t boot
echo -e "\e[36m Kernel build success! \e[0m"