Repository navigation
novatek: the mask ROM's Ethernet boot, DHCP and TFTP through nvt-eqos - #226
Conversation
The fallback's Ethernet stage (#225) sent nothing. It is now the NA51089 ROM's DHCP and TFTP client, as read from a dump of the ROM and seen on an NT98562 on a real LAN: - A MAC of 00:00:00 and three random bytes, new every boot. DHCPDISCOVER every 5 s. - The first broadcast offer is taken; a unicast one, to an address it has not configured, is dropped, as silicon dropped dnsmasq's. - DHCPREQUEST, the ACK, an ARP request for the next-server, then one TFTP read request for loader.bin from port 2962, to the offer's MAC. - Then it waits for DATA from that server with no timeout and no retransmission, so a network DHCP server that wins the race holds it for good. A short block ends it, then the loader check. - The letters are silicon's: aOfIP <ip> SRV <srv>, MSK, bS2, cAkS3S4, CD for ARP, t<block>, Dn, T. The ROM drives nvt-eqos through a new hook: attached, every frame goes to it instead of the rings, and it sends on the NIC's queue; it detaches before the jump, and the loader brings the MAC up as before. Attaching flushes the queue, or a tap backend that stopped polling while the MAC could not receive never starts again. defib's Ethernet recovery (OpenIPC/defib#170, #171) runs against it unmodified over a tap: the ROM takes defib's offer, fetches loader.bin, the real Ethernet loader then does its own DHCP and fetches the U-Boot pack, and U-Boot from RAM answers at its prompt, on nt98562 and nt98566. qemu-boot/test-novatek-recovery.sh gains that third way in, and CI runs it (sudo for the tap and ports 67/69), with defib pinned to 74e1bcc. test-novatek.py drives the ROM over a UDP socket netdev with no root: a unicast offer dropped, a broadcast one taken, the ARP and the single read request to the offering MAC, no retransmission while it waits, and one short block running the loader. 802 checks pass.
PR Summary by QodoEmulate Novatek mask ROM Ethernet recovery over DHCP and TFTP
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
Code Review by Qodo
1.
|
…s a caller's tap alone Review follow-ups: - The ROM's DHCPREQUEST carries the offer's own server identifier (option 54) and no longer the next-server, which may be a separate TFTP host; the next-server stays the one TFTP is asked. - test-novatek-recovery.sh changes a pre-existing tap only by adding its address if missing, and takes back just that; a tap it made, it deletes.
…eading of a capture (#227) The Ethernet stage (#226) dropped unicast offers and named the offer's option 54 in its DHCPREQUEST. The reconstruction of NA51089's ROM (OpenIPC/opennovatek, re/net.c, net_run 0x3384..0x3e7c) shows otherwise, and the lab run behind the unicast claim had dnsmasq lose the race by arriving 3 s late (its ping check), not by being unicast. Now, as the ROM: - An offer is taken on its xid alone, broadcast or unicast, of any message type, if yiaddr and siaddr share a subnet (option 1, else /24); otherwise the ROM keeps waiting and asks again in 5 s. "b" follows every frame in that state. - The DHCPREQUEST names siaddr as the server, not option 54 (which #226's review had asked for: wrong for this ROM). Its letters are "S2a"; an NT98562's capture lacks that "a", likely lost to the ROM's unwaited UART writes. - Any reply with the xid counts as the ACK, a NAK included. - ARP requests for its address are answered ("Darp"); before, the model never answered. test_rom_eth now checks an off-subnet offer being passed over, a unicast offer taken, siaddr named in the REQUEST although option 54 differs, and the ARP answer. 804 checks pass; defib burn --nic still recovers a blank nt98566 over a tap.
The second half of #225: the ROM fallback's Ethernet stage is now the NA51089 ROM's own DHCP and TFTP client, as read from the ROM dump and seen on an NT98562 on a real LAN.
ROM behaviour modelled:
00:00:00:xx:xx:xx, new every boot.loader.binfrom port 2962, sent to the offering MAC.Emulator change: a small
nvt-eqoshook lets the ROM drive the MAC before any loader runs.Tests:
defib burn --nic(novatek: recover over Ethernet, the ROM's own fallback, for boards with flash straps defib#170, novatek: SPI NOR controller and flash boot; the SDK firmware boots #171) runs unmodified over a tap. U-Boot from RAM answers at its prompt on nt98562 and nt98566.test-novatek-recovery.shgains that third way in, and CI runs it with defib pinned to74e1bcc.test-novatek.pychecks the ROM's DHCP and TFTP behaviour over a UDP socket netdev, without root. All 802 checks pass.