]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
Use IH_TYPE_FILESYSTEM for TRAB "disk" images.
authorwdenk <wdenk>
Tue, 7 Oct 2003 20:01:55 +0000 (20:01 +0000)
committerwdenk <wdenk>
Tue, 7 Oct 2003 20:01:55 +0000 (20:01 +0000)
CHANGELOG
board/trab/auto_update.c

index f3481222cedb19e0c9d7cee62378566c6f4635be..c1492ccd43803a44eb6cc4908935358b47ec4068 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,8 @@
 Changes for U-Boot 1.0.0:
 ======================================================================
 
+* Use IH_TYPE_FILESYSTEM for TRAB "disk" images.
+
 * Fix build problems under FreeBSD
 
 * Add generic filesystem image type
index 3113cf89ad00858cbdaf826018f7919b835c2f56..f44b9bf5944fdeaedc8e5f5ca1205601bcc9baaa 100644 (file)
@@ -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;
        }