diff --git a/README.md b/README.md index 03bf5b7..617ef42 100644 --- a/README.md +++ b/README.md @@ -80,13 +80,6 @@ with regard to installing or upgrading your OpenWRT router. OpenWRT upgrades often don't normalize upgraded config files in the same way from version to version -## Raspberry Pi 4 Network Performance Tuning - - * [(15) BIFRÖST Part 2 - RPi 4B Hybrid Bridging Router - Tuning Linux Network for Gigabit Line Speed | LinkedIn](https://www.linkedin.com/pulse/bifr%C3%B6st-rpi-4b-hybrid-routing-bridge-tuning-linux-network-corner/?trk=read_related_article-card_title) - very detailed article about tuning RPi4 network performance using IRQ - CPU pinning and other tricks. Kind of a hardwired ues of `irqbalance` - - ## Post Install Actions * [[OpenWrt Wiki] UCI defaults](https://openwrt.org/docs/guide-developer/uci-defaults) @@ -125,6 +118,39 @@ with regard to installing or upgrading your OpenWRT router. Disable DHCP server on LAN: `uci set dhcp.lan.ignore=1 && uci commit && /etc/init.d/dnsmasq restart` +# Raspberry Pi 4 + +OpenWRT uses a single (main) partition for both the `/rom` and `rootfs_data` +and uses a special `mtdsplit` driver to make this sub-partitioning. +The `/rom` contains a squashfs filesystem with kernel and rootfs and +`rootfs_data` is where the writable `overlayfs` is mounted: +[[OpenWrt Wiki] The OpenWrt Flash Layout](https://openwrt.org/docs/techref/flash.layout) + +For some reason, on a Raspberry Pi 4, this partition is by default only 104MB. +This leaves only around 70MB writable space. Run-time re-partitioning is quite +complicated (contact me if you know how to do it) so that leaves us with +the only option of building the image with a pre-determined size. +The `oi-build` script takes the value of `CONFIG_TARGET_ROOTFS_PARTSIZE` as +the size of the main partition. Make sure that you don't make it larger than +the SD-card you are using. + +NOTE: Contrary to what the OpenWRT Wiki says, +`CONFIG_TARGET_ROOTFS_PARTSIZE` is ignored by the "make" command-line, +and you have to set it in the `.config` file instead. + +See additional info here from the forum: + * [Building a x86-based image and need more disk space in the image - For Developers - OpenWrt Forum](https://forum.openwrt.org/t/building-a-x86-based-image-and-need-more-disk-space-in-the-image/2585/5) + * [X86 sysupgrade not working - For Developers - OpenWrt Forum](https://forum.openwrt.org/t/x86-sysupgrade-not-working/37869) + +https://forum.openwrt.org/t/x86-sysupgrade-not-working/37869 + +## Raspberry Pi 4 Network Performance Tuning + + * [(15) BIFRÖST Part 2 - RPi 4B Hybrid Bridging Router - Tuning Linux Network for Gigabit Line Speed | LinkedIn](https://www.linkedin.com/pulse/bifr%C3%B6st-rpi-4b-hybrid-routing-bridge-tuning-linux-network-corner/?trk=read_related_article-card_title) + very detailed article about tuning RPi4 network performance using IRQ + CPU pinning and other tricks. Kind of a hardwired ues of `irqbalance` + + # Similar projects * [Github ansemjo/openwrtbuilder](https://gist.github.com/ansemjo/cb41677a76f1c063527744438b03b932) diff --git a/configs/rpi-4 b/configs/rpi-4 index 02271a5..6489aef 100644 --- a/configs/rpi-4 +++ b/configs/rpi-4 @@ -10,6 +10,13 @@ PROFILE="rpi-4" RELEASE=${RELEASE_21_02} +# Define this if you want a larger file writable system +# The default for RPi4 is 104 (MB) +# Here we set it to 4096 (MB) which is almost 4GB. +# You must lower the value if your SD-card is smaller than that. +CONFIG_TARGET_ROOTFS_PARTSIZE=4096 + + # See https://openwrt.org/packages/start # # - irqbalance package distributes hardware interrupts across diff --git a/oi-build b/oi-build index f47bd16..1c6a588 100755 --- a/oi-build +++ b/oi-build @@ -138,6 +138,14 @@ image_build() { locate_files_dir + if [ -n "${CONFIG_TARGET_ROOTFS_PARTSIZE}" ]; then + local configfile="${imagebuilder_dir}/.config" + echo_note "Configuring CONFIG_TARGET_ROOTFS_PARTSIZE=${CONFIG_TARGET_ROOTFS_PARTSIZE}" + echo_note "by appending to ${configfile}" + echo "CONFIG_TARGET_ROOTFS_PARTSIZE=${CONFIG_TARGET_ROOTFS_PARTSIZE}" \ + >> .config + fi + PACKAGES=$(echo "${PACKAGES}" | tr '\n' ' ') echo_run "make image PROFILE='${PROFILE}' FILES='${FILES}' PACKAGES='${PACKAGES}' DISABLED_SERVICES='${DISABLED_SERVICES}'" || die "image build FAILED" @@ -299,4 +307,13 @@ fi if [ -d bin/targets/${TARGET} ]; then echo_run "ls -lh bin/targets/${TARGET}/" echo_note "Final images are in ${imagebuilder_dir}/bin/targets/${TARGET}" + cat << EOF +Run following commands to perform a system upgrade: + scp FILE.img.gz HOST:/tmp + ssh HOST '/sbin/sysupgrade -v /tmp/*.img.gz' + +For example: + scp openwrt-imagebuilder-21.02.0-rc3-bcm27xx-bcm2711.Linux-x86_64/bin/targets/bcm27xx/bcm2711/openwrt-21.02.0-rc3-bcm27xx-bcm2711-rpi-4-ext4-sysupgrade.img.gz 192.168.1.1:/tmp + ssh 192.168.1.1 '/sbin/sysupgrade -v /tmp/*.img.gz' +EOF fi