Skip to contentSkip to conversation

Add Kconfig option for altbootcmd when using CONFIG_BOOTCOUNT_LIMIT

PATCH In review Tomáš Peterka 5 participants 10 messages Jan 30, 2025 – Mar 3, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add Kconfig option for altbootcmd when using CONFIG_BOOTCOUNT_LIMIT

Hello u-boot maintainers,

I would like to merge a simple patch for user-friendliness when configuring u-boot with Yocto. The problem is missing option for altbootcmd when using the feature CONFIG_BOOTCOUNT_LIMIT. Simply adding the option CONFIG_BOOTCOUNT_ALTBOOTCMD into Kconfig shouldn't be a problem when there is already CONFIG_BOOTCOMMAND? Users then can use CONFIG_BOOTCOUNT_ALTBOOTCMD instead of misusing CFG_EXTRA_ENV_SETTINGS (and friends) that are usually used by configs of specific boards.

Many thanks for considering this,
Tomas

From 9f5d1863e99c3a33893381cc924f25797b4b6f8a Wed Jan 29 19:06:55 2025 -0600
From: Tomas Peterka <[email protected]>
Date: Tue, 30 Jan 2025 09:00:00 +0100
Subject: [PATCH] Add altbootcmd to Kconfig
Upstream-Status: Pending
---

drivers/bootcount/Kconfig +0 -0
index 0080d2a165..982ddc9826 100644
@@ -183,6 +183,12 @@ config BOOTCOUNT_BOOTLIMIT

counter being cleared.
If set to 0, do not set a boot limit in the environment.

+config BOOTCOUNT_ALTBOOTCMD
+ string "Alternative boot command when BOOTLIMIT is reached"
+ default "env set bootfile altboot.scr; bootflow scan -lb"
+ help
+ Set the alternative boot command once BOOTLIMIT is reached +
config SYS_BOOTCOUNT_SINGLEWORD
bool "Use single word to pack boot count and magic value" depends on BOOTCOUNT_GENERIC

