From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] startup: register autoboot vars in initcall
Date: Fri, 26 Jun 2020 08:01:34 +0200 [thread overview]
Message-ID: <20200626060134.19836-1-s.hauer@pengutronix.de> (raw)
globalvars should be registered early so that code modifying them also
updates the backing store pointer. Move registering of
global.autoboot_abort_key, global.autoboot_timeout and global.autoboot
to an initcall.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/startup.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/common/startup.c b/common/startup.c
index 511675ed55..7e0f7d6b64 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -281,19 +281,8 @@ enum autoboot_state do_autoboot_countdown(void)
return autoboot_state;
}
-static int run_init(void)
+static int register_autoboot_vars(void)
{
- DIR *dir;
- struct dirent *d;
- const char *initdir = "/env/init";
- bool env_bin_init_exists;
- 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,
@@ -305,6 +294,19 @@ static int run_init(void)
global_autoboot_states,
ARRAY_SIZE(global_autoboot_states));
+ return 0;
+}
+postcore_initcall(register_autoboot_vars);
+
+static int run_init(void)
+{
+ DIR *dir;
+ struct dirent *d;
+ const char *initdir = "/env/init";
+ bool env_bin_init_exists;
+ enum autoboot_state autoboot;
+ struct stat s;
+
setenv("PATH", "/env/bin");
/* Run legacy /env/bin/init if it exists */
--
2.27.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2020-06-26 6:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200626060134.19836-1-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--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