From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Christian Melki <christian.melki@t2data.com>,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] startup: don't fallback to shell from menu
Date: Mon, 25 Nov 2024 16:39:15 +0100 [thread overview]
Message-ID: <20241125153915.1548894-1-a.fatoum@pengutronix.de> (raw)
The code to determine whether to drop to shell or to run the menu is a
bit hard to follow and may even be used to circumvent the menu in some
circumstances.
Fix this by wrapping the menu in an infinite loop and refuse dropping to
shell.
Suggested-by: Christian Melki <christian.melki@t2data.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/startup.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/common/startup.c b/common/startup.c
index d71d83c221dc..4c497d95bedb 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -318,16 +318,17 @@ static int run_init(void)
if (IS_ENABLED(CONFIG_NET) && !IS_ENABLED(CONFIG_CONSOLE_DISABLE_INPUT))
eth_open_all();
- if (autoboot == AUTOBOOT_MENU)
+ if (autoboot != AUTOBOOT_MENU) {
+ if (autoboot == AUTOBOOT_ABORT && autoboot == global_autoboot_state)
+ watchdog_inhibit_all();
+
+ run_shell();
+ }
+
+ while (1)
run_command(MENUFILE);
- if (autoboot == AUTOBOOT_ABORT && autoboot == global_autoboot_state)
- watchdog_inhibit_all();
-
- run_shell();
- run_command(MENUFILE);
-
- return 0;
+ unreachable();
}
typedef void (*ctor_fn_t)(void);
--
2.39.5
reply other threads:[~2024-11-25 15:39 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=20241125153915.1548894-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=christian.melki@t2data.com \
/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