diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2013-04-03 10:12:12 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-04-04 10:54:27 +0200 |
commit | 54c3870f5426bab88f2f4ae456a9c88b996969ac (patch) | |
tree | f877d8738bf5d99972d9355682a4177bccb4b57b /common | |
parent | 7b66d9cdddf2bccb9b88a34317428c44c1b750cc (diff) | |
download | barebox-54c3870f5426bab88f2f4ae456a9c88b996969ac.tar.gz barebox-54c3870f5426bab88f2f4ae456a9c88b996969ac.tar.xz |
bootsource: use initcall to export bootsource location to environment
This way the bootsource is exported to the environment, even if unknown.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/bootsource.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/common/bootsource.c b/common/bootsource.c index 6f9ae54ceb..5f1d40c1d8 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("bootsource", bootsource_str[src]); - export("bootsource"); } enum bootsource bootsource_get(void) @@ -51,3 +51,12 @@ enum bootsource bootsource_get(void) } BAREBOX_MAGICVAR(bootsource, "The source barebox has been booted from"); + +static int bootsource_init(void) +{ + bootsource_set(bootsource); + export("bootsource"); + + return 0; +} +coredevice_initcall(bootsource_init); |