mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] Pass barebox version to kernel
Date: Mon, 26 Feb 2018 09:23:49 +0100	[thread overview]
Message-ID: <20180226082349.31568-1-s.hauer@pengutronix.de> (raw)

When userspace is interested in the barebox version it has currently no
way of reliably reading it. Add it to the kernel command line as it's an
established way to pass information from the bootloader to the kernel.
If CONFIG_FLEXIBLE_BOOTARGS is enabled then the barebox version is
passed in the "bootloader.version=" variable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/globalvar.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/common/globalvar.c b/common/globalvar.c
index b9bfce7dac..eff4cbc72e 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -571,6 +571,8 @@ int globalvar_add_simple_ip(const char *name, IPaddr_t *ip)
 	return 0;
 }
 
+static char *kernel_arg_bootloader_version;
+
 static int globalvar_init(void)
 {
 	register_device(&global_device);
@@ -580,6 +582,13 @@ static int globalvar_init(void)
 
 	globalvar_add_simple("version", UTS_RELEASE);
 
+	if (IS_ENABLED(CONFIG_FLEXIBLE_BOOTARGS)) {
+		kernel_arg_bootloader_version = basprintf("bootloader.version=barebox-%s",
+					       UTS_RELEASE);
+		globalvar_add_simple_string("linux.bootargs.bootloader.version",
+					    &kernel_arg_bootloader_version);
+	}
+
 	return 0;
 }
 pure_initcall(globalvar_init);
-- 
2.16.1


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

             reply	other threads:[~2018-02-26  8:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26  8:23 Sascha Hauer [this message]
2018-02-26 10:12 ` Peter Mamonov
2018-02-27  8:34   ` Sascha Hauer
2018-02-27 19:43     ` Peter Mamonov
2018-02-28  7:34       ` 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=20180226082349.31568-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