forked from ccrisan/motionpie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·55 lines (44 loc) · 1.17 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
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 <board|all> [mkimage|mkrelease|make_targets...]"
exit 1
fi
set -e # exit at first error
board=$1
target=${*:2}
cd $(dirname $0)
basedir=$(pwd)
if [ "$board" == "all" ]; then
boards=$(ls $basedir/configs/*_defconfig | grep -oE '\w+_defconfig$' | cut -d '_' -f 1)
for b in $boards; do
if ! $0 $b $target; then
exit 1
fi
done
exit 0
fi
outputdir=$basedir/output/$board
boarddir=$basedir/board/$board
if ! [ -f $basedir/configs/${board}_defconfig ]; then
echo "unknown board: $board"
exit 1
fi
mkdir -p $outputdir
if ! [ -f $outputdir/.config ]; then
make O=$outputdir ${board}_defconfig
fi
if [ "$target" == "mkimage" ]; then
$boarddir/mkimage.sh
elif [ "$target" == "mkrelease" ]; then
$boarddir/mkimage.sh
cp $outputdir/images/motionpie-$board.img $basedir
date=$(date +%Y%m%d)
mv $basedir/motionpie-$board.img $basedir/motionpie-$board-$date.img
rm -f $basedir/motionpie-$board-$date.img.gz
gzip $basedir/motionpie-$board-$date.img
elif [ -n "$target" ]; then
make O=$outputdir $target
else
make O=$outputdir
$boarddir/mkimage.sh
fi