-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild-openwrt.sh
executable file
·78 lines (68 loc) · 2.21 KB
/
build-openwrt.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
#!/bin/sh
set -e
. ./package.conf
FIREHOL_MD5=`cut -f1 -d' ' < build/firehol.md5`
IPRANGE_MD5=`cut -f1 -d' ' < build/iprange.md5`
# For each release, first architecture builds firehol and iprange.
#
# Subsequent arcitectures just build iprange. This is because firehol
# is not actually architecture-dependent, we just need a way to get
# it into a package, whereas iprange is a binary and must be compiled
# for each target.
osver=22.03
fullver=22.03.0
gccver=11.2.0
mkdir -p build/openwrt-$osver
cd build/openwrt-$osver
rm -f build-list
rm -f outputs
while read short url sdk
do
if [ ! -d "$short" ]
then
if [ ! -f "$sdk.tar.xz" ]
then
wget "$url/$sdk.tar.xz"
fi
tar xfJ "$sdk.tar.xz"
mv "$sdk" "$short"
fi
if [ ! -f build-list ]
then
rm -rf "$short"/package/firehol
cp -rp ../../openwrt/firehol "$short"/package
sed -i -e "s;<<VER>>;$FIREHOL_VERSION;" -e "s;<<URL>>;$FIREHOL_URL;" -e "s;<<MD5>>;$FIREHOL_MD5;" "$short"/package/firehol/Makefile
fi
rm -rf "$short"/package/iprange
cp -rp ../../openwrt/iprange "$short"/package
sed -i -e "s;<<VER>>;$IPRANGE_VERSION;" -e "s;<<URL>>;$IPRANGE_URL;" -e "s;<<MD5>>;$IPRANGE_MD5;" "$short"/package/iprange/Makefile
echo "$short" >> build-list
done <<!
bcm47xx_generic https://downloads.openwrt.org/releases/$fullver/targets/bcm47xx/generic openwrt-sdk-${fullver}-bcm47xx-generic_gcc-${gccver}_musl.Linux-x86_64
ipq806x_generic https://downloads.openwrt.org/releases/$fullver/targets/ipq806x/generic openwrt-sdk-${fullver}-ipq806x-generic_gcc-${gccver}_musl_eabi.Linux-x86_64
!
for t in `cat build-list`
do
echo "build $t"
cd "$t"
# We don't want to build the kernel or modules
make -j1 V=s defconfig
rm -rf package/linux; touch .config
make -j1 V=s package/compile
cd ..
find "$t" -name '*.ipk' -a \! -name 'lib*.ipk' -a \! -name 'kmod*.ipk' -a \! -name 'kernel*.ipk' >> outputs
done
while read output
do
short=`echo $output | cut -f1 -d'/'`
base=`basename "$output"`
case "$base" in
firehol*)
outname=`echo "$base" | sed "s:\.ipk\$:_${osver}_all.ipk:"`
;;
*)
outname=`echo "$base" | sed "s:\.ipk\$:_${osver}_${short}.ipk:"`
;;
esac
cp "$output" "../../output/packages/$outname"
done < outputs