[U-Boot] [PATCH 1/2] image: Support relative-addresses property in FIT images

Stephen Warren swarren at nvidia.com
Fri Sep 30 21:53:02 CEST 2011


uImage files contain absolute "load" and "entry" addresses. Such a concept
is incompatible with using the same kernel image on multiple SoCs, each with
a potentially different SDRAM base. To support that, augment the FIT image
syntax with a "relative-addresses" property, which indicates that the "load"
and "entry" properties are an offset from SDRAM, rather than an absolute
address.

In theory, a similar change could be made to the legacy uImage format.
However, representing the a "relative-addresses" flag in that format is
problematic, so I have ignored that possibility for now.

Signed-off-by: Stephen Warren <swarren at nvidia.com>
---
 common/image.c                        |   14 ++++++++++++++
 doc/uImage.FIT/source_file_format.txt |    3 +++
 include/image.h                       |    1 +
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/common/image.c b/common/image.c
index d38ce4a..e62fc76 100644
--- a/common/image.c
+++ b/common/image.c
@@ -2299,6 +2299,13 @@ int fit_image_get_load (const void *fit, int noffset, ulong *load)
 	}
 
 	*load = uimage_to_cpu (*data);
+
+#ifndef USE_HOSTCC
+	data = fdt_getprop(fit, noffset, FIT_REL_ADDRS_PROP, &len);
+	if (data != NULL)
+		*load += getenv_bootm_low();
+#endif
+
 	return 0;
 }
 
@@ -2327,6 +2334,13 @@ int fit_image_get_entry (const void *fit, int noffset, ulong *entry)
 	}
 
 	*entry = uimage_to_cpu (*data);
+
+#ifndef USE_HOSTCC
+	data = fdt_getprop(fit, noffset, FIT_REL_ADDRS_PROP, &len);
+	if (data != NULL)
+		*entry += getenv_bootm_low();
+#endif
+
 	return 0;
 }
 
diff --git a/doc/uImage.FIT/source_file_format.txt b/doc/uImage.FIT/source_file_format.txt
index 6d20707..c2ae67e 100644
--- a/doc/uImage.FIT/source_file_format.txt
+++ b/doc/uImage.FIT/source_file_format.txt
@@ -183,6 +183,9 @@ the '/images' node should have the following layout:
   Optional nodes:
   - hash at 1 : Each hash sub-node represents separate hash or checksum
     calculated for node's data according to specified algorithm.
+  - relative-addresses : Indicates the the values of the load and entry
+    properties are to be interpreted as relative to the base of SDRAM, rather
+    than as an absolute values.
 
 
 5) Hash nodes
diff --git a/include/image.h b/include/image.h
index 352e4a0..aefba5d 100644
--- a/include/image.h
+++ b/include/image.h
@@ -538,6 +538,7 @@ static inline int image_check_target_arch (const image_header_t *hdr)
 #define FIT_COMP_PROP		"compression"
 #define FIT_ENTRY_PROP		"entry"
 #define FIT_LOAD_PROP		"load"
+#define FIT_REL_ADDRS_PROP	"relative-addresses"
 
 /* configuration node */
 #define FIT_KERNEL_PROP		"kernel"
-- 
1.7.0.4



More information about the U-Boot mailing list