Compare commits

..

10 Commits

3 changed files with 174 additions and 87 deletions

View File

@@ -56,7 +56,7 @@ Profile keys:
| `files` | No | Host directory containing custom overlay files. In `imagebuilder` mode this is passed as `FILES=<dir>`. In `source` mode contents are synced into `<build dir>/files/` before build. Defaults to `<buildroot>/src/files`. |
| `cherrypicks` | No | Space-separated entries in `URL@branch:commit` form. Each commit is fetched and cherry-picked in `source` mode. |
| `branches` | No | Space-separated `URL@branch` entries to merge into the source worktree in `source` mode. |
| `release` | No | Default release/ref for the profile (for example `snapshot`, `25.12.3`). CLI `--release` overrides it. |
| `release` | No | Default release/ref for the profile (for example `snapshot`, `25.12.4`). CLI `--release` overrides it. |
| `clean` | No | Optional source cleanup step (`clean`, `targetclean`, `dirclean`, `distclean`). CLI `--clean` overrides it. |
| `repo` | No | Extra Image Builder repository line appended to `repositories.conf` before build. |
@@ -70,8 +70,8 @@ Notes:
* `openwrtbuilder -p r4s -p ax6000`
* `openwrtbuilder -p r4s -r snapshot --debug`
* `openwrtbuilder -p ax6000 -r 25.12.3 --mode source --debug`
* `openwrtbuilder -p rpi4 -r 25.12.3 --flash /dev/sdX`
* `openwrtbuilder -p ax6000 -r 25.12.4 --mode source --debug`
* `openwrtbuilder -p rpi4 -r 25.12.4 --flash /dev/sdX`
* `openwrtbuilder -p linksys -r snapshot --ssh-upgrade root@192.168.1.1`
## Additional Info

View File

