forked from JiaY-shi/build-gl.inet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·123 lines (115 loc) · 4.09 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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
CRTDIR=$(pwd)
base=$1
profile=$2
ui=$3
echo $base
if [ ! -e "$base" ]; then
echo "Please enter base folder"
exit 1
else
if [ ! -d $base ]; then
echo "Openwrt base folder not exist"
exit 1
fi
fi
if [ ! -n "$profile" ]; then
profile=target_wlan_ap-gl-ax1800
fi
if [ ! -n "$ui" ]; then
ui=true
fi
echo "Start..."
#clone source tree
git clone https://github.com/gl-inet/gl-infra-builder.git $base/gl-infra-builder
cp -r custom/ $base/gl-infra-builder/feeds/custom/
cp -r *.yml $base/gl-infra-builder/profiles
cd $base/gl-infra-builder
function build_firmware(){
cd ~/openwrt
need_gl_ui=$1
ui_path=$2
# fix helloword build error
rm -rf feeds/packages/lang/golang
svn co https://github.com/openwrt/packages/branches/openwrt-22.03/lang/golang feeds/packages/lang/golang
#install feed
./scripts/feeds update -a && ./scripts/feeds install -a && make defconfig
#build
if [[ $need_gl_ui == true ]]; then
make -j$(expr $(nproc) + 1) GL_PKGDIR=~/glinet/$ui_path/ V=s
else
make -j$(expr $(nproc) + 1) V=s
fi
return
}
function copy_file(){
path=$1
mkdir ~/firmware
mkdir ~/packages
cd $path
rm -rf packages
cp -rf ./* ~/firmware
cp -rf ~/openwrt/bin/packages/* ~/packages
return
}
case $profile in
target_wlan_ap-gl-ax1800|\
target_wlan_ap-gl-axt1800|\
target_wlan_ap-gl-ax1800-5-4|\
target_wlan_ap-gl-axt1800-5-4)
if [[ $profile == *5-4* ]]; then
python3 setup.py -c configs/config-wlan-ap-5.4.yml
else
python3 setup.py -c configs/config-wlan-ap.yml
fi
ln -s $base/gl-infra-builder/wlan-ap/openwrt ~/openwrt && cd ~/openwrt
if [[ $ui == true ]]; then
./scripts/gen_config.py $profile glinet_depends glinet_nas custom
git clone https://github.com/gl-inet/glinet4.x.git ~/glinet
else
./scripts/gen_config.py $profile openwrt_common glinet_nas luci custom
fi
build_firmware $ui ipq60xx && copy_file ~/openwrt/bin/targets/*/*
;;
target_ipq40xx_gl-a1300)
python3 setup.py -c configs/config-21.02.2.yml
ln -s $base/gl-infra-builder/openwrt-21.02/openwrt-21.02.2 ~/openwrt && cd ~/openwrt
if [[ $ui == true ]]; then
./scripts/gen_config.py $profile glinet_depends glinet_nas custom
git clone https://github.com/gl-inet/glinet4.x.git ~/glinet
else
./scripts/gen_config.py $profile openwrt_common glinet_nas luci custom
fi
build_firmware $ui ipq40xx && copy_file ~/openwrt/bin/targets/*/*
;;
target_mt7981_gl-mt2500|\
target_mt7981_gl-mt3000)
python3 setup.py -c configs/config-mt798x-7.6.6.1.yml
ln -s $base/gl-infra-builder/mt7981 ~/openwrt && cd ~/openwrt
if [[ $ui == true ]]; then
./scripts/gen_config.py $profile glinet_depends glinet_nas custom
git clone https://github.com/gl-inet/glinet4.x.git ~/glinet
if [[ $profile == *mt3000* ]]; then
cp -rf ~/glinet/pkg_config/gl_pkg_config_mt7981_mt3000.mk ~/glinet/mt7981/gl_pkg_config.mk
else
cp -rf ~/glinet/pkg_config/gl_pkg_config_mt7981_mt2500.mk ~/glinet/mt7981/gl_pkg_config.mk
fi
else
./scripts/gen_config.py $profile glinet_nas custom
fi
build_firmware $ui mt7981 && copy_file ~/openwrt/bin/targets/*/*
;;
target_siflower_gl-sf1200|\
target_siflower_gl-sft1200)
python3 setup.py -c configs/config-siflower-18.x.yml
ln -s $base/gl-infra-builder/openwrt-18.06/siflower/openwrt-18.06 ~/openwrt && cd ~/openwrt
./scripts/gen_config.py $profile glinet_nas custom
build_firmware && copy_file ~/openwrt/bin/targets/*
;;
target_ramips_gl-mt1300)
python3 setup.py -c configs/config-22.03.0.yml
ln -s $base/gl-infra-builder/openwrt-22.03/openwrt-22.03.0 ~/openwrt && cd ~/openwrt
./scripts/gen_config.py $profile glinet_nas luci custom
build_firmware && copy_file ~/openwrt/bin/targets/*/*
;;
esac