9
0
Fork 0

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>
This commit is contained in:
Sascha Hauer 2013-08-14 21:30:52 +02:00
parent 068bed22a6
commit 338b6e7edc
1 changed files with 9 additions and 2 deletions

View File

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