blob: 00ccf574c7cbf5d2f50e22f953df177803707a38 [file] [log] [blame]
From 4223232d3fa9b71997ac5d5c890d5bd91c39ce8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
Date: Wed, 11 Oct 2017 11:51:14 +0200
Subject: [PATCH 3/3] clearfog: hard-code the RAUC redundant boot to uboot's
config
...so that we can save one partition and an extra detour via a boot.scr
in there.
The "|| reset" are required because the watchdog timer is left running
*and* being periodically reset from within the uboot's prompt, which
completely defeats the point of our logic.
---
include/configs/clearfog.h | 39 +++++++++++++++++++++++++++++++++++----
1 file changed, 35 insertions(+), 4 deletions(-)
diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h
index 8f87eca771..bd2cc3c26e 100644
--- a/include/configs/clearfog.h
+++ b/include/configs/clearfog.h
@@ -174,14 +174,45 @@
"scriptaddr=" SCRIPT_ADDR_R "\0" \
"pxefile_addr_r=" PXEFILE_ADDR_R "\0"
-#include <config_distro_bootcmd.h>
-
#define CONFIG_EXTRA_ENV_SETTINGS \
RELOCATION_LIMITS_ENV_SETTINGS \
LOAD_ADDRESS_ENV_SETTINGS \
- "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
"console=ttyS0,115200\0" \
- BOOTENV
+ "bootcmd=test -n \"${BOOT_A_LEFT}\" || setenv BOOT_A_LEFT 3;" \
+ "test -n \"${BOOT_B_LEFT}\" || setenv BOOT_B_LEFT 3;" \
+ "setenv rauc_part;" \
+ "for BOOT_SLOT in \"A B\"; do" \
+ " if test \"x${rauc_part}\" != \"x\"; then" \
+ " ;" \
+ " 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 slot A, ${BOOT_A_LEFT} attempts remaining\";" \
+ " setenv rauc_part 1;" \
+ " setenv rauc_slot A;" \
+ " 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 slot B, ${BOOT_B_LEFT} attempts remaining\";" \
+ " setenv rauc_part 2;" \
+ " setenv rauc_slot B;" \
+ " fi;" \
+ " fi;" \
+ "done;" \
+ "if test -n \"${rauc_part}\"; then" \
+ " saveenv ;" \
+ "else" \
+ " echo \"No valid slot found, resetting tries to 3\";" \
+ " setenv BOOT_A_LEFT 3;" \
+ " setenv BOOT_B_LEFT 3;" \
+ " saveenv;" \
+ " reset;" \
+ "fi;" \
+ "setenv bootargs root=/dev/mmcblk0p${rauc_part} rauc.slot=${rauc_slot} czechlight=${czechlight};" \
+ "load mmc 0:${rauc_part} ${fdt_addr_r} /boot/armada-388-clearfog-base.dtb || reset;" \
+ "load mmc 0:${rauc_part} ${kernel_addr_r} /boot/zImage || reset;" \
+ "bootz ${kernel_addr_r} - ${fdt_addr_r} || reset\0"
#endif /* CONFIG_SPL_BUILD */
--
2.14.1