-
Notifications
You must be signed in to change notification settings - Fork 133
/
configure
executable file
·69 lines (60 loc) · 1.43 KB
/
configure
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
#!/bin/bash
set -o errexit
usage() {
cat <<USAGE
Usage: $0 -p <PRODUCT> [-c <DEFCONFIG>]
Options:
-h, --help
Display this help message
-p, --product
The product name
-c, --config
The config name under the product
USAGE
}
build_defconfig() {
DST=openwrt/.config
SRC=products/${PRODUCT}/configs/${DEFCONFIG}_defconfig
cp $SRC $DST
echo "copied from ${SRC} to ${DST} and ready for building"
make -C openwrt defconfig
}
# set defaults
PRODUCT=
DEFCONFIG=
# setup getopt
options=$(getopt -o hp:c: --long "help,product:config:")
[ $? -eq 0 ] || {
echo -e "\nERROR: Getopt failed. Extra args\n"
usage
exit 1
}
set -- "$@"
for i
do
case "$i" in
-h|--help)
usage; exit 1;;
-p|--product)
PRODUCT="$2"; DEFCONFIG="$2"; shift;
shift;;
-c|--config)
DEFCONFIG="$2"; shift;
shift;;
--)
shift; break;;
esac
done
#============================================================
# prepare build enviroment
#===========================================================
if [ -z $PRODUCT ];then
usage
exit 1
else
echo "selected product(${PRODUCT}) and defconfig is ${DEFCONFIG}_defconfig"
fi
#============================================================
# default build all modules, make all image and save stuff
#============================================================
build_defconfig