Raspberry Pi boot EEPROM
The following Raspberry Pi models use an EEPROM to boot the system:
-
Flagship models since Raspberry Pi 4B
-
Compute Module models since CM4 (including CM4S)
-
Keyboard models since Raspberry Pi 400
All other models of Raspberry Pi computer use the bootcode.bin file located in the boot filesystem.
You can find the scripts and pre-compiled binaries used to create rpi-eeprom in the rpi-eeprom GitHub repository.
|
Reset the Raspberry Pi bootloader
This section provides instructions for reflashing the bootloader to reset it. You typically do this to recover a system that fails to boot, or to reset the bootloader configuration.
If, instead of resetting the bootloader, you want to upgrade the bootloader version or choose a different boot order, see Update the bootloader in the Configuration page.
The following instructions are relevant only to newer Raspberry Pi models that store the bootloader in an on-board SPI flash EEPROM:
-
Flagship single-board computers (SBCs) since Raspberry Pi 4B.
-
Compute Modules since CM4 (including CM4S).
-
All keyboard computers (Raspberry Pi 400, 500, and 500+).
On other Raspberry Pi models the boot ROM always loads the bootcode.bin file located in the boot partition of your boot media.
Diagnose bootloader issues
If your Raspberry Pi device fails to boot, the bootloader provides feedback in the following ways:
-
LED activity. The green LED on your Raspberry Pi can flash in specific patterns to indicate specific errors. Check the LED warning flash codes to identify errors based on the flash pattern. For example, seven short flashes of the green LED means that the kernel image wasn’t found.
-
HDMI diagnostic screen. On newer devices, the bootloader can display a diagnostic screen over HDMI during startup. If you have a monitor connected to your Raspberry Pi, this screen provides information like the bootloader version and build date, the detected boot order, and specific error codes if the OS fails to load. For more information, see Boot diagnostics.
Reflash the bootloader
Reflash the bootloader if your system fails to boot or if you want to reset the bootloader configuration. Reflashing the bootloader clears any local bootloader configuration that might be preventing your Raspberry Pi from booting.
You can also reflash the bootloader using USB rpiboot. This method is typically used to mass provision Compute Modules. Reflashing the bootloader over USB is also the only option available for CM4 and CM4S. For more information, see Compute Module hardware.
|
To reflash the bootloader on your Raspberry Pi device:
-
Connect a spare or empty microSD storage device to your host computer.
-
Find and open Imager on your host computer.
-
In the Device tab, select your Raspberry Pi model from the list, and then select Next.
-
In the OS tab, scroll down to the bottom of the list and select Misc utility images > Bootloader > SD Card Boot, then select Next.
-
In the Storage tab, select your storage device and then select Next.
-
In the Writing tab, select Write.
-
Select I understand, erase and write; wait for the write to complete and then select Finish.
-
Eject the storage device from your host computer and then plug it into your Raspberry Pi.
-
Boot your Raspberry Pi by plugging it into power.
-
When the green activity LED flashes with a steady pattern and after your HDMI display shows a green screen, turn off your Raspberry Pi by disconnecting it from power and eject the boot media.
Update the bootloader configuration
The default version of the bootloader represents the latest factory default firmware image. It updates to provide critical bug fixes, hardware support and periodically after features have been tested in the latest release.
The latest bootloader updates more often to include the latest fixes and improvements.
Advanced users can switch to the latest bootloader to get the latest functionality.
First, ensure that your Raspberry Pi runs the latest software. Run the following command to update:
$ sudo apt update && sudo apt full-upgrade
Next, run the following command to open raspi-config:
$ sudo raspi-config
Navigate to Advanced Options > Bootloader Version. Select Latest, then choose Yes to confirm. Select Finish and confirm that you want to reboot.
If you run sudo rpi-eeprom-update, you should see that a more recent version of the bootloader is available and it’s the latest release.
*** UPDATE AVAILABLE ***
BOOTLOADER: update available
CURRENT: Thu 18 Jan 13:59:23 UTC 2024 (1705586363)
LATEST: Mon 22 Jan 10:41:21 UTC 2024 (1705920081)
RELEASE: latest (/lib/firmware/raspberrypi/bootloader-2711/latest)
Use raspi-config to change the release.
VL805_FW: Using bootloader EEPROM
VL805: up to date
CURRENT: 000138c0
LATEST: 000138c0
Now you can update your bootloader.
$ sudo rpi-eeprom-update -a
$ sudo reboot
Reboot, then run sudo rpi-eeprom-update. You should now see that the CURRENT date has updated to the latest version of the bootloader:
BOOTLOADER: up to date
CURRENT: Mon 22 Jan 10:41:21 UTC 2024 (1705920081)
LATEST: Mon 22 Jan 10:41:21 UTC 2024 (1705920081)
RELEASE: latest (/lib/firmware/raspberrypi/bootloader-2711/latest)
Use raspi-config to change the release.
VL805_FW: Using bootloader EEPROM
VL805: up to date
CURRENT: 000138c0
LATEST: 000138c0
Read the current bootloader configuration
To view the configuration used by the current running bootloader, run the following command:
$ rpi-eeprom-config
Read the configuration from an bootloader image
To read the configuration from a bootloader image:
$ rpi-eeprom-config pieeprom.bin
Editing the current bootloader configuration
The following command loads the current bootloader configuration into a text editor. When the editor is closed, rpi-eeprom-config applies the updated configuration to latest available bootloader release and uses rpi-eeprom-update to schedule an update when the system is rebooted:
$ sudo rpi-eeprom-config --edit
$ sudo reboot
If the updated configuration is identical or empty, then no changes are made.
Applying a saved configuration
The following command applies boot.conf to the latest available bootloader image and uses rpi-eeprom-update to schedule an update when the system is rebooted.
$ sudo rpi-eeprom-config --apply boot.conf
$ sudo reboot
Automatic updates
The rpi-eeprom-update systemd service runs at startup and applies an update if a new image is available, automatically migrating the current bootloader configuration.
To disable automatic updates:
$ sudo systemctl mask rpi-eeprom-update
To re-enable automatic updates:
$ sudo systemctl unmask rpi-eeprom-update
| If the FREEZE_VERSION bootloader config is set then the update service will skip any automatic updates. This removes the need to individually disable the update service if there are multiple operating systems installed, or when swapping SD cards. |
rpi-eeprom-update
Raspberry Pi OS uses the rpi-eeprom-update script to implement an automatic update service. The script can also be run interactively or wrapped to create a custom bootloader update service.
Reading the current bootloader version:
$ vcgencmd bootloader_version
Check if an update is available:
$ sudo rpi-eeprom-update
Install the update:
$ sudo rpi-eeprom-update -a
$ sudo reboot
Cancel the pending update:
$ sudo rpi-eeprom-update -r
Installing a specific bootloader image:
$ sudo rpi-eeprom-update -d -f pieeprom.bin
The -d flag instructs rpi-eeprom-update to use the configuration in the specified image file instead of automatically migrating the current configuration.
Display the built-in documentation:
$ rpi-eeprom-update -h
A/B bootloader updates
A/B EEPROM bootloader updates protect against a Raspberry Pi device being unable to boot after an interrupted update — this protects the device if power is removed from it mid-update.
A/B-capable firmware splits the EEPROM into two partitions, A and B. At any time, one partition is 'committed' and is the partition that the device boots from by default. Updates are written to the other partition, leaving the committed partition untouched until the new image has been written in full and checked.
It is compatible only with the Raspberry Pi 5, Raspberry Pi Compute Module 5, and Raspberry Pi 5 keyboard computer devices.
A/B-capable firmware also supports a tryboot rollback mechanism that can test a new partition before committing to it. For more information, see the rpi-eeprom-ab README.
For information about A/B update for Raspberry Pi OS, see A/B boot update.
Enable A/B bootloader updates
While A/B firmware updates are enabled, tools that write to EEPROM directly (such as flashrom) no longer work.
|
To enable or disable A/B firmware updates with raspi-config:
-
From the command line, run the following command to update your Raspberry Pi software to the latest version:
$ sudo apt update && sudo apt full-upgrade -
From the command line, run the following command to open
raspi-config:$ sudo raspi-config -
Navigate to
6 Advanced Options > A14 AB Firmwareand selectEnableorDisable. -
Select
Finishand reboot when prompted. -
From the command line, run the following command to perform the A/B update.
$ rpi-eeprom-update
Bootloader release status
The firmware release status corresponds to a particular subdirectory of bootloader firmware images (/lib/firmware/raspberrypi/bootloader/...), and can be changed to select a different release stream.
-
default– Updated for new hardware support, critical bug fixes and periodic update for new features that have been tested through thelatestrelease -
latest– Updated when new features are available
Since the release status string is just a subdirectory name, it’s possible to create your own release streams, for example, a pinned release or custom network boot configuration.
Changing the bootloader release
You can change which release stream is to be used during an update by editing the /etc/default/rpi-eeprom-update file and changing the FIRMWARE_RELEASE_STATUS entry to the appropriate stream.
|
Updating the bootloader configuration in an bootloader image file
The following command replaces the bootloader configuration in pieeprom.bin with boot.conf and writes the new image to new.bin:
$ rpi-eeprom-config --config boot.conf --out new.bin pieeprom.bin
recovery.bin
At power on, the ROM found on BCM2711 and BCM2712 looks for a file called recovery.bin in the root directory of the boot partition on the SD card. If a valid recovery.bin is found then the ROM executes this instead of the contents of the EEPROM. This mechanism ensures that the bootloader flash image can always be reset to a valid image with factory default settings.
For more information, see EEPROM bootflow.
Bootloader update files
| Filename | Purpose |
|---|---|
|
Bootloader recovery executable |
|
Bootloader EEPROM image |
|
Bootloader EEPROM image – same as |
|
The sha256 checksum (and optional timestamp) of bootloader image ( |
|
The VLI805 USB firmware EEPROM image – Raspberry Pi 4B revision 1.3 and earlier only. |
|
The sha256 checksum of vl805.bin |
-
If the bootloader update image is called
pieeprom.upd, thenrecovery.binis renamed torecovery.000after the update has completed, then the system is rebooted. Becauserecovery.binis no longer present the ROM loads the newly updated bootloader from SPI flash and the OS is booted as normal. -
If the bootloader update image is called
pieeprom.binthenrecovery.binwill stop after the update has completed. On success the HDMI output will be green and the green activity LED is flashed rapidly. If the update fails, the HDMI output will be red and an error code will be displayed by the activity LED. -
The
.sigfiles contain the hexadecimal sha256 checksum of the corresponding image file on the first line, optionally followed by the timestamp of the image (ts: unixtime) on the next line; additional fields might be added in the future. -
The ROM found on BCM2711 and BCM2712 does not support loading
recovery.binfrom USB mass storage or TFTP. Instead, newer versions of the bootloader support a self-update mechanism where the bootloader is able to reflash the SPI flash itself. SeeENABLE_SELF_UPDATEon the bootloader configuration page. -
The temporary EEPROM update files are automatically deleted by the
rpi-eeprom-updateservice at startup.
For more information about the rpi-eeprom-update configuration file see rpi-eeprom-update -h.
EEPROM write protect
Both the bootloader and VLI EEPROMs support hardware write protection. See the eeprom_write_protect option for more information about how to enable this when flashing the EEPROMs.