qemu: provision a real U-Boot env and add expect_reboot #1

Merged
noah merged 2 commits from qemu-env-partition into flare-edge-next 2026-09-28 01:26:07 -06:00
Owner

For flare-edge#62: the QEMU rig gets a valid U-Boot env partition, and qmp.py gains expect_reboot for actions whose correct outcome is a reboot.

  • qemu/mkimage.sh: 32 KiB ENVF image (bootcount=0, LE CRC32), parsed cleanly by flare-edge tools/envf.py.
  • qemu/tests/qmp.py: expect_reboot TIMEOUT_S passes only on the kernel's orderly restart line plus QEMU gone; fails on panic, on exit without the line, and on timeout. Six tests in test_qmp_drive.py; the full suite passes.
  • Proven on the rig from flare-edge: both factory-reset flows pass with this change; with the env partition zeroed, expect_reboot fails with "no reboot within 60s".

Based on the commit flare-edge next pins (ed87da1, uplink-routing), so this also carries that commit into flare-edge-next.

Generated with Claude Code

https://claude.ai/code/session_01441BzdGcvQmXkiN2qDjfZg

For flare-edge#62: the QEMU rig gets a valid U-Boot env partition, and qmp.py gains `expect_reboot` for actions whose correct outcome is a reboot. - `qemu/mkimage.sh`: 32 KiB ENVF image (`bootcount=0`, LE CRC32), parsed cleanly by flare-edge `tools/envf.py`. - `qemu/tests/qmp.py`: `expect_reboot TIMEOUT_S` passes only on the kernel's orderly restart line plus QEMU gone; fails on panic, on exit without the line, and on timeout. Six tests in `test_qmp_drive.py`; the full suite passes. - Proven on the rig from flare-edge: both factory-reset flows pass with this change; with the env partition zeroed, `expect_reboot` fails with "no reboot within 60s". Based on the commit flare-edge `next` pins (ed87da1, uplink-routing), so this also carries that commit into flare-edge-next. Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01441BzdGcvQmXkiN2qDjfZg
noah added 2 commits 2026-09-28 00:32:25 -06:00
flare-edge#181: a wired DHCP uplink with no internet (an unactivated
Starlink Mini on eth0) took the default route from wlan0, and replies
to the office left through it, so the panel went unreachable although
its Wi-Fi never dropped. The fix gives every uplink its own routing
table and a `from <address>` rule, so replies leave by the interface
the request arrived on. That needs IPv4 policy routing, which this
kernel did not have: only IPV6_MULTIPLE_TABLES was set, and every
table silently aliased main (seen on the warehouse panel, 0.9.24-rc).

Adds CONFIG_IP_ADVANCED_ROUTER and CONFIG_IP_MULTIPLE_TABLES. Against
a pristine linux-6.18.46 (sha256 pinned), the expanded .config changes
only in that block: FIB_RULES was already selected by the IPv6 option.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MVGTC78dgCGfRANNKjoPea
The rig's env partition was left zeroed, so flared could never clear
bootcount there. It treats that as "intentional reboot bookkeeping not
durable", so every factory reset on the rig wiped the store, was then
refused, and never rebooted (flare-edge#62). mkimage.sh now writes a
valid 32 KiB Rockchip ENVF image (bootcount=0, LE CRC32 over the rest),
the same format flared/src/envf.rs and flare-edge tools/envf.py read;
tools/envf.py parses it with a matching CRC.

An accepted reset then reboots the guest, which ends the VM under
-no-reboot. qmp.py gains expect_reboot TIMEOUT_S for an action whose
correct outcome is a reboot: it passes only when the console shows the
kernel's orderly "reboot: Restarting system" (written after the step
began) and QEMU is gone, and fails on a kernel panic, on an exit without
that line, and on a VM still running at the deadline. The console is
read after the liveness check so the guest's last lines are not missed.
Six drive tests cover it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01441BzdGcvQmXkiN2qDjfZg
noah merged commit 0cf46ba1a4 into flare-edge-next 2026-09-28 01:26:07 -06:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blueflare/bfe-core1106-sdk#1