Signed-off-by: Loic Poulain <loic.poul...@linaro.org>
---
 common/spl/spl_fit.c | 10 ++++++++++
 include/spl.h        |  4 +++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 1d42cb1d10..08428660b0 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -18,6 +18,7 @@
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <linux/libfdt.h>
+#include <linux/lzo.h>
 #include <linux/printk.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -215,6 +216,8 @@ static inline bool spl_fit_decompression_supported(uint8_t 
comp)
                return IS_ENABLED(CONFIG_SPL_GZIP);
        case IH_COMP_LZMA:
                return IS_ENABLED(CONFIG_SPL_LZMA);
+       case IH_COMP_LZO:
+               return IS_ENABLED(CONFIG_SPL_LZO);
        case IH_COMP_NONE:
                return true;
        }
@@ -357,6 +360,13 @@ static int load_simple_fit(struct spl_load_info *info, 
ulong sector,
                        return -EIO;
                }
                length = loadEnd - CONFIG_SYS_LOAD_ADDR;
+       } else if (IS_ENABLED(CONFIG_SPL_LZO) && image_comp == IH_COMP_LZO) {
+               size = CONFIG_SYS_BOOTM_LEN;
+               if (lzop_decompress(src, length, load_ptr, &size)) {
+                       puts("Uncompressing error\n");
+                       return -EIO;
+               }
+               length = size;
        } else {
                memcpy(load_ptr, src, length);
        }
diff --git a/include/spl.h b/include/spl.h
index 8ff20adc28..e07092372a 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -1016,6 +1016,8 @@ int spl_load_fit_image(struct spl_image_info *spl_image,
  */
 static inline bool spl_decompression_enabled(void)
 {
-       return IS_ENABLED(CONFIG_SPL_GZIP) || IS_ENABLED(CONFIG_SPL_LZMA);
+       return IS_ENABLED(CONFIG_SPL_GZIP) || IS_ENABLED(CONFIG_SPL_LZMA) ||
+               IS_ENABLED(CONFIG_SPL_LZO);
 }
+
 #endif
-- 
2.34.1

Reply via email to