include/env_default.h +0 -0
index aa3dd40f3f..59bb0f6a6a 100644
@@ -115,6 +115,9 @@ const char default_environment[] = {

#if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0) "bootlimit=" __stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0"
#endif
+#ifdef CONFIG_BOOTCOUNT_ALTBOOTCMD
+ "altbootcmd=" CONFIG_BOOTCOUNT_ALTBOOTCMD "\0"
+#endif
#ifdef CONFIG_MTDIDS_DEFAULT
"mtdids=" CONFIG_MTDIDS_DEFAULT "\0"
#endif

#1 lore raw
Quoted 3 lines · Tomáš Peterka

Hello u-boot maintainers,

I would like to merge a simple patch for user-friendliness when configuring u-boot with Yocto. The problem is missing option for altbootcmd when using the feature CONFIG_BOOTCOUNT_LIMIT. Simply adding the option CONFIG_BOOTCOUNT_ALTBOOTCMD into Kconfig shouldn't be a problem when there is already CONFIG_BOOTCOMMAND? Users then can use CONFIG_BOOTCOUNT_ALTBOOTCMD instead of misusing CFG_EXTRA_ENV_SETTINGS (and friends) that are usually used by configs of specific boards.

Thanks for posting this. In general, yes, this the right approach.

Quoted 10 lines

Many thanks for considering this,
Tomas

From 9f5d1863e99c3a33893381cc924f25797b4b6f8a Wed Jan 29 19:06:55 2025 -0600
From: Tomas Peterka <[email protected]>
Date: Tue, 30 Jan 2025 09:00:00 +0100
Subject: [PATCH] Add altbootcmd to Kconfig
Upstream-Status: Pending

Here is where you need to explain the purpose of the commit. Ideally this is what you should git send-email as well, as that might help with the next problem.

Quoted 9 lines

---

drivers/bootcount/Kconfig +0 -0
index 0080d2a165..982ddc9826 100644
@@ -183,6 +183,12 @@ config BOOTCOUNT_BOOTLIMIT

counter being cleared.
If set to 0, do not set a boot limit in the environment.

drivers/bootcount/Kconfig

Quoted 6 lines
drivers/bootcount/Kconfig +6 -0
+config BOOTCOUNT_ALTBOOTCMD
+ string "Alternative boot command when BOOTLIMIT is reached"
+ default "env set bootfile altboot.scr; bootflow scan -lb"
+ help
+ Set the alternative boot command once BOOTLIMIT is reached
+

I suspect due to how this was sent, there's whitespace problems.

Also, we shouldn't specify a default here, as that ends up being per-platform. Migrating that in turn might be a bit tricky since you need to take it from a few different places depending on the board. It probably involves doing some loops of building u-boot-initial-env for all the platforms that enable BOOTCOUNT. If this sounds a bit too much, I can v2 things with that if you like.

Signature · 1 line
Tom
#2 lore raw

PATCH 1/1 feat: Add CONFIG_BOOTCOUNT_ALTBOOTCMD to Kconfig

Add CONFIG_BOOTCOUNT_ALTBOOTCMD so the developer is able to add custom altbootcmd via Kconfig when they enable BOOTCOUNT.

---
 drivers/bootcount/Kconfig | 3 +++
 include/env_default.h     | 3 +++
 2 files changed, 6 insertions(+)
drivers/bootcount/Kconfig +3 -0
index 0080d2a165..99b6c7534f 100644
@@ -183,6 +183,9 @@ config BOOTCOUNT_BOOTLIMIT
 	  counter being cleared.
 	  If set to 0, do not set a boot limit in the environment.
 
+config BOOTCOUNT_ALTBOOTCMD
+	string "Alternative boot command when BOOTLIMIT is reached"
+
 config SYS_BOOTCOUNT_SINGLEWORD
 	bool "Use single word to pack boot count and magic value"
 	depends on BOOTCOUNT_GENERIC
include/env_default.h +3 -0
index aa3dd40f3f..60c39f9853 100644
@@ -115,6 +115,9 @@ const char default_environment[] = {
 #if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0)
 	"bootlimit="	__stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0"
 #endif
+#ifdef CONFIG_BOOTCOUNT_ALTBOOTCMD
+	"altbootcmd="	CONFIG_BOOTCOUNT_ALTBOOTCMD            "\0"
+#endif
 #ifdef CONFIG_MTDIDS_DEFAULT
 	 "mtdids="	CONFIG_MTDIDS_DEFAULT		"\0"
 #endif
Signature · 1 line
2.47.1
#3 lore raw

PATCH 1/1 configs: Migrate CONFIG_BOOTCOUNT_ALTBOOTCMD to defconfig

Now that we have moved CONFIG_BOOTCOUNT_ALTBOOTCMD to be in Kconfig so that it can be more easily modified in many cases, we need to move it from environment files / config.h files and in to the defconfig file.

This was done by generating u-boot-initial-env for all platforms before the Kconfig change, to extract altbootcmd values and then again after to compare the result.

---
When applying I will fold this in to the original commit to make sure we don't have bisect problems.

---
 board/comvetia/lxr2/lxr2.env                |  1 -
 board/keymile/scripts/develop-common.txt    |  1 -
 board/keymile/scripts/ramfs-common.txt      |  1 -
 board/keymile/secu1/socfpga_secu.env        |  1 -
 board/storopack/smegw01/smegw01.env         | 15 ---------------
 configs/am335x_guardian_defconfig           |  1 +
 configs/bk4r1_defconfig                     |  1 +
 configs/brppt2_defconfig                    |  1 +
 configs/capricorn_cxg3_defconfig            |  1 +
 configs/display5_defconfig                  |  1 +
 configs/draco-etamin_defconfig              |  1 +
 configs/draco-rastaban_defconfig            |  1 +
 configs/draco-thuban_defconfig              |  1 +
 configs/ge_b1x5v2_defconfig                 |  1 +
 configs/ge_bx50v3_defconfig                 |  1 +
 configs/imx6q_bosch_acc_defconfig           |  1 +
 configs/imx6qdl_icore_mmc_defconfig         |  1 +
 configs/imx8mm-mx8menlo_defconfig           |  1 +
 configs/imx8mm_data_modul_edm_sbc_defconfig |  1 +
 configs/imx8mp_data_modul_edm_sbc_defconfig |  1 +
 configs/imx8mp_dhcom_drc02_defconfig        |  1 +
 configs/imx8mp_dhcom_pdk2_defconfig         |  1 +
 configs/imx8mp_dhcom_pdk3_defconfig         |  1 +
 configs/imx8mp_dhcom_picoitx_defconfig      |  1 +
 configs/kmcent2_defconfig                   |  1 +
 configs/kmcoge5ne_defconfig                 |  1 +
 configs/kmeter1_defconfig                   |  1 +
 configs/kmopti2_defconfig                   |  1 +
 configs/kmsupx5_defconfig                   |  1 +
 configs/kmtepr2_defconfig                   |  1 +
 configs/lxr2_defconfig                      |  1 +
 configs/m53menlo_defconfig                  |  1 +
 configs/mx53ppd_defconfig                   |  1 +
 configs/pg_wcom_expu1_defconfig             |  1 +
 configs/pg_wcom_expu1_update_defconfig      |  1 +
 configs/pg_wcom_seli8_defconfig             |  1 +
 configs/pg_wcom_seli8_update_defconfig      |  1 +
 configs/pxm2_defconfig                      |  1 +
 configs/rut_defconfig                       |  1 +
 configs/smegw01_defconfig                   |  1 +
 configs/socfpga_secu1_defconfig             |  1 +
 configs/stm32mp13_dhcor_defconfig           |  1 +
 configs/stm32mp15_dhcom_basic_defconfig     |  1 +
 configs/stm32mp15_dhcor_basic_defconfig     |  1 +
 configs/tuge1_defconfig                     |  1 +
 configs/tuxx1_defconfig                     |  1 +
 include/configs/am335x_guardian.h           |  5 -----
 include/configs/bk4r1.h                     |  2 --
 include/configs/brppt2.h                    |  1 -
 include/configs/display5.h                  |  1 -
 include/configs/ge_b1x5v2.h                 |  8 --------
 include/configs/ge_bx50v3.h                 |  8 --------
 include/configs/imx6-engicam.h              |  1 -
 include/configs/imx6q-bosch-acc.h           |  3 +--
 include/configs/imx8mm-mx8menlo.h           |  8 --------
 include/configs/imx8mm_data_modul_edm_sbc.h |  1 -
 include/configs/imx8mp_data_modul_edm_sbc.h |  1 -
 include/configs/imx8mp_dhcom_pdk2.h         |  1 -
 include/configs/m53menlo.h                  |  7 -------
 include/configs/mx53ppd.h                   |  8 --------
 include/configs/siemens-am33x-common.h      |  1 -
 include/configs/siemens-env-common.h        |  1 -
 include/configs/snapper9g45.h               |  3 +--
 include/env/pg-wcom/common.env              |  1 -
 64 files changed, 43 insertions(+), 78 deletions(-)
board/comvetia/lxr2/lxr2.env +0 -1
index ec213800222d..26ad4f18c684 100644
@@ -2,7 +2,6 @@ addcons=setenv bootargs ${bootargs} console=${console},${baudrate}
 addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off
 addmisc=setenv bootargs ${bootargs} ${miscargs}
 addmtd=run mtdnand;run mtdspi;setenv bootargs ${bootargs} ${mtdparts}
-altbootcmd=run swupdate
 bootcmd=run nandboot;run swupdate
 bootcount=2
 bootlimit=3
board/keymile/scripts/develop-common.txt +0 -1
index 1bdff2f908f8..cfc69357e43e 100644
@@ -1,4 +1,3 @@
-altbootcmd=run ${subbootcmds}
 bootcmd=run ${subbootcmds}
 configure=run set_uimage; run set_tftppath; km_setboardid && run try_import_nfs_path && saveenv && reset
 subbootcmds=tftpfdt tftpkernel nfsargs add_default boot
board/keymile/scripts/ramfs-common.txt +0 -1
index 0a4a9c80b7e3..c86e6267bdc4 100644
@@ -1,6 +1,5 @@
 addramfs=setenv bootargs "${bootargs} phram.phram=rootfs${boot_bank},${rootfsaddr},${rootfssize}"
 boot_bank=-1
-altbootcmd=run ${subbootcmds}
 bootcmd=run ${subbootcmds}
 subbootcmds=save_and_reset_once tftpfdt tftpkernel setrootfsaddr tftpramfs flashargs add_default addpanic addramfs boot
 save_and_reset_once=setenv save_and_reset_once true && saveenv && reset
board/keymile/secu1/socfpga_secu.env +0 -1
index 147c4170ef54..609998829589 100644
@@ -1,4 +1,3 @@
-altbootcmd=run bootcmd;
 bootlimit=6
 bootnum=1
 bootretry=CONFIG_BOOT_RETRY_TIME
board/storopack/smegw01/smegw01.env +0 -15
index 93de8669109d..c0d408e4a206 100644
@@ -12,21 +12,6 @@
 			setenv bootmenu_${emmc_priority} eMMC=run boot_emmc; \
 			setenv bootmenu_${sd_priority} SD=run boot_sd;
 #endif
-
-altbootcmd=
-	echo Performing rollback...;
-	if test "${mmcpart_committed}" = 1; then
-		setenv mmcpart 2;
-		setenv mmcpart_committed 2;
-	else
-		setenv mmcpart 1;
-		setenv mmcpart_committed 1;
-	fi;
-	setenv bootcount 0;
-	setenv upgrade_available;
-	setenv ustate 3;
-	saveenv;
-	run bootcmd;
 boot_emmc=setenv mmcdev_wanted 1; run persist_mmcdev; run bootcmd;
 boot_sd=setenv mmcdev_wanted 0; run persist_mmcdev; run bootcmd;
 bootcmd=
configs/am335x_guardian_defconfig +1 -0
index 4059d07b5c8f..c550e5e121eb 100644
@@ -77,6 +77,7 @@ CONFIG_SPL_DM=y
 CONFIG_REGMAP=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_AM33XX_NVMEM=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="setenv boot_syslinux_conf \"extlinux/extlinux-rollback.conf\"; run distro_bootcmd; setenv boot_syslinux_conf \"extlinux/extlinux.conf\"; run bootcmd_ubifs0;"
 CONFIG_CLK=y
 CONFIG_CLK_CCF=y
 CONFIG_CLK_TI_AM3_DPLL=y
configs/bk4r1_defconfig +1 -0
index 3ed587a10603..2b72ec916327 100644
@@ -59,6 +59,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ARP_TIMEOUT=500
 CONFIG_NETCONSOLE=y
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="led 5 on; boot"
 CONFIG_VYBRID_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
configs/brppt2_defconfig +1 -0
index f02aef240486..d468465a9ccb 100644
@@ -76,6 +76,7 @@ CONFIG_SPL_DM_SEQ_ALIAS=y
 # CONFIG_OF_TRANSLATE is not set
 # CONFIG_SPL_BLK is not set
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="setenv b_mode 0; run b_default;"
 CONFIG_SYS_I2C_MXC=y
 CONFIG_MMC_BROKEN_CD=y
 # CONFIG_SPL_DM_MMC is not set
configs/capricorn_cxg3_defconfig +1 -0
index 4832a795e50f..10e0cbd9ad28 100644
@@ -95,6 +95,7 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SPL_CLK=y
 CONFIG_CLK_IMX8=y
 CONFIG_CPU=y
configs/display5_defconfig +1 -0
index 765920bd5d18..55f9bbaa1cf8 100644
@@ -96,6 +96,7 @@ CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run recovery"
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
 CONFIG_I2C_DEFAULT_BUS_NUMBER=0x2
configs/draco-etamin_defconfig +1 -0
index f650dbca660f..6c175dd73b9d 100644
@@ -79,6 +79,7 @@ CONFIG_SPL_DM=y
 # CONFIG_SPL_BLK is not set
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_CLK=y
 CONFIG_CLK_TI_CTRL=y
 CONFIG_DFU_NAND=y
configs/draco-rastaban_defconfig +1 -0
index 511956ec8449..521a090e376d 100644
@@ -76,6 +76,7 @@ CONFIG_SPL_DM=y
 # CONFIG_SPL_BLK is not set
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_CLK=y
 CONFIG_CLK_TI_CTRL=y
 CONFIG_DFU_NAND=y
configs/draco-thuban_defconfig +1 -0
index 1b2ce3b01045..2c16db237f86 100644
@@ -76,6 +76,7 @@ CONFIG_SPL_DM=y
 # CONFIG_SPL_BLK is not set
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_CLK=y
 CONFIG_CLK_TI_CTRL=y
 CONFIG_DFU_NAND=y
configs/ge_b1x5v2_defconfig +1 -0
index 215858c789b0..fec4b67aee22 100644
@@ -78,6 +78,7 @@ CONFIG_BOUNCE_BUFFER=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_BOOTCOUNT=y
 CONFIG_DM_BOOTCOUNT_SPI_FLASH=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="setenv mmcpart 1; run hasfirstboot || setenv mmcpart 2; run hasfirstboot || setenv mmcpart 0; if test ${mmcpart} != 0; then setenv bootcause REVERT; run swappartitions loadimage doboot; fi; run failbootcmd"
 CONFIG_DM_PCA953X=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
configs/ge_bx50v3_defconfig +1 -0
index c24513f6ab1f..676b5bc8a28e 100644
@@ -52,6 +52,7 @@ CONFIG_BOUNCE_BUFFER=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_BOOTCOUNT=y
 CONFIG_DM_BOOTCOUNT_I2C_EEPROM=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run doquiet; setenv partnum 1; run hasfirstboot || setenv partnum 2; run hasfirstboot || setenv partnum 0; if test ${partnum} != 0; then run swappartitions loadimage doboot; fi; run failbootcmd"
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_I2C_MUX=y
configs/imx6q_bosch_acc_defconfig +1 -0
index 54758df8c015..017c27479d2c 100644
@@ -86,6 +86,7 @@ CONFIG_SPL_DM=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_BOOTCOUNT=y
 CONFIG_DM_BOOTCOUNT_PMIC_PFUZE100=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run handle_ustate; run switch_bootset; run save_env; run bootcmd"
 CONFIG_SYS_I2C_MXC=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
configs/imx6qdl_icore_mmc_defconfig +1 -0
index fb0787d1beb2..269fe271a760 100644
@@ -72,6 +72,7 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run recoveryboot"
 CONFIG_SYS_BOOTCOUNT_MAGIC=0x0B01C041
 CONFIG_SYS_I2C_MXC=y
 CONFIG_FSL_USDHC=y
configs/imx8mm-mx8menlo_defconfig +1 -0
index ae9595e82b48..ad310750c77c 100644
@@ -102,6 +102,7 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_TFTP_BLOCKSIZE=4096
 CONFIG_SPL_DM=y
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="mmc partconf 0 mmcpart ; if test ${mmcpart} -eq 1 ; then mmc partconf 0 1 2 0 ; else mmc partconf 0 1 1 0 ; fi ; boot"
 CONFIG_SYS_BOOTCOUNT_MAGIC=0xB0C40000
 CONFIG_SPL_CLK_COMPOSITE_CCF=y
 CONFIG_CLK_COMPOSITE_CCF=y
configs/imx8mm_data_modul_edm_sbc_defconfig +1 -0
index 66cb1331ded0..debaa7cb5aa2 100644
@@ -37,3 +37,4 @@ CONFIG_SPL_USB_GADGET=y
 CONFIG_SPL_USB_HOST=y
 CONFIG_SPL_USB_SDP_SUPPORT=y
 CONFIG_SYS_LOAD_ADDR=0x60000000
+CONFIG_BOOTCOUNT_ALTBOOTCMD=run bootcmd
configs/imx8mp_data_modul_edm_sbc_defconfig +1 -0
index ea8109bf0496..5024c093b99d 100644
@@ -52,3 +52,4 @@ CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y
 CONFIG_USB_XHCI_HCD=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
configs/imx8mp_dhcom_drc02_defconfig +1 -0
index c43839cecf53..dccf5ffc1e6e 100644
@@ -5,3 +5,4 @@ CONFIG_ARCH_IMX8M=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8mp-dhcom-drc02"
 CONFIG_DEFAULT_FDT_FILE="imx8mp-dhcom-drc02.dtb"
 CONFIG_PREBOOT=""
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd ; reset"
configs/imx8mp_dhcom_pdk2_defconfig +1 -0
index aae2e210f44f..4f50806573ba 100644
@@ -7,3 +7,4 @@ CONFIG_DEFAULT_FDT_FILE="freescale/imx8mp-dhcom-pdk2.dtb"
 CONFIG_PREBOOT=""
 CONFIG_OF_UPSTREAM=y
 CONFIG_OF_UPSTREAM_INCLUDE_LOCAL_FALLBACK_DTBOS=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd ; reset"
configs/imx8mp_dhcom_pdk3_defconfig +1 -0
index f40bf269d978..d505ddfd09d9 100644
@@ -14,3 +14,4 @@ CONFIG_PCIE_DW_IMX=y
 CONFIG_PHY_IMX8M_PCIE=y
 CONFIG_I2C_MUX=y
 CONFIG_I2C_MUX_PCA954x=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd ; reset"
configs/imx8mp_dhcom_picoitx_defconfig +1 -0
index 99cd5f279dcb..d98ca9e434f6 100644
@@ -5,3 +5,4 @@ CONFIG_ARCH_IMX8M=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8mp-dhcom-picoitx"
 CONFIG_DEFAULT_FDT_FILE="imx8mp-dhcom-picoitx.dtb"
 CONFIG_PREBOOT=""
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd ; reset"
configs/kmcent2_defconfig +1 -0
index 4e37df2e6144..76e98c9b2a44 100644
@@ -60,6 +60,7 @@ CONFIG_ENV_ADDR_REDUND=0xebf00000
 CONFIG_USE_ETHPRIME=y
 CONFIG_ETHPRIME="fm1-mac5"
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SYS_BOOTCOUNT_BE=y
 CONFIG_FSL_CAAM=y
 CONFIG_DDR_CLK_FREQ=66666666
configs/kmcoge5ne_defconfig +1 -0
index 6b2fc2ec6e75..cf50e2d27d85 100644
@@ -166,6 +166,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_BOOTCOUNT=y
 CONFIG_BOOTCOUNT_MEM=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SYS_BOOTCOUNT_BE=y
 CONFIG_SYS_BR0_PRELIM_BOOL=y
 CONFIG_SYS_BR0_PRELIM=0xF0001001
configs/kmeter1_defconfig +1 -0
index 55e87b0215af..7638fc2f5cf6 100644
@@ -145,6 +145,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_BOOTCOUNT=y
 CONFIG_BOOTCOUNT_MEM=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SYS_BOOTCOUNT_BE=y
 CONFIG_SYS_BR0_PRELIM_BOOL=y
 CONFIG_SYS_BR0_PRELIM=0xF0001001
configs/kmopti2_defconfig +1 -0
index df419b01c68c..1c750455fc66 100644
@@ -152,6 +152,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_BOOTCOUNT=y
 CONFIG_BOOTCOUNT_MEM=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SYS_BR0_PRELIM_BOOL=y
 CONFIG_SYS_BR0_PRELIM=0xF0001001
 CONFIG_SYS_OR0_PRELIM=0xF0000E55
configs/kmsupx5_defconfig +1 -0
index 1436860f1ccb..5dd98175cd3a 100644
@@ -137,6 +137,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_BOOTCOUNT=y
 CONFIG_BOOTCOUNT_MEM=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SYS_BOOTCOUNT_BE=y
 CONFIG_SYS_BR0_PRELIM_BOOL=y
 CONFIG_SYS_BR0_PRELIM=0xF0001001
configs/kmtepr2_defconfig +1 -0
index cce7a044aee9..2b240b3380da 100644
@@ -151,6 +151,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_BOOTCOUNT=y
 CONFIG_BOOTCOUNT_MEM=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SYS_BR0_PRELIM_BOOL=y
 CONFIG_SYS_BR0_PRELIM=0xF0001001
 CONFIG_SYS_OR0_PRELIM=0xF0000E55
configs/lxr2_defconfig +1 -0
index 7ab817960a2c..b41a6ed93fd6 100644
@@ -77,6 +77,7 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_ARP_TIMEOUT=200
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run swupdate"
 CONFIG_SYS_BOOTCOUNT_MAGIC=0xB0C4000
 CONFIG_SYS_BOOTCOUNT_BE=y
 CONFIG_DM_I2C=y
configs/m53menlo_defconfig +1 -0
index 6130cd8e466a..ccd1cb7475b1 100644
@@ -79,6 +79,7 @@ CONFIG_USE_HOSTNAME=y
 CONFIG_HOSTNAME="m53menlo"
 CONFIG_VERSION_VARIABLE=y
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="if test ${mmcpart} -eq 1 ; then setenv mmcpart 2 ; else setenv mmcpart 1 ; fi ; boot"
 CONFIG_SYS_BOOTCOUNT_MAGIC=0x0B01C041
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
configs/mx53ppd_defconfig +1 -0
index d91c59ffe466..4ec8516015f9 100644
@@ -47,6 +47,7 @@ CONFIG_ARP_TIMEOUT=200
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_BOOTCOUNT=y
 CONFIG_DM_BOOTCOUNT_I2C_EEPROM=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run doquiet; setenv partnum 1; run hasfirstboot || setenv partnum 2; run hasfirstboot || setenv partnum 0; if test ${partnum} != 0; then run swappartitions loadimage doboot; fi; run failbootcmd"
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_I2C_MUX=y
configs/pg_wcom_expu1_defconfig +1 -0
index 1120191585ce..4b82b077ea7d 100644
@@ -73,6 +73,7 @@ CONFIG_HOSTNAME="EXPU1"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_SCSI_AHCI is not set
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SYS_BOOTCOUNT_BE=y
 CONFIG_DDR_CLK_FREQ=50000000
 CONFIG_SYS_FSL_DDR3=y
configs/pg_wcom_expu1_update_defconfig +1 -0
index 772aa210fc21..53d547896879 100644
@@ -71,6 +71,7 @@ CONFIG_HOSTNAME="EXPU1"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_SCSI_AHCI is not set
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SYS_BOOTCOUNT_BE=y
 CONFIG_DDR_CLK_FREQ=50000000
 CONFIG_SYS_FSL_DDR3=y
configs/pg_wcom_seli8_defconfig +1 -0
index 6cde217a34c4..731ca4350897 100644
@@ -73,6 +73,7 @@ CONFIG_HOSTNAME="SELI8"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_SCSI_AHCI is not set
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SYS_BOOTCOUNT_BE=y
 CONFIG_DDR_CLK_FREQ=50000000
 CONFIG_SYS_FSL_DDR3=y
configs/pg_wcom_seli8_update_defconfig +1 -0
index e8afc95d6076..2598e477ed5e 100644
@@ -71,6 +71,7 @@ CONFIG_HOSTNAME="SELI8"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_SCSI_AHCI is not set
 CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SYS_BOOTCOUNT_BE=y
 CONFIG_DDR_CLK_FREQ=50000000
 CONFIG_SYS_FSL_DDR3=y
configs/pxm2_defconfig +1 -0
index 162b1f1c748d..fd2727e48d75 100644
@@ -85,6 +85,7 @@ CONFIG_SPL_DM=y
 # CONFIG_SPL_BLK is not set
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_DFU_NAND=y
 CONFIG_SYS_DFU_DATA_BUF_SIZE=0x100000
 CONFIG_DM_I2C=y
configs/rut_defconfig +1 -0
index dd8df542aa38..b2930e8044d6 100644
@@ -86,6 +86,7 @@ CONFIG_SPL_DM=y
 # CONFIG_SPL_BLK is not set
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_DFU_NAND=y
 CONFIG_SYS_DFU_DATA_BUF_SIZE=0x100000
 CONFIG_DM_I2C=y
configs/smegw01_defconfig +1 -0
index 6dc95e551e34..ae6c9b60cd57 100644
@@ -60,6 +60,7 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="echo Performing rollback...; if test \"${mmcpart_committed}\" = 1; then setenv mmcpart 2; setenv mmcpart_committed 2; else setenv mmcpart 1; setenv mmcpart_committed 1; fi; setenv bootcount 0; setenv upgrade_available; setenv ustate 3; saveenv; run bootcmd;"
 CONFIG_DFU_MMC=y
 CONFIG_DM_I2C=y
 CONFIG_SUPPORT_EMMC_BOOT=y
configs/socfpga_secu1_defconfig +1 -0
index dc6d66ade239..84badec60aaf 100644
@@ -74,6 +74,7 @@ CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_BOOTCOUNT=y
 CONFIG_DM_BOOTCOUNT_RTC=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd;"
 CONFIG_DWAPB_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
configs/stm32mp13_dhcor_defconfig +1 -0
index ff948b904bee..4dc3954128db 100644
@@ -44,3 +44,4 @@ CONFIG_OPTEE=y
 CONFIG_USB_ONBOARD_HUB=y
 CONFIG_USB_HUB_DEBOUNCE_TIMEOUT=2000
 CONFIG_ERRNO_STR=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="
configs/stm32mp15_dhcom_basic_defconfig +1 -0
index a28f28620487..f89c921925d9 100644
@@ -8,3 +8,4 @@ CONFIG_SYS_MEMTEST_END=0xc4000000
 CONFIG_SYS_I2C_EEPROM_BUS=3
 CONFIG_OF_LIST="st/stm32mp157c-dhcom-pdk2 st/stm32mp153c-dhcom-drc02 st/stm32mp157c-dhcom-picoitx"
 CONFIG_SYS_I2C_EEPROM_ADDR=0x50
+CONFIG_BOOTCOUNT_ALTBOOTCMD="
configs/stm32mp15_dhcor_basic_defconfig +1 -0
index f6f2af6e7a2b..bde668761b32 100644
@@ -8,3 +8,4 @@ CONFIG_OF_LIST="st/stm32mp157a-dhcor-avenger96 st/stm32mp151a-dhcor-testbench st
 CONFIG_SYS_I2C_EEPROM_ADDR=0x53
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="
configs/tuge1_defconfig +1 -0
index d1b771993cf5..ab0fd12bc482 100644
@@ -137,6 +137,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_BOOTCOUNT=y
 CONFIG_BOOTCOUNT_MEM=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SYS_BOOTCOUNT_BE=y
 CONFIG_SYS_BR0_PRELIM_BOOL=y
 CONFIG_SYS_BR0_PRELIM=0xF0001001
configs/tuxx1_defconfig +1 -0
index 1dc737e4954d..e5a99b24dab9 100644
@@ -151,6 +151,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_BOOTCOUNT=y
 CONFIG_BOOTCOUNT_MEM=y
+CONFIG_BOOTCOUNT_ALTBOOTCMD="run bootcmd"
 CONFIG_SYS_BR0_PRELIM_BOOL=y
 CONFIG_SYS_BR0_PRELIM=0xF0001001
 CONFIG_SYS_OR0_PRELIM=0xF0000E55
include/configs/am335x_guardian.h +0 -5
index 96efd38594a0..385dec2ff4f7 100644
@@ -63,11 +63,6 @@
 		  "fi; " \
 		  "setenv extrabootargs $extrabootargs \"swi_attached\"; " \
 		"fi;" \
-		"run bootcmd_ubifs0;\0" \
-	"altbootcmd=" \
-		"setenv boot_syslinux_conf \"extlinux/extlinux-rollback.conf\"; " \
-		"run distro_bootcmd; " \
-		"setenv boot_syslinux_conf \"extlinux/extlinux.conf\"; " \
 		"run bootcmd_ubifs0;\0"
 
 #endif /* ! CONFIG_XPL_BUILD */
include/configs/bk4r1.h +0 -2
index 5df8d03c7065..6d24c5decd5b 100644
@@ -16,8 +16,6 @@
 #define BK4_EXTRA_ENV_SETTINGS \
 	"bootlimit=3\0" \
 	"eraseuserdata=false\0" \
-	"altbootcmd=led 5 on; " \
-		"boot\0" \
 	"set_gpio103=mw 0x400ff0c4 0x0080; mw 0x4004819C 0x000011bf\0" \
 	"set_gpio102=mw 0x400ff0c4 0x40; mw 0x40048198 0x000011bf\0" \
 	"set_gpio96=mw 0x40048180 0x282; mw 0x400ff0c4 0x1\0"\
include/configs/brppt2.h +0 -1
index d01f0d373163..93559a171ae9 100644
@@ -64,7 +64,6 @@ BUR_COMMON_ENV \
 " do echo \"### booting ${target} ###\"; run b_${target};" \
 " if test ${b_break} = 1; then; exit; fi; done\0" \
 "loaddev=mmc 0\0" \
-"altbootcmd=setenv b_mode 0; run b_default;\0" \
 "bootlimit=1\0" \
 "net2nor=sf probe && dhcp &&" \
 " tftp ${loadaddr} SPL && sf erase 0 +${filesize} &&" \
include/configs/display5.h +0 -1
index 51fa2b03a2e6..98b1e5af2c08 100644
@@ -170,7 +170,6 @@
 	"display=tianma-tm070-800x480\0" \
 	"board=display5\0" \
 	"mmcdev=0\0" \
-	"altbootcmd=run recovery\0" \
 	"bootdelay=1\0" \
 	"baudrate=115200\0" \
 	"ethact=FEC\0" \
include/configs/ge_b1x5v2.h +0 -8
index f3d85c9c11e8..5e3f67124c05 100644
@@ -82,14 +82,6 @@
 	"doboot=" \
 		"echo Booting from mmc:${mmcdev}:${mmcpart} ...; " \
 		"run helix;\0" \
-	"altbootcmd=" \
-		"setenv mmcpart 1; run hasfirstboot || setenv mmcpart 2; " \
-		"run hasfirstboot || setenv mmcpart 0; " \
-		"if test ${mmcpart} != 0; then " \
-			"setenv bootcause REVERT; " \
-			"run swappartitions loadimage doboot; " \
-		"fi; " \
-		"run failbootcmd\0" \
 	"tryboot=" \
 		"setenv mmcpart 1; run hasfirstboot || setenv mmcpart 2; " \
 		"run loadimage || run swappartitions && run loadimage || " \
include/configs/ge_bx50v3.h +0 -8
index 07b36706e56d..c8ef048bd43c 100644
@@ -67,14 +67,6 @@
 		"Try again, or contact GE Service for support.\"; " \
 		"bootcount reset; " \
 		"while true; do sleep 1; done; \0" \
-	"altbootcmd=" \
-		"run doquiet; " \
-		"setenv partnum 1; run hasfirstboot || setenv partnum 2; " \
-		"run hasfirstboot || setenv partnum 0; " \
-		"if test ${partnum} != 0; then " \
-			"run swappartitions loadimage doboot; " \
-		"fi; " \
-		"run failbootcmd\0" \
 	"loadimage=" \
 		"ext2load ${dev} ${devnum}:${partnum} ${loadaddr} ${image}\0" \
 	"doboot=" \
include/configs/imx6-engicam.h +0 -1
index 786b70fe064d..3d5701c636c8 100644
@@ -47,7 +47,6 @@
 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
 	"loadfit=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${fit_image}\0" \
-	"altbootcmd=run recoveryboot\0"\
 	"fitboot=echo Booting FIT image from mmc ...; " \
 		"run mmcargs; " \
 		"bootm ${loadaddr}\0" \
include/configs/imx6q-bosch-acc.h +1 -2
index 64ddbf711d31..84da8250684a 100644
@@ -42,8 +42,7 @@
 	"env_persisted=0\0" \
 	"env_persist=if test ${env_persisted} != 1; " \
 		"then env set env_persisted 1; run save_env; fi;\0" \
-	"save_env=env save; env save\0" \
-	"altbootcmd=run handle_ustate; run switch_bootset; run save_env; run bootcmd\0"
+	"save_env=env save; env save\0"
 
 #define CFG_ENV_FLAGS_LIST_STATIC \
 	"bootset:bw," \
include/configs/imx8mm-mx8menlo.h +0 -8
index 7058d632d674..626ccae72057 100644
@@ -18,14 +18,6 @@
 	"devtype=mmc\0"							\
 	"devnum=1\0"							\
 	"distro_bootpart=1\0"						\
-	"altbootcmd="							\
-		"mmc partconf 0 mmcpart ; "				\
-		"if test ${mmcpart} -eq 1 ; then "			\
-			"mmc partconf 0 1 2 0 ; "			\
-		"else "							\
-			"mmc partconf 0 1 1 0 ; "			\
-		"fi ; "							\
-		"boot\0"						\
 	"boot_file=fitImage\0"						\
 	"console=ttymxc0\0"						\
 	"fdt_addr=0x43000000\0"						\
include/configs/imx8mm_data_modul_edm_sbc.h +0 -1
index 57ecb5e21907..5ce4219912f3 100644
@@ -34,7 +34,6 @@
 #define CFG_SYS_FSL_ESDHC_ADDR	0
 
 #define CFG_EXTRA_ENV_SETTINGS						\
-	"altbootcmd=run bootcmd\0"					\
 	"bootlimit=3\0"							\
 	"devtype=mmc\0"							\
 	"devpart=1\0"							\
include/configs/imx8mp_data_modul_edm_sbc.h +0 -1
index de5bdd30e18d..58a03b35ac4f 100644
@@ -24,7 +24,6 @@
 #define FEC_QUIRK_ENET_MAC
 
 #define CFG_EXTRA_ENV_SETTINGS						\
-	"altbootcmd=run bootcmd\0"					\
 	"bootlimit=3\0"							\
 	"devtype=mmc\0"							\
 	"devpart=1\0"							\
include/configs/imx8mp_dhcom_pdk2.h +0 -1
index c848fce8bdac..f3e239d780f7 100644
@@ -28,7 +28,6 @@
 #define CFG_SYS_FSL_ESDHC_ADDR	0
 
 #define CFG_EXTRA_ENV_SETTINGS						\
-	"altbootcmd=run bootcmd ; reset\0"				\
 	"bootlimit=3\0"							\
 	"dfu_alt_info="							\
 		/* RAM block at DRAM offset 256..768 MiB */		\
include/configs/m53menlo.h +0 -7
index 1ea4fa59fd53..a6aafb518542 100644
@@ -93,13 +93,6 @@
 	"splashfile=boot/usplash.bmp.gz\0"				\
 	"splashimage=0x88000000\0"					\
 	"splashpos=m,m\0"						\
-	"altbootcmd="							\
-		"if test ${mmcpart} -eq 1 ; then "			\
-			"setenv mmcpart 2 ; "				\
-		"else "							\
-			"setenv mmcpart 1 ; "				\
-		"fi ; "							\
-		"boot\0"						\
 	"stdout=serial,vidconsole\0"					\
 	"stderr=serial,vidconsole\0"					\
 	"addcons="							\
include/configs/mx53ppd.h +0 -8
index 6d1f669de501..3707de254e14 100644
@@ -59,14 +59,6 @@
 		"Try again, or contact GE Service for support.\"; " \
 		"bootcount reset; " \
 		"while true; do sleep 1; done; \0" \
-	"altbootcmd=" \
-		"run doquiet; " \
-		"setenv partnum 1; run hasfirstboot || setenv partnum 2; " \
-		"run hasfirstboot || setenv partnum 0; " \
-		"if test ${partnum} != 0; then " \
-			"run swappartitions loadimage doboot; " \
-		"fi; " \
-		"run failbootcmd\0" \
 	"loadimage=" \
 		"ext2load ${dev} ${devnum}:${partnum} ${loadaddr} ${image}\0" \
 	"doboot=" \
include/configs/siemens-am33x-common.h +0 -1
index 74b7fe85800f..a918dc1350c4 100644
@@ -128,7 +128,6 @@
 	"verify=no \0" \
 	"project_dir=targetdir\0" \
 	"upgrade_available=0\0" \
-	"altbootcmd=run bootcmd\0" \
 	"partitionset_active=A\0" \
 	"loadaddr=0x82000000\0" \
 	"kloadaddr=0x81000000\0" \
include/configs/siemens-env-common.h +0 -1
index 36fa5d936f70..c028823e1ebd 100644
@@ -183,7 +183,6 @@
 	"rootfs_name=/dev/mmcblk0\0" \
 	"upgrade_available=0\0" \
 	"bootlimit=3\0" \
-	"altbootcmd=run bootcmd\0" \
 	"optargs=\0" \
 
 /**********************************************************************/
include/configs/snapper9g45.h +1 -2
index df8ed451a43a..8ea708d0e92b 100644
@@ -58,8 +58,7 @@
 	"boot_tftp=setenv bootargs $bootargs_def ip=any nfsroot=$nfsroot; setenv autoload y && bootp && bootm\0" \
 	"boot_usb=setenv bootargs $bootargs_def; usb start && usb storage && fatload usb 0:1 $loadaddr dds-xm200.bin && bootm\0" \
 	"boot_mmc=setenv bootargs $bootargs_def; mmc rescan && fatload mmc 0:1 $loadaddr dds-xm200.bin && bootm\0" \
-	"bootcmd=run boot_mmc ; run boot_usb ; run boot_working ; run boot_safe\0" \
-	"altbootcmd=run boot_mmc ; run boot_usb ; run boot_safe ; run boot_working\0"
+	"bootcmd=run boot_mmc ; run boot_usb ; run boot_working ; run boot_safe\0"
 
 /* Console settings */
 
include/env/pg-wcom/common.env +0 -1
index 4b660cebd675..5f2ba1c4090b 100644
@@ -22,7 +22,6 @@ add_default=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${
 		WCOM_UBI_LINUX_MTD
 
 addpanic=setenv bootargs ${bootargs} panic=1 panic_on_oops=1
-altbootcmd=run bootcmd
 backup_bank=0
 boot=bootm ${load_addr_r} - ${fdt_addr_r}
 
Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH] feat: Add CONFIG_BOOTCOUNT_ALTBOOTCMD to Kconfig

In reply to Tomas Peterka
Quoted 3 lines · Tomas Peterka

Add CONFIG_BOOTCOUNT_ALTBOOTCMD so the developer is able to add custom altbootcmd via Kconfig when they enable BOOTCOUNT.

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
reviewer
#5 lore raw

Re: [PATCH] feat: Add CONFIG_BOOTCOUNT_ALTBOOTCMD to Kconfig

Quoted 1 line · Tom Rini

Applied to u-boot/next, thanks!

The author's Signed-off-by tag is missing.

#6 lore raw

Re: [PATCH] feat: Add CONFIG_BOOTCOUNT_ALTBOOTCMD to Kconfig

Quoted 6 lines · Fabio Estevam
Quoted 1 line · Tom Rini

Applied to u-boot/next, thanks!

The author's Signed-off-by tag is missing.

Maybe we need to add a CI check for sign-off's

#7 lore raw

Re: [PATCH] feat: Add CONFIG_BOOTCOUNT_ALTBOOTCMD to Kconfig

Quoted 10 lines · Peter Robinson
Quoted 6 lines · Fabio Estevam
Quoted 1 line · Tom Rini

Applied to u-boot/next, thanks!

The author's Signed-off-by tag is missing.

Maybe we need to add a CI check for sign-off's

We actually have two checks for it, and I believe both of them caught it (it's not in gitlab, it's part of my build tests). The issue really is that for a small contribution like this, a Signed-off-by didn't seem worth asking for a v3 over. It's small, the relevant discussion threads show this was developed for upstream and adding a Kconfig symbol isn't the level of contribution some malicious third party could start a lawsuit over on the authors behalf.

That said an after the fact Signed-off-by would still be appreciated.

Signature · 1 line
Tom
#8 lore raw
In reply to Tom Rini

Hello Tom,

sorry for the formatting of the first email. As you might have figured out, the it was not send using git send-email. I tried to do better later and I had to use different SMTP server and account ([email protected]) because our company email provider is too much ahead in the future.

Hope it didn't bring too much confusion and the new patch made it to your mailing list.

Regards,
Tomas

Quoted 44 lines · Tom Rini
Quoted 3 lines · Tomáš Peterka

Hello u-boot maintainers,

I would like to merge a simple patch for user-friendliness when configuring u-boot with Yocto. The problem is missing option for altbootcmd when using the feature CONFIG_BOOTCOUNT_LIMIT. Simply adding the option CONFIG_BOOTCOUNT_ALTBOOTCMD into Kconfig shouldn't be a problem when there is already CONFIG_BOOTCOMMAND? Users then can use CONFIG_BOOTCOUNT_ALTBOOTCMD instead of misusing CFG_EXTRA_ENV_SETTINGS (and friends) that are usually used by configs of specific boards.

Thanks for posting this. In general, yes, this the right approach.

Quoted 9 lines

Many thanks for considering this,
Tomas

From 9f5d1863e99c3a33893381cc924f25797b4b6f8a Wed Jan 29 19:06:55 2025 -0600
From: Tomas Peterka <[email protected]>
Date: Tue, 30 Jan 2025 09:00:00 +0100
Subject: [PATCH] Add altbootcmd to Kconfig
Upstream-Status: Pending

Here is where you need to explain the purpose of the commit. Ideally this is what you should git send-email as well, as that might help with the next problem.

Quoted 9 lines

---

drivers/bootcount/Kconfig +0 -0
index 0080d2a165..982ddc9826 100644
@@ -183,6 +183,12 @@ config BOOTCOUNT_BOOTLIMIT

counter being cleared.
If set to 0, do not set a boot limit in the environment.

drivers/bootcount/Kconfig

Quoted 6 lines
drivers/bootcount/Kconfig +6 -0
+config BOOTCOUNT_ALTBOOTCMD
+ string "Alternative boot command when BOOTLIMIT is reached"
+ default "env set bootfile altboot.scr; bootflow scan -lb"
+ help
+ Set the alternative boot command once BOOTLIMIT is reached
+

I suspect due to how this was sent, there's whitespace problems.

Also, we shouldn't specify a default here, as that ends up being per-platform. Migrating that in turn might be a bit tricky since you need to take it from a few different places depending on the board. It probably involves doing some loops of building u-boot-initial-env for all the platforms that enable BOOTCOUNT. If this sounds a bit too much, I can v2 things with that if you like.

#9 lore raw
Quoted 10 lines · Tomáš Peterka

Hello Tom,

sorry for the formatting of the first email. As you might have figured out, the it was not send using git send-email. I tried to do better later and I had to use different SMTP server and account ([email protected]) because our company email provider is too much ahead in the future.

Hope it didn't bring too much confusion and the new patch made it to your mailing list.

Thanks for posting v2, it looks good. I'll follow up to that with a patch that does the migration of the existing altbootcmd definitions to the config files.

Signature · 1 line
Tom