[U-Boot-Users] [PATCH 09/20] [new uImage] Add node offsets for FIT images listed in struct bootm_headers

Bartlomiej Sieka tur at semihalf.com
Wed Mar 12 21:11:22 CET 2008


From: Marian Balakowicz <m8 at semihalf.com>

This patch adds new node offset fields to struct bootm_headers
and updates bootm_headers processing code to make use of them.
Saved node offsets allow to avoid repeating fit_image_get_node() calls.

Signed-off-by: Marian Balakowicz <m8 at semihalf.com>
---

 common/cmd_bootm.c |   23 ++++++++---------------
 common/image.c     |    1 +
 include/image.h    |    7 +++++--
 lib_ppc/bootm.c    |    1 +
 4 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index aca54b5..11c476e 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -130,9 +130,6 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	ulong		image_start, image_end;
 	ulong		load_start, load_end;
 	ulong		mem_start, mem_size;
-#if defined(CONFIG_FIT)
-	int		os_noffset;
-#endif
 
 	struct lmb lmb;
 
@@ -172,32 +169,27 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		break;
 #if defined(CONFIG_FIT)
 	case IMAGE_FORMAT_FIT:
-		os_noffset = fit_image_get_node (images.fit_hdr_os,
-				images.fit_uname_os);
-		if (os_noffset < 0) {
-			printf ("Can't get image node for '%s'!\n",
-					images.fit_uname_os);
-			return 1;
-		}
-
-		if (fit_image_get_type (images.fit_hdr_os, os_noffset, &type)) {
+		if (fit_image_get_type (images.fit_hdr_os,
+					images.fit_noffset_os, &type)) {
 			puts ("Can't get image type!\n");
 			return 1;
 		}
 
-		if (fit_image_get_comp (images.fit_hdr_os, os_noffset, &comp)) {
+		if (fit_image_get_comp (images.fit_hdr_os,
+					images.fit_noffset_os, &comp)) {
 			puts ("Can't get image compression!\n");
 			return 1;
 		}
 
-		if (fit_image_get_os (images.fit_hdr_os, os_noffset, &os)) {
+		if (fit_image_get_os (images.fit_hdr_os,
+					images.fit_noffset_os, &os)) {
 			puts ("Can't get image OS!\n");
 			return 1;
 		}
 
 		image_end = fit_get_end (images.fit_hdr_os);
 
-		if (fit_image_get_load (images.fit_hdr_os, os_noffset,
+		if (fit_image_get_load (images.fit_hdr_os, images.fit_noffset_os,
 					&load_start)) {
 			puts ("Can't get image load address!\n");
 			return 1;
@@ -569,6 +561,7 @@ static void *boot_get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]
 		*os_data = (ulong)data;
 		images->fit_hdr_os = fit_hdr;
 		images->fit_uname_os = fit_uname_kernel;
+		images->fit_noffset_os = os_noffset;
 		break;
 #endif
 	default:
diff --git a/common/image.c b/common/image.c
index 6458fb1..e838f65 100644
--- a/common/image.c
+++ b/common/image.c
@@ -891,6 +891,7 @@ int boot_get_ramdisk (int argc, char *argv[], bootm_headers_t *images,
 
 			images->fit_hdr_rd = fit_hdr;
 			images->fit_uname_rd = fit_uname_ramdisk;
+			images->fit_noffset_rd = rd_noffset;
 			break;
 #endif
 		default:
diff --git a/include/image.h b/include/image.h
index 6fca6f4..51c0c89 100644
--- a/include/image.h
+++ b/include/image.h
@@ -208,13 +208,16 @@ typedef struct bootm_headers {
 #if defined(CONFIG_FIT)
 	void		*fit_hdr_os;	/* os FIT image header */
 	const char	*fit_uname_os;	/* os subimage node unit name */
+	int		fit_noffset_os;	/* os subimage node offset */
 
 	void		*fit_hdr_rd;	/* init ramdisk FIT image header */
-	const char	*fit_uname_rd;	/* init ramdisk node unit name */
+	const char	*fit_uname_rd;	/* init ramdisk subimage node unit name */
+	int		fit_noffset_rd;	/* init ramdisk subimage node offset */
 
 #if defined(CONFIG_PPC)
 	void		*fit_hdr_fdt;	/* FDT blob FIT image header */
-	const char	*fit_uname_fdt;	/* FDT blob node unit name */
+	const char	*fit_uname_fdt;	/* FDT blob subimage node unit name */
+	int		fit_noffset_fdt;/* FDT blob subimage node offset */
 #endif
 	int		verify;		/* getenv("verify")[0] != 'n' */
 	int		autostart;	/* getenv("autostart")[0] != 'n' */
diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index 60bc04b..4d8ef35 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -585,6 +585,7 @@ static int boot_get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
 
 				images->fit_hdr_fdt = fit_hdr;
 				images->fit_uname_fdt = fit_uname_fdt;
+				images->fit_noffset_fdt = fdt_noffset;
 				break;
 			} else
 #endif





More information about the U-Boot mailing list