diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-08-14 21:30:52 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-08-16 08:40:56 +0200 |
commit | 338b6e7edc054523e2cc0dec77ab3aa1716a385f (patch) | |
tree | 97f1e889bb9f0868da19b119283eb040d1191ee6 /common/misc.c | |
parent | 068bed22a6154aec1fe689603b8a8eaa27c0f350 (diff) | |
download | barebox-338b6e7edc054523e2cc0dec77ab3aa1716a385f.tar.gz barebox-338b6e7edc054523e2cc0dec77ab3aa1716a385f.tar.xz |
export model as globalvar
The model string is valuable information. Make it available to scripts
with a globalvar.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/misc.c')
-rw-r--r-- | common/misc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/common/misc.c b/common/misc.c index d5ddfc4917..f73f4cfe99 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); |