DEV Community

Hedy
Hedy

Posted on

1

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`

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (0)

Heroku

This site is powered by Heroku

Heroku was created by developers, for developers. Get started today and find out why Heroku has been the platform of choice for brands like DEV for over a decade.

Sign Up

πŸ‘‹ Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay