]> git.sur5r.net Git - u-boot/commitdiff
SPL: Add option to skip copying of the mkimage header
authorStefan Roese <sr@denx.de>
Mon, 27 Aug 2012 10:50:58 +0000 (12:50 +0200)
committerTom Rini <trini@ti.com>
Thu, 27 Sep 2012 18:20:27 +0000 (11:20 -0700)
On some system (e.g. powerpc), the load-address and entry-point is
located at address 0. So the current approach to load the image
(payload) including the header to the address "load-address - 64"
can't work here.

This patch adds an flag to skip this copying including header to
the SPL framework. By setting SPL_COPY_PAYLOAD_ONLY, only the
playload will be copied. This will be used by the SPL NOR flash
driver on powerpc.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Tom Rini <trini@ti.com>
common/spl/spl.c
include/spl.h

index 3156401fd52a760fdbda894b7c5b2a913e48b089..95dd9d50ccf84b32dacbfd576ad0b3605f623c00 100644 (file)
@@ -76,10 +76,23 @@ void spl_parse_image_header(const struct image_header *header)
        u32 header_size = sizeof(struct image_header);
 
        if (image_get_magic(header) == IH_MAGIC) {
-               spl_image.size = image_get_data_size(header) + header_size;
-               spl_image.entry_point = image_get_load(header);
-               /* Load including the header */
-               spl_image.load_addr = spl_image.entry_point - header_size;
+               if (spl_image.flags & SPL_COPY_PAYLOAD_ONLY) {
+                       /*
+                        * On some system (e.g. powerpc), the load-address and
+                        * entry-point is located at address 0. We can't load
+                        * to 0-0x40. So skip header in this case.
+                        */
+                       spl_image.load_addr = image_get_load(header);
+                       spl_image.entry_point = image_get_ep(header);
+                       spl_image.size = image_get_data_size(header);
+               } else {
+                       spl_image.entry_point = image_get_load(header);
+                       /* Load including the header */
+                       spl_image.load_addr = spl_image.entry_point -
+                               header_size;
+                       spl_image.size = image_get_data_size(header) +
+                               header_size;
+               }
                spl_image.os = image_get_os(header);
                spl_image.name = image_get_name(header);
                debug("spl: payload image: %s load addr: 0x%x size: %d\n",
index e40538600ee1febe94cee536cd31e44268d1ff84..cf441a16b5a37937ed991986f14aa76706ae6c42 100644 (file)
@@ -38,8 +38,11 @@ struct spl_image_info {
        u32 load_addr;
        u32 entry_point;
        u32 size;
+       u32 flags;
 };
 
+#define SPL_COPY_PAYLOAD_ONLY  1
+
 extern struct spl_image_info spl_image;
 extern u32 *boot_params_ptr;