summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2007-03-01 21:12:06 +0100
committerStefan Roese <sr@denx.de>2007-03-01 21:12:06 +0100
commit3bf6c39b7bbd103fe58c7532152529bcd9b8fabe (patch)
treea26b42873e78aea0b5b6cfb29b558d6019e1d8a6 /board
parent8c12045a3b06c5b6675d3fe02fbc9f545988129a (diff)
parentccbc7036648e465697ca298ba51e0e76dda352a0 (diff)
downloadu-boot-imx-3bf6c39b7bbd103fe58c7532152529bcd9b8fabe.zip
u-boot-imx-3bf6c39b7bbd103fe58c7532152529bcd9b8fabe.tar.gz
u-boot-imx-3bf6c39b7bbd103fe58c7532152529bcd9b8fabe.tar.bz2
Merge with /home/sr/git/u-boot/denx
Diffstat (limited to 'board')
-rw-r--r--board/mcc200/auto_update.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/board/mcc200/auto_update.c b/board/mcc200/auto_update.c
index faa01bd..90d03ec 100644
--- a/board/mcc200/auto_update.c
+++ b/board/mcc200/auto_update.c
@@ -162,7 +162,7 @@ int au_check_cksum_valid(int idx, long nbytes)
int au_check_header_valid(int idx, long nbytes)
{
image_header_t *hdr;
- unsigned long checksum;
+ unsigned long checksum, fsize;
hdr = (image_header_t *)LOAD_ADDR;
/* check the easy ones first */
@@ -205,7 +205,7 @@ int au_check_header_valid(int idx, long nbytes)
return -1;
}
if ((idx == IDX_ROOTFS) &&
- ( (hdr->ih_type != IH_TYPE_RAMDISK) || (hdr->ih_type != IH_TYPE_FILESYSTEM) )
+ ( (hdr->ih_type != IH_TYPE_RAMDISK) && (hdr->ih_type != IH_TYPE_FILESYSTEM) )
) {
printf ("Image %s wrong type\n", aufile[idx]);
ausize[idx] = 0;
@@ -213,8 +213,10 @@ int au_check_header_valid(int idx, long nbytes)
}
/* recycle checksum */
checksum = ntohl(hdr->ih_size);
- /* for kernel and app the image header must also fit into flash */
- if (idx != IDX_FIRMWARE)
+
+ fsize = checksum + sizeof(*hdr);
+ /* for kernel and ramdisk the image header must also fit into flash */
+ if (idx == IDX_KERNEL || hdr->ih_type == IH_TYPE_RAMDISK)
checksum += sizeof(*hdr);
/* check the size does not exceed space in flash. HUSH scripts */
@@ -224,7 +226,7 @@ int au_check_header_valid(int idx, long nbytes)
return -1;
}
/* Update with the real filesize */
- ausize[idx] = (idx == IDX_FIRMWARE ? checksum + sizeof(*hdr) : checksum);
+ ausize[idx] = fsize;
return checksum; /* return size to be written to flash */
}