[PATCH 1/2] common: oftree: Pass bootsource and bootsource instance to kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux