nfstoney
Posts: 36
Joined: Fri Jul 21, 2017 2:04 pm

CM4 can't change boot EEPROM

Wed Jan 20, 2021 2:35 pm

Hello
I have a problem to change the content of the boot EEPOM on my CM4.

I have the latest raspian (2021-01-11-raspios-buster-armhf.img) on my uSDCard.

Code: Select all

sudo CM4_ENABLE_RPI_EEPROM_UPDATE=1 -E rpi-eeprom-update

Code: Select all

BCM2711 detected
VL805 firmware in bootloader EEPROM
BOOTLOADER: up-to-date
CURRENT: Fr Okt  2 07:44:17 UTC 2020 (1601624657)
 LATEST: Do Sep  3 12:11:43 UTC 2020 (1599135103)
 FW DIR: /lib/firmware/raspberrypi/bootloader/default
VL805: up-to-date
CURRENT: 
 LATEST: 
From other thread (viewtopic.php?t=293311) I run

Code: Select all

sudo CM4_ENABLE_RPI_EEPROM_UPDATE=1 -E rpi-eeprom-config --edit
to edit the file /tmp/tmpxxxxxx/boot.conf
and safe it with Ctrl+O and leave with Ctrl+X

Then the answer of this step

Code: Select all

Updating bootloader EEPROM
 image: /lib/firmware/raspberrypi/bootloader/default/pieeprom-2020-09-03.bin
config_src: /boot/pieeprom.upd
config: /tmp/tmp3vi5ox47/boot.conf
################################################################################
[all]
BOOT_UART=0
WAKE_ON_GPIO=0
POWER_OFF_ON_HALT=1
DISABLE_HDMI=0
BOOT_ORDER=0xf51


################################################################################

*** To cancel this update run 'sudo rpi-eeprom-update -r' ***

BCM2711 detected
VL805 firmware in bootloader EEPROM
*** INSTALLING /tmp/tmp3vi5ox47/pieeprom.upd  ***
BOOTFS /boot
EEPROM update pending. Please reboot to apply the update.
Now, there are three new files in /boot
- pieeeprom.sig
- pieeprom.upd
- recovery.bin

Now, I rebbot the system like guided above

Code: Select all

sudo reboot
The system reboots and I have a look to the eeprom-content

Code: Select all

vcgencmd bootloader_config
the content doesn't change.

If I run

Code: Select all

sudo CM4_ENABLE_RPI_EEPROM_UPDATE=1 -E rpi-eeprom-config --edit
the content is as I want it to be.

Where do I make the mistake so that the eeprom is not written?
Many thanks for any hints.

nfstoney

timg236
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 903
Joined: Thu Jun 21, 2018 4:30 pm

Re: CM4 can't change boot EEPROM

Wed Jan 20, 2021 2:40 pm

You can't use rpi-update-eeprom on CM4, you need to use rpiboot instead.

https://www.raspberrypi.org/documentati ... lashing.md

If you look in the recovery directory there's a simple shell-script to automate the process of updating the image + signature after editing the boot config.

cleverca22
Posts: 4642
Joined: Sat Aug 18, 2012 2:33 pm

Re: CM4 can't change boot EEPROM

Wed Jan 20, 2021 3:02 pm

nfstoney wrote:
Wed Jan 20, 2021 2:35 pm
Now, there are three new files in /boot
- pieeeprom.sig
- pieeprom.upd
- recovery.bin
i believe recovery.bin is disabled on the CM4, so you either need to use rpiboot as timg236 said, or use the deprecated flashrom route

nfstoney
Posts: 36
Joined: Fri Jul 21, 2017 2:04 pm

Re: CM4 can't change boot EEPROM

Wed Jan 20, 2021 4:15 pm

timg236 wrote:
Wed Jan 20, 2021 2:40 pm
You can't use rpi-update-eeprom on CM4, you need to use rpiboot instead.

https://www.raspberrypi.org/documentati ... lashing.md

If you look in the recovery directory there's a simple shell-script to automate the process of updating the image + signature after editing the boot config.
Many thanks for this hint. It works.

nfstoney
Posts: 36
Joined: Fri Jul 21, 2017 2:04 pm

Re: CM4 can't change boot EEPROM

Wed Jan 20, 2021 4:16 pm

cleverca22 wrote:
Wed Jan 20, 2021 3:02 pm
nfstoney wrote:
Wed Jan 20, 2021 2:35 pm
Now, there are three new files in /boot
- pieeeprom.sig
- pieeprom.upd
- recovery.bin
i believe recovery.bin is disabled on the CM4, so you either need to use rpiboot as timg236 said, or use the deprecated flashrom route
Please tell me more about "the deprecated flashrom route".

cleverca22
Posts: 4642
Joined: Sat Aug 18, 2012 2:33 pm

Re: CM4 can't change boot EEPROM

Wed Jan 20, 2021 4:36 pm

nfstoney wrote:
Wed Jan 20, 2021 4:16 pm
Please tell me more about "the deprecated flashrom route".
https://github.com/raspberrypi/rpi-eepr ... update#L31
https://github.com/raspberrypi/rpi-eepr ... pdate#L239

i think you just add USE_FLASHROM=1 to the command

nfstoney
Posts: 36
Joined: Fri Jul 21, 2017 2:04 pm

Re: CM4 can't change boot EEPROM

Fri Jan 22, 2021 10:10 am

