diff mbox series

[U-Boot] Bootcount on raspberry pi 0 w

Message ID 6763c4bf-8103-1a66-2e16-ca98d7217fe3@tmweb.at
State New
Delegated to: Matthias Brugger
Headers show
Series [U-Boot] Bootcount on raspberry pi 0 w | expand

Commit Message

Thomas Mahringer Oct. 3, 2019, 3:26 p.m. UTC
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:

  CONFIG_MMC_SDHCI_BCM2835=y

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

root@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
diff mbox series

Patch

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