@@ -42,9 +42,9 @@ static int bootloader_initialize(struct uboot_ctx **ctx)
int ret;
const char *namespace = NULL;
- ret = libuboot_read_config_ext(ctx, CONFIG_UBOOT_FWENV);
+ ret = libuboot_read_config_ext(ctx, get_fwenv_config());
if (ret) {
- ERROR("Cannot initialize environment from %s", CONFIG_UBOOT_FWENV);
+ ERROR("Cannot initialize environment from %s", get_fwenv_config());
return -EINVAL;
}
@@ -321,6 +321,13 @@ static int read_globals_settings(void *elem, void *data)
get_field(LIBCFG_PARSER, elem, "syslog", &sw->syslog_enabled);
GET_FIELD_STRING(LIBCFG_PARSER, elem,
"no-downgrading", sw->minimum_version);
+ tmp[0] = '\0';
+ GET_FIELD_STRING(LIBCFG_PARSER, elem,
+ "fwenv-config-location", tmp);
+ if (strlen(tmp)) {
+ set_fwenv_config(tmp);
+ tmp[0] = '\0';
+ }
if (strlen(sw->minimum_version))
sw->no_downgrading = true;
GET_FIELD_STRING(LIBCFG_PARSER, elem,
@@ -48,10 +48,10 @@
# Possible values are ebg, grub, uboot, and none for
# EFI Boot Guard, U-Boot, GRUB, and the Environment in RAM bootloader,
# respectively, given the respective bootloader support is compiled-in.
-#
# namespace-vars : namespace used by libubootenv for application/SWUpdate persistent
# variables. This can be overridden in sw-description.
# It is one set in libubootenv configuration file.
+# fwenv-config-location : path of the configuration file for libubootenv
globals :
{
Add a way to override the compile option CONFIG_UBOOT_FWENV at runtime. Signed-off-by: Stefano Babic <stefano.babic@swupdate.org> --- bootloader/uboot.c | 4 ++-- core/swupdate.c | 7 +++++++ examples/configuration/swupdate.cfg | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-)