cleverca22 wrote:
Wed Jan 20, 2021 4:36 pm
nfstoney wrote:
Wed Jan 20, 2021 4:16 pm
Please tell me more about "the deprecated flashrom route".
https://github.com/raspberrypi/rpi-eepr ... update#L31
https://github.com/raspberrypi/rpi-eepr ... pdate#L239

i think you just add USE_FLASHROM=1 to the command
Thanks for the hint. i am a few steps further but unfortunately not yet completely successful.


I changed the boot.conf and generate a new pieeprom.bin with

Code: Select all

sudo ./update-pieeprom.sh
Then I want to write the EEPROM with

Code: Select all

sudo CM4_ENABLE_RPI_EEPROM_UPDATE=1 USE_FLASHROM=1 rpi-eeprom-update -f /home/pi/usbboot/recovery/pieeprom.bin 
Following by the return

Code: Select all

BCM2711 detected
VL805 firmware in bootloader EEPROM
*** INSTALLING /home/pi/usbboot/recovery/pieeprom.bin  ***
WARNING: USE_FLASHROM is deprecated.
Applying bootloader update /home/pi/usbboot/recovery/pieeprom.bin
flashrom  on Linux 5.4.83-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... 
Warning: Chip content is identical to the requested image.
Erase/write done.
Applying bootloader update /home/pi/usbboot/recovery/pieeprom.bin
EEPROM update pending. Please reboot to apply the update.

The note "Warning: Chip content is identical to the requested image." I think ist strange. The pieeprom.bin is really not the same as in the EEPROM.

The note "EEPROM update pending. Please reboot to apply the update." is also strange because i think this isn't necessary.

I wrote some extra code for readout the EEPROM with the flashrom-command, but the EEPROM content doesn't change.


Can someone see a mistake or more with the description above?

timg236
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 903
Joined: Thu Jun 21, 2018 4:30 pm

Re: CM4 can't change boot EEPROM

Fri Jan 22, 2021 10:35 am

Presumably flashrom is correct it's just doing SPI reads.

btw. The USE_FLASHROM option is pending removal from rpi-eeprom-update but there's nothing to top anyone using the code as reference to create a simple system / init script which loads the appropriate DT overlay to configure the GPIOs and running flashrom directly.

cleverca22
Posts: 4642
Joined: Sat Aug 18, 2012 2:33 pm

Re: CM4 can't change boot EEPROM

Fri Jan 22, 2021 10:40 am

timg236 wrote:
Fri Jan 22, 2021 10:35 am
Presumably flashrom is correct it's just doing SPI reads.

btw. The USE_FLASHROM option is pending removal from rpi-eeprom-update but there's nothing to top anyone using the code as reference to create a simple system / init script which loads the appropriate DT overlay to configure the GPIOs and running flashrom directly.
why remove it entirely? too many conflicts against the other spi stuff and not wanting to deal with that?

timg236
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 903
Joined: Thu Jun 21, 2018 4:30 pm

Re: CM4 can't change boot EEPROM

Fri Jan 22, 2021 11:43 am

Yes, there are too many cases where an arbitrary system configuration won't be in a suitable state to run flashrom or vl805 directly and will lockup hang. This makes it unsuitable for use as a generic automatic update.

Removing this simplifies the script and dependencies.

rpi-eeprom-config & rpi-eeprom-update already provide all the plumbing to generate pieeprom.bin files so if anyone wants to use flashrom then all they need to do is re-use the existing tools and then call flashrom at a suitable point (after calling dtoverlay etc)

nfstoney
Posts: 36
Joined: Fri Jul 21, 2017 2:04 pm

Re: CM4 can't change boot EEPROM

Fri Jan 22, 2021 1:31 pm

timg236 wrote:
Fri Jan 22, 2021 11:43 am
Yes, there are too many cases where an arbitrary system configuration won't be in a suitable state to run flashrom or vl805 directly and will lockup hang. This makes it unsuitable for use as a generic automatic update.

Removing this simplifies the script and dependencies.

rpi-eeprom-config & rpi-eeprom-update already provide all the plumbing to generate pieeprom.bin files so if anyone wants to use flashrom then all they need to do is re-use the existing tools and then call flashrom at a suitable point (after calling dtoverlay etc)
It seems to me no longer advisable to pursue my goal of wanting to write the EEPROM manually. In the future, I will have to be satisfied with the available official tools.

How is it intended to manipulate the bootloader EEPROM in a setup where is no physical access to the PI(CM4)?

timg236
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 903
Joined: Thu Jun 21, 2018 4:30 pm

Re: CM4 can't change boot EEPROM

Fri Jan 22, 2021 9:17 pm

nfstoney wrote:
Fri Jan 22, 2021 1:31 pm
timg236 wrote:
Fri Jan 22, 2021 11:43 am
Yes, there are too many cases where an arbitrary system configuration won't be in a suitable state to run flashrom or vl805 directly and will lockup hang. This makes it unsuitable for use as a generic automatic update.

Removing this simplifies the script and dependencies.

rpi-eeprom-config & rpi-eeprom-update already provide all the plumbing to generate pieeprom.bin files so if anyone wants to use flashrom then all they need to do is re-use the existing tools and then call flashrom at a suitable point (after calling dtoverlay etc)
It seems to me no longer advisable to pursue my goal of wanting to write the EEPROM manually. In the future, I will have to be satisfied with the available official tools.

How is it intended to manipulate the bootloader EEPROM in a setup where is no physical access to the PI(CM4)?
For industrial applications we recommend not changing it making the EEPROM read only via the jumper

Return to “Compute Module”