Native seL4/Microkit firmware for NanoPi R5S
A standalone non-Linux router: DHCP-configured native WAN, two independently routed RTL8125 LANs (10.44.1.0/24, 10.44.2.0/24), endpoint-preserving NAPT, and fixed stateful forwarding.
WAN uplink
Zero-copy pool
NAT workers
Hot pathDispatcher & control
LAN 1 + LAN 2
Two images of the same firmware and the tool archive the flash steps use. Run production, diagnose with debug. Check the SHA-256 after downloading.
Production96 MiB
Quiet firmware, release SDK. The image to run.
r5s-rtl8125-lan-repair.img
734920599454fff1c447821ce594be0fbd3d14dc6de2312e67fb18ba45a65a1dDebug96 MiB
Firmware logging, status endpoint, LED fault codes. The image to diagnose with.
r5s-rtl8125-lan-repair-debug.img
93a9c30bb655b720a91d2b0b81fef1404fd7f2025c9c17c21bc245cafc9a28e5Tools412 KiB
Image verification and guarded flashing utilities. Needed for the flash steps.
tools.tar.gz
4877c1e93b561e51ea65d9b6f1ea3fe381a75a8b4b487c91072146adfacea280Verify what you downloaded
Keep the files in one folder together with the SHA256SUMS list from this page:
sha256sum -c --ignore-missing SHA256SUMSThe firmware runs from an SD card. Whatever Linux your R5S currently runs (usually on its eMMC) stays untouched and remains available as recovery. The steps below copy the image into the device’s Linux, verify it there, and write it to the SD card. Afterwards the board boots the firmware from the card.
Run on your own Linux machine, in the folder where you downloaded the image, tools.tar.gz and SHA256SUMS. Replace 10.0.1.81 with your R5S’s LAN address. For the debug image, set IMAGE to the debug filename.
IMAGE="r5s-rtl8125-lan-repair.img"
STAGE=/tmp/r5s-wan-fastpath
mkdir -p "$STAGE"
cp "$IMAGE" tools.tar.gz SHA256SUMS "$STAGE/"
ssh [email protected] \
'mkdir -p /dev/shm/r5s-wan-fastpath'
scp "$STAGE/"* \
[email protected]:/dev/shm/r5s-wan-fastpath/Log into the device’s Linux and run the checks. Nothing is written to any disk in this step.
ssh [email protected]
cd /dev/shm/r5s-wan-fastpath
export TMPDIR="$PWD"
sha256sum -c --ignore-missing SHA256SUMS &&
tar -xzf tools.tar.gz &&
python3 scripts/verify-image r5s-rtl8125-lan-repair.imgStill on the R5S. Check which block device is the card you want to write, and read its identity. The name becomes SD_MODEL, the CID becomes SD_CID, and the size in bytes becomes SD_BYTES.
findmnt /
lsblk -b -o NAME,PATH,TYPE,SIZE,MODEL,MOUNTPOINTS
cat /sys/class/block/mmcblk0/device/type
cat /sys/class/block/mmcblk0/device/name
cat /sys/class/block/mmcblk0/device/cid
blockdev --getsize64 /dev/mmcblk0Set the SD_* guards to the values you just read. The ones below are one working example. The first command is a dry run; the second, with --execute, writes the card.
export SD_DEVICE=/dev/mmcblk0
export SD_MODEL=NCard
export SD_CID=8903034e43617264100d3aa313016c07
export SD_BYTES=62534975488
export IMAGE=r5s-rtl8125-lan-repair.img
python3 scripts/flash-sd \
--profile r5s \
--device "${SD_DEVICE:?}" \
--image "${IMAGE:?}" \
--expect-model "${SD_MODEL:?}" \
--expect-serial "${SD_CID:?}" \
--expect-bytes "${SD_BYTES:?}"
python3 scripts/flash-sd \
--profile r5s \
--device "${SD_DEVICE:?}" \
--image "${IMAGE:?}" \
--expect-model "${SD_MODEL:?}" \
--expect-serial "${SD_CID:?}" \
--expect-bytes "${SD_BYTES:?}" \
--executeIf you flashed the debug image
It adds firmware logging, full LED fault codes, the port-5201 TSO test generator and a read-only status endpoint on port 48125. Ask it for a full JSON report:
python3 scripts/read-b51-udp <router-ip>Measure throughput on the production image. The debug SDK and logging cost real cycles.
A seL4/Microkit system of eleven protection domains on four Cortex-A55 cores. Payloads never move between them: a shared zero-copy DMA pool hands off 16-byte references. Budgets are microseconds per 1 ms.
| PD | Core | µs / 1 ms | Role |
|---|---|---|---|
| gmac | 1 | 710 | GMAC0 rings, TSO, checksum offload |
| heartbeat | 1 | 200 | supervisor, SYS LED |
| health | 1 | 90 | health monitor |
| logical_lan | 0 | 330 | dispatcher, bridge, DHCP, fallback |
| wan | 0 | 130 | DHCP client, ARP, echo |
| forward0 | 0 | 260 | NAT worker |
| forward1 | 0 | 220 | NAT worker |
| lan1 | 2 | 650 | RTL8125 rings, GRO |
| forward2 | 2 | 300 | NAT worker (LAN 1) |
| lan2 | 3 | 650 | RTL8125 rings, GRO |
| forward3 | 3 | 300 | NAT worker (LAN 2) |
download gmac RX → worker (NAT + frame prep) → lanX TX → client
upload client → lanX RX → worker (NAT + frame prep) → gmac TX
control wan app ⇄ logical_lan (DHCP · ARP · bridge · copy fallback)Board-tested h4 build, operator-measured on real hardware with manual iperf3 runs, not lab-certified. Both flavors carry the same datapath tuning.
| h4-production | quiet firmware, release SDK, no status endpoint, no test generator, no fault-code LED patterns |
| h4-debug | debug SDK, firmware logging, status JSON on port 48125, port-5201 test generator, LED fault codes |