SARPi Project - Slacking on a Raspberry Pi
Raspberry Pi boot EEPROM
The Raspberry Pi EEPROM (Electrically Erasable Programmable Read-Only Memory) is a rewritable chip on Raspberry Pi 5, Raspberry Pi 4, Raspberry Pi 400, Compute Module 4, and Compute Module 4S computers, which stores firmware, configurations and settings. Updating the EEPROM is a way to maintain and improve the performance, stability, and functionality of Raspberry Pi computers when bug fixes, security enhancements, and new features are available. Updates are periodically released by Raspberry Pi Ltd. and are made available for users to keep their compatible Raspberry Pi devices up-to-date. Raspberry Pi EEPROM updates often introduce new customised options, allowing users to fine-tune boot configurations and settings, and other related hardware parameters. Updating the Raspberry Pi EEPROM ensures that the device stays current with the latest software improvements and optimizations, providing an optimal and up-to-date computing experience.
NB: Only the Raspberry Pi 5, Raspberry Pi 4, Raspberry Pi 400, Compute Module 4, and Compute Module 4S computers use an EEPROM to boot the system. All other models of Raspberry Pi computer use the 'bootcode.bin' file located in the /boot directory to boot the system.
•
Quick Links
• What's required for this mini-project
• Installing the Raspberry Pi boot EEPROM software
• Raspberry Pi boot EEPROM Documentation
• Updating the Raspberry Pi boot EEPROM
• Raspberry Pi EEPROM BOOT_ORDER configuration
• Editing the Raspberry Pi EEPROM BOOT_ORDER configuration
• Recovering an unbootable Raspberry Pi boot EEPROM configuration
•
What's required for this mini-project
You're going to need the following in order to satisfy requirements for this SARPi mini-project:
• A Raspberry Pi computer featuring a boot EEPROM chip (i.e. Raspberry Pi 5, Raspberry Pi 4, Raspberry Pi 400, Compute Module 4, or Compute Module 4S) running an ARM-based Slackware Linux operating system.
• The Raspberry Pi boot EEPROM software installed.
• Optional (but HIGHLY advised) is to read and understand the Raspberry Pi boot EEPROM Documentation and what it entails.
In this SARPi mini-project we will be using Slackware AArch64 Linux on a Raspberry Pi 5 [8GB] with the hostname 'iana', and logged in as 'root' user. Your Slackware Linux operating system and Raspberry Pi version may be different than those shown here so bear that in mind.
•
Installing the Raspberry Pi boot EEPROM software
Installing the Raspberry Pi boot EEPROM software can be done in various ways. It's each individual end-user's decision on how this is achieved.
• By far the easiest solution is to use the 'rpi-eeprom' software included in the Slackware AArch64 Linux operating system. However, at the time of creating this mini-project [08 March 2024], when this 'rpi-eeprom' tool was used, the software was configured specifically for the Raspberry Pi 4 only (see: this page). So, the official Slackware Linux 'rpi-eeprom' tool was not available for us to use at the time, on a Raspberry Pi 5. Hopefully, this will be addressed by the Slackware Linux developers, moving forward.
• You have the option to install the Slackware Linux 'RPi bootloader EEPROM configuration tool' package created and maintained by the SARPi Project, which is available from the SARPi Downloads section.
• Of course, the Raspberry Pi boot EEPROM software can be downloaded and installed from the Raspberry Pi GitHub repository. Or refashioned for Slackware Linux from the latest official Debian package.
How you install the Raspberry Pi boot EEPROM software is your choice. Although, please note that it is a prerequisite for configuring and updating the Raspberry Pi boot EEPROM.
•
Raspberry Pi boot EEPROM Documentation
One of the first things you should do is to read the Raspberry Pi boot EEPROM Documentation, if you have not already done so or are not familiar with what's involved. It cannot be stressed strongly enough that this process requires accurate and precise steps in order to succeed. Any omissions, errors, or typos can lead to serious problems. So if you haven't done so, read the Raspberry Pi Boot EEPROM Documentation before you do anything else.
IMPORTANT! : Just in case you missed it, if you are not already aware and familiar with the Raspberry Pi Boot EEPROM Documentation then READ IT NOW before doing anything else. The last thing you want to do is miss anything out, make mistakes, and/or not fully understand what's required.
Ignore this advice at your own risk!
NB: putting 'sudo' before commands in Slackware Linux is not required by default. You should be logged in as 'root' user to do this anyway.
When the 'rpi-eeprom' software is installed on your system, there's a comprehensive help document with further information and instructions on using this tool. This can be viewed by using the following command:
This help information offers additional instructions and details on how the 'rpi-eeprom' tool can be used. It's well worth reading through it in order to realise the full potential of this software and the scope of its capabilities.
•
Updating the Raspberry Pi boot EEPROM
Updating the Raspberry Pi boot EEPROM can be achieved by using the following command option:
The following screenshot shows the output of using the 'rpi-eeprom-update -a' command option:
The output shows that an EEPROM update was available, and that a reboot is required to apply this update.
Once the 'rpi-eeprom-update' command has been executed, a backup of the current EEPROM configuration is written to the '/var/lib/raspberrypi/bootloader/backup' directory. So, if any problems arise as a result of updating the EEPROM then any previous configurations can be easily reinstated.
It also states that you may cancel any pending EEPROM update(s) by using the 'rpi-eeprom-update -r' command. If you are unsure or apprehensive about going ahead with the EEPROM update then this is what you should do here:.
This will cancel the EEPROM update and remove any temporary files. As shown at the bottom of the following screenshot:
Otherwise, to go ahead with the EEPROM update, reboot the Raspberry Pi at this point.
After rebooting the system, using the 'rpi-eeprom-update -a' command once again should tell you that the EEPROM is up-to-date:
Verifying the latest update version (e.g. '1708097321' in this example) is confirmation that the update was applied.
Now you can be sure that the Raspberry Pi boot EEPROM update has been successful.
•
Raspberry Pi EEPROM BOOT_ORDER configuration
To view the Raspberry Pi boot EEPROM configuration use the following 'rpi-eeprom-config' command:
This will output the current EEPROM configuration settings. What you should see is something similar to the following screenshot:
This is the EEPROM configuration on our Slackware Linux system running on a Raspberry Pi 5 computer. Remember that the results on your own system may be different to those shown here.
The significant setting in this output is the 'BOOT_ORDER' property and string that it specifies. This is commonly known as the "BOOT_ORDER boot modes settings" and dictates which storage devices are sequentially probed and used as boot devices when you power on your Raspberry Pi computer.
The 'BOOT_ORDER' setting allows flexible configuration for the priority of different boot modes. It is represented as a 32-bit unsigned integer where each nibble represents a boot-mode. The boot modes are attempted in lowest significant nibble to highest significant nibble order. They are read right to left and up to 8 digits may be defined.
So, in our screenshot the 'BOOT_ORDER' is set to probe devices for bootable volumes in this specific order:
1. microSD card
2. NVMe PCIe storage device
3. USB storage device
To appreciate what's going on with the 'BOOT_ORDER' and why, the Raspberry Pi BOOT_ORDER Documentation explains everything in detail.
Once again, is it of vital importance that you become familiar with, and fully understand, what these 'BOOT_ORDER boot modes settings' signify and do. Full details and instructions are available in the Raspberry Pi BOOT_ORDER Documentation. Some time spent reading and self-educating may be required to assimilate this information.
IMPORTANT! : If you haven't already done so, you really SHOULD take the time to familiarise yourself with the Raspberry Pi BOOT_ORDER Documentation in order to learn and fully understand the BOOT_ORDER property and configuration for the priority of different boot modes on Raspberry Pi computers.
•
Editing the Raspberry Pi EEPROM BOOT_ORDER configuration
To edit and modify the Raspberry Pi boot EEPROM configuration use the following 'rpi-eeprom-config --edit' command:
The 'rpi-eeprom-config --edit' command will open the Raspberry Pi boot EEPROM configuration in the default text editor on your system. For us that's 'nano', as shown in the following screenshot:
Now you can modify the 'BOOT_ORDER' string (or add/modify/delete any other content) to your specific requirements and save any changes. Just the same as you would for any other file in a text editor.
NB: Remember that the 'rpi-eeprom' help file documentation specifies that the Raspberry Pi boot EEPROM configuration must contain a minimum of 3 lines.
* If the updated saved configuration is identical to the previous configuration, or is empty, then no changes are made.
A reboot of the system is required for any changes to the Raspberry Pi boot EEPROM configuration settings to take effect.
•
Recovering an unbootable Raspberry Pi boot EEPROM configuration
In the event that Raspberry Pi computer is not booting, or if/when you suspect/know that the Raspberry Pi boot EEPROM configuration is missing or has become corrupted, all hope is not lost. There is a way to recover from this nightmare of a predicament.
At power on, the ROM found on BCM2711 and BCM2712 (i.e. Raspberry Pi 4 and Raspberry Pi 5 computers) looks for a file called recovery.bin in the root directory of the boot partition on the microSD 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 EEPROM can always be reset to a valid image with factory default settings.
All you need to do is download and copy the appropriate 'recovery.bin' file to a microSD card, insert that into the microSD card slot of your Raspberry Pi 4 or Rasdpberry Pi 5 computer, power it on, and wait for 30 seconds or so.
• Raspberry Pi 4 'recovery.bin' file: https://github.com/raspberrypi/rpi-eeprom/tree/master/firmware-2711/latest
• Raspberry Pi 5 'recovery.bin' file: https://github.com/raspberrypi/rpi-eeprom/tree/master/firmware-2712/latest
When that's been done, power off the Raspberry Pi computer and remove the microSD card. Plug in the storage device containing your operating system and power the Raspberry Pi on once again.
You should then be back up and running as before.
•
Thanks!
Thank you for reading and taking part in this SARPi mini-project. We hope you enjoyed it and found it interesting and educational.
Thanks also to Patrick Volkerding, and the entire Slackware Team, for producing a truly wonderful OS. Without you, and the work you do, the SARPi Project would not exist.
If you have any questions or need help, visit the Slackware Linux Forum on Linux Questions. Or get in touch on the #SARPi IRC channel on irc.libera.chat.
•