]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - common/cmd_bootm.c
common/cmd_bootm.c: fix subcommand processing in OS specific do_bootm_xxx() functions
[people/ms/u-boot.git] / common / cmd_bootm.c
index 1685c14a5261eba30d21ea29c9eb87a65fbe50e5..ba73f5781a92258c306907f15fc83c37e40278d0 100644 (file)
@@ -368,7 +368,7 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,
 
        const char *type_name = genimg_get_type_name(os.type);
 
-       load_buf = map_sysmem(load, image_len);
+       load_buf = map_sysmem(load, unc_len);
        image_buf = map_sysmem(image_start, image_len);
        switch (comp) {
        case IH_COMP_NONE:
@@ -436,11 +436,12 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,
        }
 #endif /* CONFIG_LZMA */
 #ifdef CONFIG_LZO
-       case IH_COMP_LZO:
+       case IH_COMP_LZO: {
+               size_t size;
+
                printf("   Uncompressing %s ... ", type_name);
 
-               ret = lzop_decompress(image_buf, image_len, load_buf,
-                                     &unc_len);
+               ret = lzop_decompress(image_buf, image_len, load_buf, &size);
                if (ret != LZO_E_OK) {
                        printf("LZO: uncompress or overwrite error %d "
                              "- must RESET board to recover\n", ret);
@@ -449,8 +450,9 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,
                        return BOOTM_ERR_RESET;
                }
 
-               *load_end = load + unc_len;
+               *load_end = load + size;
                break;
+       }
 #endif /* CONFIG_LZO */
        default:
                printf("Unimplemented compression type %d\n", comp);
@@ -556,6 +558,7 @@ static ulong bootm_disable_interrupts(void)
 #ifdef CONFIG_NETCONSOLE
        /* Stop the ethernet stack if NetConsole could have left it up */
        eth_halt();
+       eth_unregister(eth_get_dev());
 #endif
 
 #if defined(CONFIG_CMD_USB)
@@ -797,8 +800,12 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        return do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START |
                BOOTM_STATE_FINDOS | BOOTM_STATE_FINDOTHER |
-               BOOTM_STATE_LOADOS | BOOTM_STATE_OS_PREP |
-               BOOTM_STATE_OS_FAKE_GO | BOOTM_STATE_OS_GO, &images, 1);
+               BOOTM_STATE_LOADOS |
+#if defined(CONFIG_PPC) || defined(CONFIG_MIPS)
+               BOOTM_STATE_OS_CMDLINE |
+#endif
+               BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
+               BOOTM_STATE_OS_GO, &images, 1);
 }
 
 int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
@@ -1462,10 +1469,8 @@ static int do_bootm_netbsd(int flag, int argc, char * const argv[],
        char *consdev;
        char *cmdline;
 
-       if (flag & BOOTM_STATE_OS_PREP)
+       if (flag != BOOTM_STATE_OS_GO)
                return 0;
-       if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
-               return 1;
 
 #if defined(CONFIG_FIT)
        if (!images->legacy_hdr_valid) {
@@ -1543,10 +1548,8 @@ static int do_bootm_lynxkdi(int flag, int argc, char * const argv[],
 {
        image_header_t *hdr = &images->legacy_hdr_os_copy;
 
-       if (flag & BOOTM_STATE_OS_PREP)
+       if (flag != BOOTM_STATE_OS_GO)
                return 0;
-       if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
-               return 1;
 
 #if defined(CONFIG_FIT)
        if (!images->legacy_hdr_valid) {
@@ -1567,10 +1570,8 @@ static int do_bootm_rtems(int flag, int argc, char * const argv[],
 {
        void (*entry_point)(bd_t *);
 
-       if (flag & BOOTM_STATE_OS_PREP)
+       if (flag != BOOTM_STATE_OS_GO)
                return 0;
-       if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
-               return 1;
 
 #if defined(CONFIG_FIT)
        if (!images->legacy_hdr_valid) {
@@ -1602,10 +1603,8 @@ static int do_bootm_ose(int flag, int argc, char * const argv[],
 {
        void (*entry_point)(void);
 
-       if (flag & BOOTM_STATE_OS_PREP)
+       if (flag != BOOTM_STATE_OS_GO)
                return 0;
-       if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
-               return 1;
 
 #if defined(CONFIG_FIT)
        if (!images->legacy_hdr_valid) {
@@ -1638,10 +1637,8 @@ static int do_bootm_plan9(int flag, int argc, char * const argv[],
        void (*entry_point)(void);
        char *s;
 
-       if (flag & BOOTM_STATE_OS_PREP)
+       if (flag != BOOTM_STATE_OS_GO)
                return 0;
-       if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
-               return 1;
 
 #if defined(CONFIG_FIT)
        if (!images->legacy_hdr_valid) {
@@ -1687,10 +1684,8 @@ static int do_bootm_vxworks(int flag, int argc, char * const argv[],
 {
        char str[80];
 
-       if (flag & BOOTM_STATE_OS_PREP)
+       if (flag != BOOTM_STATE_OS_GO)
                return 0;
-       if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
-               return 1;
 
 #if defined(CONFIG_FIT)
        if (!images->legacy_hdr_valid) {
@@ -1712,10 +1707,8 @@ static int do_bootm_qnxelf(int flag, int argc, char * const argv[],
        char *local_args[2];
        char str[16];
 
-       if (flag & BOOTM_STATE_OS_PREP)
+       if (flag != BOOTM_STATE_OS_GO)
                return 0;
-       if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
-               return 1;
 
 #if defined(CONFIG_FIT)
        if (!images->legacy_hdr_valid) {
@@ -1739,10 +1732,8 @@ static int do_bootm_integrity(int flag, int argc, char * const argv[],
 {
        void (*entry_point)(void);
 
-       if (flag & BOOTM_STATE_OS_PREP)
+       if (flag != BOOTM_STATE_OS_GO)
                return 0;
-       if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
-               return 1;
 
 #if defined(CONFIG_FIT)
        if (!images->legacy_hdr_valid) {