WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Howto: RPi4 update the bootloader eeprom  (Read 2835 times)

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14799
Howto: RPi4 update the bootloader eeprom
« on: June 08, 2020, 02:08:58 AM »
Be careful, if something goes wrong, you could end up with an RPi4-shaped paperweight...

Not all RPi4 are the same, first check if you have one suitable for update by running the following script:
Code: [Select]
#!/bin/sh
BOARD_INFO="$(sed -n '/^Revision/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo)"
if [ $(((0x$BOARD_INFO >> 23) & 1)) -ne 0 ] && [ $(((0x$BOARD_INFO >> 12) & 15)) -eq 3 ]; then
   echo "BCM2711 detected"
else
   # Not a BCM2711, no EEPROMs to update.
   exit ${EXIT_SUCCESS}
fi

BOARD_TYPE=$(((0x$BOARD_INFO >> 4) & 0xff))
BOARD_REVISION=$((0x$BOARD_INFO & 0xf))

if [ ${BOARD_TYPE} -eq 17 ] && [ ${BOARD_REVISION} -lt 4 ]; then
   echo "Dedicated VL805 EEPROM detected"
else
   echo "VL805 firmware in bootloader EEPROM"
fi
If you see "Dedicated VL805 EEPROM detected" you have the appropriate RPi4.

Next check what version of eeprom firmware you have:
Code: [Select]
$ tce-load -i rpi-vc
$ sudo vcgencmd bootloader_version
Jul 15 2019 12:59:55
version 514670a211212cbbbbd5bcf91555c86ca4750897 (release)
timestamp 1563195595

Then get the latest firmware and check the date:
Code: [Select]
$ tce-load -i git
$ git clone https://github.com/raspberrypi/rpi-eeprom/
$ ls rpi-eeprom/firmware/stable/pieeprom*
/tmp/rpi-eeprom/firmware/stable/pieeprom-2020-04-16.bin
..so the latest stable firmware is more recent.

Prepare the RPi4 to update by making the following changes to /mnt/mmcblk0p1/config.txt:
Code: [Select]
dtparam audio=off
dtoverlay spi-gpio40-45
..and reboot

After reboot, check that the following modules are loaded:
Code: [Select]
$ lsmod | grep spi
spidev                 20480  0
spi_bcm2835            20480  0

Now flash the eeprom:
Code: [Select]
$ tce-load -i flashrom
$ sudo flashrom -p "linux_spi:dev=/dev/spidev0.0,spispeed=16000" -w "pieeprom-2020-04-16.bin"
flashrom v1.2 on Linux 4.19.81-piCore-v7l (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Winbond flash chip "W25X40" (512 kB, SPI) on linux_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

Finally reboot and check the firmware version:
Code: [Select]
$ tce-load -i rpi-vc
$ sudo vcgencmd bootloader_version
Apr 16 2020 18:11:26
version a5e1b95f320810c69441557c5f5f0a7f2460dfb8 (release)
timestamp 1587057086

..and remember to change /mnt/mmcblk0p1/config.txt back to your original settings.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14799
Re: Howto: RPi4 update the bootloader eeprom
« Reply #1 on: June 08, 2020, 02:43:50 AM »
Be careful, if something goes wrong, you could end up with an RPi4-shaped paperweight...

To update the vl805 eeprom firmware, first get the software and check the eeprom firmware version:
Code: [Select]
$ tce-load -i git
$ git clone https://github.com/raspberrypi/rpi-eeprom/
$ sudo rpi-eeprom/firmware/vl805
VL805 FW version: 00013701

Next check if a more recent version exists:
Code: [Select]
$ ls rpi-eeprom/firmware/stable/vi805*
vl805-000137ad.bin
..so the latest stable version is more recent

Now update the firmware:
Code: [Select]
$ sudo rpi-eeprom/firmware/vl805 -w rpi-eeprom/firmware/stable/vl805-000137ad.bin
VL805 FW version: 00013701
VL805 EEPROM successfully reprogrammed - please reboot to activate.

Finally, reboot and check the firmware version:
Code: [Select]
$ sudo ./vl805
VL805 FW version: 000137ad

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1243
Re: Howto: RPi4 update the bootloader eeprom
« Reply #2 on: June 08, 2020, 08:41:14 AM »
A paperweight is unlikely, but you may need to use a rpi recovery image to get back....Its on their download page.

https://www.raspberrypi.org/downloads/