[PATCH v1 00/13] This patch-series includes updates for Toradex modules:

1. Environment clean-up (dropping legacy emmcboot, sdboot wrappers) 2. Boot count support for multiple modules 3. Distro Boot fixes
Igor Opaniuk (6): apalis-tk1: enable distroboot apalis-tk1: fix setting fdtfile value toradex: imx: enable BOOTCOUNT feature apalis_imx6: boot env configuration updates colibri_imx7: boot env configuration updates colibri_imx6: boot env configuration updates
Marcel Ziswiler (1): apalis-imx8: enable of_system_setup
Max Krummenacher (3): apalis/colibri-imx8: re-enable CONFIG_IMX_SCU_THERMAL colibri_vf_defconfig: enable part cmd configs/colibri_vf.h: drop sdboot in favour of distro_bootcmd
Oleksandr Suvorov (1): colibri-imx8x: declare consoleargs
Stefan Agner (2): colibri_imx7: add addresses required for distro boot colibri-imx6ull/imx7: define bootubipart for distro boot
configs/apalis-imx8qm_defconfig | 2 ++ configs/apalis-tk1_defconfig | 2 +- configs/apalis_imx6_defconfig | 3 +++ configs/colibri-imx6ull_defconfig | 3 +++ configs/colibri-imx8qxp_defconfig | 1 + configs/colibri_imx6_defconfig | 3 +++ configs/colibri_imx7_defconfig | 3 +++ configs/colibri_imx7_emmc_defconfig | 3 +++ configs/colibri_vf_defconfig | 3 +-- include/configs/apalis-tk1.h | 51 ++++++++++--------------------------- include/configs/apalis_imx6.h | 29 +-------------------- include/configs/colibri-imx6ull.h | 1 + include/configs/colibri-imx8x.h | 8 +++--- include/configs/colibri_imx6.h | 29 +-------------------- include/configs/colibri_imx7.h | 28 +++----------------- include/configs/colibri_vf.h | 18 +------------ 16 files changed, 46 insertions(+), 141 deletions(-)

From: Marcel Ziswiler marcel.ziswiler@toradex.com
Enable CONFIG_OF_SYSTEM_DEFAULT for Apalis iMX8.
Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com ---
configs/apalis-imx8qm_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/apalis-imx8qm_defconfig b/configs/apalis-imx8qm_defconfig index 4c27c33..fdc1e4e 100644 --- a/configs/apalis-imx8qm_defconfig +++ b/configs/apalis-imx8qm_defconfig @@ -9,6 +9,7 @@ CONFIG_TARGET_APALIS_IMX8=y CONFIG_NR_DRAM_BANKS=3 CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y +CONFIG_OF_SYSTEM_SETUP=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/toradex/apalis-imx8/apalis-imx8qm-imximage.cfg" CONFIG_LOG=y CONFIG_VERSION_VARIABLE=y

From: Marcel Ziswiler marcel.ziswiler@toradex.com Enable CONFIG_OF_SYSTEM_DEFAULT for Apalis iMX8. Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Max Krummenacher max.krummenacher@toradex.com
This got dropped by a global 'make savedefconfig' resync as required patches are still in flight.
Signed-off-by: Max Krummenacher max.krummenacher@toradex.com ---
configs/apalis-imx8qm_defconfig | 1 + configs/colibri-imx8qxp_defconfig | 1 + 2 files changed, 2 insertions(+)
diff --git a/configs/apalis-imx8qm_defconfig b/configs/apalis-imx8qm_defconfig index fdc1e4e..289d644 100644 --- a/configs/apalis-imx8qm_defconfig +++ b/configs/apalis-imx8qm_defconfig @@ -62,4 +62,5 @@ CONFIG_DM_REGULATOR_GPIO=y CONFIG_DM_SERIAL=y CONFIG_FSL_LPUART=y CONFIG_DM_THERMAL=y +CONFIG_IMX_SCU_THERMAL=y # CONFIG_EFI_LOADER is not set diff --git a/configs/colibri-imx8qxp_defconfig b/configs/colibri-imx8qxp_defconfig index d86cefa..57b48e3 100644 --- a/configs/colibri-imx8qxp_defconfig +++ b/configs/colibri-imx8qxp_defconfig @@ -59,4 +59,5 @@ CONFIG_DM_REGULATOR_GPIO=y CONFIG_DM_SERIAL=y CONFIG_FSL_LPUART=y CONFIG_DM_THERMAL=y +CONFIG_IMX_SCU_THERMAL=y # CONFIG_EFI_LOADER is not set

