diff mbox series

[5/7] hmibsc: Enable RAUC support

Message ID 20231218072428.1802969-6-sumit.garg@linaro.org
State New
Headers show
Series Add SE HMBSC board support | expand

Commit Message

Sumit Garg Dec. 18, 2023, 7:24 a.m. UTC
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
---
 include/configs/hmibsc.h | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

Comments

Caleb Connolly Dec. 19, 2023, 4:30 p.m. UTC | #1
Hi Sumit,

Please add a description to this patch (what is RAUC?).

On 18/12/2023 07:24, Sumit Garg wrote:
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> ---
>  include/configs/hmibsc.h | 38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/include/configs/hmibsc.h b/include/configs/hmibsc.h
> index 04052ed6dee..b614dec7870 100644
> --- a/include/configs/hmibsc.h
> +++ b/include/configs/hmibsc.h
> @@ -16,4 +16,42 @@
>  #define PHYS_SDRAM_1_SIZE		SZ_1G
>  #define CFG_SYS_SDRAM_BASE		PHYS_SDRAM_1
>  
> +#undef CONFIG_BOOTCOMMAND
> +# define CONFIG_BOOTCOMMAND \
> +	"setenv devtype mmc; setenv devnum 0; " \
> +	"test -n \"${BOOT_ORDER}\" || setenv BOOT_ORDER \"A B\"; " \
> +	"test -n \"${BOOT_A_LEFT}\" || setenv BOOT_A_LEFT 3; " \
> +	"test -n \"${BOOT_B_LEFT}\" || setenv BOOT_B_LEFT 3; " \
> +	"setenv raucslot; " \
> +	"for BOOT_SLOT in \"${BOOT_ORDER}\"; do " \
> +	"  if test \"x${raucslot}\" != \"x\"; then " \
> +	"      echo \"skip remaining slots...\"; " \
> +	"  elif test \"x${BOOT_SLOT}\" = \"xA\"; then " \
> +	"    if test ${BOOT_A_LEFT} -gt 0; then " \
> +	"      setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1; " \
> +	"      echo \"Found valid RAUC slot A\"; " \
> +	"      setenv raucslot \"rauc.slot=A\"; " \
> +	"      setenv raucpart A; setenv distro_bootpart 6;" \
> +	"    fi; " \
> +	"  elif test \"x${BOOT_SLOT}\" = \"xB\"; then " \
> +	"    if test ${BOOT_B_LEFT} -gt 0; then " \
> +	"      setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1; " \
> +	"      echo \"Found valid RAUC slot B\"; " \
> +	"      setenv raucslot \"rauc.slot=B\"; " \
> +	"      setenv raucpart B; setenv distro_bootpart 7;" \
> +	"    fi; " \
> +	"  fi; " \
> +	"done; " \
> +	"if test -n \"${raucslot}\"; then " \
> +	"  setenv bootargs console=ttyMSM1 root=PARTLABEL=rootfs_${raucpart} rw rootwait ${raucslot}; " \
> +	"  saveenv; " \
> +	"else " \
> +	"  echo \"No valid RAUC slot found. Resetting tries to 3\"; " \
> +	"  setenv BOOT_A_LEFT 3; " \
> +	"  setenv BOOT_B_LEFT 3; " \
> +	"  saveenv; " \
> +	"  reset; " \
> +	"fi; " \
> +	"load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} /boot/fitImage && bootm"
> +
>  #endif
diff mbox series

Patch

diff --git a/include/configs/hmibsc.h b/include/configs/hmibsc.h
index 04052ed6dee..b614dec7870 100644
--- a/include/configs/hmibsc.h
+++ b/include/configs/hmibsc.h
@@ -16,4 +16,42 @@ 
 #define PHYS_SDRAM_1_SIZE		SZ_1G
 #define CFG_SYS_SDRAM_BASE		PHYS_SDRAM_1
 
+#undef CONFIG_BOOTCOMMAND
+# define CONFIG_BOOTCOMMAND \
+	"setenv devtype mmc; setenv devnum 0; " \
+	"test -n \"${BOOT_ORDER}\" || setenv BOOT_ORDER \"A B\"; " \
+	"test -n \"${BOOT_A_LEFT}\" || setenv BOOT_A_LEFT 3; " \
+	"test -n \"${BOOT_B_LEFT}\" || setenv BOOT_B_LEFT 3; " \
+	"setenv raucslot; " \
+	"for BOOT_SLOT in \"${BOOT_ORDER}\"; do " \
+	"  if test \"x${raucslot}\" != \"x\"; then " \
+	"      echo \"skip remaining slots...\"; " \
+	"  elif test \"x${BOOT_SLOT}\" = \"xA\"; then " \
+	"    if test ${BOOT_A_LEFT} -gt 0; then " \
+	"      setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1; " \
+	"      echo \"Found valid RAUC slot A\"; " \
+	"      setenv raucslot \"rauc.slot=A\"; " \
+	"      setenv raucpart A; setenv distro_bootpart 6;" \
+	"    fi; " \
+	"  elif test \"x${BOOT_SLOT}\" = \"xB\"; then " \
+	"    if test ${BOOT_B_LEFT} -gt 0; then " \
+	"      setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1; " \
+	"      echo \"Found valid RAUC slot B\"; " \
+	"      setenv raucslot \"rauc.slot=B\"; " \
+	"      setenv raucpart B; setenv distro_bootpart 7;" \
+	"    fi; " \
+	"  fi; " \
+	"done; " \
+	"if test -n \"${raucslot}\"; then " \
+	"  setenv bootargs console=ttyMSM1 root=PARTLABEL=rootfs_${raucpart} rw rootwait ${raucslot}; " \
+	"  saveenv; " \
+	"else " \
+	"  echo \"No valid RAUC slot found. Resetting tries to 3\"; " \
+	"  setenv BOOT_A_LEFT 3; " \
+	"  setenv BOOT_B_LEFT 3; " \
+	"  saveenv; " \
+	"  reset; " \
+	"fi; " \
+	"load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} /boot/fitImage && bootm"
+
 #endif