This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
build.sh
executable file
·111 lines (94 loc) · 1.84 KB
/
build.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
107
108
109
110
111
#!/bin/bash
RELEASE=r6p0
JOBS=$(nproc)
BUILD_OPTS="USING_UMP=0
BUILD=release
USING_PROFILING=0
MALI_PLATFORM=sunxi
USING_DVFS=1
USING_DEVFREQ=1"
apply_patches() {
pushd $2
quilt push -a
if [ $? -ne 0 ]; then
echo "Error applying patch $patch"
exit 1
fi
popd
}
unapply_patches() {
pushd $2
quilt pop -a
if [ $? -ne 0 ]; then
echo "Error unapplying patch $patch"
exit 1
fi
popd
}
build_driver() {
local driver_dir=$(pwd)/$RELEASE/src/devicedrv/mali/
make JOBS=$JOBS $BUILD_OPTS -C $driver_dir
if [ $? -ne 0 ]; then
echo "Error building the driver"
exit 1
fi
cp $driver_dir/mali.ko .
}
install_driver() {
local driver_dir=$(pwd)/$RELEASE/src/devicedrv/mali/
make JOBS=$JOBS $BUILD_OPTS -C $driver_dir install
}
clean_driver() {
local driver_dir=$(pwd)/$RELEASE/src/devicedrv/mali/
make JOBS=$JOBS $BUILD_OPTS -C $driver_dir clean
}
while getopts "j:r:aubcit" opt
do
case $opt in
a)
echo "applying patches"
apply_patches $(pwd)/patches $RELEASE
;;
b)
echo "building..."
apply_patches $(pwd)/patches $RELEASE
build_driver $RELEASE
;;
c)
echo "cleaning..."
unapply_patches $(pwd)/patches $RELEASE
clean_driver $RELEASE
;;
i)
echo "installing..."
install_driver $RELEASE
;;
j)
JOBS=$OPTARG
;;
r)
case $OPTARG in
r6p0 | r6p2 | r8p1 | r9p0)
RELEASE=$OPTARG
;;
*)
echo "Unsupported release"
exit 1
esac
;;
u)
echo "unapplying patches"
unapply_patches $(pwd)/patches $RELEASE
;;
t)
echo "Generating travis-ci YAML"
cat travis-base.yml > .travis.yml
./travis.py >> .travis.yml
;;
\?)
echo "invalid option -$OPTARG"
exit 1
;;
esac
done
exit 0