From: Max Krummenacher max.krummenacher@toradex.com This got dropped by a global 'make savedefconfig' resync as required patches are still in flight. Signed-off-by: Max Krummenacher max.krummenacher@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Oleksandr Suvorov oleksandr.suvorov@toradex.com
Store all console-related kernel parameters in dedicated variable.
Signed-off-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com ---
include/configs/colibri-imx8x.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/configs/colibri-imx8x.h b/include/configs/colibri-imx8x.h index da9226e..7d00707 100644 --- a/include/configs/colibri-imx8x.h +++ b/include/configs/colibri-imx8x.h @@ -62,7 +62,7 @@ #define BOOTENV_RUN_NET_USB_START ""
#define CONFIG_MFG_ENV_SETTINGS \ - "mfgtool_args=setenv bootargs console=${console},${baudrate} " \ + "mfgtool_args=setenv bootargs ${consoleargs} " \ "rdinit=/linuxrc g_mass_storage.stall=0 " \ "g_mass_storage.removable=1 g_mass_storage.idVendor=0x066F " \ "g_mass_storage.idProduct=0x37FF " \ @@ -81,7 +81,7 @@ M4_BOOT_ENV \ MEM_LAYOUT_ENV_SETTINGS \ "boot_file=Image\0" \ - "console=ttyLP3 earlycon\0" \ + "consoleargs=console=ttyLP3,${baudrate} earlycon\0" \ "fdt_addr=0x83000000\0" \ "fdt_file=fsl-imx8qxp-colibri-dsihdmi-eval-v3.dtb\0" \ "fdtfile=fsl-imx8qxp-colibri-dsihdmi-eval-v3.dtb\0" \ @@ -89,11 +89,11 @@ "image=Image\0" \ "initrd_addr=0x83800000\0" \ "initrd_high=0xffffffffffffffff\0" \ - "mmcargs=setenv bootargs console=${console},${baudrate} " \ + "mmcargs=setenv bootargs ${consoleargs} " \ "root=PARTUUID=${uuid} rootwait " \ "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \ "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \ - "netargs=setenv bootargs console=${console},${baudrate} " \ + "netargs=setenv bootargs ${consoleargs} " \ "root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp " \ "${vidargs}\0" \ "nfsboot=run netargs; dhcp ${loadaddr} ${image}; tftp ${fdt_addr} " \

From: Oleksandr Suvorov oleksandr.suvorov@toradex.com Store all console-related kernel parameters in dedicated variable. Signed-off-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Stefan Agner stefan.agner@toradex.com
Define addresses required for full distro boot support.
Signed-off-by: Stefan Agner stefan.agner@toradex.com ---
include/configs/colibri_imx7.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h index 09722f4..b550bc6 100644 --- a/include/configs/colibri_imx7.h +++ b/include/configs/colibri_imx7.h @@ -109,8 +109,9 @@ "bootm_size=0x10000000\0" \ "fdt_addr_r=0x82000000\0" \ "kernel_addr_r=0x81000000\0" \ + "pxefile_addr_r=0x87100000\0" \ "ramdisk_addr_r=0x82100000\0" \ - "scriptaddr=0x82500000\0" + "scriptaddr=0x87000000\0"
#define NFS_BOOTCMD \ "nfsargs=ip=:::::eth0: root=/dev/nfs\0" \

From: Stefan Agner stefan.agner@toradex.com Define addresses required for full distro boot support. Signed-off-by: Stefan Agner stefan.agner@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Stefan Agner stefan.agner@toradex.com
When using distro boot to boot from UBI volumes the boot partition has been hardcoded to "UBI" (capital letters). However, our default MTD layout uses "ubi" (lower case letter). Define "ubi" as the default UBI partition for distro boot for Toradex. This allows to use distro boot without having to redefine the MTD partition layout which is useful for TorizonCore.
Signed-off-by: Stefan Agner stefan.agner@toradex.com ---
include/configs/colibri-imx6ull.h | 1 + include/configs/colibri_imx7.h | 1 + 2 files changed, 2 insertions(+)
diff --git a/include/configs/colibri-imx6ull.h b/include/configs/colibri-imx6ull.h index 2d3b4c1..c80fb96 100644 --- a/include/configs/colibri-imx6ull.h +++ b/include/configs/colibri-imx6ull.h @@ -88,6 +88,7 @@ NFS_BOOTCMD \ UBI_BOOTCMD \ UBOOT_UPDATE \ + "bootubipart=ubi\0" \ "console=ttymxc0\0" \ "defargs=user_debug=30\0" \ "dfu_alt_info=" DFU_ALT_NAND_INFO "\0" \ diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h index b550bc6..b3f660b 100644 --- a/include/configs/colibri_imx7.h +++ b/include/configs/colibri_imx7.h @@ -169,6 +169,7 @@ MODULE_EXTRA_ENV_SETTINGS \ UBOOT_UPDATE \ "boot_file=zImage\0" \ + "bootubipart=ubi\0" \ "console=ttymxc0\0" \ "defargs=\0" \ "fdt_board=eval-v3\0" \

