-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuildloop
More file actions
executable file
·115 lines (95 loc) · 2.45 KB
/
buildloop
File metadata and controls
executable file
·115 lines (95 loc) · 2.45 KB
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
112
113
114
115
#!/bin/bash
usage=$(
cat <<EOF
$0 [OPTION]
Builds the kernel repeatedly in a loop.
This has been known to cause crashes with unstable hardware
or device drivers.
-l numeric level
1 - stop after make
2 - stop after make modules_install
3 - complete to make install
Default is 3, complete to make install.
-c sparse level
1 - sparse only for newly compiled sources
2 - sparse for all sources
-j number of cpu cores to use (default is all cores)
-b build versioning string
-v verbose make
-h this help screen
With no options, each make in the loop will build and install
the kernel and kernel modules using all processors.
The loop stops if the build fails.
EOF
)
# default settings
#
level=3 # set for complete build/install
sparse=0 # no sparse
verbose="" # no verbose
kabi="" # no kabitools database
cores=$(cat /proc/cpuinfo | grep processor | wc -l)
while getopts b:c:j:l:vh OPTION; do
case "$OPTION" in
b ) echo "$OPTARG" > localversion
;;
l ) level=$OPTARG
;;
c ) sparse=$OPTARG
;;
j ) cores=$OPTARG
;;
v ) verbose="V=1"
;;
h ) echo "$usage"
exit 0
;;
esac
done
loopvar=1
while [ $loopvar -ge 1 ]; do
START1=$(date +%s)
echo "***************************************************"
echo "** **"
echo "** Make Loop Number $loopvar **"
echo "** **"
echo "***************************************************"
loopvar=$((loopvar + 1))
echo "make clean"
make clean;
echo -n "make -j $cores"
[ "$verbose" ] && echo -n "$verbose"
echo
make -j$cores $verbose;
makestat=$?
END=$(date +%s)
DIFF=$(( $END - $START1 ))
minutes=$(( $DIFF / 60 ))
seconds=$(( $DIFF % 60 ))
echo
echo "Elapsed time: $minutes : $seconds"
echo
[ $level -eq 1 ] && exit 0
[ $makestat -eq 0 ] || exit $makestat
make -j$cores modules_install $verbose
makestat=$?
END=$(date +%s)
DIFF=$(( $END - $START1 ))
minutes=$(( $DIFF / 60 ))
seconds=$(( $DIFF % 60 ))
echo
echo "Elapsed time: $minutes : $seconds"
echo
[ $level -eq 2 ] && exit 0
[ $makestat -eq 0 ] || exit $makestat
make -j$cores $verbose C=$sparse install 2>&1 | tee -a ../make.log
makestat=$?
END=$(date +%s)
DIFF=$(( $END - $START1 ))
minutes=$(( $DIFF / 60 ))
seconds=$(( $DIFF % 60 ))
echo
echo "Elapsed time: $minutes : $seconds"
echo
[ $makestat -eq 0 ] || exit $makestat
done