-
Notifications
You must be signed in to change notification settings - Fork 46
/
build
executable file
·93 lines (76 loc) · 2.27 KB
/
build
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
#!/bin/bash
# build kernel for all devices
# syntax: build <How much cpu threads> <ReleaseTag> [[<device>] [device]...]
# * if no device(s) is/are specified, ALL known devices are built
# kown devices to be built
KNOWNDEVICES="odys_genio"
# additional options for make
# path to kernel archive
KERNEL_PATH="../kernels"
# current timestamp
TIMESTAMP=$(date "+%Y%m%d%H%M")
# current git branch
CURRBRANCH=$(git branch | grep '*' | sed 's/*//;s/\s//g')
# parameter $1 is used for -j flag
if [ "" == "$1" ]; then
MAKE_OPTIONS="-j4"
else
MAKE_OPTIONS="$1"
fi
# parameter $2 is treated as release tag name
if [ "" == "$2" ]; then
echo "assuming release tag: TEST"
RELEASETAG=TEST
else
# replace tag spaces in tag with underscores
RELEASETAG=$(echo "$2" | sed 's/\s/_/g')
shift 1
fi
# device list to be built
if [ "" == "$3" ]; then
echo -e "assuming devices: ${KNOWNDEVICES}"
DEVICES=${KNOWNDEVICES}
else
DEVICES="$3"
fi
# create revision tag
rev="${TIMESTAMP}_${RELEASETAG}"
# check for local git changes
LOCALCHANGES=$(git status -s)
if [ "$LOCALCHANGES" != "" ]; then
echo "Local changes present"
echo "Please commit changes before building a release..."
# exit -1
fi
echo -e "\nPerforming Build with following parameters:"
echo -e "Devices:\t$DEVICES"
echo -e "ReleaseTag:\t$RELEASETAG"
echo -e "Revision:\t$rev"
echo -e "MAKE_OPTIONS:\t$MAKE_OPTIONS"
echo
read -p "Press any key to continue, CTRL-C to abort ..."
# perform complete cleanup
echo "Cleaning up ..."
make distclean
# loop through each device
for device in ${DEVICES} ; do
echo -e "***\n*** Building kernel for device: ${device} ***\n***"
make clean
rm kernel.img
make ${device}_defconfig
make ${MAKE_OPTIONS} kernel.img modules 2>&1 | tee build_${device}_${rev}.log
# abort on missing make result
if [ ! -f kernel.img ]; then echo "ABORTED WITH ERROR"; exit; fi
# archive kernel.img
mkdir -p ${KERNEL_PATH}/${device}/${rev}
cp kernel.img ${KERNEL_PATH}/${device}/${rev}
7z a ${KERNEL_PATH}/crewrktablets_kernel_3036_${device}_${rev}.7z kernel.img
# tag current git state with delivery tag
# git tag ${device}.${RELEASETAG}
# create package of all available modules
MODULES=`find . -name '*.ko'`
7z a ${KERNEL_PATH}/modules_3036_${rev}.7z ${MODULES}
done
make clean
echo "Done"
exit 0