From: Stefan Agner stefan.agner@toradex.com When using distro boot to boot from UBI volumes the boot partition has been hardcoded to "UBI" (capital letters). However, our default MTD layout uses "ubi" (lower case letter). Define "ubi" as the default UBI partition for distro boot for Toradex. This allows to use distro boot without having to redefine the MTD partition layout which is useful for TorizonCore. Signed-off-by: Stefan Agner stefan.agner@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Max Krummenacher max.krummenacher@toradex.com
This allows to boot from SD/USB with passing the rootfs partition via UUID.
Signed-off-by: Max Krummenacher max.krummenacher@toradex.com ---
configs/colibri_vf_defconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig index c494fb4..ed0acbe 100644 --- a/configs/colibri_vf_defconfig +++ b/configs/colibri_vf_defconfig @@ -18,8 +18,6 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_ARCH_MISC_INIT=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_HUSH_PARSER=y -# CONFIG_CMDLINE_EDITING is not set -# CONFIG_AUTO_COMPLETE is not set # CONFIG_SYS_LONGHELP is not set CONFIG_SYS_PROMPT="Colibri VFxx # " # CONFIG_CMD_BOOTD is not set @@ -39,6 +37,7 @@ CONFIG_CMD_GPIO=y # CONFIG_CMD_LOADB is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_MMC=y +CONFIG_CMD_PART=y CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_SETEXPR is not set

From: Max Krummenacher max.krummenacher@toradex.com This allows to boot from SD/USB with passing the rootfs partition via UUID. Signed-off-by: Max Krummenacher max.krummenacher@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Max Krummenacher max.krummenacher@toradex.com
The distro bootscript uses kernel_image to get the file name of the kernel, so change that variable name. UBI boot has precedence in the default boot command. If one wants to boot from SD with a working NAND installation stop in U-Boot and enter:
setenv fdtfile ${soc}-colibri-${fdt_board}.dtb && run distro_bootcmd
Signed-off-by: Max Krummenacher max.krummenacher@toradex.com ---
include/configs/colibri_vf.h | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/include/configs/colibri_vf.h b/include/configs/colibri_vf.h index 7d17bd8..012350d 100644 --- a/include/configs/colibri_vf.h +++ b/include/configs/colibri_vf.h @@ -69,21 +69,6 @@ "tftp ${fdt_addr_r} ${soc}-colibri-${fdt_board}.dtb && " \ "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
-#define SD_BOOTCMD \ - "set_sdargs=setenv sdargs root=PARTUUID=${uuid} ro rootwait\0" \ - "sdboot=run setup; run sdfinduuid; run set_sdargs; " \ - "setenv bootargs ${defargs} ${sdargs} ${mtdparts} " \ - "${setupargs} ${vidargs}; echo Booting from MMC/SD card...; " \ - "load mmc ${sddev}:${sdbootpart} ${kernel_addr_r} ${kernel_file} && " \ - "load mmc ${sddev}:${sdbootpart} ${fdt_addr_r} " \ - "${soc}-colibri-${fdt_board}.dtb && " \ - "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \ - "sdbootpart=1\0" \ - "sddev=0\0" \ - "sdfinduuid=part uuid mmc ${sddev}:${sdrootpart} uuid\0" \ - "sdrootpart=2\0" - - #define UBI_BOOTCMD \ "ubiargs=ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs " \ "ubi.fm_autoconvert=1\0" \ @@ -112,7 +97,6 @@ BOOTENV \ MEM_LAYOUT_ENV_SETTINGS \ NFS_BOOTCMD \ - SD_BOOTCMD \ UBI_BOOTCMD \ UBOOT_UPDATE \ "console=ttyLP0\0" \ @@ -120,7 +104,7 @@ "dfu_alt_info=" DFU_ALT_NAND_INFO "\0" \ "fdt_board=eval-v3\0" \ "fdt_fixup=;\0" \ - "kernel_file=zImage\0" \ + "kernel_image=zImage\0" \ "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ "setsdupdate=mmc rescan && set interface mmc && " \ "fatload ${interface} 0:1 ${loadaddr} flash_blk.img && " \

