mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] startup: Register autoboot variables earlier
Date: Wed, 21 Aug 2019 15:28:59 +0200	[thread overview]
Message-ID: <20190821132859.GA21288@lenoch> (raw)

Autoboot is controlled by autoboot_timeout and autoboot_abort_key
variables which might be altered by init scripts, so we need to
register them before those scripts are run. Otherwise they are
set back to defaultenv values upon registration.

Fixes: 35266d7e583f ("startup: Factor out the autoboot counter...")
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 common/startup.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/common/startup.c b/common/startup.c
index bef9d29c6..b5b86d114 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -221,13 +221,6 @@ enum autoboot_state do_autoboot_countdown(void)
 	if (autoboot_state != AUTOBOOT_UNKNOWN)
 		return autoboot_state;
 
-	globalvar_add_simple_enum("autoboot_abort_key",
-				  &global_autoboot_abort_key,
-                                  global_autoboot_abort_keys,
-				  ARRAY_SIZE(global_autoboot_abort_keys));
-	globalvar_add_simple_int("autoboot_timeout",
-				 &global_autoboot_timeout, "%u");
-
 	menu_exists = stat(MENUFILE, &s) == 0;
 
 	if (menu_exists) {
@@ -272,6 +265,17 @@ static int run_init(void)
 	enum autoboot_state autoboot;
 	struct stat s;
 
+	/*
+	 * Register autoboot variables here as they might be altered by
+	 * init scripts.
+	 */
+	globalvar_add_simple_enum("autoboot_abort_key",
+				  &global_autoboot_abort_key,
+                                  global_autoboot_abort_keys,
+				  ARRAY_SIZE(global_autoboot_abort_keys));
+	globalvar_add_simple_int("autoboot_timeout",
+				 &global_autoboot_timeout, "%u");
+
 	setenv("PATH", "/env/bin");
 
 	/* Run legacy /env/bin/init if it exists */
-- 
2.23.0.rc1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2019-08-21 13:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 13:28 Ladislav Michl [this message]
2019-08-23  7:09 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190821132859.GA21288@lenoch \
    --to=ladis@linux-mips.org \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox