-
Notifications
You must be signed in to change notification settings - Fork 1
/
_build-bootimg.sh
executable file
·106 lines (86 loc) · 2.26 KB
/
_build-bootimg.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
KERNEL_DIR=$PWD
IMAGE_NAME=boot
BIN_DIR=out/$TARGET_DEVICE/$BUILD_TARGET/bin
OBJ_DIR=out/$TARGET_DEVICE/$BUILD_TARGET/obj
mkdir -p $BIN_DIR
mkdir -p $OBJ_DIR
. build_func
. mod_version
. cross_compile
# jenkins build number
if [ -n "$BUILD_NUMBER" ]; then
export KBUILD_BUILD_VERSION="$BUILD_NUMBER"
fi
# set build env
export ARCH=arm
export CROSS_COMPILE=$BUILD_CROSS_COMPILE
export LOCALVERSION="-$BUILD_LOCALVERSION"
echo ""
echo "====================================================================="
echo " BUILD START (KERNEL VERSION $BUILD_KERNELVERSION-$BUILD_LOCALVERSION)"
echo "====================================================================="
if [ ! -n "$1" ]; then
echo ""
read -p "select build? [(a)ll/(u)pdate/(i)mage default:update] " BUILD_SELECT
else
BUILD_SELECT=$1
fi
# copy RAMDISK
echo ""
echo "=====> COPY RAMDISK"
copy_ramdisk
# boot splash header
if [ -f ./drivers/video/samsung/logo_rgb24_user.h ]; then
export USER_BOOT_SPLASH=y
fi
# make start
if [ "$BUILD_SELECT" = 'all' -o "$BUILD_SELECT" = 'a' ]; then
echo ""
echo "=====> CLEANING..."
make clean
cp -f ./arch/arm/configs/$KERNEL_DEFCONFIG $OBJ_DIR/.config
make -C $PWD O=$OBJ_DIR oldconfig || exit -1
fi
if [ "$BUILD_SELECT" != 'image' -a "$BUILD_SELECT" != 'i' ]; then
echo ""
echo "=====> BUILDING..."
if [ -e make.log ]; then
mv make.log make_old.log
fi
nice -n 10 make O=$OBJ_DIR -j12 2>&1 | tee make.log
fi
# check compile error
COMPILE_ERROR=`grep 'error:' ./make.log`
if [ "$COMPILE_ERROR" ]; then
echo ""
echo "=====> ERROR"
grep 'error:' ./make.log
exit -1
fi
# *.ko replace
echo ""
echo "=====> INSTALL KERNEL MODULES"
find -name '*.ko' -exec cp -av {} $RAMDISK_TMP_DIR/lib/modules/ \;
echo ""
echo "=====> CREATE RELEASE IMAGE"
# clean release dir
if [ `find $BIN_DIR -type f | wc -l` -gt 0 ]; then
rm -rf $BIN_DIR/*
fi
mkdir -p $BIN_DIR
# copy zImage -> kernel
cp $OBJ_DIR/arch/arm/boot/zImage $BIN_DIR/kernel
# create boot image
make_boot_image
# create odin image
cd $BIN_DIR
make_odin3_image
# create cwm image
make_cwm_image
cd $KERNEL_DIR
echo ""
echo "====================================================================="
echo " BUILD COMPLETED"
echo "====================================================================="
exit 0