summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/image.c8
-rw-r--r--include/image.h5
-rw-r--r--lib_ppc/bootm.c18
3 files changed, 21 insertions, 10 deletions
diff --git a/common/image.c b/common/image.c
index 5ca77b9..c689b0e 100644
--- a/common/image.c
+++ b/common/image.c
@@ -375,6 +375,10 @@ void image_print_contents (image_header_t *hdr)
* gen_image_get_format() checks whether provided address points to a valid
* legacy or FIT image.
*
+ * New uImage format and FDT blob are based on a libfdt. FDT blob
+ * may be passed directly or embedded in a FIT image. In both situations
+ * gen_image_get_format() must be able to dectect libfdt header.
+ *
* returns:
* image format type or IMAGE_FORMAT_INVALID if no image is present
*/
@@ -382,14 +386,14 @@ int gen_image_get_format (void *img_addr)
{
ulong format = IMAGE_FORMAT_INVALID;
image_header_t *hdr;
-#if defined(CONFIG_FIT)
+#if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT)
char *fit_hdr;
#endif
hdr = (image_header_t *)img_addr;
if (image_check_magic(hdr))
format = IMAGE_FORMAT_LEGACY;
-#if defined(CONFIG_FIT)
+#if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT)
else {
fit_hdr = (char *)img_addr;
if (fdt_check_header (fit_hdr) == 0)
diff --git a/include/image.h b/include/image.h
index 1bc090a..08566ea 100644
--- a/include/image.h
+++ b/include/image.h
@@ -376,8 +376,9 @@ const char* image_get_comp_name (uint8_t comp);
void image_print_contents (image_header_t *hdr);
#define IMAGE_FORMAT_INVALID 0x00
-#define IMAGE_FORMAT_LEGACY 0x01
-#define IMAGE_FORMAT_FIT 0x02
+#define IMAGE_FORMAT_LEGACY 0x01 /* legacy image_header based format */
+#define IMAGE_FORMAT_FIT 0x02 /* new, libfdt based format */
+
int gen_image_get_format (void *img_addr);
ulong gen_get_image (ulong img_addr);
diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index ad05bc5..d80d69a 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -357,11 +357,15 @@ static void get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
fdt_blob = (char *)image_get_load (fdt_hdr);
break;
-#if defined(CONFIG_FIT)
case IMAGE_FORMAT_FIT:
-
- /* check FDT blob vs FIT hdr */
- if (fit_uname_config || fit_uname_fdt) {
+ /*
+ * This case will catch both: new uImage format
+ * (libfdt based) and raw FDT blob (also libfdt
+ * based).
+ */
+#if defined(CONFIG_FIT)
+ /* check FDT blob vs FIT blob */
+ if (0) { /* FIXME: call FIT format verification */
/*
* FIT image
*/
@@ -369,15 +373,17 @@ static void get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
debug ("* fdt: FIT format image\n");
fit_unsupported_reset ("PPC fdt");
do_reset (cmdtp, flag, argc, argv);
- } else {
+ } else
+#endif
+ {
/*
* FDT blob
*/
+ debug ("* fdt: raw FDT blob\n");
printf ("## Flattened Device Tree blob at %08lx\n", fdt_blob);
fdt_blob = (char *)fdt_addr;
}
break;
-#endif
default:
fdt_error ("Did not find a cmdline Flattened Device Tree");
do_reset (cmdtp, flag, argc, argv);