All of the previous generations of Raspberry Pi contained all of their firmware on the SD card. Starting with the Raspberry Pi 4 the device actually has onboard upgradable firmware stored on an EEPROM chip separate from your storage. Updating this firmware is very important as one of the first released updates reduces power usage of the Pi by 30% which also reduces how hot it gets.
In this guide I’ll show you how to update the bootloader firmware (no, it’s not apt-get upgrade, it’s a new utility called rpi-eeprom!) and also show you how to make a recovery SD card if your firmware gets corrupted and needs to be reflashed.
Upgrading the Bootloader Firmware
Requirements
To upgrade the firmware you should be running the latest Raspbian. Do not attempt this from another distribution.
If you want to use another distribution afterward that is great! I personally use my 64-bit Ubuntu Server 18.04.3 image most of the time, but not for this procedure!
Since the Raspberry Pi bootloader firmware is stored on a chip on the device you can update it to the latest with Raspbian and then go right back to using whatever you want. I personally have a separate SD card just for Raspbian that I use to periodically plug in and update the firmware.
Install rpi-eeprom
First we need to install the new bootloader update utility. We can do this with the following commands:
sudo apt update
sudo apt upgrade
sudo apt install rpi-eeprom
Once the utility is installed Raspbian will check at boot whether there are any critical bootloader firmware updates for your Pi.
Checking for Updates Manually
If you are like me and don’t want to wait around for Raspbian to decide whether do these updates there is a command to check for updates manually:
sudo rpi-eeprom-update
You will see output like this:
Bootloader EEPROM is up to date CURRENT: Tue 10 Sep 10:41:50 UTC 2019 (1568112110) LATEST: Tue 10 Sep 10:41:50 UTC 2019 (1568112110)
If the firmware isn’t up to date it will look like this:
*** UPDATE REQUIRED *** CURRENT: Tue 10 Sep 10:41:50 UTC 2019 (1568112110) LATEST: Wed 25 Sep 10:40:05 UTC 2019 (1569408005)
We now can see that there is updated firmware for our device. To install this update we will use the -a switch:
sudo rpi-eeprom-update -a
Your output should look like this:
CURRENT: Tue 10 Sep 10:41:50 UTC 2019 (1568112110) LATEST: Wed 25 Sep 10:40:05 UTC 2019 (1569408005) *** INSTALLING REQUIRED UPDATE *** Bootloader EEPROM update pending. Please reboot to apply the update.
Reboot now by typing sudo reboot and then run sudo rpi-eeprom-update again. This time it should tell you it is now up to date!
Changing rpi-eeprom’s Release Channel
By default you will only receive updates from Raspbian’s “critical” channel. This is a very conservative firmware update channel that will only give you very well tested firmware updates that are considered critical fixes for the device.
If you want to get the latest firmware updates and fixes you may want to try the “beta” channel. These updates haven’t been tested as long and could potentially break your bootloader so Raspbian only recommends using it if you are comfortable using the recovery tool to reflash your bootloader if something goes wrong. Check out the recovery section below for instructions on how to do this.
To switch to the beta channel we are going to edit the file /etc/default/rpi-eeprom-update:
sudo nano /etc/default/rpi-eeprom-update
Change the line FIRMWARE_RELEASE_STATUS=”critical” to:
FIRMWARE_RELEASE_STATUS="beta"
Now you can run sudo rpi-eeprom-update and you should see a new update available.
View Bootloader Firmware Patch Notes
The latest official patch notes for all versions and changes are available in the rpi-eeprom GitHub repository
Disable Automatic Bootloader Firmware Updates
If you want to control when the updates are applied instead of leaving it up to Raspbian the autoupdating service can be disabled with the following command:
sudo systemctl mask rpi-eeprom-update
The startup service has now been disabled and automatic bootloader firmware updates will only be applied if you do it manually.
To undo this and reenable the service we will use the unmask command:
sudo systemctl unmask rpi-eeprom-update
Now automatic firmware updates are enabled again!
Bootloader Recovery
The downside of having an onboard bootloader is that if something breaks reformatting your SD card will not fix it. In this section I will cover how to use the official tools to reflash and recover your Pi’s bootloader.
Requirements
Raspbian has a special recovery bootloader available on their downloads page. Grab the latest version.
You will also need a blank SD card formatted with FAT32 (the same type the /boot partition uses on a imaged Pi SD card).
If your card is bigger than 32 GB you need to be very careful here because most operating systems will try to format it as ex-FAT instead of regular FAT/FAT32. Windows won’t even show you an option to format a card bigger than 32 GB as FAT. If you have a card 32 GB or smaller it would be ideal to choose that one to avoid this issue.
Note: Do not try to cheat and use ex-FAT. This is *not* the same as “regular” FAT (also known as FAT32) and will NOT WORK.
When to Attempt Recovery
There is a simple procedure to tell if your bootloader is corrupt. Turn off your Pi completely and remove the SD card / all attached storage. Now plug your Pi back in with no storage media in it.
If your Pi’s bootloader is healthy you will see the green light blink a few times and then enter a pattern where it will blink 4 times and then have a long pause. It will repeat these 4 blinks / pause in an endless loop.
If your Pi’s bootloader is NOT healthy the green light will not blink. If this is the case it is time to do a bootloader recovery!
Recovery Procedure
Extract the files from the rpi-boot-eeprom-recovery zip file into a temporary folder. These files will be recovery.bin, pieeprom.bin and README.txt.
Now put those 3 files directly on the root of your blank FAT32 formatted SD card. Your recovery card is now prepped and ready!
Before powering up your device make sure that all USB devices are removed. Even keyboards have been known to cause issues so make sure absolutely everything is unplugged!
Now insert the SD card into the Pi and connect the power.
If the bootloader recovery is successful the green activity light will start blinking rapidly continuously (forever). In this case you have successfully recovered your bootloader! You may now insert a normal fully imaged SD card and it will boot normally again.
If anything other than a continuous rapidly blinking green light happens the recovery was not successful.
If Recovery Doesn’t Work
- There is a known (and strange) issue with Raspberry Pi 4’s and 32 GB SD cards where the Pi will abort the boot. If this might apply to you then read this post.
- Make sure you created your SD card correctly. A common pitfall is using cards above 32 GB and formatting them with ex-FAT instead of regular FAT/FAT32.
- Make sure *all* USB devices are unplugged from the Pi
- Try a different SD card if you have one available. SD cards do go bad all the time. If there’s any doubt here check out my Raspberry Pi storage benchmarks page to see the highest performing SD cards (you definitely want an A1 rated one).
- Check your power cord. Make sure you are using a high quality USB-C power cord that is compatible with the Pi. Even if it was working before I have had several old Pi power supplies that worked for years die on me. If there’s any doubt grab a known reliable one like the Canakit USB-C Raspberry Pi 4 Power Supply
If you’ve gone through all the steps and are positive it’s not one of the above “gotcha” issues then it’s time to go deeper. You need to observe your Pi’s exact behavior when you plug it in (what the lights are doing). Here is a table of different blink patterns and what they mean:
If your Pi’s LED behavior matches any of these codes then we now have much more to go on to diagnose why your Pi won’t boot. Some of them are very obvious but they’re all worth a quick web search once you have matched it to a code.
If your Pi’s behavior does not match one of these codes head to the official sticky post on the Raspberry Pi forums and scroll to the very bottom (post #4 specifically for Raspberry Pi). This tracks ongoing boot issues with the Pi 4 that may affect your Pi and a whole bunch of things to try. If you get through that post go all the way up to post #1 and start going down the list.
Could My Pi Be Dead?
It’s absolutely possible. Things like power issues (surges etc), wiring breadboards incorrectly, etc. can kill your Pi completely. That being said, if you have a Pi 4 that appears to be dead and you’ve gone through all my troubleshooting steps / the official sticky post / you aren’t covered by warranty then I would hold onto it for now as it’s still very new and some problems are still being investigated with the bootloader.
I have definitely killed a couple myself. I had a 3B+ that I had been using for a year building images (basically beating the crap out of it) on that finally had a hardware failure and would no longer boot. I wasn’t too sad about this one because I absolutely beat the crud out of these devices and push them to the absolute limit.
My more heartbreaking one was that I have killed a 4 GB Pi 4 that I got right at the Pi 4’s launch. I left this Pi in a very hot area running an experimental image that didn’t have proper firmware on it for about 2.5 weeks and now upon powering it up the green light will start blinking like it’s about to start booting then the green light will freeze and stay stuck on forever. I have a couple other Pi 4’s so I know all my cards and power supplies are good.
Make sure you’ve reviewed the official sticky post I linked in the previous section before jumping to this conclusion though. These things are not fragile and over all the years of running this blog it’s pretty amazing I’ve only killed 2 of them with the insane things I try on them all the time.
I may be able to help if you want to leave a comment here with *exactly* what behavior you’re seeing when you try these procedures, when you plug it in with no SD card in it, when you plug it in with a SD card in it, any little details will help!
Post navigation
5 thoughts on “Raspberry Pi 4 Bootloader Firmware Updating / Recovery Guide”
- Tommy Shulker November 3, 2019 at 1:54 am Will it be possible to use rpi-eeprom from an OS other than Raspbian at any point in the future do you know? Reply
- jamesachambers November 3, 2019 at 12:22 pm Hey Tommy,The utility is open source at https://github.com/raspberrypi/rpi-eeprom
so it’s not closed source or a precompiled binary or anything. Looking
at the source code you would need to have very up to date Raspberry Pi
userland tools (this one uses vcmailbox and dtparam). Here’s the code
for the main update part:
if [ -f "${BOOTLOADER_UPDATE_IMAGE}" ]; then
# Bootloader EEPROM chip-select is muxed with audio pin so disable audio
# LDO first to avoid sending noise to analog audio.
"${VCMAILBOX}" 0x00030056 4 4 0 > /dev/null || true
dtparam audio=off# Switch the SPI pins to boot EEPROM
dtoverlay spi-gpio40-45
modprobe spidev
modprobe spi-bcm2835prepareImage "${BOOTLOADER_UPDATE_IMAGE}"
echo "Applying bootloaer update ${BOOTLOADER_UPDATE_IMAGE}"
flashrom -p "linux_spi:dev=/dev/spidev0.0,spispeed=${SPI_SPEED}" -w "${TMP_EEPROM_IMAGE}" || die "flashrom EEPROM update failed"dtparam -R spi-gpio40-45
I personally haven’t tried it since I have already bricked one 4 GB Pi 4 since launch which has lowered my appetite for trying this. That may change some day as I continue to get more adventurousSince there aren’t a lot of distributions that have up to date userland tools like vcmailbox it would be inadvisable to to try it if the code I pasted above makes you uncomfortable. For my Ubuntu 18.04.3 image I build the very latest userland tools every update so I know they are up to date in there but it looks like you also need to have working spidev and several other kernel modules so even with the latest tools on mine there’s a bunch of things I’d have to double check.So the final answer would be: probably in time this will appear in some other distributions! Reply
dtparam audio=on
${VCMAILBOX} 0x00030056 4 4 1 > /dev/null || true
fi- Tim November 6, 2019 at 9:18 am The latest userland tools are all that is necessary to utilize rpi-eeprom-update. You do not need the latest spidev or any other kernel modules in order to update. The default and recommended method which rpi-eeprom-update uses is to copy recovery.bin, pieeprom.upd and vl805.bin along with signature files for each to the boot partition. Upon reboot the Pi’s bootloader will load and execute recovery.bin which then flashes the update files after checking that they match the signatures in signature files to prevent flashing corrupt firmware files. recovery.bin is then renamed to recovery.000 to prevent it form executing the next time the Pi is rebooted.I have successfully updated multiple Pi’s without incident under Ubuntu. Reply
- jamesachambers November 3, 2019 at 12:22 pm Hey Tommy,The utility is open source at https://github.com/raspberrypi/rpi-eeprom
so it’s not closed source or a precompiled binary or anything. Looking
at the source code you would need to have very up to date Raspberry Pi
userland tools (this one uses vcmailbox and dtparam). Here’s the code
for the main update part:
- hi_pat_trick October 8, 2019 at 1:35 pm Is it safe to be using the server (CLI-only) version of Raspbian to perform this update? Reply
- jamesachambers October 8, 2019 at 10:12 pm Yes, Raspbian Lite is safe!