Add self-update over the BBA: receive a .dol and relaunch into it
Copying to SD and rebooting is now the slowest part of the loop. Z in the
test app pulls a new .dol over the adapter and launches it.
Deliberately NOT built on an IP stack. Frames carry a private ethertype
(0x88B5, IEEE 802 local experimental 1) and a 12-byte header, so there is no
ARP, no IP, no checksums, and no libogc network driver competing with our raw
driver for the EXI channel. It reuses exactly the two paths the suite already
proves on hardware: bba_tx_bytes() for TX and the SPRAM ring at RRP for RX.
A side benefit is that each update is a few hundred round trips through that
path -- a soak test we did not have.
STOP-AND-WAIT is load-bearing, not laziness. The gateware does not consume
RRP, so RXFrameAssembler can overwrite ring pages the GC has not read yet;
there is no overflow protection. One block in flight means the ring never
holds more than one unread frame, so the missing protection cannot bite. Both
the header and the README say not to make this a sliding window without adding
RBFI-style protection first.
Failure behaviour, so a bad update never costs a power cycle:
- 30 s idle with no frames, or 5 s mid-transfer, aborts to the menu rather
than hanging.
- A duplicate block is RE-ACKed rather than ignored, because a duplicate
means our previous ACK was lost and re-ACKing is what lets the host move
on.
- netboot_receive() re-asserts the NCRA SR bit first: an earlier test may
have left receive disabled, and then this would wait forever for frames
the gateware is not storing.
- netboot_launch() refuses an image whose entry point or first text section
is not in MEM1 instead of jumping into a mis-parsed header.
The jump itself is the one unavoidable risk: once sections are copied and
interrupts are off, a bad image hangs the console hard enough to need a power
cycle. The MEM1 check is what stands between a truncated transfer and that.
Host side is scripts/send-dol.py (AF_PACKET, needs sudo). The GC's MAC is
discovered from its first ACK, so neither side needs an address configured.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -72,3 +72,41 @@ Builds clean (no warnings) with devkitPPC 16.1.0 / GCC 16 in the devcontainer:
|
||||
`gc_bba_test.dol`, ~172 KB, entry `0x80003100`.
|
||||
|
||||
`.gitignore` excludes the build products — run `make` to produce the `.dol`.
|
||||
|
||||
## Self-update over the BBA (Z button)
|
||||
|
||||
Press **Z** in the test app to pull a new `.dol` over the adapter and relaunch
|
||||
into it, instead of copying to the SD card and rebooting.
|
||||
|
||||
On the host, with the interface facing the GameCube:
|
||||
|
||||
```bash
|
||||
sudo ./scripts/send-dol.py enp3s0 gc_bba_test/gc_bba_test.dol
|
||||
```
|
||||
|
||||
It needs `CAP_NET_RAW`, hence `sudo`. The GC's MAC is discovered from its first
|
||||
ACK, so nothing needs configuring on either side — no IP address, no DHCP.
|
||||
|
||||
**It is deliberately not IP.** Frames carry a private ethertype (`0x88B5`,
|
||||
IEEE 802 local experimental 1) and a 12-byte header, so there is no ARP, no IP
|
||||
stack, no checksums and no libogc network driver competing for the EXI
|
||||
channel. It reuses exactly the two paths the test suite already proves on
|
||||
hardware: `bba_tx_bytes()` for TX, and the SPRAM ring at RRP for RX. That also
|
||||
makes it a useful soak test of the data path — a few hundred round trips per
|
||||
update.
|
||||
|
||||
**The transfer is stop-and-wait, and that is load-bearing.** The gateware does
|
||||
not consume RRP, so `RXFrameAssembler` can overwrite ring pages the GC has not
|
||||
read yet — there is no overflow protection. One block in flight means the ring
|
||||
never holds more than one unread frame. Do **not** turn this into a sliding
|
||||
window without adding RBFI-style protection first.
|
||||
|
||||
Failure behaviour, so a bad update never costs a power cycle:
|
||||
- 30 s with no frames at all, or 5 s mid-transfer, aborts back to the menu.
|
||||
- A duplicate block is re-ACKed rather than ignored, so a lost ACK recovers.
|
||||
- `netboot_launch()` refuses an image whose entry point or first text section
|
||||
is not in MEM1, rather than jumping into a mis-parsed header.
|
||||
|
||||
The one unavoidable risk is the jump itself: once sections are copied and
|
||||
interrupts are off, a bad image hangs the console and needs a power cycle. The
|
||||
header check above is what stands between a truncated transfer and that.
|
||||
|
||||
Reference in New Issue
Block a user