From f811c91c06bffe32f46472524059914987e653ba Mon Sep 17 00:00:00 2001 From: Christian Storm Date: Tue, 21 May 2019 16:20:02 +0200 Subject: [PATCH] u-boot: fix script format when !CONFIG_UBOOT_NEWAPI When !CONFIG_UBOOT_NEWAPI and hence linking against U-Boot's tools/env/lib.a, SWUpdate's bootloader/uboot.c calls lib.a's fw_parse_script() which expects input to be in format, quoting: ... * Each line has a couple with name, value: * variable_namevariable_value This was changed in SWUpdate by commit dab1b70 "Unify bootloader script format" to be '='-separated instead of space-separated, hence breaking the integration with the "old" libubootenv binding. Signed-off-by: Christian Storm Reported-by: Akihiro Suzuki Acked-by: Stefano Babic [Backported from: f811c91c06bffe32f46472524059914987e653ba] Signed-off-by: Pierre-Jean Texier --- corelib/installer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/corelib/installer.c b/corelib/installer.c index edfcb6a..2dda40a 100644 --- a/corelib/installer.c +++ b/corelib/installer.c @@ -169,7 +169,11 @@ static int update_bootloader_env(struct swupdate_cfg *cfg, const char *script) if (!key || !value) continue; +#if defined(CONFIG_UBOOT) && !defined(CONFIG_UBOOT_NEWAPI) + snprintf(buf, sizeof(buf), "%s %s\n", key, value); +#else snprintf(buf, sizeof(buf), "%s=%s\n", key, value); +#endif if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf)) { TRACE("Error saving temporary bootloader environment file"); close(fd); -- 2.7.4