openwrt/.buildbot/openwrt/build.sh

114 lines
3.5 KiB
Bash
Executable File

#!/bin/bash
# use the SDK to build the module:
# https://github.com/IchthysMaranatha/asterisk-chan-quectel
# The module is for two vendors, the Quectel-EC* and Simcom SIM7600. In
# preparation I bought one of each (EC25EUX and SIM7600G specifically), I don't
# really care if only one will work, then I'll just buy more of that specific
# vendor's model.
# now I noticed there is actually a Makefile for openwrt in the repo already:
# https://github.com/IchthysMaranatha/asterisk-chan-quectel/tree/master/openwrt
set -x
tar -xJf /Downloads/openwrt-sdk-${OPENWRT_VERSION}-*.tar.xz
cp -r feed openwrt-sdk-*/
pwd=$(pwd)
cd openwrt-sdk-*/
cp feeds.conf.default feeds.conf
cat ${pwd}/feeds.conf >> feeds.conf
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
# Enable collectd network encryption
echo "CONFIG_PACKAGE_COLLECTD_ENCRYPTED_NETWORK=y" >> .config
make package/asterisk-chan-quectel/compile
make package/collectd/compile
# no signing key
make package/index
sdkdir=$(pwd)
cd ${pwd}
tar -xJf /Downloads/openwrt-imagebuilder-${OPENWRT_VERSION}-*.tar.xz
cd openwrt-imagebuilder-*/
cp ${sdkdir}/bin/targets/bcm27xx/bcm2711/packages/*.ipk packages/
cp ${sdkdir}/bin/packages/aarch64_cortex-a72/packages/*.ipk packages/
cp ${sdkdir}/bin/packages/aarch64_cortex-a72/telephony/*.ipk packages/
cp ${sdkdir}/bin/packages/aarch64_cortex-a72/quectel/*.ipk packages/
make info
# Increase the size of the root partition
echo "CONFIG_TARGET_ROOTFS_PARTSIZE=308" >> .config
# Disable ext4 images
echo "CONFIG_TARGET_ROOTFS_EXT4FS=n" >> .config
# Setup files
mkdir -p files/etc/dropbear
chmod 0750 files/etc/dropbear
cp ${pwd}/authorized_keys files/etc/dropbear
chmod 0400 files/etc/dropbear/authorized_keys
mkdir -p files/etc/uci-defaults
cp ${pwd}/defaults/* files/etc/uci-defaults
mkdir -p files/boot/overlays
cp ${pwd}/overlays/*.txt files/boot/
cp ${pwd}/overlays/*.dtbo files/boot/overlays/
PACKAGES="kmod-i2c-bcm2835 kmod-nf-nathelper-extra kmod-rtc-ds1307 \
kmod-usb-audio kmod-usb-net-rtl8152 \
alsa-lib pciutils usbutils \
kmod-usb-net-qmi-wwan libqmi qmi-utils uqmi luci-proto-qmi \
shadow-usermod \
asterisk \
asterisk-app-sms asterisk-pjsip asterisk-bridge-simple \
asterisk-codec-alaw asterisk-codec-ulaw \
asterisk-res-rtp-asterisk \
asterisk-chan-quectel \
ca-certificates \
collectd collectd-mod-contextswitch collectd-mod-cpu \
collectd-mod-curl collectd-mod-df \
collectd-mod-dhcpleases collectd-mod-disk \
collectd-mod-dns collectd-mod-entropy \
collectd-mod-ethstat collectd-mod-exec \
collectd-mod-filecount collectd-mod-fscache \
collectd-mod-interface collectd-mod-ipstatistics \
collectd-mod-iptables collectd-mod-irq \
collectd-mod-iwinfo collectd-mod-load \
collectd-mod-memory collectd-mod-network \
collectd-mod-nginx collectd-mod-ping \
collectd-mod-processes collectd-mod-protocols \
collectd-mod-sensors collectd-mod-smart \
collectd-mod-sqm collectd-mod-tcpconns \
collectd-mod-thermal collectd-mod-uptime \
collectd-mod-users collectd-mod-vmem \
collectd-mod-wireless \
curl etherwake fail2ban \
luci-app-mwan3 luci-app-upnp \
luci-proto-wireguard \
luci-ssl-nginx luci-app-acme \
python3-packages python3-yaml \
openssh-sftp-server tcpdump \
iptables-nft ip6tables-nft \
wireguard-tools wget-ssl \
"
make image PROFILE=rpi-4 \
PACKAGES="${PACKAGES}" DISABLED_SERVICES="dropbear" FILES="files"
make manifest PROFILE=rpi-4 PACKAGES="${PACKAGES}"
out=../../out
mkdir -p ${out}
mv bin/targets/bcm27xx/bcm2711/*.gz ${out}
mv packages ${out}