-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·75 lines (59 loc) · 2.44 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
#!/bin/bash
set -e
set -x
TARGET=$1
OPENWRT_VERSION="v24.10.0"
ROOT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
BUILD_DIR="/mnt/nfs-firmware/${OPENWRT_VERSION}/${TARGET}"
cd ${ROOT_DIR}
if [[ "${TARGET}" != "lamobo_R1" ]] || [[ "${TARGET}" != "tplink_c2600" ]]
then
# issue on lamobo_R1 or tplink_c2600
# ERROR: package/network/services/ppp failed to build (build variant: default)
export CONFIG_CCACHE=y
export CCACHE_DIR=/tmp/ccache
export CCACHE_MAXSIZE=10G
export CCACHE_COMPILERCHECK="%compiler% -dumpmachine; %compiler% -dumpversion"
[ -d $CCACHE_DIR ] || mkdir -m 777 $CCACHE_DIR
else
export CLEAN_BUILD=true
fi
# Install all necessary packages
#sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core libssl-dev unzip python wget time
if [[ ! -d openwrt/.git ]]
then
rm -rf openwrt
git clone https://github.com/openwrt/openwrt.git openwrt
fi
cd ${ROOT_DIR}/openwrt
git fetch -a
git reset --hard HEAD^
git checkout -f ${OPENWRT_VERSION}
# Patch kernel config to enable nf_conntrack_events
#patch ${ROOT_DIR}/openwrt/target/linux/generic/config-5.10 < ${ROOT_DIR}/configs/kernel-config.patch
rm -rf ${ROOT_DIR}/openwrt/files
cp -r ${ROOT_DIR}/root_files ${ROOT_DIR}/openwrt/files
# configure feeds
echo "src-git chilli https://github.com/mikysal78/coova-chilli-openwrt.git" > feeds.conf
echo "src-git openwisp_config https://github.com/openwisp/openwisp-config.git^1.0.1" >> feeds.conf
echo "src-git openwisp_monitoring https://github.com/openwisp/openwrt-openwisp-monitoring.git" >> feeds.conf
echo "src-git zerotier https://github.com/mwarning/zerotier-openwrt.git" >> feeds.conf
sed '/telephony/d' feeds.conf.default >> feeds.conf
./scripts/feeds update -a -f
./scripts/feeds install -a -f
rm -rf package/feeds/luci/luci-app-apinger
rm -rf ${ROOT_DIR}/openwrt/.config*
cp ${ROOT_DIR}/configs/${TARGET}.config ${ROOT_DIR}/openwrt/.config
cat ${ROOT_DIR}/configs/base-config >> ${ROOT_DIR}/openwrt/.config
make defconfig
if [[ "${CLEAN_BUILD}" == "true" || "${CONFIG_CCACHE}" == "y" ]]
then
make clean
fi
echo "Cleaning bin dir"
rm -rf ./bin/*
# If you try compiling OpenWrt on multiple cores and don't download all source files for all dependency packages
# it is very likely that your build will fail.
# https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem#download_sources_and_multi_core_compile
make download
make -j$(nproc) || make V=s # Retry with full log if failed