[PATCH 8/8] export model as globalvar
Sascha Hauer
s.hauer at pengutronix.de
Thu Aug 15 03:29:01 EDT 2013
The model string is valuable information. Make it available to scripts
with a globalvar.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
common/misc.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/common/misc.c b/common/misc.c
index d5ddfc4..f73f4cf 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -139,13 +139,20 @@ static char *model;
*/
void barebox_set_model(const char *__model)
{
- free(model);
- model = xstrdup(__model);
+ if (IS_ENABLED(CONFIG_GLOBALVAR)) {
+ globalvar_add_simple("model", __model);
+ } else {
+ free(model);
+ model = xstrdup(__model);
+ }
}
EXPORT_SYMBOL(barebox_set_model);
const char *barebox_get_model(void)
{
+ if (IS_ENABLED(CONFIG_GLOBALVAR))
+ return getenv("global.model");
+
return model;
}
EXPORT_SYMBOL(barebox_get_model);
--
1.8.4.rc2
More information about the barebox
mailing list