Commit 022b4975c8dd304fa9f949594784f78601ae07c2
Committed by
Tom Rini
1 parent
33d346464a
Exists in
master
and in
54 other branches
SPL: Add option to skip copying of the mkimage header
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>
Showing 2 changed files with 20 additions and 4 deletions Side-by-side Diff
common/spl/spl.c
... | ... | @@ -76,10 +76,23 @@ |
76 | 76 | u32 header_size = sizeof(struct image_header); |
77 | 77 | |
78 | 78 | if (image_get_magic(header) == IH_MAGIC) { |
79 | - spl_image.size = image_get_data_size(header) + header_size; | |
80 | - spl_image.entry_point = image_get_load(header); | |
81 | - /* Load including the header */ | |
82 | - spl_image.load_addr = spl_image.entry_point - header_size; | |
79 | + if (spl_image.flags & SPL_COPY_PAYLOAD_ONLY) { | |
80 | + /* | |
81 | + * On some system (e.g. powerpc), the load-address and | |
82 | + * entry-point is located at address 0. We can't load | |
83 | + * to 0-0x40. So skip header in this case. | |
84 | + */ | |
85 | + spl_image.load_addr = image_get_load(header); | |
86 | + spl_image.entry_point = image_get_ep(header); | |
87 | + spl_image.size = image_get_data_size(header); | |
88 | + } else { | |
89 | + spl_image.entry_point = image_get_load(header); | |
90 | + /* Load including the header */ | |
91 | + spl_image.load_addr = spl_image.entry_point - | |
92 | + header_size; | |
93 | + spl_image.size = image_get_data_size(header) + | |
94 | + header_size; | |
95 | + } | |
83 | 96 | spl_image.os = image_get_os(header); |
84 | 97 | spl_image.name = image_get_name(header); |
85 | 98 | debug("spl: payload image: %s load addr: 0x%x size: %d\n", |