061-image-fit-don-t-set-compression-if-it-can-t-be-read.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. From b2c109c012ca946baebbb23e7f4301f6eee4c6f3 Mon Sep 17 00:00:00 2001
  2. From: Daniel Golle <[email protected]>
  3. Date: Mon, 15 Aug 2022 12:15:50 +0200
  4. Subject: [PATCH 2/2] image-fit: don't set compression if it can't be read
  5. fit_image_get_comp() should not set value -1 in case it can't read
  6. the compression node. Instead, leave the value untouched in that case
  7. as it can be absent and a default value previously defined by the
  8. caller of fit_image_get_comp() should be used.
  9. As a result the warning message
  10. WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file!
  11. no longer shows if the compression node is actually absent.
  12. Signed-off-by: Daniel Golle <[email protected]>
  13. ---
  14. boot/bootm.c | 6 ++----
  15. boot/image-fit.c | 3 +--
  16. cmd/ximg.c | 7 ++-----
  17. 3 files changed, 5 insertions(+), 11 deletions(-)
  18. --- a/boot/bootm.c
  19. +++ b/boot/bootm.c
  20. @@ -1024,10 +1024,8 @@ static int bootm_host_load_image(const v
  21. return -EINVAL;
  22. }
  23. - if (fit_image_get_comp(fit, noffset, &image_comp)) {
  24. - puts("Can't get image compression!\n");
  25. - return -EINVAL;
  26. - }
  27. + if (fit_image_get_comp(fit, noffset, &image_comp))
  28. + image_comp = IH_COMP_NONE;
  29. /* Allow the image to expand by a factor of 4, should be safe */
  30. load_buf = malloc((1 << 20) + len * 4);
  31. --- a/boot/image-fit.c
  32. +++ b/boot/image-fit.c
  33. @@ -477,7 +477,7 @@ void fit_print_contents(const void *fit)
  34. void fit_image_print(const void *fit, int image_noffset, const char *p)
  35. {
  36. char *desc;
  37. - uint8_t type, arch, os, comp;
  38. + uint8_t type, arch, os, comp = IH_COMP_NONE;
  39. size_t size;
  40. ulong load, entry;
  41. const void *data;
  42. @@ -794,7 +794,6 @@ int fit_image_get_comp(const void *fit,
  43. data = fdt_getprop(fit, noffset, FIT_COMP_PROP, &len);
  44. if (data == NULL) {
  45. fit_get_debug(fit, noffset, FIT_COMP_PROP, len);
  46. - *comp = -1;
  47. return -1;
  48. }
  49. --- a/cmd/ximg.c
  50. +++ b/cmd/ximg.c
  51. @@ -171,11 +171,8 @@ do_imgextract(struct cmd_tbl *cmdtp, int
  52. return 1;
  53. }
  54. - if (fit_image_get_comp(fit_hdr, noffset, &comp)) {
  55. - puts("Could not find script subimage "
  56. - "compression type\n");
  57. - return 1;
  58. - }
  59. + if (fit_image_get_comp(fit_hdr, noffset, &comp))
  60. + comp = IH_COMP_NONE;
  61. data = (ulong)fit_data;
  62. len = (ulong)fit_len;