From: Max Krummenacher max.krummenacher@toradex.com The distro bootscript uses kernel_image to get the file name of the kernel, so change that variable name. UBI boot has precedence in the default boot command. If one wants to boot from SD with a working NAND installation stop in U-Boot and enter: setenv fdtfile ${soc}-colibri-${fdt_board}.dtb && run distro_bootcmd Signed-off-by: Max Krummenacher max.krummenacher@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Igor Opaniuk igor.opaniuk@toradex.com
1. Use distro_bootcmd as default boot command instead of legacy emmcboot wrapper. 2. Drop emmcboot and sdboot wrappers. 3. Provide proper boot order for Distro Boot.
Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
configs/apalis-tk1_defconfig | 2 +- include/configs/apalis-tk1.h | 51 ++++++++++++-------------------------------- 2 files changed, 15 insertions(+), 38 deletions(-)
diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig index 868303a..db66d68 100644 --- a/configs/apalis-tk1_defconfig +++ b/configs/apalis-tk1_defconfig @@ -11,7 +11,7 @@ CONFIG_SPL_TEXT_BASE=0x80108000 CONFIG_FIT=y CONFIG_OF_SYSTEM_SETUP=y CONFIG_BOOTDELAY=1 -CONFIG_BOOTCOMMAND="run emmcboot; setenv fdtfile ${soc}-${fdt-module}-${fdt_board}.dtb && run distro_bootcmd" +CONFIG_BOOTCOMMAND="setenv fdtfile ${soc}-${fdt-module}-${fdt_board}.dtb && run distro_bootcmd" CONFIG_CONSOLE_MUX=y CONFIG_SYS_STDIO_DEREGISTER=y CONFIG_VERSION_VARIABLE=y diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h index 965259c..6f73606 100644 --- a/include/configs/apalis-tk1.h +++ b/include/configs/apalis-tk1.h @@ -34,6 +34,20 @@ /* General networking support */ #define CONFIG_TFTP_TSIZE
+/* + * Custom Distro Boot configuration: + * 1. 8bit SD port (MMC1) + * 2. 4bit SD port (MMC2) + * 3. eMMC (MMC0) + */ +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 1) \ + func(MMC, mmc, 2) \ + func(MMC, mmc, 0) \ + func(USB, usb, 0) \ + func(PXE, pxe, na) \ + func(DHCP, dhcp, na) + #undef CONFIG_IPADDR #define CONFIG_IPADDR 192.168.10.2 #define CONFIG_NETMASK 255.255.255.0 @@ -54,24 +68,6 @@ "update_uboot=run set_blkcnt && mmc dev 0 ${uboot_hwpart} && " \ "mmc write ${loadaddr} ${uboot_blk} ${blkcnt}\0" \
-#define EMMC_BOOTCMD \ - "set_emmcargs=setenv emmcargs ip=off root=PARTUUID=${uuid} " \ - "ro rootfstype=ext4 rootwait\0" \ - "emmcboot=run setup; run emmcfinduuid; run set_emmcargs; " \ - "setenv bootargs ${defargs} ${emmcargs} " \ - "${setupargs} ${vidargs}; echo Booting from internal eMMC; " \ - "run emmcdtbload; " \ - "load mmc ${emmcdev}:${emmcbootpart} ${kernel_addr_r} " \ - "${boot_file} && run fdt_fixup && " \ - "bootz ${kernel_addr_r} - ${dtbparam}\0" \ - "emmcbootpart=1\0" \ - "emmcdev=0\0" \ - "emmcdtbload=setenv dtbparam; load mmc ${emmcdev}:${emmcbootpart} " \ - "${fdt_addr_r} ${soc}-${fdt_module}-${fdt_board}.dtb && " \ - "setenv dtbparam ${fdt_addr_r}\0" \ - "emmcfinduuid=part uuid mmc ${mmcdev}:${emmcrootpart} uuid\0" \ - "emmcrootpart=2\0" - #define NFS_BOOTCMD \ "nfsargs=ip=:::::eth0:on root=/dev/nfs rw\0" \ "nfsboot=pci enum; run setup; setenv bootargs ${defargs} ${nfsargs} " \ @@ -82,23 +78,6 @@ "${soc}-${fdt_module}-${fdt_board}.dtb " \ "&& setenv dtbparam ${fdt_addr_r}\0"
-#define SD_BOOTCMD \ - "set_sdargs=setenv sdargs ip=off root=PARTUUID=${uuid} ro " \ - "rootfstype=ext4 rootwait\0" \ - "sdboot=run setup; run sdfinduuid; run set_sdargs; " \ - "setenv bootargs ${defargs} ${sdargs} ${setupargs} " \ - "${vidargs}; echo Booting from SD card in 8bit slot...; " \ - "run sddtbload; load mmc ${sddev}:${sdbootpart} " \ - "${kernel_addr_r} ${boot_file} && run fdt_fixup && " \ - "bootz ${kernel_addr_r} - ${dtbparam}\0" \ - "sdbootpart=1\0" \ - "sddev=1\0" \ - "sddtbload=setenv dtbparam; load mmc ${sddev}:${sdbootpart} " \ - "${fdt_addr_r} ${soc}-${fdt_module}-${fdt_board}.dtb " \ - "&& setenv dtbparam ${fdt_addr_r}\0" \ - "sdfinduuid=part uuid mmc ${sddev}:${sdrootpart} uuid\0" \ - "sdrootpart=2\0" - #define BOARD_EXTRA_ENV_SETTINGS \ "boot_file=zImage\0" \ "console=ttyS0\0" \ @@ -106,12 +85,10 @@ "usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0 " \ "user_debug=30 pcie_aspm=off\0" \ "dfu_alt_info=" DFU_ALT_EMMC_INFO "\0" \ - EMMC_BOOTCMD \ "fdt_board=eval\0" \ "fdt_fixup=;\0" \ "fdt_module=" FDT_MODULE "\0" \ NFS_BOOTCMD \ - SD_BOOTCMD \ UBOOT_UPDATE \ "setethupdate=if env exists ethaddr; then; else setenv ethaddr " \ "00:14:2d:00:00:00; fi; pci enum && tftpboot ${loadaddr} " \

