X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fbootm.c;h=58936ca4978a9e3914abdfd415b84c133b73cfe9;hb=1caf934a0504013874238445daaea7f32c36ab04;hp=34f60bbb5319e0fe8bea2c8ac0c5db85fdcae76f;hpb=b9cb64825b5e6efeb715abd8b48d9b12f98973e9;p=u-boot diff --git a/common/bootm.c b/common/bootm.c index 34f60bbb53..58936ca497 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -205,7 +206,23 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc, return 0; } -static int bootm_find_ramdisk(int flag, int argc, char * const argv[]) +/** + * bootm_find_images - wrapper to find and locate various images + * @flag: Ignored Argument + * @argc: command argument count + * @argv: command argument list + * + * boot_find_images() will attempt to load an available ramdisk, + * flattened device tree, as well as specifically marked + * "loadable" images (loadables are FIT only) + * + * Note: bootm_find_images will skip an image if it is not found + * + * @return: + * 0, if all existing images were loaded correctly + * 1, if an image is found but corrupted, or invalid + */ +int bootm_find_images(int flag, int argc, char * const argv[]) { int ret; @@ -217,14 +234,7 @@ static int bootm_find_ramdisk(int flag, int argc, char * const argv[]) return 1; } - return 0; -} - #if defined(CONFIG_OF_LIBFDT) -static int bootm_find_fdt(int flag, int argc, char * const argv[]) -{ - int ret; - /* find flattened device tree */ ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, &images, &images.ft_addr, &images.ft_len); @@ -232,21 +242,17 @@ static int bootm_find_fdt(int flag, int argc, char * const argv[]) puts("Could not find a valid device tree\n"); return 1; } - set_working_fdt_addr((ulong)images.ft_addr); - - return 0; -} #endif -int bootm_find_ramdisk_fdt(int flag, int argc, char * const argv[]) -{ - if (bootm_find_ramdisk(flag, argc, argv)) - return 1; - -#if defined(CONFIG_OF_LIBFDT) - if (bootm_find_fdt(flag, argc, argv)) +#if defined(CONFIG_FIT) + /* find all of the loadables */ + ret = boot_get_loadable(argc, argv, &images, IH_ARCH_DEFAULT, + NULL, NULL); + if (ret) { + printf("Loadable(s) is corrupt or invalid\n"); return 1; + } #endif return 0; @@ -260,7 +266,7 @@ static int bootm_find_other(cmd_tbl_t *cmdtp, int flag, int argc, (images.os.type == IH_TYPE_MULTI)) && (images.os.os == IH_OS_LINUX || images.os.os == IH_OS_VXWORKS)) - return bootm_find_ramdisk_fdt(flag, argc, argv); + return bootm_find_images(flag, argc, argv); return 0; } @@ -383,6 +389,15 @@ int bootm_decomp_image(int comp, ulong load, ulong image_start, int type, break; } #endif /* CONFIG_LZO */ +#ifdef CONFIG_LZ4 + case IH_COMP_LZ4: { + size_t size = unc_len; + + ret = ulz4fn(image_buf, image_len, load_buf, &size); + image_len = size; + break; + } +#endif /* CONFIG_LZ4 */ default: printf("Unimplemented compression type %d\n", comp); return BOOTM_ERR_UNIMPLEMENTED; @@ -468,7 +483,9 @@ ulong bootm_disable_interrupts(void) #ifdef CONFIG_NETCONSOLE /* Stop the ethernet stack if NetConsole could have left it up */ eth_halt(); +# ifndef CONFIG_DM_ETH eth_unregister(eth_get_dev()); +# endif #endif #if defined(CONFIG_CMD_USB)