Skip to content

Start the FIBER over USB without rpiboot - #2

Merged
hubpav merged 2 commits into
mainfrom
native-rpiboot
Nov 16, 2026
Merged

hubpav merged 2 commits into
mainfrom
native-rpiboot

Conversation

@hubpav

@hubpav hubpav commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

The app now starts a FIBER over USB by itself, the way Raspberry Pi's rpiboot does, so the bundled rpiboot, its libusb and Cygwin's DLLs are gone.

Draft: it has run against a simulated board only. It must start a real FIBER on Linux, macOS and Windows before it is merged.

Two commits

  1. Keep a stalled download going, quote every character for YAML, test the write path. Fixes found by testing 1.1.0 with the real Raspberry Pi OS image:
    • the image download froze when its connection went silent and Cancel could not stop it; it now times out per read and goes on with a Range request;
    • a few unusual characters (DEL, C1 controls, U+2028/2029) in a Wi-Fi name, Wi-Fi password or SSH key comment made the settings unreadable to cloud-init and netplan, or changed the value;
    • an .xz that was no disk image left its unpacked copy in the cache.
  2. Start the FIBER over USB without rpiboot. crates/fiber-setup-core/src/rpiboot.rs talks to the boot ROM through the nusb crate: the boot code first, then the files the boot code asks for. Steps, order and time limits are rpiboot's.

What changes for the build and the release

  • The bundle holds one program, the app. The gadget (boot.img, bootfiles.bin, config.txt) is data.
  • npm run usbboot only downloads those files at the pinned usbboot commit and checks each SHA-256. No C compiler, no Cygwin, no libusb.
  • sign-macos signs one program instead of three. sign-windows no longer signs rpiboot.exe.
  • The WinUSB driver package for Windows stays: the boot ROM has no driver there.
  • On Windows the board is chosen by its port, so the "one board at a time" limit is gone.
  • New: fiber-setup-cli boot starts a FIBER over USB and stops when its eMMC is a disk. Nothing is written.

Checked

  • 64 Rust tests on macOS, 17 of them for the new code: the boot ROM stage, the board coming back, the file requests, a board that leaves, stalls, is busy or refuses, Cancel and the time limit.
  • The Windows and Linux builds of the core and the CLI type-check and lint clean (cross-checked from a Mac).
  • A macOS app built from this branch holds exactly one Mach-O program.

Not checked yet

  • A real FIBER, on any system.
  • The app's Windows build, the changed PowerShell scripts and both workflows: this PR's CI is their first run.
  • sign-macos and sign-windows run only for a release tag.

To try it on a FIBER

Jumper on BOOT, power, USB-B cable, then:

npm run usbboot
cargo build --release -p fiber-setup-cli
FIBER_SETUP_USBBOOT=src-tauri/resources/usbboot target/release/fiber-setup-cli boot

It should end with the eMMC's path and size, and writes nothing.

Licence

rpiboot.rs is derived from rpiboot, which is Apache-2.0, so that one file is marked Apache-2.0 and the licence text is in LICENSES/Apache-2.0.txt. The rest stays MIT.

🤖 Generated with Claude Code

hubpav and others added 2 commits November 16, 2026 06:15
…he write path

Found by testing with the real Raspberry Pi OS image and with awkward
settings.

- The image download froze when its connection went silent (seen at 1.8 MB),
  for up to an hour, and Cancel could not interrupt it. Each read now has a
  time limit. A connection that is silent, closed early or refused for a
  moment is replaced by a new one that asks for the rest of the file (Range),
  a few times, and Cancel acts at once. The checksum is still that of the
  whole file.
- A Wi-Fi name, Wi-Fi password or SSH key comment with DEL, a C1 control
  character, U+2028, U+2029, U+FEFF, U+FFFE or U+FFFF made user-data or
  network-config unreadable to the FIBER (PyYAML in cloud-init, libyaml in
  netplan), or changed the value. They are written as escapes now.
- An .xz file that unpacked to something that is no disk image stayed in the
  cache. It is checked before it gets its name.
- Tests: the download against a local server that stalls, cuts off, knows no
  ranges or refuses; the image cache; the settings written into a small disk
  image and read back; the write with the patch at every edge and images of
  any length; what verify reports; a link as the target.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
What Raspberry Pi's rpiboot does is now part of the app, in Rust on the nusb
crate (crates/fiber-setup-core/src/rpiboot.rs): the boot code goes to the
boot ROM, then the boot code gets the files it asks for, from the gadget's
folder and from bootfiles.bin. The steps, their order and their time limits
are rpiboot's.

- Gone from the bundle: rpiboot, on macOS the libusb built for it, on
  Windows rpiboot.exe with Cygwin's two DLLs. The app is the only program in
  it; the gadget (boot.img, bootfiles.bin, config.txt) is data.
- npm run usbboot only downloads the gadget's files at the pinned usbboot
  commit and checks their SHA-256 (scripts/fetch-usbboot.mjs). No C
  compiler, no Cygwin, no libusb headers; the deb no longer depends on
  libusb.
- Release: sign-macos signs one program instead of three, sign-windows no
  longer signs rpiboot.exe. The USB driver package for Windows stays: the
  boot ROM has no driver there.
- Windows: the board is chosen by its port, as on the other systems, so
  several boards in USB mode are no longer refused.
- A board that just appeared may be without permission (Linux) or without
  its driver (Windows) for a moment: that is waited out, and said if it
  stays so.
- fiber-setup-cli boot starts a FIBER over USB and stops when its eMMC is a
  disk; nothing is written.
- rpiboot.rs is derived from rpiboot and under its license, Apache-2.0
  (LICENSES/Apache-2.0.txt); the rest stays MIT.

Run against a simulated board only (the boot ROM, the boot code and its
requests); not yet with a real FIBER.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@hubpav
hubpav marked this pull request as ready for review November 16, 2026 05:30
@hubpav
hubpav merged commit 58f0419 into main Nov 16, 2026
3 checks passed
@hubpav
hubpav deleted the native-rpiboot branch November 16, 2026 05:30
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