DEV Community

Hedy
Hedy

Posted on

How to edit boot config Raspberry Pi 5 USB?

The Raspberry Pi 5 supports USB booting, allowing you to boot directly from an external USB drive instead of the SD card. Here’s how to configure and edit the boot settings for USB boot.

Image description

πŸ› οΈ 1. Prerequisites

  • Raspberry Pi 5
  • USB Bootable Drive (e.g., SSD or USB Flash Drive)
  • MicroSD Card (for initial configuration, if required)
  • Power Supply (official Raspberry Pi power supply recommended)

Ensure your Raspberry Pi 5 firmware is up to date.

`bash

sudo apt update
sudo apt full-upgrade`

Reboot after upgrading:

`bash

sudo reboot`

βš™οΈ 2. Accessing the Boot Configuration File

On the Raspberry Pi:

  1. Open the terminal.
  2. Edit the config.txt file on the boot partition:

`bash

sudo nano /boot/config.txt`

On Another Computer (if SD card is used):

  1. Insert the SD card into your computer.
  2. Locate the boot partition.
  3. Open the config.txt file in a text editor.

πŸ“„ 3. Enable USB Boot in Bootloader Configuration
The Raspberry Pi uses the BOOT_ORDER configuration in the EEPROM bootloader to define the boot sequence.

1.Edit the EEPROM bootloader settings:

`bash

sudo raspi-config`

2.Navigate to:

`mathematica

Advanced Options > Boot Order > USB Boot`

Select USB Boot and confirm.

3.Alternatively, manually edit the bootloader configuration:

`bash

sudo -E rpi-eeprom-config --edit`

4.Look for the line:

`makefile

BOOT_ORDER=0xf41`

  • 0xf41 means:
  • f: Try all devices.
  • 4: USB devices.
  • 1: SD card.

5.Save the file and reboot:

`bash

sudo reboot`

πŸ“ 4. Verify Boot Settings

After rebooting, verify that the Raspberry Pi is set to boot from USB:
`bash

vcgencmd bootloader_config`
Check the BOOT_ORDER value. It should match the desired USB boot configuration (0xf41).

πŸ”„ 5. Copy Operating System to USB Drive

  1. Use the Raspberry Pi Imager tool.
  2. Select your USB Drive as the target.
  3. Write a Raspberry Pi OS image to the USB drive.

Alternatively, clone the SD card:

`bash

sudo dd if=/dev/mmcblk0 of=/dev/sda bs=4M status=progress`

Replace /dev/mmcblk0 (SD Card) and /dev/sda (USB drive) with your device paths.

βœ… 6. Test USB Boot

  1. Remove the SD card.
  2. Connect the USB drive to the Raspberry Pi.
  3. Power on the Raspberry Pi.

If everything is configured correctly, the Raspberry Pi should boot from the USB drive.

πŸ›‘οΈ 7. Troubleshooting

  • Stuck on Boot Screen: Verify the bootloader configuration (BOOT_ORDER).
  • USB Drive Not Detected: Use a powered USB hub for external hard drives.
  • Corrupted USB OS Installation: Re-flash the OS on the USB drive.
  • Check Boot Logs: Review boot logs using:

`bash

dmesg | grep -i usb`

Top comments (0)