summaryrefslogtreecommitdiffstats
path: root/board/trab
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-10-07 20:01:55 +0000
committerwdenk <wdenk>2003-10-07 20:01:55 +0000
commitd9a405aaf62cc8204f7300eb94713b39df793f04 (patch)
tree12db16a6247a291d3bcd2c8388a47b1365b5e95d /board/trab
parent147031aef15cedbcb6dea3679094baba34002f66 (diff)
downloadu-boot-d9a405aaf62cc8204f7300eb94713b39df793f04.tar.gz
u-boot-d9a405aaf62cc8204f7300eb94713b39df793f04.tar.xz
u-boot-d9a405aaf62cc8204f7300eb94713b39df793f04.zip
Use IH_TYPE_FILESYSTEM for TRAB "disk" images.
Diffstat (limited to 'board/trab')
-rw-r--r--board/trab/auto_update.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/board/trab/auto_update.c b/board/trab/auto_update.c
index 3113cf89ad..f44b9bf594 100644
--- a/board/trab/auto_update.c
+++ b/board/trab/auto_update.c
@@ -254,9 +254,11 @@ au_check_valid(int idx, long nbytes)
printf ("Image %s wrong type\n", aufile[idx]);
return -1;
}
- if ((idx == IDX_DISK || idx == IDX_APP)
- && (hdr->ih_type != IH_TYPE_RAMDISK))
- {
+ if ((idx == IDX_DISK) && (hdr->ih_type != IH_TYPE_FILESYSTEM)) {
+ printf ("Image %s wrong type\n", aufile[idx]);
+ return -1;
+ }
+ if ((idx == IDX_APP) && (hdr->ih_type != IH_TYPE_RAMDISK)) {
printf ("Image %s wrong type\n", aufile[idx]);
return -1;
}
@@ -269,8 +271,14 @@ au_check_valid(int idx, long nbytes)
/* special case for prepare.img */
if (idx == IDX_PREPARE)
return 0;
- /* check the size does not exceed space in flash */
- if ((ausize[idx] != 0) && (ausize[idx] < ntohl(hdr->ih_size))) {
+ /* recycle checksum */
+ checksum = ntohl(hdr->ih_size);
+ /* for kernel and app the image header must also fit into flash */
+ if (idx != IDX_DISK)
+ checksum += sizeof(*hdr);
+ /* check the size does not exceed space in flash. HUSH scripts */
+ /* all have ausize[] set to 0 */
+ if ((ausize[idx] != 0) && (ausize[idx] < checksum)) {
printf ("Image %s is bigger than FLASH\n", aufile[idx]);
return -1;
}