Jan Kundrát | 102b740 | 2017-10-11 12:53:34 +0200 | [diff] [blame^] | 1 | From 4223232d3fa9b71997ac5d5c890d5bd91c39ce8d Mon Sep 17 00:00:00 2001 |
Jan Kundrát | 6da3461 | 2017-10-11 12:28:53 +0200 | [diff] [blame] | 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. |
Jan Kundrát | 102b740 | 2017-10-11 12:53:34 +0200 | [diff] [blame^] | 9 | |
| 10 | The "|| reset" are required because the watchdog timer is left running |
| 11 | *and* being periodically reset from within the uboot's prompt, which |
| 12 | completely defeats the point of our logic. |
Jan Kundrát | 6da3461 | 2017-10-11 12:28:53 +0200 | [diff] [blame] | 13 | --- |
Jan Kundrát | 102b740 | 2017-10-11 12:53:34 +0200 | [diff] [blame^] | 14 | include/configs/clearfog.h | 39 +++++++++++++++++++++++++++++++++++---- |
| 15 | 1 file changed, 35 insertions(+), 4 deletions(-) |
Jan Kundrát | 6da3461 | 2017-10-11 12:28:53 +0200 | [diff] [blame] | 16 | |
| 17 | diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h |
Jan Kundrát | 102b740 | 2017-10-11 12:53:34 +0200 | [diff] [blame^] | 18 | index 8f87eca771..bd2cc3c26e 100644 |
Jan Kundrát | 6da3461 | 2017-10-11 12:28:53 +0200 | [diff] [blame] | 19 | --- a/include/configs/clearfog.h |
| 20 | +++ b/include/configs/clearfog.h |
Jan Kundrát | 102b740 | 2017-10-11 12:53:34 +0200 | [diff] [blame^] | 21 | @@ -174,14 +174,45 @@ |
Jan Kundrát | 6da3461 | 2017-10-11 12:28:53 +0200 | [diff] [blame] | 22 | "scriptaddr=" SCRIPT_ADDR_R "\0" \ |
| 23 | "pxefile_addr_r=" PXEFILE_ADDR_R "\0" |
| 24 | |
| 25 | -#include <config_distro_bootcmd.h> |
| 26 | - |
| 27 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 28 | RELOCATION_LIMITS_ENV_SETTINGS \ |
| 29 | LOAD_ADDRESS_ENV_SETTINGS \ |
| 30 | - "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ |
| 31 | "console=ttyS0,115200\0" \ |
| 32 | - BOOTENV |
| 33 | + "bootcmd=test -n \"${BOOT_A_LEFT}\" || setenv BOOT_A_LEFT 3;" \ |
| 34 | + "test -n \"${BOOT_B_LEFT}\" || setenv BOOT_B_LEFT 3;" \ |
| 35 | + "setenv rauc_part;" \ |
| 36 | + "for BOOT_SLOT in \"A B\"; do" \ |
| 37 | + " if test \"x${rauc_part}\" != \"x\"; then" \ |
| 38 | + " ;" \ |
| 39 | + " elif test \"x${BOOT_SLOT}\" = \"xA\"; then" \ |
| 40 | + " if test ${BOOT_A_LEFT} -gt 0; then" \ |
| 41 | + " setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1;" \ |
| 42 | + " echo \"Found valid slot A, ${BOOT_A_LEFT} attempts remaining\";" \ |
| 43 | + " setenv rauc_part 1;" \ |
| 44 | + " setenv rauc_slot A;" \ |
| 45 | + " fi;" \ |
| 46 | + " elif test \"x${BOOT_SLOT}\" = \"xB\"; then" \ |
| 47 | + " if test ${BOOT_B_LEFT} -gt 0; then" \ |
| 48 | + " setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1;" \ |
| 49 | + " echo \"Found valid slot B, ${BOOT_B_LEFT} attempts remaining\";" \ |
| 50 | + " setenv rauc_part 2;" \ |
| 51 | + " setenv rauc_slot B;" \ |
| 52 | + " fi;" \ |
| 53 | + " fi;" \ |
| 54 | + "done;" \ |
| 55 | + "if test -n \"${rauc_part}\"; then" \ |
| 56 | + " saveenv ;" \ |
| 57 | + "else" \ |
| 58 | + " echo \"No valid slot found, resetting tries to 3\";" \ |
| 59 | + " setenv BOOT_A_LEFT 3;" \ |
| 60 | + " setenv BOOT_B_LEFT 3;" \ |
| 61 | + " saveenv;" \ |
| 62 | + " reset;" \ |
| 63 | + "fi;" \ |
Jan Kundrát | 6da3461 | 2017-10-11 12:28:53 +0200 | [diff] [blame] | 64 | + "setenv bootargs root=/dev/mmcblk0p${rauc_part} rauc.slot=${rauc_slot} czechlight=${czechlight};" \ |
Jan Kundrát | 102b740 | 2017-10-11 12:53:34 +0200 | [diff] [blame^] | 65 | + "load mmc 0:${rauc_part} ${fdt_addr_r} /boot/armada-388-clearfog-base.dtb || reset;" \ |
| 66 | + "load mmc 0:${rauc_part} ${kernel_addr_r} /boot/zImage || reset;" \ |
| 67 | + "bootz ${kernel_addr_r} - ${fdt_addr_r} || reset\0" |
Jan Kundrát | 6da3461 | 2017-10-11 12:28:53 +0200 | [diff] [blame] | 68 | |
| 69 | #endif /* CONFIG_SPL_BUILD */ |
| 70 | |
| 71 | -- |
| 72 | 2.14.1 |
| 73 | |