Jan Kundrát | 6da3461 | 2017-10-11 12:28:53 +0200 | [diff] [blame^] | 1 | From a0bfcfc02bbcb3bdaedbe1328ae056a31b7e3d34 Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz> |
| 3 | Date: Wed, 11 Oct 2017 11:51:14 +0200 |
| 4 | Subject: [PATCH 3/3] clearfog: hard-code the RAUC redundant boot to uboot's |
| 5 | config |
| 6 | |
| 7 | ...so that we can save one partition and an extra detour via a boot.scr |
| 8 | in there. |
| 9 | --- |
| 10 | include/configs/clearfog.h | 40 ++++++++++++++++++++++++++++++++++++---- |
| 11 | 1 file changed, 36 insertions(+), 4 deletions(-) |
| 12 | |
| 13 | diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h |
| 14 | index 8f87eca771..aaf896eb59 100644 |
| 15 | --- a/include/configs/clearfog.h |
| 16 | +++ b/include/configs/clearfog.h |
| 17 | @@ -174,14 +174,46 @@ |
| 18 | "scriptaddr=" SCRIPT_ADDR_R "\0" \ |
| 19 | "pxefile_addr_r=" PXEFILE_ADDR_R "\0" |
| 20 | |
| 21 | -#include <config_distro_bootcmd.h> |
| 22 | - |
| 23 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 24 | RELOCATION_LIMITS_ENV_SETTINGS \ |
| 25 | LOAD_ADDRESS_ENV_SETTINGS \ |
| 26 | - "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ |
| 27 | "console=ttyS0,115200\0" \ |
| 28 | - BOOTENV |
| 29 | + "bootcmd=test -n \"${BOOT_A_LEFT}\" || setenv BOOT_A_LEFT 3;" \ |
| 30 | + "test -n \"${BOOT_B_LEFT}\" || setenv BOOT_B_LEFT 3;" \ |
| 31 | + "setenv rauc_part;" \ |
| 32 | + "for BOOT_SLOT in \"A B\"; do" \ |
| 33 | + " if test \"x${rauc_part}\" != \"x\"; then" \ |
| 34 | + " ;" \ |
| 35 | + " elif test \"x${BOOT_SLOT}\" = \"xA\"; then" \ |
| 36 | + " if test ${BOOT_A_LEFT} -gt 0; then" \ |
| 37 | + " setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1;" \ |
| 38 | + " echo \"Found valid slot A, ${BOOT_A_LEFT} attempts remaining\";" \ |
| 39 | + " setenv rauc_part 1;" \ |
| 40 | + " setenv rauc_slot A;" \ |
| 41 | + " fi;" \ |
| 42 | + " elif test \"x${BOOT_SLOT}\" = \"xB\"; then" \ |
| 43 | + " if test ${BOOT_B_LEFT} -gt 0; then" \ |
| 44 | + " setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1;" \ |
| 45 | + " echo \"Found valid slot B, ${BOOT_B_LEFT} attempts remaining\";" \ |
| 46 | + " setenv rauc_part 2;" \ |
| 47 | + " setenv rauc_slot B;" \ |
| 48 | + " fi;" \ |
| 49 | + " fi;" \ |
| 50 | + "done;" \ |
| 51 | + "if test -n \"${rauc_part}\"; then" \ |
| 52 | + " saveenv ;" \ |
| 53 | + "else" \ |
| 54 | + " echo \"No valid slot found, resetting tries to 3\";" \ |
| 55 | + " setenv BOOT_A_LEFT 3;" \ |
| 56 | + " setenv BOOT_B_LEFT 3;" \ |
| 57 | + " saveenv;" \ |
| 58 | + " reset;" \ |
| 59 | + "fi;" \ |
| 60 | + "setenv BOOT_SLOT;" \ |
| 61 | + "load mmc 0:${rauc_part} ${fdt_addr_r} /boot/armada-388-clearfog-base.dtb;" \ |
| 62 | + "load mmc 0:${rauc_part} ${kernel_addr_r} /boot/zImage;" \ |
| 63 | + "setenv bootargs root=/dev/mmcblk0p${rauc_part} rauc.slot=${rauc_slot} czechlight=${czechlight};" \ |
| 64 | + "bootz ${kernel_addr_r} - ${fdt_addr_r}\0" |
| 65 | |
| 66 | #endif /* CONFIG_SPL_BUILD */ |
| 67 | |
| 68 | -- |
| 69 | 2.14.1 |
| 70 | |