From: Igor Opaniuk igor.opaniuk@toradex.com
- Use distro_bootcmd as default boot command instead of
legacy emmcboot wrapper. 2. Drop emmcboot and sdboot wrappers. 3. Provide proper boot order for Distro Boot. Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Igor Opaniuk igor.opaniuk@toradex.com
s/fdt-module/fdt_module/g, as we don't use dash in fdt_file anymore.
Fixes: 4c63a601("apalis-tk1: support v1.2 hardware revision") Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
configs/apalis-tk1_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig index db66d68..42e320e 100644 --- a/configs/apalis-tk1_defconfig +++ b/configs/apalis-tk1_defconfig @@ -11,7 +11,7 @@ CONFIG_SPL_TEXT_BASE=0x80108000 CONFIG_FIT=y CONFIG_OF_SYSTEM_SETUP=y CONFIG_BOOTDELAY=1 -CONFIG_BOOTCOMMAND="setenv fdtfile ${soc}-${fdt-module}-${fdt_board}.dtb && run distro_bootcmd" +CONFIG_BOOTCOMMAND="setenv fdtfile ${soc}-${fdt_module}-${fdt_board}.dtb && run distro_bootcmd" CONFIG_CONSOLE_MUX=y CONFIG_SYS_STDIO_DEREGISTER=y CONFIG_VERSION_VARIABLE=y

