[U-Boot] Bootcount on raspberry pi 0 w

Thomas Mahringer tmahring at tmweb.at
Thu Oct 3 15:26:03 UTC 2019


We are using yocto + swupdate and u-boot do deliver software updates for 
our hardware which is based on a raspberry pi zero w.

So far everything seems to be working, however I would like to use 
u-boot's bootcount feature to switch back to the previous version in 
case an upgrade fails to run.

I have tried enabling bootcount with this patch to the config:

diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig
index 39da54c3e7..5e5afe0dd6 100644
--- a/configs/rpi_0_w_defconfig
+++ b/configs/rpi_0_w_defconfig
@@ -20,6 +20,12 @@ CONFIG_ENV_FAT_INTERFACE="mmc"
+CONFIG_EXTRA_ENV_SETTINGS="altbootcmd=if test $rpipart -eq 2; then 
setenv rpipart 3; else; setenv rpipart 2; fi; saveenv;boot\0"

However, every time i boot the system bootcount is set to 1

root at raspberrypi0-wifi:~# fw_printenv | grep count

Even if I manually increase bootcount via fw_setenv it gets reset to 1 
after i reboot.

I don't really know where to go from here, could anyone maybe point me 
in the right direction?

best regards
Thomas Mahringer

More information about the U-Boot mailing list