-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild_u-boot.sh
executable file
·84 lines (67 loc) · 1.89 KB
/
build_u-boot.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
#!/bin/sh
CROSS_COMPILE=${CROSS_COMPILE:-arm-linux-gnueabi-}
JOBS=8
title() {
echo "# $*"
}
list_configs() {
if [ -s boards.cfg ]; then
awk '/sun[4567x]i/ {print $7;}' boards.cfg
elif [ -d configs/ ]; then
grep -rl SUNXI configs/ | sed -n \
-e 's|.*/\(.*\)_defconfig|\1|p'
fi
}
main() {
local builddir_base="$1" nightly_base="$2" NAME="$3"
local log= error=
local prefix=
local rev=$(git rev-parse HEAD | sed -e 's/^\(.......\).*/\1/')
local tstamp=$(date +%Y%m%dT%H%M%S)
local nightly="$builddir_base/$NAME-$tstamp-$rev"
mkdir -p "$nightly_base" "$nightly"
for board in $(list_configs); do
name=$(echo "$board" | tr 'A-Z' 'a-z')
builddir="$builddir_base/build_$name"
log="$builddir"
prefix=$NAME-$name
error=false
title "$prefix ($rev)"
mkdir -p "$builddir"
rm -f "$log.out"
for x in ${board}_config all; do
make CROSS_COMPILE=$CROSS_COMPILE \
O="$builddir" -j$JOBS \
"$x" >> $log.out 2>&1
if [ $? -ne 0 ]; then
error=true
break
fi
done
if $error; then
mv "$log.out" "$nightly/$prefix.err.txt"
else
mv "$log.out" "$nightly/$prefix.build.txt"
mkdir -p "$nightly/$prefix-$tstamp-$rev"
spl="$builddir/spl"
if [ -s "$spl/sunxi-spl.bin" ]; then
cp "$spl/sunxi-spl.bin" "$nightly/$prefix-$tstamp-$rev/"
elif [ -s "$spl/u-boot-spl.bin" ]; then
# FEL case
cp "$spl/u-boot-spl.bin" "$nightly/$prefix-$tstamp-$rev/"
fi
for x in u-boot.bin u-boot-sunxi-with-spl.bin; do
[ -s "$builddir/$x" ] || continue
cp "$builddir/$x" "$nightly/$prefix-$tstamp-$rev/"
done
tar -C "$nightly" -vJcf "$nightly/$prefix.tar.xz" "$prefix-$tstamp-$rev" | sort > "$nightly/$prefix.txt"
rm -rf "$nightly/$prefix-$tstamp-$rev/"
cd "$nightly"
sha1sum -b "$prefix.tar.xz" > "$prefix.sha1"
cd - > /dev/null
fi
done
mv "$nightly" "$nightly_base/"
ln -snf "$NAME-$tstamp-$rev" "$nightly_base/$NAME-latest"
}
main "$@"