From: Igor Opaniuk igor.opaniuk@toradex.com s/fdt-module/fdt_module/g, as we don't use dash in fdt_file anymore. Fixes: 4c63a601("apalis-tk1: support v1.2 hardware revision") Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Igor Opaniuk igor.opaniuk@toradex.com
This introduces automatic boot counter that increases after every reset.After a power-on reset, it will be initialized with 1, and each reboot will increment the value by 1. By default it's disabled if bootlimit isn't set.
To enable this feature you have set bootcount limit ("bootlimit"), alternate boot action ("altbootcmd") that will be performed if the new value of bootcount exceeds the value of bootlimit, and "upgrade_available" to let U-Boot automatically increase and save the counter value after every reset:
setenv bootlimit 5 setenv upgrade_available 1 setenv altbootcmd "bootm ..."
In case the bootlimit exceeds, the message will be shown and albootcmd executed: Warning: Bootlimit (5) exceeded. Using altbootcmd.
To reset bootcount run:
bootcount reset
Print current value:
bootcount print
Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
configs/apalis_imx6_defconfig | 3 +++ configs/colibri-imx6ull_defconfig | 3 +++ configs/colibri_imx6_defconfig | 3 +++ configs/colibri_imx7_defconfig | 3 +++ configs/colibri_imx7_emmc_defconfig | 3 +++ 5 files changed, 15 insertions(+)
diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig index 6b0f0e4..65162a2 100644 --- a/configs/apalis_imx6_defconfig +++ b/configs/apalis_imx6_defconfig @@ -53,6 +53,7 @@ CONFIG_CMD_USB_SDP=y CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_NFS is not set CONFIG_CMD_BMP=y +CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_PMIC=y @@ -65,6 +66,8 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=4096 CONFIG_DWC_AHSATA=y +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_BOOTCOUNT_ENV=y CONFIG_DM_I2C=y CONFIG_DM_MMC=y CONFIG_SUPPORT_EMMC_BOOT=y diff --git a/configs/colibri-imx6ull_defconfig b/configs/colibri-imx6ull_defconfig index 74a67a0..ce145cd 100644 --- a/configs/colibri-imx6ull_defconfig +++ b/configs/colibri-imx6ull_defconfig @@ -40,6 +40,7 @@ CONFIG_CMD_USB=y CONFIG_CMD_USB_SDP=y CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_BMP=y +CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_CACHE=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_MTDPARTS=y @@ -54,6 +55,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=16352 +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_BOOTCOUNT_ENV=y CONFIG_DFU_NAND=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MXC=y diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig index 44a3ff8..ca33327 100644 --- a/configs/colibri_imx6_defconfig +++ b/configs/colibri_imx6_defconfig @@ -52,6 +52,7 @@ CONFIG_CMD_USB_SDP=y CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_NFS is not set CONFIG_CMD_BMP=y +CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_UUID=y @@ -64,6 +65,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=16352 +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_BOOTCOUNT_ENV=y CONFIG_DM_I2C=y CONFIG_DM_MMC=y CONFIG_SUPPORT_EMMC_BOOT=y diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig index 7596478..89ee6e5 100644 --- a/configs/colibri_imx7_defconfig +++ b/configs/colibri_imx7_defconfig @@ -40,6 +40,7 @@ CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_BOOTP_PXE is not set CONFIG_CMD_BMP=y +CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_CACHE=y # CONFIG_CMD_HASH is not set CONFIG_CMD_MTDPARTS=y @@ -54,6 +55,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=16352 +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_BOOTCOUNT_ENV=y CONFIG_FSL_CAAM=y CONFIG_DFU_NAND=y CONFIG_DM_I2C=y diff --git a/configs/colibri_imx7_emmc_defconfig b/configs/colibri_imx7_emmc_defconfig index c23ff97..13a3aae 100644 --- a/configs/colibri_imx7_emmc_defconfig +++ b/configs/colibri_imx7_emmc_defconfig @@ -38,6 +38,7 @@ CONFIG_CMD_MMC=y CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_BMP=y +CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_CACHE=y # CONFIG_CMD_HASH is not set # CONFIG_ISO_PARTITION is not set @@ -48,6 +49,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=16352 +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_BOOTCOUNT_ENV=y CONFIG_FSL_CAAM=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x82000000

