[U-Boot] Bootcount on raspberry pi 0 w

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


Hello

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_ENV_FAT_DEVICE_AND_PART="0:1"
  CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
  CONFIG_DM_KEYBOARD=y
+CONFIG_BOOTDELAY=-2
+CONFIG_BOOTCOUNT=y
+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y
+CONFIG_BOOTCOUNT_BOOTLIMIT=3
+CONFIG_EXTRA_ENV_SETTINGS="altbootcmd=if test $rpipart -eq 2; then 
setenv rpipart 3; else; setenv rpipart 2; fi; saveenv;boot\0"
  CONFIG_DM_MMC=y
  CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_BCM2835=y

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

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

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