mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] fastboot: add support to set fastboot_bbu from board code
@ 2024-03-13 19:56 Marco Felsch
  2024-03-13 19:56 ` [PATCH 2/4] boot: add helper to set default boot source from board file Marco Felsch
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Marco Felsch @ 2024-03-13 19:56 UTC (permalink / raw)
  To: barebox

Add a helper to set the fastboot_bbu variable to be independent of the
initlevel.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 common/fastboot.c  | 5 +++++
 include/fastboot.h | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/common/fastboot.c b/common/fastboot.c
index 261283d50a3a..da55e9c2577f 100644
--- a/common/fastboot.c
+++ b/common/fastboot.c
@@ -933,6 +933,11 @@ bool get_fastboot_bbu(void)
 	return fastboot_bbu;
 }
 
+void set_fastboot_bbu(unsigned int enable)
+{
+	fastboot_bbu = enable;
+}
+
 struct file_list *get_fastboot_partitions(void)
 {
 	if (fastboot_partitions && *fastboot_partitions)
diff --git a/include/fastboot.h b/include/fastboot.h
index 8a98b482fe14..cd415847e348 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -60,6 +60,7 @@ enum fastboot_msg_type {
 
 #ifdef CONFIG_FASTBOOT_BASE
 bool get_fastboot_bbu(void);
+void set_fastboot_bbu(unsigned int enable);
 struct file_list *get_fastboot_partitions(void);
 #else
 static inline int get_fastboot_bbu(void)
@@ -67,6 +68,10 @@ static inline int get_fastboot_bbu(void)
 	return false;
 }
 
+static inline void set_fastboot_bbu(unsigned int enable)
+{
+}
+
 static inline struct file_list *get_fastboot_partitions(void)
 {
 	return file_list_parse("");
-- 
2.39.2




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/4] boot: add helper to set default boot source from board file
  2024-03-13 19:56 [PATCH 1/4] fastboot: add support to set fastboot_bbu from board code Marco Felsch
@ 2024-03-13 19:56 ` Marco Felsch
  2024-03-13 19:56 ` [PATCH 3/4] startup: fix autoboot_state in case of abort Marco Felsch
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Marco Felsch @ 2024-03-13 19:56 UTC (permalink / raw)
  To: barebox

Add a helper which can be called from board files to setup the
"boot.default" parameter to be independent of the initcall level.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 common/boot.c  | 9 ++++++++-
 include/boot.h | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/common/boot.c b/common/boot.c
index dd9e26afc769..9cf9e9f391fd 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -115,11 +115,18 @@ struct watchdog *boot_get_enabled_watchdog(void)
 }
 
 static char *global_boot_default;
+
+void boot_set_default(const char *boot_default)
+{
+	free(global_boot_default);
+	global_boot_default = xstrdup(boot_default);
+}
+
 static char *global_user;
 
 static int init_boot(void)
 {
-	global_boot_default = xstrdup("net");
+	global_boot_default = global_boot_default ? : xstrdup("net");
 	globalvar_add_simple_string("boot.default", &global_boot_default);
 	globalvar_add_simple_int("boot.watchdog_timeout",
 				 &boot_watchdog_timeout, "%u");
diff --git a/include/boot.h b/include/boot.h
index c9e8c0fd0d87..0f97901a9a72 100644
--- a/include/boot.h
+++ b/include/boot.h
@@ -44,6 +44,7 @@ int bootentry_register_provider(int (*fn)(struct bootentries *bootentries, const
 
 struct watchdog;
 
+void boot_set_default(const char *boot_default);
 void boot_set_watchdog_timeout(unsigned int timeout);
 struct watchdog *boot_get_enabled_watchdog(void);
 struct bootentries *bootentries_alloc(void);
-- 
2.39.2




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/4] startup: fix autoboot_state in case of abort
  2024-03-13 19:56 [PATCH 1/4] fastboot: add support to set fastboot_bbu from board code Marco Felsch
  2024-03-13 19:56 ` [PATCH 2/4] boot: add helper to set default boot source from board file Marco Felsch