From: Igor Opaniuk igor.opaniuk@toradex.com This introduces automatic boot counter that increases after every reset.After a power-on reset, it will be initialized with 1, and each reboot will increment the value by 1. By default it's disabled if bootlimit isn't set. To enable this feature you have set bootcount limit ("bootlimit"), alternate boot action ("altbootcmd") that will be performed if the new value of bootcount exceeds the value of bootlimit, and "upgrade_available" to let U-Boot automatically increase and save the counter value after every reset:
setenv bootlimit 5 setenv upgrade_available 1 setenv altbootcmd "bootm ..."
In case the bootlimit exceeds, the message will be shown and albootcmd executed: Warning: Bootlimit (5) exceeded. Using altbootcmd. To reset bootcount run:
bootcount reset
Print current value:
bootcount print
Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Igor Opaniuk igor.opaniuk@toradex.com
1. Drop legacy emmcboot wrapper from env. 2. Change the "boot try" order. Default one is: SD -> eMMC -> USB -> DHCP 3. Drop DFU defines
Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
include/configs/apalis_imx6.h | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-)
diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h index d5a0625..dd99096 100644 --- a/include/configs/apalis_imx6.h +++ b/include/configs/apalis_imx6.h @@ -93,9 +93,9 @@
#ifndef CONFIG_SPL_BUILD #define BOOT_TARGET_DEVICES(func) \ - func(MMC, mmc, 0) \ func(MMC, mmc, 1) \ func(MMC, mmc, 2) \ + func(MMC, mmc, 0) \ func(USB, usb, 0) \ func(DHCP, dhcp, na) #include <config_distro_bootcmd.h> @@ -105,14 +105,6 @@ #define BOOTENV #endif /* CONFIG_SPL_BUILD */
-#define DFU_ALT_EMMC_INFO \ - "u-boot.imx raw 0x2 0x3ff mmcpart 0;" \ - "boot part 0 1;" \ - "rootfs part 0 2;" \ - "zImage fat 0 1;" \ - "imx6q-apalis-eval.dtb fat 0 1;" \ - "imx6q-apalis-cam-eval.dtb fat 0 1" - #define UBOOT_UPDATE \ "uboot_hwpart=1\0" \ "uboot_blk=8a\0" \ @@ -124,23 +116,6 @@ "update_spl=run set_blkcnt && mmc dev 0 ${uboot_hwpart} && " \ "mmc write ${loadaddr} ${uboot_spl_blk} ${blkcnt}\0"
-#define EMMC_BOOTCMD \ - "set_emmcargs=setenv emmcargs ip=off root=PARTUUID=${uuid} " \ - "ro,noatime rootfstype=ext4 rootwait\0" \ - "emmcboot=run setup; run emmcfinduuid; run set_emmcargs; " \ - "setenv bootargs ${defargs} ${emmcargs} ${setupargs} " \ - "${vidargs}; echo Booting from internal eMMC chip...; " \ - "run emmcdtbload; load mmc ${emmcdev}:${emmcbootpart} " \ - "${kernel_addr_r} ${boot_file} && run fdt_fixup && " \ - "bootz ${kernel_addr_r} ${dtbparam}\0" \ - "emmcbootpart=1\0" \ - "emmcdev=0\0" \ - "emmcdtbload=setenv dtbparam; load mmc ${emmcdev}:${emmcbootpart} " \ - "${fdt_addr_r} ${fdt_file} && " \ - "setenv dtbparam " - ${fdt_addr_r}" && true\0" \ - "emmcfinduuid=part uuid mmc ${mmcdev}:${emmcrootpart} uuid\0" \ - "emmcrootpart=2\0" - #define MEM_LAYOUT_ENV_SETTINGS \ "bootm_size=0x20000000\0" \ "fdt_addr_r=0x12100000\0" \ @@ -173,8 +148,6 @@ "boot_file=zImage\0" \ "console=ttymxc0\0" \ "defargs=enable_wait_mode=off vmalloc=400M\0" \ - "dfu_alt_info=" DFU_ALT_EMMC_INFO "\0" \ - EMMC_BOOTCMD \ "fdt_file=" FDT_FILE "\0" \ "fdt_fixup=;\0" \ MEM_LAYOUT_ENV_SETTINGS \

From: Igor Opaniuk igor.opaniuk@toradex.com
- Drop legacy emmcboot wrapper from env.
- Change the "boot try" order. Default one is: SD -> eMMC -> USB -> DHCP
- Drop DFU defines
Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Igor Opaniuk igor.opaniuk@toradex.com
1. Drop legacy emmcboot wrapper from env. 2. Change the "boot try" order. Default one is: SD -> eMMC -> USB -> DHCP 3. Drop DFU defines
Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
include/configs/colibri_imx7.h | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-)
diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h index b3f660b..1afa937 100644 --- a/include/configs/colibri_imx7.h +++ b/include/configs/colibri_imx7.h @@ -88,23 +88,6 @@ "mmc read ${android_fdt_addr} ${env_start} ${env_size}; " \ "bootm ${loadaddr} ${loadaddr} ${android_fdt_addr}\0 "
-#define EMMC_BOOTCMD \ - "set_emmcargs=setenv emmcargs ip=off root=PARTUUID=${uuid} ro " \ - "rootfstype=ext4 rootwait\0" \ - "emmcboot=run setup; run emmcfinduuid; run set_emmcargs; " \ - "setenv bootargs ${defargs} ${emmcargs} ${setupargs} " \ - "${vidargs}; echo Booting from internal eMMC chip...; " \ - "run m4boot && " \ - "load mmc ${emmcdev}:${emmcbootpart} ${fdt_addr_r} " \ - "${soc}-colibri-emmc-${fdt_board}.dtb && " \ - "load mmc ${emmcdev}:${emmcbootpart} ${kernel_addr_r} " \ - "${boot_file} && run fdt_fixup && " \ - "bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \ - "emmcbootpart=1\0" \ - "emmcdev=0\0" \ - "emmcfinduuid=part uuid mmc ${emmcdev}:${emmcrootpart} uuid\0" \ - "emmcrootpart=2\0" - #define MEM_LAYOUT_ENV_SETTINGS \ "bootm_size=0x10000000\0" \ "fdt_addr_r=0x82000000\0" \ @@ -144,7 +127,6 @@ "setenv fdtfile ${soc}-colibri-emmc-${fdt_board}.dtb && run distro_bootcmd;" #define MODULE_EXTRA_ENV_SETTINGS \ "variant=-emmc\0" \ - EMMC_BOOTCMD \ EMMC_ANDROID_BOOTCMD #endif
@@ -155,8 +137,8 @@ func(DHCP, dhcp, na) #elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC) #define BOOT_TARGET_DEVICES(func) \ - func(MMC, mmc, 0) \ func(MMC, mmc, 1) \ + func(MMC, mmc, 0) \ func(USB, usb, 0) \ func(DHCP, dhcp, na) #endif @@ -239,10 +221,6 @@
#define CONFIG_USBD_HS
-/* USB Device Firmware Update support */ -#define CONFIG_SYS_DFU_DATA_BUF_SIZE SZ_16M -#define DFU_DEFAULT_POLL_TIMEOUT 300 - #if defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO) #define CONFIG_VIDEO_MXS #define CONFIG_VIDEO_LOGO

From: Igor Opaniuk igor.opaniuk@toradex.com
- Drop legacy emmcboot wrapper from env.
- Change the "boot try" order. Default one is: SD -> eMMC -> USB -> DHCP
- Drop DFU defines
Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Igor Opaniuk igor.opaniuk@toradex.com
1. Drop legacy emmcboot wrapper from env. 2. Change the "boot try" order. Default one is: SD -> eMMC -> USB -> DHCP 3. Drop DFU defines
Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
include/configs/colibri_imx6.h | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-)
diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h index 6beef25..7271f29 100644 --- a/include/configs/colibri_imx6.h +++ b/include/configs/colibri_imx6.h @@ -83,6 +83,7 @@ #define BOOT_TARGET_DEVICES(func) \ func(MMC, mmc, 0) \ func(MMC, mmc, 1) \ + func(MMC, mmc, 0) \ func(USB, usb, 0) \ func(DHCP, dhcp, na) #include <config_distro_bootcmd.h> @@ -92,14 +93,6 @@ #define BOOTENV #endif /* CONFIG_SPL_BUILD */
-#define DFU_ALT_EMMC_INFO \ - "u-boot.imx raw 0x2 0x3ff mmcpart 0;" \ - "boot part 0 1;" \ - "rootfs part 0 2;" \ - "zImage fat 0 1;" \ - "imx6dl-colibri-eval-v3.dtb fat 0 1;" \ - "imx6dl-colibri-cam-eval-v3.dtb fat 0 1" - #define UBOOT_UPDATE \ "uboot_hwpart=1\0" \ "uboot_blk=8a\0" \ @@ -111,24 +104,6 @@ "update_spl=run set_blkcnt && mmc dev 0 ${uboot_hwpart} && " \ "mmc write ${loadaddr} ${uboot_spl_blk} ${blkcnt}\0"
-#define EMMC_BOOTCMD \ - "set_emmcargs=setenv emmcargs ip=off root=PARTUUID=${uuid} "\ - "rw,noatime rootfstype=ext4 " \ - "rootwait\0" \ - "emmcboot=run setup; run emmcfinduuid; run set_emmcargs; " \ - "setenv bootargs ${defargs} ${emmcargs} ${setupargs} " \ - "${vidargs}; echo Booting from internal eMMC chip...; " \ - "run emmcdtbload; load mmc ${emmcdev}:${emmcbootpart} " \ - "${kernel_addr_r} ${boot_file} && run fdt_fixup && " \ - "bootz ${kernel_addr_r} ${dtbparam}\0" \ - "emmcbootpart=1\0" \ - "emmcdev=0\0" \ - "emmcdtbload=setenv dtbparam; load mmc ${emmcdev}:${emmcbootpart} " \ - "${fdt_addr_r} ${fdt_file} && " \ - "setenv dtbparam " - ${fdt_addr_r}" && true\0" \ - "emmcfinduuid=part uuid mmc ${mmcdev}:${emmcrootpart} uuid\0" \ - "emmcrootpart=2\0" - #define MEM_LAYOUT_ENV_SETTINGS \ "bootm_size=0x10000000\0" \ "fdt_addr_r=0x12100000\0" \ @@ -156,8 +131,6 @@ "boot_file=zImage\0" \ "console=ttymxc0\0" \ "defargs=enable_wait_mode=off galcore.contiguousSize=50331648\0" \ - "dfu_alt_info=" DFU_ALT_EMMC_INFO "\0" \ - EMMC_BOOTCMD \ "fdt_file=" FDT_FILE "\0" \ "fdt_fixup=;\0" \ MEM_LAYOUT_ENV_SETTINGS \

From: Igor Opaniuk igor.opaniuk@toradex.com
- Drop legacy emmcboot wrapper from env.
- Change the "boot try" order. Default one is: SD -> eMMC -> USB -> DHCP
- Drop DFU defines
Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic
participants (2)
-
Igor Opaniuk
-
sbabic@denx.de