forked from crewrktablets/rk29_kernel_308
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build
executable file
·82 lines (69 loc) · 2.19 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
#!/bin/bash
# build kernel for all devices
# syntax: build <ReleaseTag> [[<device>] [device]...]
# * if no device(s) is/are specified, ALL known devices are built
# set up build environment (external script because this is specific to developer)
. setenv
# kown devices to be built
KNOWNDEVICES="odys_xpress odys_loox_plus odys_next odys_loox"
# additional options for make
MAKE_OPTIONS="-j2"
# 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 treated as release tag name
if [ "" == "$1" ]; then
echo "assuming release tag: TEST"
RELEASETAG=TEST
else
# replace tag spaces in tag with underscores
RELEASETAG=$(echo "$1" | sed 's/\s/_/g')
shift 1
fi
# device list to be built
if [ "" == "$*" ]; then
echo "assuming devices: ${KNOWNDEVICES}"
DEVICES=${KNOWNDEVICES}
else
DEVICES="$*"
fi
# create revision tag
rev="${CURRBRANCH}_${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
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 mrproper
rm kernel.img
make ${device}_defconfig
make ${MAKE_OPTIONS} kernel.img modules 2>&1 | tee build.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}/kernel_308_${device}_${rev}.7z kernel.img
# tag current git state with delivery tag
git tag ${device}.${RELEASETAG}
done
# create package of all available modules
MODULES=`find . -name '*.ko'`
7z a ${KERNEL_PATH}/modules_308_${rev}.7z ${MODULES}