Skip to content

Add full firmware install via UART + TFTP#30

Merged
widgetii merged 2 commits intomasterfrom
install-via-tftp
Apr 3, 2026
Merged

Add full firmware install via UART + TFTP#30
widgetii merged 2 commits intomasterfrom
install-via-tftp

Conversation

@widgetii
Copy link
Copy Markdown
Member

@widgetii widgetii commented Apr 3, 2026

Summary

  • Add defib install command that flashes a complete OpenIPC firmware (U-Boot + kernel + rootfs) to NOR flash via UART boot ROM + TFTP
  • Extend TFTP server to support multiple files with filename-based routing
  • CRC32 verification at every step: after TFTP transfer in RAM, and after flash write (read-back)

How it works

defib install -c hi3516ev300 \
  --firmware openipc.hi3516ev300-nor-lite.tgz \
  -p /dev/uart-IVG85HG50PYA-S \
  --power-cycle --nor-size 8
  1. Extracts tarball, verifies MD5 checksums
  2. Downloads U-Boot from OpenIPC (cached)
  3. Burns U-Boot to RAM via HiSilicon boot ROM protocol
  4. Breaks into U-Boot console (Ctrl-C)
  5. Starts multi-file TFTP server with U-Boot, kernel, and rootfs
  6. Sends U-Boot commands: setenv networking → tftpbootsf erasesf write for each partition
  7. CRC32 verifies each partition in RAM and after flash write
  8. Runs setnor8m/setnor16m, saveenv, reset

TFTP multi-file support

TFTPServerProtocol now accepts files: dict[str, bytes] for filename-based routing. U-Boot requests each file by name (tftpboot 0x42000000 uImage.hi3516ev300), and the server serves the matching data. Backward compatible — single-file mode still works.

Test plan

  • 301 unit tests pass (4 new multi-file TFTP tests)
  • Tested on real hi3516ev300 (IVG85HG50PYA-S) with 16MB W25Q128 NOR
  • CRC32 verified: U-Boot 4B3C3231, kernel 4210590F, rootfs 389C689C
  • OpenIPC Linux boots successfully (squashfs mounted, services started)
  • PoE power cycling via CRS112-8P-4S

🤖 Generated with Claude Code

widgetii and others added 2 commits April 3, 2026 20:36
Add `defib install` command that flashes a complete OpenIPC release
(U-Boot + kernel + rootfs) to NOR flash in a single automated flow:

- Extract and verify firmware tarball with MD5 checksums
- Burn U-Boot to RAM via boot ROM, break into console
- Start multi-file TFTP server, configure U-Boot networking
- Flash each partition with CRC32 verification (RAM + read-back)
- Save boot environment (setnor8m/setnor16m) and reset

Also extends the TFTP server to support multiple files with
filename-based routing (backward compatible with single-file mode).

Tested on real hi3516ev300 hardware with 16MB NOR (W25Q128),
PoE power cycling via CRS112-8P-4S, and verified boot into
OpenIPC Linux.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@widgetii widgetii merged commit 89775db into master Apr 3, 2026
13 checks passed
@widgetii widgetii deleted the install-via-tftp branch April 3, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant