0003-u-boot-fix-script-format-when-CONFIG_UBOOT_NEWAPI.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From f811c91c06bffe32f46472524059914987e653ba Mon Sep 17 00:00:00 2001
  2. From: Christian Storm <christian.storm@siemens.com>
  3. Date: Tue, 21 May 2019 16:20:02 +0200
  4. Subject: [PATCH] u-boot: fix script format when !CONFIG_UBOOT_NEWAPI
  5. When !CONFIG_UBOOT_NEWAPI and hence linking against U-Boot's
  6. tools/env/lib.a, SWUpdate's bootloader/uboot.c calls lib.a's
  7. fw_parse_script() which expects input to be in format, quoting:
  8. ...
  9. * Each line has a couple with name, value:
  10. * <white spaces>variable_name<white spaces>variable_value
  11. This was changed in SWUpdate by commit dab1b70 "Unify bootloader
  12. script format" to be '='-separated instead of space-separated,
  13. hence breaking the integration with the "old" libubootenv binding.
  14. Signed-off-by: Christian Storm <christian.storm@siemens.com>
  15. Reported-by: Akihiro Suzuki <akihiro27.suzuki@toshiba.co.jp>
  16. Acked-by: Stefano Babic <sbabic@denx.de>
  17. [Backported from: f811c91c06bffe32f46472524059914987e653ba]
  18. Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
  19. ---
  20. corelib/installer.c | 4 ++++
  21. 1 file changed, 4 insertions(+)
  22. diff --git a/corelib/installer.c b/corelib/installer.c
  23. index edfcb6a..2dda40a 100644
  24. --- a/corelib/installer.c
  25. +++ b/corelib/installer.c
  26. @@ -169,7 +169,11 @@ static int update_bootloader_env(struct swupdate_cfg *cfg, const char *script)
  27. if (!key || !value)
  28. continue;
  29. +#if defined(CONFIG_UBOOT) && !defined(CONFIG_UBOOT_NEWAPI)
  30. + snprintf(buf, sizeof(buf), "%s %s\n", key, value);
  31. +#else
  32. snprintf(buf, sizeof(buf), "%s=%s\n", key, value);
  33. +#endif
  34. if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf)) {
  35. TRACE("Error saving temporary bootloader environment file");
  36. close(fd);
  37. --
  38. 2.7.4