Merge branch 'master' into next
[oweals/u-boot.git] / common / cmd_bootm.c
index 401bf27d15de35d54841ab2813e4f98d4b4f5fe9..efd6aec0cf19f60b36e32f15c5345db6be03865e 100644 (file)
 #include <lzma/LzmaTools.h>
 #endif /* CONFIG_LZMA */
 
+#ifdef CONFIG_LZO
+#include <linux/lzo.h>
+#endif /* CONFIG_LZO */
+
 DECLARE_GLOBAL_DATA_PTR;
 
 extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
@@ -405,6 +409,24 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
                *load_end = load + unc_len;
                break;
 #endif /* CONFIG_LZMA */
+#ifdef CONFIG_LZO
+       case IH_COMP_LZO:
+               printf ("   Uncompressing %s ... ", type_name);
+
+               int ret = lzop_decompress((const unsigned char *)image_start,
+                                         image_len, (unsigned char *)load,
+                                         &unc_len);
+               if (ret != LZO_E_OK) {
+                       printf ("LZO: uncompress or overwrite error %d "
+                             "- must RESET board to recover\n", ret);
+                       if (boot_progress)
+                               show_boot_progress (-6);
+                       return BOOTM_ERR_RESET;
+               }
+
+               *load_end = load + unc_len;
+               break;
+#endif /* CONFIG_LZO */
        default:
                printf ("Unimplemented compression type %d\n", comp);
                return BOOTM_ERR_UNIMPLEMENTED;
@@ -453,8 +475,8 @@ cmd_tbl_t cmd_bootm_sub[] = {
 #ifdef CONFIG_OF_LIBFDT
        U_BOOT_CMD_MKENT(fdt, 0, 1, (void *)BOOTM_STATE_FDT, "", ""),
 #endif
-       U_BOOT_CMD_MKENT(bdt, 0, 1, (void *)BOOTM_STATE_OS_BD_T, "", ""),
        U_BOOT_CMD_MKENT(cmdline, 0, 1, (void *)BOOTM_STATE_OS_CMDLINE, "", ""),
+       U_BOOT_CMD_MKENT(bdt, 0, 1, (void *)BOOTM_STATE_OS_BD_T, "", ""),
        U_BOOT_CMD_MKENT(prep, 0, 1, (void *)BOOTM_STATE_OS_PREP, "", ""),
        U_BOOT_CMD_MKENT(go, 0, 1, (void *)BOOTM_STATE_OS_GO, "", ""),
 };
@@ -1000,8 +1022,8 @@ U_BOOT_CMD(
 #if defined(CONFIG_OF_LIBFDT)
        "\tfdt     - relocate flat device tree\n"
 #endif
-       "\tbdt     - OS specific bd_t processing\n"
        "\tcmdline - OS specific command line processing/setup\n"
+       "\tbdt     - OS specific bd_t processing\n"
        "\tprep    - OS specific prep before relocation or go\n"
        "\tgo      - start OS"
 );