[PATCH 07/10] bootsource: use initcall to export bootsource location to environment

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

 



This way the bootsource is exported to the environment, even if unknown.

Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
---
 common/bootsource.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/common/bootsource.c b/common/bootsource.c
index 2aa0ffa..ebe4407 100644
--- a/common/bootsource.c
+++ b/common/bootsource.c
@@ -19,6 +19,7 @@
 #include <bootsource.h>
 #include <environment.h>
 #include <magicvar.h>
+#include <init.h>
 
 static const char *bootsource_str[] = {
 	[BOOTSOURCE_UNKNOWN] = "unknown",
@@ -42,7 +43,6 @@ void bootsource_set(enum bootsource src)
 	bootsource = src;
 
 	setenv("barebox_loc", bootsource_str[src]);
-	export("barebox_loc");
 }
 
 enum bootsource bootsource_get(void)
@@ -51,3 +51,12 @@ enum bootsource bootsource_get(void)
 }
 
 BAREBOX_MAGICVAR(barebox_loc, "The source barebox has been booted from");
+
+static int bootsource_init(void)
+{
+	bootsource_set(bootsource);
+	export("barebox_loc");
+
+	return 0;
+}
+coredevice_initcall(bootsource_init);
-- 
1.8.2.rc2


_______________________________________________
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