@ 2024-03-13 19:56 ` Marco Felsch
  2024-03-13 19:56 ` [PATCH 4/4] common: barebox_banner: fix missing newline Marco Felsch
  2024-03-15  7:20 ` [PATCH 1/4] fastboot: add support to set fastboot_bbu from board code Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Marco Felsch @ 2024-03-13 19:56 UTC (permalink / raw)
  To: barebox

Currently do_autoboot_countdown() always returns AUTOBOOT_BOOT if no
interactive console was found which is wrong if global_autoboot_state
was set to AUTOBOOT_ABORT. Fix this by checking the
global_autoboot_state as well.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 common/startup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/startup.c b/common/startup.c
index bbba72f89255..d7f7b5163e87 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -174,7 +174,8 @@ enum autoboot_state do_autoboot_countdown(void)
 	if (autoboot_state != AUTOBOOT_UNKNOWN)
 		return autoboot_state;
 
-	if (!console_get_first_active()) {
+	if (!console_get_first_active() &&
+	    global_autoboot_state != AUTOBOOT_ABORT) {
 		printf("\nNon-interactive console, booting system\n");
 		return autoboot_state = AUTOBOOT_BOOT;
 	}
-- 
2.39.2




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/4] common: barebox_banner: fix missing newline
  2024-03-13 19:56 [PATCH 1/4] fastboot: add support to set fastboot_bbu from board code Marco Felsch
  2024-03-13 19:56 ` [PATCH 2/4] boot: add helper to set default boot source from board file Marco Felsch
  2024-03-13 19:56 ` [PATCH 3/4] startup: fix autoboot_state in case of abort Marco Felsch
@ 2024-03-13 19:56 ` Marco Felsch
  2024-03-15  7:20 ` [PATCH 1/4] fastboot: add support to set fastboot_bbu from board code Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Marco Felsch @ 2024-03-13 19:56 UTC (permalink / raw)
  To: barebox

Albeit the banner is shown correctly due to following printf(), the
dmesg() output isn't. This cause the next log buffer print printed on
the same line as the "Buildsystem version:" print. Fix this by adding a
newline afterwards.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 common/version.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/version.c b/common/version.c
index 465e22c7f52e..0cac5ee609e6 100644
--- a/common/version.c
+++ b/common/version.c
@@ -22,7 +22,7 @@ void barebox_banner (void)
 	printf("\n\n");
 	pr_info("%s\n", version_string);
 	if (strlen(buildsystem_version_string) > 0)
-		pr_info("Buildsystem version: %s", buildsystem_version_string);
+		pr_info("Buildsystem version: %s\n", buildsystem_version_string);
 	printf("\n\n");
 	pr_info("Board: %s\n", barebox_get_model());
 }
-- 
2.39.2




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/4] fastboot: add support to set fastboot_bbu from board code
  2024-03-13 19:56 [PATCH 1/4] fastboot: add support to set fastboot_bbu from board code Marco Felsch
                   ` (2 preceding siblings ...)
  2024-03-13 19:56 ` [PATCH 4/4] common: barebox_banner: fix missing newline Marco Felsch
@ 2024-03-15  7:20 ` Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2024-03-15  7:20 UTC (permalink / raw)
  To: barebox, Marco Felsch


On Wed, 13 Mar 2024 20:56:03 +0100, Marco Felsch wrote:
> Add a helper to set the fastboot_bbu variable to be independent of the
> initlevel.
> 
> 

Applied, thanks!

[1/4] fastboot: add support to set fastboot_bbu from board code
      https://git.pengutronix.de/cgit/barebox/commit/?id=583b331c2325 (link may not be stable)
[2/4] boot: add helper to set default boot source from board file
      https://git.pengutronix.de/cgit/barebox/commit/?id=f6bea691a0d9 (link may not be stable)
[3/4] startup: fix autoboot_state in case of abort
      https://git.pengutronix.de/cgit/barebox/commit/?id=5a76a2dd1cc5 (link may not be stable)
[4/4] common: barebox_banner: fix missing newline
      https://git.pengutronix.de/cgit/barebox/commit/?id=dc82ff225a9b (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-15  7:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 19:56 [PATCH 1/4] fastboot: add support to set fastboot_bbu from board code Marco Felsch
2024-03-13 19:56 ` [PATCH 2/4] boot: add helper to set default boot source from board file Marco Felsch
2024-03-13 19:56 ` [PATCH 3/4] startup: fix autoboot_state in case of abort Marco Felsch
2024-03-13 19:56 ` [PATCH 4/4] common: barebox_banner: fix missing newline Marco Felsch
2024-03-15  7:20 ` [PATCH 1/4] fastboot: add support to set fastboot_bbu from board code Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox