RPi4 image builder script (based on 21.02.0-rc1)

The OpenWRT image builder is easy to use but I made a small bash script github:openwrt-image-buildomatic that makes it even easier to use: the script reads settings from a (pre-made) config file and then downloads and runs the OpenWRT Image Builder. It thus builds an OpenWRT device image in seconds (1m14s on my machine but depends on download speed)

There is already a Raspberry Pi 4 config with some additional packages. The rpi-4 config has eth0 IRQs processed on CPU2 instead of CPU1 thus significantly decreasing the softirq load. The image is running nicely on my RPi4.

Generating an image for the RPi 4 takes three commands (on Linux):

git clone https://github.com/mmeisner/openwrt-image-buildomatic
cd openwrt-image-buildomatic
./oi-build -b -c rpi-4

And a config file looks like this (rpi-4 config example):

#!/bin/sh
# Raspberry PI 4 configuration for openwrt-image-buildomatic

# Which target CPU to build image for.
TARGET=bcm27xx/bcm2711

# Currently there is only the "rpi-4" build profile for this TARGET
PROFILE="rpi-4"

RELEASE="21.02.0-rc1"

# See https://openwrt.org/packages/start
#
# - irqbalance package distributes hardware interrupts across
#   processors on a multiprocessor system in order to increase performance.
# - bcm27xx-eeprom package provides rpi-eeprom-update, rpi-eeprom-config
#   commands for the RPi-4 eeprom
# - netperf installs /usr/bin/netserver and is used by various speedtest scripts
#   See https://forum.openwrt.org/t/package-to-run-speed-test-on-router/16016
PACKAGES="
${packages_usb_eth}
${packages_luci_apps}
${packages_usb_storage}
bcm27xx-eeprom
irqbalance
ethtool
netperf speedtest-netperf iperf3
nmap netdiscover arp-scan arp-scan-database
iptables-mod-geoip
igmpproxy
-dnsmasq dnsmasq-full
-ip-tiny ip-full
zoneinfo-europe
procps-ng procps-ng-watch procps-ng-pgrep procps-ng-ps procps-ng-top procps-ng-free
curl wget rsync file htop lsof less mc tree usbutils bash
strace
openssh-sftp-server
"
# openssh-server
FILES="rpi-4-files"

DISABLED_SERVICES="\
adblock banip collectd ddns fwknopd https-dns-proxy igmpproxy netserver sqm"

Hello. I am using this little script, and I like it. Thanks for making it available.

For anyone else's reference: It currently only works on 21.02.0-rc3, because ImageBuilder on rc1 and rc2 are broken due to packages updates. This update in rc3 makes it so that hopefully won't happen in the future:

ea308e2

Have you given any thought to adding the ability to change the image size, so that the filesystems have more space? The only way I've found to do so is to edit the .config file in the imagebuilder directory, these two lines:

CONFIG_TARGET_KERNEL_PARTSIZE=64
CONFIG_TARGET_ROOTFS_PARTSIZE=104

There's supposed to be an ImageBuilder option that would accomplish the same thing, like this:

make image PROFILE=foo PACKGES="..." CONFIG_TARGET_KERNEL_PARTSIZE384 CONFIG_TARGET_ROOTFS_PARTSIZE=960

but I never got it to work. I had to change .config.

Glad you find the script useful.
And yes, I too had troubles with rc2 - so good to know that rc3 is out.
Wrt. resizing: I know that Raspian does it on first boot and that would probably be the optimal and generic way to handle it instead of config options. That way it would work with any SD card size. Do tell me if you find anything out!

Thanks for this I'd been scratching my head how to upgrade and include the driver for my USB-Ethernet dongle.