Skip to content

Instantly share code, notes, and snippets.

@stargieg
Created March 12, 2021 21:13
Show Gist options
  • Save stargieg/2734a22e6c8b262d8c99dec378c76d42 to your computer and use it in GitHub Desktop.
Save stargieg/2734a22e6c8b262d8c99dec378c76d42 to your computer and use it in GitHub Desktop.
Build Firmware for ubnt-nano-m with minimal packages selection
#!/bin/sh
#sudo apt install subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc zip imagemagick
umask 022
upd_out="ubnt-nano-m"
upd_target="ar71xx"
upd_subtarget="generic"
upd_profile="ubnt-nano-m"
upd_profilel=$(echo "$upd_profile" | tr '[:upper:]' '[:lower:]')
#slot="snapshots"
#gcc_ver="gcc-8.3.0_musl"
#version="18.06.5"
#version="19.07.5"
version="19.07.7"
slot="releases/$version"
versioni="-$version"
#gcc_ver="gcc-7.3.0_musl"
gcc_ver="gcc-7.5.0_musl"
path="$(pwd)"
rm -rf $upd_out
mkdir -p $upd_out
mkdir -p dl
cd dl
wget -N -c https://downloads.openwrt.org/$slot/targets/$upd_target/$upd_subtarget/openwrt-imagebuilder$versioni-$upd_target-$upd_subtarget.Linux-x86_64.tar.xz
cd ..
[ -f dl/openwrt-imagebuilder$versioni-$upd_target-$upd_subtarget.Linux-x86_64.tar.xz ] || exit
rm -rf openwrt-imagebuilder$versioni-$upd_target-$upd_subtarget.Linux-x86_64
tar -x -f dl/openwrt-imagebuilder$versioni-$upd_target-$upd_subtarget.Linux-x86_64.tar.xz
cd openwrt-imagebuilder$versioni-$upd_target-$upd_subtarget.Linux-x86_64
touch staging_dir/host/.prereq-build
eval $(grep ^CONFIG_TARGET_ARCH_PACKAGES .config)
upd_arch=$CONFIG_TARGET_ARCH_PACKAGES
mkdir -p files/etc/uci-defaults
echo "src luci2_ffwizard file:$path/luci2-ffwizard/$slot/packages/$upd_arch/luci2_ffwizard" >> repositories.conf
PACKAGES="$PACKAGES -wpad-basic wpad-mesh-wolfssl"
PACKAGES="$PACKAGES dnsmasq libustream-wolfssl20150806 luci-app-opkg"
PACKAGES="$PACKAGES luci-mod-admin-full luci-theme-material luci-proto-ipv6"
PACKAGES="$PACKAGES luci-app-commands luci-app-uhttpd px5g-standalone"
PACKAGES="$PACKAGES libiwinfo-lua libuhttpd-wolfssl"
PACKAGES="$PACKAGES luci2-ffwizard-lua uhttpd-mod-lua libiwinfo-lua luci-proto-ipv6 luci-lib-json luci-i18n-base-de"
PACKAGES="$PACKAGES luci2-ffwizard-olsrd-ipv4 olsrd olsrd-mod-jsoninfo olsrd-mod-nameservice"
PACKAGES="$PACKAGES luci2-ffwizard-olsrv2-ipv6 oonf-init-scripts oonf-olsrd2"
PACKAGES="$PACKAGES luci-app-ddns luci-app-olsr2 luci-app-olsr luci-app-olsr-public luci-mod-freifunk"
PACKAGES="$PACKAGES luci-app-falter-owm-cmd luci-app-falter-owm-gui luci-app-falter-owm-ant"
PACKAGES="$PACKAGES -firewall -mod-usb-core -ppp-mod-pppoe -kmod-ipt-offload -ip6tables -iptables -ppp"
make image PROFILE="$upd_profile" PACKAGES="$PACKAGES" BIN_DIR="$path/$upd_out" FILES="files"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment