summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-11-27 17:03:05 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-11-29 20:59:54 +0100
commitec4ee82ca96a6a4867cd3f2e58fed4afd816d14a (patch)
treed19dc5a9d7e451231b01f805a7cc83a75bb6c133 /commands
parent6dbe704263ebcfc243bcce7af0b718c67bdbd54c (diff)
downloadbarebox-ec4ee82ca96a6a4867cd3f2e58fed4afd816d14a.tar.gz
barebox-ec4ee82ca96a6a4867cd3f2e58fed4afd816d14a.tar.xz
bootm relocate_image: honour load_address
the uImage should be relocated to load_address. This is handled correctly in gzip/bzip2 compressed images, but not in uncompressed images. fix this. Also, when a variable is not used once without casting to another type it probably means that its type is wrong. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/bootm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/commands/bootm.c b/commands/bootm.c
index a486b508dc..ff9b18520f 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -62,28 +62,28 @@ int relocate_image(struct image_handle *handle, void *load_address)
image_header_t *hdr = &handle->header;
unsigned long len = image_get_size(hdr);
struct image_handle_data *iha;
- unsigned long data;
+ void *data;
#if defined CONFIG_CMD_BOOTM_ZLIB || defined CONFIG_CMD_BOOTM_BZLIB
- uint unc_len = CFG_BOOTM_LEN;
+ uint unc_len = BOOTM_LEN;
#endif
iha = image_handle_data_get_by_num(handle, 0);
- data = (unsigned long)(iha->data);
+ data = iha->data;
switch (image_get_comp(hdr)) {
case IH_COMP_NONE:
- if(image_get_load(hdr) == data) {
+ if (load_address == data) {
printf (" XIP ... ");
} else {
- memmove ((void *) image_get_load(hdr), (uchar *)data, len);
+ memmove(load_address, data, len);
}
break;
#ifdef CONFIG_CMD_BOOTM_ZLIB
case IH_COMP_GZIP:
printf (" Uncompressing ... ");
if (gunzip (load_address, unc_len,
- (uchar *)data, &len) != 0)
+ data, &len) != 0)
return -1;
break;
#endif
@@ -96,7 +96,7 @@ int relocate_image(struct image_handle *handle, void *load_address)
* at most 2300 KB of memory.
*/
if (BZ2_bzBuffToBuffDecompress (load_address,
- &unc_len, (char *)data, len,
+ &unc_len, data, len,
MALLOC_SIZE < (4096 * 1024), 0)
!= BZ_OK)
return -1;