X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=common%2Fimage-fit.c;h=28f7aa83ba4e6b60882227a2670a69c27c8d76ca;hb=a83c6285388b5aa22980d96a70fff7d111d971fd;hp=1589ee3e4fb811ccb9bc8f31fbc094533abcd093;hpb=d1c3310d4084488ff483843724d42cd394ae1786;p=karo-tx-uboot.git diff --git a/common/image-fit.c b/common/image-fit.c index 1589ee3e4f..28f7aa83ba 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -16,6 +16,7 @@ #else #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; #endif /* !USE_HOSTCC*/ @@ -112,6 +113,33 @@ static void fit_get_debug(const void *fit, int noffset, fdt_strerror(err)); } +/** + * fit_get_subimage_count - get component (sub-image) count + * @fit: pointer to the FIT format image header + * @images_noffset: offset of images node + * + * returns: + * number of image components + */ +int fit_get_subimage_count(const void *fit, int images_noffset) +{ + int noffset; + int ndepth; + int count = 0; + + /* Process its subnodes, print out component images details */ + for (ndepth = 0, count = 0, + noffset = fdt_next_node(fit, images_noffset, &ndepth); + (noffset >= 0) && (ndepth > 0); + noffset = fdt_next_node(fit, noffset, &ndepth)) { + if (ndepth == 1) { + count++; + } + } + + return count; +} + #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_FIT_SPL_PRINT) /** * fit_print_contents - prints out the contents of the FIT format image @@ -423,7 +451,8 @@ void fit_image_print(const void *fit, int image_noffset, const char *p) } } } -#endif + +#endif /* !defined(CONFIG_SPL_BUILD) || defined(CONFIG_FIT_SPL_PRINT) */ /** * fit_get_desc - get node description property @@ -982,9 +1011,7 @@ int fit_image_verify(const void *fit, int image_noffset) } /* Process all hash subnodes of the component image node */ - for (noffset = fdt_first_subnode(fit, image_noffset); - noffset >= 0; - noffset = fdt_next_subnode(fit, noffset)) { + fdt_for_each_subnode(fit, noffset, image_noffset) { const char *name = fit_get_name(fit, noffset, NULL); /* @@ -1409,6 +1436,7 @@ void fit_conf_print(const void *fit, int noffset, const char *p) char *desc; char *uname; int ret; + int loadables_index; /* Mandatory properties */ ret = fit_get_desc(fit, noffset, &desc); @@ -1433,6 +1461,22 @@ void fit_conf_print(const void *fit, int noffset, const char *p) uname = (char *)fdt_getprop(fit, noffset, FIT_FDT_PROP, NULL); if (uname) printf("%s FDT: %s\n", p, uname); + + /* Print out all of the specified loadables */ + for (loadables_index = 0; + fdt_get_string_index(fit, noffset, + FIT_LOADABLE_PROP, + loadables_index, + (const char **)&uname) == 0; + loadables_index++) + { + if (loadables_index == 0) { + printf("%s Loadables: ", p); + } else { + printf("%s ", p); + } + printf("%s\n", uname); + } } static int fit_image_select(const void *fit, int rd_noffset, int verify) @@ -1500,6 +1544,8 @@ static const char *fit_get_image_type_property(int type) return FIT_RAMDISK_PROP; case IH_TYPE_X86_SETUP: return FIT_SETUP_PROP; + case IH_TYPE_LOADABLE: + return FIT_LOADABLE_PROP; } return "unknown"; @@ -1617,7 +1663,13 @@ int fit_image_load(bootm_headers_t *images, ulong addr, os_ok = image_type == IH_TYPE_FLATDT || fit_image_check_os(fit, noffset, IH_OS_LINUX) || fit_image_check_os(fit, noffset, IH_OS_OPENRTOS); - if (!type_ok || !os_ok) { + + /* + * If either of the checks fail, we should report an error, but + * if the image type is coming from the "loadables" field, we + * don't care what it is + */ + if ((!type_ok || !os_ok) && image_type != IH_TYPE_LOADABLE) { fit_image_get_os(fit, noffset, &os); printf("No %s %s %s Image\n", genimg_get_os_name(os),