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: #!/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: $ 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: $ 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: dtparam audio=off
dtoverlay spi-gpio40-45
..and reboot
After reboot, check that the following modules are loaded: $ lsmod | grep spi
spidev 20480 0
spi_bcm2835 20480 0
Now flash the eeprom: $ 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: $ 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.