Add support to decompress LZ4 images. LZ4 is used on more recent
Chromebooks to store the FIT image.

Signed-off-by: Stephen Boyd <swb...@chromium.org>
---
 cmd/ximg.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/cmd/ximg.c b/cmd/ximg.c
index a6341a078019..eed66c776d12 100644
--- a/cmd/ximg.c
+++ b/cmd/ximg.c
@@ -30,6 +30,7 @@
 #include <asm/byteorder.h>
 #include <asm/cache.h>
 #include <asm/io.h>
+#include <u-boot/lz4.h>
 
 static int
 do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
@@ -253,6 +254,18 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, 
char *const argv[])
                        }
                        break;
 #endif /* CONFIG_LZO */
+#if IS_ENABLED(CONFIG_LZ4)
+               case IH_COMP_LZ4:
+                       {
+                               int ret;
+                               size_t size = unc_len;
+                               printf("   Uncompressing part %d ... ", part);
+
+                               ret = ulz4fn((void *)data, len, (void *)dest, 
&size);
+                               len = size;
+                       }
+                       break;
+#endif /* CONFIG_LZ4 */
 #if IS_ENABLED(CONFIG_ZSTD)
                case IH_COMP_ZSTD:
                        {
-- 
Sent by a computer, using git, on the internet

Reply via email to