[U-Boot] [PATCH v2 1/3] image: Make image_get_fdt work like image_get_{ram_disk, kernel}

Stephen Warren swarren at nvidia.com
Tue Nov 1 17:28:20 CET 2011


image_get_ram_disk() and image_get_kernel() perform operations in a
consistent order. Modify image_get_fdt() to do things the same way.
This allows a later change to insert some image header manipulations
into these three functions in a consistent fashion.

v2: New patch

Signed-off-by: Stephen Warren <swarren at nvidia.com>
---
 common/image.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/common/image.c b/common/image.c
index 555d9d9..b773505 100644
--- a/common/image.c
+++ b/common/image.c
@@ -1131,14 +1131,19 @@ static const image_header_t *image_get_fdt(ulong fdt_addr)
 {
 	const image_header_t *fdt_hdr = (const image_header_t *)fdt_addr;
 
-	image_print_contents(fdt_hdr);
+	if (!image_check_magic(fdt_hdr)) {
+		fdt_error("fdt header bad magic number\n");
+		return NULL;
+	}
 
-	puts("   Verifying Checksum ... ");
 	if (!image_check_hcrc(fdt_hdr)) {
 		fdt_error("fdt header checksum invalid");
 		return NULL;
 	}
 
+	image_print_contents(fdt_hdr);
+
+	puts("   Verifying Checksum ... ");
 	if (!image_check_dcrc(fdt_hdr)) {
 		fdt_error("fdt checksum invalid");
 		return NULL;
-- 
1.7.0.4



More information about the U-Boot mailing list