Owut: OpenWrt Upgrade Tool

Here's an early holiday gift for experimentalists. There is an undocumented command line switch on owut that allows you to request builds for specific devices. It overrides the information derived from the device on which owut is running and might be useful for building images for, say, tiny 8/64 boxes on which you can't fit "normal" software.

This was originally implemented for my own use in testing, where I build an array of different target/device combinations in automated tests. It will remain "unsupported" in that it's not going to be exposed and documented other than right here.

--device target:profile:fstype:efi

  • target = device target, x86/64 or ath79/generic

  • profile = device "board name", generic or tplink_archer-c7-v4 or zyxel_nwa50ax-pro

  • fstype = depends on device, but usually squashfs, maybe ext4 or something exotic like sdcard or whatever on weird boxes

  • efi = force or check or no, almost always no (which is the default), but could be force for x86 or armsr targets

Here's how to build a minimal AP image for an Archer C7 V4 from your x86 ext4 device:

#!/bin/sh

download_location="/tmp/images"

# See https://downloads.openwrt.org/ and pick a release.
version="${1:-24.10}"

# Run 'ubus call system board' on the target device and copy the
# proper values here:
#  1) release.target => target
#  2) board_name     => board_name, but replace all comma "," with underscore "_"
#  3) rootfs_type    => rootfs_type
target="ath79/generic"
board_name="tplink_archer-c7-v4"
rootfs_type="squashfs"

# List all the packages to be removed, including any defaults.
remove="
        opkg
        firewall4
        dnsmasq
        odhcpd-ipv6only
        wpad-basic-mbedtls
"
# List all packages to add.
add="
        sqm-scripts
        wpad-mbedtls
"

stamp="$(date +'%FT%H%M')"
[ -e "$download_location" ] || mkdir -p "$download_location/"

# --keep  - since we will encounter verification errors (wrong platform),
#           don't delete the .img file.
# --force - proceed even if the package list has issues (which it probably
#           will due again to wrong platform).
owut download \
        --keep --force \
        --device "${target}:${board_name}:${rootfs_type}" \
        --image "${download_location}/${board_name}-${stamp}.bin" \
        --clean-slate --remove "$remove" --add "$add"
7 Likes