Raspberry Pi 5 - Updating Bootloader and Boot from NVMe SSD

Raspberry Pi 5 - Updating Bootloader and Boot from NVMe SSD

Keeping your Raspberry Pi's firmware up-to-date is crucial for accessing new features, improvements, and bug fixes. The Raspberry Pi Imager simplifies the process, making it easy for users to update their firmware. Follow this comprehensive guide to ensure your Raspberry Pi is running the latest firmware version.

 

This guidance is also crucial for those who want to utilize the PCIe features on Raspberry Pi 5 and wish to boot from their NVMe drive. At the time this article was written, the Raspberry Pi Bootloader (Version: 30de0ba5 – 2024/01/5) enabled users to boot from the NVMe drive via the PCIe without the need to modify the setting on the Raspberry Pi EEPROM thus simplifying the process.

 

Prerequisites:

 

Steps:

Step 1: Download and Install Raspberry Pi Imager

 

 

Visit the official Raspberry Pi website to download the Raspberry Pi Imager. Follow the installation instructions to set up the Imager on your computer.

 

Step 2: Insert MicroSD Card

Insert the microSD card into the SD card reader.

 

Step 3: Open Raspberry Pi Imager

Launch the Raspberry Pi Imager on your computer and click on "CHOOSE OS".

 

 

Step 4: Choose Operating System

Scroll down and choose “Misc utility images”.

 

 

Step 5: Select Board Bootloader

Select your specific board bootloader from the list.

 

 

Step 6: Choose boot order.

Select “SD Card Boot”.

 

 

Step 7: Choose Storage

Select your SD Card storage.

 

 

Step 8: Flash the firmware
Click on "NEXT" and approve the prompt by selecting "YES."

 

 

Step 9: Flashing

The writing process will only take a few minutes at most. Once it completes, you will see a message like as shown below.

This indicates that the Raspberry Pi bootloader has been successfully written to the SD Card, and you can now remove it from your device.

 

 

Step 10: Insert the bootloader update SD card.

1. Power off the Raspberry Pi and remove all peripherals.

2. Insert the bootloader update SD card.

 

 

3. Power on the Raspberry Pi.

4. Wait at least 10 seconds.

*If successful, the green LED on the Raspberry Pi will blink rapidly forever. An unsuccessful update of the EEPROM is indicated by a different blinking pattern corresponding to the specific error.

 

*If an HDMI display is attached, then the screen will display green for success or red if a failure occurs.

 

Congratulations! You've successfully updated your Raspberry Pi firmware using the Raspberry Pi Imager. Periodically check for firmware updates to stay current with the latest enhancements. Continue to the next step if you want to use PCIe NVMe HAT for Raspberry Pi 5.

 

As indicated in the introduction, only Raspberry Pi bootloader versions from 30de0ba5 (released on 2024/01/5) and later are compatible with PCIe NVMe HAT. With the SD Card removed, figure below demonstrates that the earlier bootloader version c2da2ae7 (released on 2023/10/18) was unable to boot from the NVMe drive.

 

 

Step 11: Install NVMe HAT

Remove the SD Card and Install the Raspberry Pi 5 PCIe NVMe Hat with preinstalled Bookworm OS drive.

 

 

Step 12: Verify Update

After rebooting, open a terminal and enter the following command to verify the bootloader update:
 

vcgencmd bootloader_version

 

 

On the same terminal, enter the following command to verify if the NVMe is detected. The lsblk command is used in Linux to list information about block devices (e.g., hard drives, SSDs, partitions). When you run lsblk  in the terminal, it provides a tree-like view of the block devices and their relationships.

 

lsblk

 

 

Troubleshooting Tips for Raspberry Pi 5 Not Booting from NVMe via PCIe

 

         

 

Despite following the guides, things can still go wrong. Therefore, to guarantee that the Raspberry Pi 5 boots successfully from the NVMe, an additional step is essential. This approach required booting from an SD Card or USB storage.

Go to terminal and paste the following command:
 

sudo rpi-eeprom-config --edit

 

    

 

In the BOOT_ORDER section, make sure that the value "6" is present. The BOOT_ORDER property specifies the order of various boot modes, read from right to left, and allows for up to eight digits to be set. In this scenario, "0xf461" indicates that the Raspberry Pi will initially boot from the SD Card (1), followed by NVMe (6), and ultimately USB (4).

 

Therefore, if the value "6" is missing from the BOOT_ORDER, simply add it to the BOOT_ORDER section. More information on boot order value can be found below. 

 

BOOT_ORDER Fields
ValueModeDescription
0x0SD CARD DETECT MODETry 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.

 

 

PCIe VS  USB 3.0 Speed Test

PCIe Boot: Cytron NVMe 2280 M-Key MakerDisk SSD 256GB

 

USB 3.0 Boot: Cytron NVMe 2280 M-Key MakerDisk SSD 256GB

 

In summary, when comparing the performance of booting from NVMe storage on a Raspberry Pi, both PCIe and USB 3.0 connections were examined using the same NVMe drive. The speed tests revealed that PCIe demonstrated superior performance over USB 3.0, showcasing faster sequential write speeds.

 

Therefore, for users seeking optimal speed and performance, particularly in scenarios with demanding applications and data-intensive tasks, utilizing the PCIe interface with an NVMe drive is recommended. The choice between PCIe and USB 3.0 should be based on the specific performance requirements of the project, as well as considerations for storage capacity and budget constraints.

Hardware Components