9
0
Fork 0

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>
This commit is contained in:
Marc Kleine-Budde 2013-04-03 10:12:12 +02:00 committed by Sascha Hauer
parent 7b66d9cddd
commit 54c3870f54
1 changed files with 10 additions and 1 deletions

View File

@ -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);