@@ -5,7 +5,7 @@
# See README and ./profiles for device configuration
# Set default release
: "${DEFAULT_RELEASE:=${RELEASE:="25.12.3"}}" # do find all replace
: "${DEFAULT_RELEASE:=${RELEASE:="25.12.4"}}" # do find all replace
# @internal
usage() {
@@ -19,7 +19,7 @@ usage() {
OPTIONS
--profile,-p PROFILE
--release,-r,--version,-v RELEASE ("snapshot", "25.12.3")
--release,-r,--version,-v RELEASE ("snapshot", "25.12.4")
Default: From profile or hardcoded RELEASE
--buildroot,-b PATH
Default: location of openwrtbuilder script
@@ -35,6 +35,10 @@ usage() {
Enabled by default for --ssh-upgrade
--flash,-f DEVICE
Example: /dev/sdX
--mirror PREFIX
Mirror prefix for feeds (default: github.com/openwrt)
--dl-timeout SECONDS
Per-file max download time for source builds (default: 300)
--depends
Force dependency installation
--yes,-y
@@ -45,7 +49,7 @@ usage() {
EXAMPLES
openwrtbuilder -p r4s -r snapshot
openwrtbuilder -p ax6000 -r 23.05.0-rc3 --mode source --debug
openwrtbuilder -p rpi4 -r 25.12.3 --flash /dev/sdX
openwrtbuilder -p rpi4 -r 25.12.4 --flash /dev/sdX
openwrtbuilder -p linksys -r snapshot --ssh-upgrade root@192.168.1.1
EOF
}
@@ -128,8 +132,8 @@ parse_input() {
debug "${FUNCNAME[0]}" "$*"
declare -ga PROFILES
declare -gi RESET=0 YES=0 DEBUG=0 FORCE_DEPENDS=0 CPUS=0
declare -g USER_RELEASE SSH_UPGRADE_PATH SSH_BACKUP_PATH FLASH_DEV USER_MODE USER_CLEAN
local long_opts='release:,version:,profile:,buildroot:,cpus:,mode:,clean:'
declare -g USER_RELEASE SSH_UPGRADE_PATH SSH_BACKUP_PATH FLASH_DEV USER_MODE USER_CLEAN USER_MIRROR USER_DL_TIMEOUT
local long_opts='release:,version:,profile:,buildroot:,cpus:,mode:,clean:,mirror:,dl-timeout:'
long_opts+='ssh-upgrade:,ssh-backup:,flash:,reset,depends,yes,debug,help'
if _input=$(getopt -o +r:v:p:b:m:c:f:ydh -l $long_opts -- "$@"); then
@@ -145,6 +149,8 @@ parse_input() {
--ssh-upgrade) shift; SSH_UPGRADE_PATH="$1" ;;
--ssh-backup) shift; SSH_BACKUP_PATH="$1" ;;
--flash|-f) shift; FLASH_DEV="$1" ;;
--mirror) shift; USER_MIRROR="$1" ;;
--dl-timeout) shift; USER_DL_TIMEOUT="$1" ;;
--reset) RESET=1 ;;
--depends) FORCE_DEPENDS=1 ;;
--yes|-y) YES=1 ;;
@@ -440,6 +446,7 @@ make_images() {
BIN_DIR="$BIN_DIR"
PROFILE="$DEVICE"
PACKAGES="$PACKAGES"
ROOTFS_FILESYSTEM="$FILESYSTEM"
FILES="$FILES_DIR"
--directory="$BUILD_DIR"
--jobs="$JOBS")
@@ -517,14 +524,33 @@ from_source() {
local src_url="https://github.com/openwrt/openwrt.git"
local seed_file="$BUILD_DIR/.config"
local worktree_meta="$SRC_DIR/.git/worktrees/source-$REF"
local pkg kconfig commit description
local pkg kconfig commit description rootfs_kconfig
local -a make_opts
echo "Building from source is under development"
# Convert filesystem to corresponding KCONFIG value
case "${FILESYSTEM,,}" in
squashfs) rootfs_kconfig="SQUASHFS" ;;
ext4|ext4fs) rootfs_kconfig="EXT4FS" ;;
ubifs) rootfs_kconfig="UBIFS" ;;
erofs) rootfs_kconfig="EROFS" ;;
jffs2) rootfs_kconfig="JFFS2" ;;
all) rootfs_kconfig="all";;
*) echo "Error: unsupported filesystem '$FILESYSTEM' for source mode"; return 1 ;;
esac
# Default KCONFIG options for all profiles (can be overridden by profile-specific KCONFIGS)
local -a kconfigs=(
"CONFIG_TARGET_${TARGET%%/*}=y"
"CONFIG_TARGET_${TARGET//\//_}=y"
"CONFIG_TARGET_PROFILE=DEVICE_$DEVICE"
"CONFIG_TARGET_${TARGET//\//_}_DEVICE_$DEVICE=y"
"CONFIG_TARGET_ROOTFS_${FILESYSTEM^^}=y"
"CONFIG_TARGET_ROOTFS_SQUASHFS=n"
"CONFIG_TARGET_ROOTFS_EXT4FS=n"
"CONFIG_TARGET_ROOTFS_UBIFS=n"
"CONFIG_TARGET_ROOTFS_EROFS=n"
"CONFIG_TARGET_ROOTFS_JFFS2=n"
"CONFIG_TARGET_MULTI_PROFILE=n"
"CONFIG_BUILDBOT=n"
"CONFIG_ALL_KMODS=n"
@@ -538,7 +564,16 @@ from_source() {
"CONFIG_TARGET_PER_DEVICE_ROOTFS=n"
)
echo "Building from source is under development"
# Add KCONFIG for selected filesystem(s)
if [[ $rootfs_kconfig == "all" ]]; then
kconfigs+=("CONFIG_TARGET_ROOTFS_SQUASHFS=y"
"CONFIG_TARGET_ROOTFS_EXT4FS=y"
"CONFIG_TARGET_ROOTFS_UBIFS=y"
"CONFIG_TARGET_ROOTFS_EROFS=y"
"CONFIG_TARGET_ROOTFS_JFFS2=y")
else
kconfigs+=("CONFIG_TARGET_ROOTFS_${rootfs_kconfig}=y")
fi
# Remove all build directories and worktrees if --reset
if ((RESET)); then
@@ -668,18 +703,19 @@ from_source() {
fi
# Use a custom (faster) mirror
execute sed -i -E 's;git.openwrt.org/(feed|project);github.com/openwrt;' feeds.conf.default
local mirror_prefix="${USER_MIRROR:-github.com/openwrt}"
execute sed -i -E "s;git.openwrt.org/(feed|project);${mirror_prefix};" feeds.conf.default
# Update package feed
./scripts/feeds update -a -f &&
./scripts/feeds install -a -f
# Apply custom files overlay for source builds.
execute rm -rf "$BUILD_DIR/files"
if [[ -d "$FILES_DIR" ]]; then
execute mkdir -p "$BUILD_DIR/files"
execute rsync -a "$FILES_DIR/" "$BUILD_DIR/files/"
fi
# execute rm -rf "$BUILD_DIR/files"
# if [[ -d "$FILES_DIR" ]]; then
# execute mkdir -p "$BUILD_DIR/files"
# execute rsync -a "$FILES_DIR/" "$BUILD_DIR/files/"
# fi
# Add custom packages
for pkg in $PACKAGES; do
@@ -707,15 +743,16 @@ from_source() {
execute make "${make_opts[@]}" "-j1" defconfig
# Run serial make download for better reliability
execute make "${make_opts[@]}" "-j1" download
# CURL_EXTRA_ARGS is picked up by OpenWRT's scripts/download.pl
CURL_EXTRA_ARGS="--max-time ${USER_DL_TIMEOUT:-300}" execute make "${make_opts[@]}" "-j1" download
# (Optional) Disable multicore make world
# ((DEBUG)) && make_opts+=("-j1") || make_opts+=("-j$JOBS)")
make_opts+=("-j$JOBS")
# Make image
if ! execute ionice -c2 -n7 nice -n19 make "${make_opts[@]}" BIN_DIR="$BIN_DIR" world; then
echo "Error: make failed"
if ! ionice -c2 -n7 nice -n19 make "${make_opts[@]}" BIN_DIR="$BIN_DIR" world 2>&1 | tee "$BUILD_DIR/make.log"; then
echo "Error: make failed (see $BUILD_DIR/make.log)"
return 1
fi
@@ -819,7 +856,7 @@ main() {
# Store profile in P_ARR nameref and set global profile vars
local -n P_ARR="$PROFILE"
declare -g REPO="${P_ARR[repo]:-}"
declare -g FILESYSTEM="${P_ARR[filesystem]:="squashfs"}"
declare -g FILESYSTEM="${P_ARR[filesystem]:-squashfs}"
declare -g TARGET="${P_ARR[target]}"
declare -g DEVICE="${P_ARR[device]}"
declare -g MODE="${USER_MODE:-${P_ARR[mode]:-imagebuilder}}"

182
profiles
View File

@@ -2,14 +2,30 @@
# Device profiles for openwrtbuilder
# shellcheck disable=SC2034
DEFAULT_RELEASE="25.12.3" # overrides default release in openwrtbuilder
DEFAULT_RELEASE="25.12.4" # overrides default release in openwrtbuilder
# Default packages (precede with "-" to exclude)
default_packages=(
ca-bundle nano vim htop diffutils tar iperf3 zsh rsync tcpdump ethtool
openssh-sftp-server
luci luci-ssl luci-proto-wireguard luci-app-statistics luci-app-filemanager
collectd-mod-sensors collectd-mod-thermal collectd-mod-conntrack collectd-mod-cpu
ca-bundle base-files apk-mbedtls libustream-mbedtls openssh-sftp-server dropbear
fstools libc libgcc logd mtd netifd
nano vim htop diffutils tar iperf3 zsh rsync tcpdump ethtool
odhcp6c ppp ppp-mod-pppoe procd-ujail
uboot-envtools uci uclient-fetch urandom-seed urngd
luci luci-ssl luci-app-statistics luci-app-filemanager luci-app-attendedsysupgrade
lm-sensors collectd-mod-sensors collectd-mod-thermal collectd-mod-conntrack collectd-mod-cpu
tailscale
)
default_router=("${default_packages[@]}"
dnsmasq odhcpd-ipv6only nftables firewall4
luci-proto-wireguard luci-app-sqm luci-app-watchcat
adblock luci-app-adblock
kmod-nft-offload
)
default_ap=("${default_packages[@]}"
-dnsmasq -odhcpd-ipv6only -nftables -firewall4
-kmod-nft-offload
)
# Default kernel configs
@@ -17,32 +33,32 @@ default_kconfigs=(
)
# Current devices
declare -Ag r4s=(
# Nanopi R4S router w/ btrfs
declare -Ag router=(
[mode]="source"
[device]="friendlyarm_nanopi-r4s"
[target]="rockchip/armv8"
[filesystem]="ext4"
[packages]="${default_packages[*]} \
adblock luci-app-adblock \
luci-app-sqm \
[packages]="${default_router[*]} \
kmod-r8169 \
collectd-mod-df usbutils kmod-usb-storage kmod-usb-storage-uas \
kmod-fs-btrfs btrfs-progs block-mount smcroute avahi-daemon \
ethtool ca-bundle tailscale"
kmod-fs-btrfs btrfs-progs block-mount \
smcroute avahi-daemon"
[kconfigs]="${default_kconfigs[*]} \
CONFIG_TARGET_ROOTFS_PARTSIZE=512 CONFIG_TARGET_KERNEL_PARTSIZE=32 \
CONFIG_KERNEL_BTRFS_FS_POSIX_ACL=y CONFIG_BTRFS_PROGS_ZSTD=y"
# For 24.10 branch (Linux 6.6)
# [cherrypicks]="https://github.com/wurzerj/openwrt.git:59d6e31 \
# https://github.com/wurzerj/openwrt.git:bb251b8" # fix inconsistent reboot
)
declare -Ag ax6000=(
# Redmi AX6000 router w/ stock layout in full router mode
declare -Ag abby_router=(
[mode]="imagebuilder"
[device]="xiaomi_redmi-router-ax6000-stock"
[target]="mediatek/filogic"
[filesystem]="squashfs"
[packages]="${default_packages[*]} \
tailscale"
[packages]="${default_router[*]} \
wpad-basic-mbedtls \
kmod-leds-ws2812b kmod-mt7915e \
kmod-mt7986-firmware mt7986-wo-firmware"
)
declare -Ag ax6000_uboot_ap=(
@@ -51,36 +67,71 @@ declare -Ag ax6000_uboot_ap=(
[target]="mediatek/filogic"
[release]="snapshot"
[filesystem]="squashfs"
[packages]="${default_packages[*]} \
-dnsmasq -odhcpd-ipv6only -nftables -firewall4"
[packages]="${default_ap[*]} \
wpad-basic-mbedtls \
kmod-leds-ws2812b kmod-mt7915e \
kmod-mt7986-firmware mt7986-wo-firmware"
)
declare -Ag n5100=(
[device]="generic"
[target]="x86/64"
# Testing
declare -Ag w1700k_ap=(
[mode]="source"
[device]="gemtek_w1700k-ubi"
[target]="airoha/an7581"
[filesystem]="squashfs"
[packages]="${default_packages[*]} \
luci-app-ddns irqbalance collectd-mod-df \
usbutils kmod-usb-storage kmod-usb-storage-uas kmod-fs-btrfs \
btrfs-progs block-mount cryptsetup kmod-crypto-xts smcroute \
avahi-daemon ethtool ca-bundle smartmontools intel-microcode \
lm-sensors samba4-server luci-app-samba4 tailscale shadow-useradd"
[kconfigs]="${default_kconfigs[*]} \
CONFIG_KERNEL_BTRFS_FS_POSIX_ACL=y CONFIG_BTRFS_PROGS_ZSTD=y \
CONFIG_TARGET_ROOTFS_PARTSIZE=512 CONFIG_TARGET_KERNEL_PARTSIZE=32"
[release]="snapshot"
[packages]="${default_ap[*]} \
wpad-basic-mbedtls libiwinfo-data \
kmod-gpio-button-hotplug kmod-leds-gpio \
airoha-en7581-npu-firmware airoha-en7581-mt7996-npu-firmware \
kmod-i2c-an7581 kmod-hwmon-nct7802 kmod-mt7996-firmware kmod-phy-rtl8261n \
fitblk"
)
declare -Ag w1700k_ap_fanboy=(
[mode]="source"
[device]="gemtek_w1700k-ubi"
[target]="airoha/an7581"
[filesystem]="squashfs"
[release]="snapshot"
[packages]="${default_ap[*]} \
wpad-basic-mbedtls libiwinfo-data \
kmod-gpio-button-hotplug kmod-leds-gpio \
airoha-en7581-npu-firmware airoha-en7581-mt7996-npu-firmware \
kmod-i2c-an7581 kmod-hwmon-nct7802 kmod-mt7996-firmware kmod-phy-rtl8261n \
fitblk"
[branches]="https://github.com/OpenWRT-fanboy/OpenW1700k.git@ubi2"
)
declare -Ag w1700k=(
[mode]="source"
[device]="gemtek_w1700k"
[device]="gemtek_w1700k-ubi"
[target]="airoha/an7581"
[filesystem]="squashfs"
[release]="snapshot"
[packages]="${default_packages[*]} \
luci-app-sqm \
smcroute avahi-daemon \
lm-sensors samba4-server luci-app-samba4 shadow-useradd \
ca-bundle tailscale"
[packages]="${default_router[*]} \
wpad-basic-mbedtls libiwinfo-data \
kmod-gpio-button-hotplug kmod-leds-gpio \
airoha-en7581-npu-firmware airoha-en7581-mt7996-npu-firmware \
kmod-i2c-an7581 kmod-hwmon-nct7802 kmod-mt7996-firmware kmod-phy-rtl8261n \
fitblk"
# tools: m4: update to 1.4.21 (fixes GCC15/C23 _Generic build failure)
# [cherrypicks]="https://github.com/openwrt/openwrt@main:ce9a0ff3fb88d037080aaf95af92ac5da4fcfdba"
)
# Deprecated: Last working profile for w1700k with stock (non-ubi) partitions
declare -Ag w1700k_fanboy=(
[mode]="source"
[device]="gemtek_w1700k-ubi"
[target]="airoha/an7581"
[filesystem]="squashfs"
[release]="snapshot"
[packages]="${default_router[*]} \
wpad-basic-mbedtls libiwinfo-data \
kmod-gpio-button-hotplug kmod-leds-gpio \
airoha-en7581-npu-firmware airoha-en7581-mt7996-npu-firmware \
kmod-i2c-an7581 kmod-hwmon-nct7802 kmod-mt7996-firmware kmod-phy-rtl8261n \
fitblk"
# [cherrypicks]="\
# https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:8d449e968cfaa774ab7a219b3a5ab4251b2f9352 \
# https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:3033241393ef6eb562539c6a3ccb9d3cf1a25d05 \
@@ -98,25 +149,12 @@ declare -Ag w1700k=(
# [branches]="https://github.com/OpenWRT-fanboy/OpenW1700k.git@minimal"
)
declare -Ag w1700k_ap=(
[mode]="source"
[device]="gemtek_w1700k"
[target]="airoha/an7581"
[filesystem]="squashfs"
[release]="snapshot"
[packages]="${default_packages[*]} \
-dnsmasq -odhcpd-ipv6only -nftables -firewall4 \
wpad-openssl libiwinfo-data tailscale bridger switch smp_util \
kmod-crypto-hw-eip93"
# [branches]="https://github.com/OpenWRT-fanboy/OpenW1700k.git@minimal"
)
declare -Ag rpi4=(
[device]="rpi-4"
[target]="bcm27xx/bcm2711"
[filesystem]="ext4"
[packages]="${default_packages[*]} \
luci-app-upnp luci-app-pbr -dnsmasq dnsmasq-full luci-app-ddns luci-app-sqm \
[packages]="${default_router[*]} \
luci-app-pbr -dnsmasq dnsmasq-full \
kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152"
)
@@ -127,20 +165,34 @@ declare -Ag r4s_stock=(
[release]="snapshot"
)
# Retired devices
declare -Ag n5100=(
[device]="generic"
[target]="x86/64"
[filesystem]="squashfs"
[packages]="${default_router[*]} \
irqbalance collectd-mod-df \
usbutils kmod-usb-storage kmod-usb-storage-uas kmod-fs-btrfs \
btrfs-progs block-mount cryptsetup kmod-crypto-xts smcroute \
avahi-daemon smartmontools intel-microcode \
samba4-server luci-app-samba4 shadow-useradd"
[kconfigs]="${default_kconfigs[*]} \
CONFIG_KERNEL_BTRFS_FS_POSIX_ACL=y CONFIG_BTRFS_PROGS_ZSTD=y \
CONFIG_TARGET_ROOTFS_PARTSIZE=512 CONFIG_TARGET_KERNEL_PARTSIZE=32"
)
declare -Ag totolink=(
[device]="totolink_x5000r"
[target]="ramips/mt7621"
[filesystem]="squashfs"
[packages]="${default_packages[*]} \
-dnsmasq -odhcpd-ipv6only -nftables -firewall4 \
-kmod-nft-offload collectd-mod-iwinfo"
[packages]="${default_ap[*]}"
)
declare -Ag archer=(
[device]="tplink_archer-c7-v2"
[target]="ath79/generic"
[filesystem]="squashfs"
[packages]="${default_packages[*]} -dnsmasq -odhcpd -iptables \
[packages]="${default_ap[*]} \
-ath10k-firmware-qca988x-ct ath10k-firmware-qca988x-ct-full-htt"
)
@@ -148,26 +200,24 @@ declare -Ag linksys=(
[device]="linksys_ea8300"
[target]="ipq40xx/generic"
[filesystem]="squashfs"
[packages]="${default_packages[*]} \
-dnsmasq -odhcpd -iptables"
[packages]="${default_ap[*]}"
)
declare -Ag r2s=(
[device]="friendlyarm_nanopi-r2s"
[target]="rockchip/armv8"
[filesystem]="ext4"
[packages]="${default_packages[*]} \
luci-app-upnp luci-app-pbr -dnsmasq dnsmasq-full \
luci-app-ddns luci-app-sqm luci-app-statistics collectd-mod-sensors \
collectd-mod-thermal collectd-mod-conntrack smcroute curl ethtool"
[packages]="${default_router[*]} \
kmod-usb-net-rtl8152 \
luci-app-upnp luci-app-pbr -dnsmasq dnsmasq-full smcroute"
)
declare -Ag r2s_tr=(
[device]="friendlyarm_nanopi-r2s"
[target]="rockchip/armv8"
[filesystem]="ext4"
[packages]="${default_packages[*]} \
luci-app-upnp luci-app-pbr luci-app-ddns \
luci-app-statistics collectd-mod-sensors collectd-mod-thermal \
collectd-mod-conntrack curl ethtool travelmate"
[packages]="${default_router[*]} \
kmod-usb-net-rtl8152 \
luci-app-upnp luci-app-pbr -dnsmasq dnsmasq-full \
travelmate"
)