Skip to main content

How to Use USB Device Boot Code

USB device boot code is an application provided by Raspberry Pi to push firmware to Compute Modules. Raspberry Pi does not provide precompiled binaries for the software so it must be complied.

Installation

warning

The git repository uses symlinks. For Windows builds clone the repository under Cygwin or use Windows Subsystem for Linux (WSL)

  1. Install software from package manager git, libusb-1.0-0-dev, pkg-config, build-essential
  2. Clone the usbboot repository
  3. Build using make
  4. Run the binary
sudo apt install git libusb-1.0-0-dev pkg-config build-essential
git clone --recurse-submodules --shallow-submodules --depth=1 https://github.com/raspberrypi/usbboot
cd usbboot
make
sudo ./rpiboot
tip

sudo isn't required if you have write permissions for the /dev/bus/usb device.

Connect USB devices to WSL

If using WSL additional setups are required to connect USB devices.

This is outside the scope of this guide, see Microsoft's documentation. For a graphical user interface see WSL USB Manager by Andrew Leech.

Updating the rpi-eeprom submodule

After updating the usbboot repo (git pull --rebase origin master) update the submodules by running

git submodule update --init

Editing the config

The firmware configurations can be edited in the file /usbboot/<firmware directory>/config.txt

Boot Order

The BOOT_ORDER field allows the configuration of which boot device is used.

# Tries to boot from NVMe, then SD Card, then network, then loops to the start
BOOT_ORDER=0xf216
ValueModeDescription
0x0SD CARD DETECTTry SD then wait for card-detect to indicate that the card has changed. Deprecated now that 0xf (RESTART) is available.
0x1SD CARDSD card (or eMMC on Compute Module 4).
0x2NETWORKNetwork boot - See Network boot server tutorial.
0x3RPIBOOTRPIBOOT - See usbboot.
0x4USB-MSDUSB mass storage boot - See USB mass storage boot.
0x5BCM-USB-MSDUSB 2.0 boot from USB Type C socket (CM4: USB type A socket on CM4IO board). Not available on Raspberry Pi 5.
0x6NVMECM4 and Pi 5 only: boot from an NVMe SSD connected to the PCIe interface. See NVMe boot for more details.
0x7HTTPHTTP boot over ethernet. See HTTP boot for more details.
0xeSTOPStop and display error pattern. A power cycle is required to exit this state.
0xfRESTARTRestart from the first boot-mode in the BOOT_ORDER field i.e. loop.

Table from Raspberry Pi documentation

Additional Resources

If you are having difficulty here are some more resources to help: