From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 1/2] common: oftree: Pass bootsource and bootsource instance to kernel
Date: Tue, 8 May 2018 14:21:24 -0700 [thread overview]
Message-ID: <20180508212125.5923-2-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20180508212125.5923-1-andrew.smirnov@gmail.com>
Pass barebox-detected bootsource and bootsource instance to Linux to
make it availible to Linux userspace. We use put the version under
/chosen/bootsource and it can be read under Linux in
/sys/firmware/devicetree/base/chosen/bootsource
and
/sys/firmware/devicetree/base/chosen/bootsource-instance.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
common/oftree.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/common/oftree.c b/common/oftree.c
index 8a2ede4c6..9c94ca116 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -11,6 +11,7 @@
#include <getopt.h>
#include <init.h>
#include <boot.h>
+#include <bootsource.h>
#include <i2c/i2c.h>
#define MAX_LEVEL 32 /* how deeply nested we will go */
@@ -118,6 +119,7 @@ static int of_fixup_bootargs(struct device_node *root, void *unused)
{
struct device_node *node;
const char *str;
+ int instance;
int err;
str = linux_bootargs_get();
@@ -130,6 +132,12 @@ static int of_fixup_bootargs(struct device_node *root, void *unused)
of_property_write_string(node, "barebox-version", release_string);
+ of_property_write_string(node, "bootsource", getenv("bootsource"));
+ instance = bootsource_get_instance();
+ of_property_write_u32(node, "bootsource-instance",
+ (instance == BOOTSOURCE_INSTANCE_UNKNOWN) ?
+ 0 : instance);
+
err = of_property_write_string(node, "bootargs", str);
return err;
--
2.17.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2018-05-08 21:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-08 21:21 [PATCH 0/2] Pass reset and boot sources via /chosen node Andrey Smirnov
2018-05-08 21:21 ` Andrey Smirnov [this message]
2018-05-14 7:48 ` [PATCH 1/2] common: oftree: Pass bootsource and bootsource instance to kernel Sascha Hauer
2018-05-15 5:40 ` Andrey Smirnov
2018-05-08 21:21 ` [PATCH 2/2] common: oftree: Pass reset source and reset source " Andrey Smirnov
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=20180508212125.5923-2-andrew.smirnov@gmail.com \
--to=andrew.smirnov@gmail.com \
--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