aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini2021-06-15 08:23:04 -0400
committerTom Rini2021-06-15 08:23:04 -0400
commit9301a5cc99dd0c298e2f7fe2fa98a7287fcda772 (patch)
treee35208da5620087f8a273aef106f5e90291b4ac9
parentc4737cd594b5c4c47aff789fc53f7dd36ed03c94 (diff)
parent029bb91e806ed36dd48f0f967429bd5107464979 (diff)
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell
- Turris: Fix bootcmd_rescue (Pali)
-rw-r--r--board/CZ.NIC/turris_mox/turris_mox.c14
-rw-r--r--board/CZ.NIC/turris_omnia/turris_omnia.c13
2 files changed, 21 insertions, 6 deletions
diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
index 44c272c7cb8..428cd23a19d 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -440,10 +440,18 @@ static bool read_reset_button(void)
static void handle_reset_button(void)
{
+ const char * const vars[1] = { "bootcmd_rescue", };
+
+ /*
+ * Ensure that bootcmd_rescue has always stock value, so that running
+ * run bootcmd_rescue
+ * always works correctly.
+ */
+ env_set_default_vars(1, (char * const *)vars, 0);
+
if (read_reset_button()) {
- const char * const vars[3] = {
+ const char * const vars[2] = {
"bootcmd",
- "bootcmd_rescue",
"distro_bootcmd",
};
@@ -451,7 +459,7 @@ static void handle_reset_button(void)
* Set the above envs to their default values, in case the user
* managed to break them.
*/
- env_set_default_vars(3, (char * const *)vars, 0);
+ env_set_default_vars(2, (char * const *)vars, 0);
/* Ensure bootcmd_rescue is used by distroboot */
env_set("boot_targets", "rescue");
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index ade923f5994..8b2f94f959a 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -339,9 +339,17 @@ static int set_regdomain(void)
static void handle_reset_button(void)
{
+ const char * const vars[1] = { "bootcmd_rescue", };
int ret;
u8 reset_status;
+ /*
+ * Ensure that bootcmd_rescue has always stock value, so that running
+ * run bootcmd_rescue
+ * always works correctly.
+ */
+ env_set_default_vars(1, (char * const *)vars, 0);
+
ret = omnia_mcu_read(CMD_GET_RESET, &reset_status, 1);
if (ret) {
printf("omnia_mcu_read failed: %i, reset status unknown!\n",
@@ -352,9 +360,8 @@ static void handle_reset_button(void)
env_set_ulong("omnia_reset", reset_status);
if (reset_status) {
- const char * const vars[3] = {
+ const char * const vars[2] = {
"bootcmd",
- "bootcmd_rescue",
"distro_bootcmd",
};
@@ -362,7 +369,7 @@ static void handle_reset_button(void)
* Set the above envs to their default values, in case the user
* managed to break them.
*/
- env_set_default_vars(3, (char * const *)vars, 0);
+ env_set_default_vars(2, (char * const *)vars, 0);
/* Ensure bootcmd_rescue is used by distroboot */
env_set("boot_targets", "rescue");