-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild_image.sh
executable file
·91 lines (72 loc) · 1.53 KB
/
build_image.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
#!/usr/bin/env bash
#Build Arduino Yun Image for Dragino2. MS14, HE.
SFLAG=
AFLAG=
BFLAG=
APP="caipirinha"
IMAGE_SUFFIX=
BUILD_TIME=`date +%s`
REPO_PATH=$(pwd)
VERSION="22.03"
OPENWRT_PATH="openwrt"
while getopts 'a:p:sh' OPTION
do
case $OPTION in
a)
AFLAG=1
APP="$OPTARG"
;;
p) OPENWRT_PATH="$OPTARG"
;;
s) SFLAG=1
;;
h|?) printf "Build Image for Caipirinha\n\n"
printf "Usage: %s [-p <openwrt_source_path>] [-a <application>] [-s] \n" $(basename $0) >&2
printf " -a: application file to build\n"
printf " -s: build in singe thread\n"
printf "\n"
exit 1
;;
esac
done
shift $(($OPTIND - 1))
BUILD=$APP-$VERSION
BUILD_TIME="`date`"
echo ""
if [ -f conf/$APP/.config ];then
echo ""
echo "Found customized .config files"
else
echo ""
echo "***Can't find conf/$APP/.config file exiting***"
exit
fi
echo "Remove custom files from last build"
rm -rf $OPENWRT_PATH/files
echo "Copy general_files to OpenWrt"
cp -r conf/$APP/files $OPENWRT_PATH/files
echo ".config.$APP to OpenWrt/.config"
cp conf/$APP/.config $OPENWRT_PATH/.config
echo "Creates symbolic link for patches"
rm -f conf/patches
ln -s $APP/patches conf/patches
echo "***Entering build directory***"
cd $OPENWRT_PATH
quilt pop -a
echo "Applying patches"
quilt push -a
make defconfig
echo ""
echo ""
echo "Update build version and build date"
echo "Build: $BUILD"
echo "Build time: $BUILD_TIME"
echo ""
echo ""
if [ ! -z $SFLAG ];then
echo "***Run make for single thread ***"
make -s V=99
else
echo "***Run make"
make -j $(($(nproc)+1)) download world
fi