A device like the Raspberry Pi utilizes a bootloader to start the operating system. It has code that creates the hardware's different parts and loads the operating system.
Since the Raspberry Pi 4 model, the bootloader for the machine is stored in an EEPROM. On the Pi's mainboard is an EEPROM that serves as permanent storage.
The Raspberry Pi 4 is intended to make it simple to upgrade the bootloader, enabling the deployment of new features and problem fixes. For instance, the most recent editions even provide network installation capabilities.
A "bootcode.bin" file included in the boot filesystem was necessary for earlier versions of the Raspberry Pi. Instead, use the EEPROM so that the Raspberry Pi 4 may carry out tasks without requiring external storage.
We'll go over some benefits and updating instructions for the Raspberry Pi 4 bootloader in the following sections.
The tools you'll need to update the bootloader on a Raspberry Pi are listed below.
Recommended Micro SD Card for Raspberry Pi 4 or Newer (You'll Need Two if You Don't Want to Replace the Current OS), Ethernet cable or Wi-Fi power supply, HDMI cable, USB Mouse, USB Keyboard, and Raspberry Pi Case
Diagnostics for the Raspberry Pi's Bootloader
There are a few techniques to determine whether the bootloader is malfunctioning if your Raspberry Pi won't boot. You can identify the cause of your device's boot-up refusal by using the information supplied in these ways.
In the next two parts, we'll briefly discuss the bootloader diagnostics screen and the diagnostic light patterns.
Screen for Bootloader Diagnostics
First off, more recent Raspberry Pi 4 bootloader iterations show readable diagnostic data when the boot process fails.
You may learn more about the system and the reasons why your device isn't booting by using this information.
Simply switch off your Raspberry Pi, remove the SD Card, and turn it on to verify this for yourself.
When a boot attempt fails, a screen similar to this will appear when an HDMI cable is plugged into any of your Pi's ports.
The bootloader will keep looking for a workable boot mechanism in your SD Card slot or through a USB connection while you are in the diagnostics panel.
As an illustration, if we connect our SD card back to the Pi 4, the bootloader will recognize it and start the computer with the loaded operating system.
Diagnostic Bootloader Lights
Before the bootloader diagnostic screen was included, you had to rely on the Raspberry Pi's power LED.
When the boot failed, this light would flash in a specified pattern. A specific failure error would match the pattern of flashes. After 2 seconds, the pattern will be repeated.
The table below can help you determine why your device won't boot if you're still using an outdated version of the Pi 4 bootloader.
Diagnostic Lights for Bootloaders
You previously had to rely on the Raspberry Pi's power LED before the bootloader diagnostic screen was included.
In the event that the boot failed, this light would flash in a certain sequence. A specific failure error would be associated with the flash pattern. After 2 seconds, the pattern will once again be shown.
The table below might help you figure out why your device won't boot if you're still using an outdated version of the Pi 4 bootloader.
Updating the Raspberry Pi's bootloader
In this part, we'll go through a few techniques you might employ to upgrade or restore the bootloader on your Raspberry Pi 4.
The Raspberry Pi Imager is utilized
The revised bootloader may be installed via a micro SD Card, according to the Raspberry Pi Foundation's initially suggested procedure.
If there is no serious hardware damage, you may still upgrade your bootloader using this approach even if the primary operating system cannot be loaded.
You'll need a spare Micro SD Card for this phase since the program we're using will delete everything on the disc.
1. Download and install the Raspberry Pi Imager on your computer or another device before continuing. Support for Windows, macOS, and Ubuntu is provided by this program.
The following command may be used to install it on a device running Raspberry Pi OS.
2. After installing the Raspberry Pi imager, open it and select "CHOOSE OS" from the menu.
3. Scroll down until you see the category labeled "Misc Utility Images" in the menu that appears.
Click the entry to enter that category after you've located it.
4. You have two options here: either use the "Beta Test Bootloader" or the "Standard Bootloader" (1.). (2.).
We advise you to stick with the "Bootloader" category if you want the most reliable bootloader for the Raspberry P 4.
5. You will be presented with three more options after choosing which bootloader release you wish to use.
We'll go through each of your three possibilities in brief. We'll use "SD Card Boot" as our example throughout.
- If an SD Card is present, the Raspberry Pi's bootloader will use it to start the computer.
- It will attempt to fall back to a linked USB device if there is no SD Card plugged in.
- A customized bootloader known as a USB Boot will prioritize a USB device if one is present.
The Raspberry Pi will start from the SD Card if a USB boot device is not available.
- The network boot The most recent of the three alternatives, this bootloader version enables network booting in the absence of an SD Card.
6. After selecting a bootloader, you must decide which storage device will be used to store this data.
By selecting the "Choose Storage" option, you may select the storage medium.
7. You can select any mounted, functional storage device from the dialogue box that appeared.
In our case, there is just one SD card inserted into the PC. To continue, choose the appropriate gadget.
Please be aware that the imager will remove all of the original material from any device you use.
8. At last, you may start writing by using the "Write" button.
9. The Raspberry Pi imager will notify you that it will delete all of the data currently present on your SD card.
You must press the "Yes" button in order to proceed.
10. At most, the writing process will take a few minutes. When it's finished, a notice similar to the one below will appear.
You can now remove the Raspberry Pi 4 bootloader from your device because this shows that the SD Card has been successfully written with the bootloader.
11. Your Raspberry Pi must be turned off and its original SD card removed at this time.
Please complete either of these chores right away if you haven't already.
12. After getting your Pi ready, connect the SD card you just formatted and turn it on. The SD card's contents will be read by the Raspberry Pi 4 before the new bootloader is installed.
Wait for at least 10 seconds before moving on to the following action.
13. There are two signs that the bootloader upgrade for your Raspberry Pi was successful.
The Raspberry Pi's power LED will initially be continuously flashing in a predictable rhythm.
Second, the Raspberry Pi ought should show a green square on your screen if an HDMI connection is plugged in.
You can now disconnect your Raspberry Pi and put in your original SD card if you see one of these.
Using the raspberry-config tool to update the bootloader
To install the most recent bootloader to your Raspberry Pi, use the raspi-config utility.
You'll need to have downloaded the most recent bootloader on your device in order to use this approach. The bootloader is a built-in component of Raspberry Pi OS by default.
1. The first thing we do is upgrade our Raspberry Pi packages. By doing this, we can make sure that our device is running the most recent bootloader versions.
To execute an update, you must enter the following two instructions into the terminal.
2. After the upgrade is finished, use the command shown below to launch the Raspberry Pi configuration tool.
We may instruct the Raspberry Pi to install the most recent stable bootloader version using this utility.
3. You may use your keyboard's ARROW keys to traverse this tool. The ENTER key must be pressed to choose an option.
Choose "Advanced Options" to start.
4. Choose "Bootloader Version" from the menu on the next screen.
This choice will lead us to a page where we can choose which bootloader release to install on the Raspberry Pi.
5. Right now, you may choose between two distinct releases. Installing the most recent version will be used in this example.
- E1 Latest - Selecting this option will offer you the bootloader's most recent version. Choose this option if you want the most recent fixes and features.
- E2 Default – By choosing this choice, the Raspberry Pi will return to the factory-installed bootloader.
You'll see that utilizing this option prevents you from choosing the beta bootloader or variant.
6. The bootloader version that will be installed on your Raspberry Pi will be shown to you on this screen.
Any modifications to the boot setup can be undone and the defaults restored. In this case, we'll decide to reset them by choosing the "Yes" option.
7. You must restart your Raspberry Pi in order for the new bootloader to take effect.
When the setup tool prompts you, you can choose to do this, or you can use the following command on your device.
Using the command line, update the bootloader on the Raspberry Pi 4
By using a particular command, the bootloader of the Raspberry Pi 4 may be upgraded. Similar to the raspi-config utility, an update should always be run before continuing.
1. Install the most recent version of your packages as a preliminary step before moving on.
By doing this, you can be sure that your Raspberry Pi will have the most recent bootloader installed.
2. After the update is finished, we may update using the following command.
The "rpi-eeprom-update" tool is instructed to automatically install any bootloader and USB (VLI) EEPROM updates when the "-a" option is used.
3. The bootloader's status will be displayed after you run this command.
You will now notice the text "*** INSTALLING EEPROM UPDATES***" at the top of the output if an update is available.
4. Your Raspberry Pi has to be restarted when this update is finished.
You must enter the following command in the terminal to restart your device.
Using the command line, install a beta version of the Pi bootloader
You must take a few more steps in order to install the beta version of the Raspberry Pi 4 bootloader on your Raspberry Pi. The stable channel will be used by default by the command-line program we use to update the bootloader.
1. Before we begin, we need to make sure that our Raspberry Pi has the most recent bootloader downloaded to it.
The two commands below can be used at the terminal to do that.
2. In order to proceed, we must change the "rpi-eeprom-update" tool's default file.
Run the command below to launch the nano text editor and start editing this file.
3. You must locate the next line in this file.
The release version that the EEPROM update tool will download is specified by this line.
Substitute the next line for that one. You'll see that we replaced "stable" with "beta."
4. You must save the file after you make this modification.
By hitting CTRL + X, Y, and ENTER after saving and closing the file, respectively.
5. The EEPROM update tool will now download the most recent version from the "beta" branch when we launch it on our Raspberry Pi.
Run the following command on your device to update the bootloader to the newest beta version.
6. You must restart your device for the new EEPROM to be installed.
Use the following command in the terminal to restart the Raspberry Pi.
This bootloader has been placed in the EEPROM since the Raspberry Pi 4 model. You will have learned how to upgrade the bootloader contained in this persistent memory by referring to this tutorial.
A crucial component of computer systems like the Pi is the bootloader.
Please leave a comment if you've had any trouble changing the bootloader on your smartphone.