[brcm63xx] add imagetag support for BT Voyager 2500V, patch from Daniel Dickinson...
authorFlorian Fainelli <florian@openwrt.org>
Thu, 18 Jun 2009 15:00:32 +0000 (15:00 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Thu, 18 Jun 2009 15:00:32 +0000 (15:00 +0000)
SVN-Revision: 16506

target/linux/brcm63xx/files/include/asm-mips/mach-bcm63xx/bcm_tag.h
target/linux/brcm63xx/image/Makefile
tools/firmware-utils/src/imagetag.c

index a4f06f8..c06f668 100644 (file)
@@ -128,7 +128,7 @@ struct bcm_tag_bc221 {
         unsigned char rootAddress[ADDRESS_LEN];         // 170-181: Address in memory of rootfs partition
         unsigned char rootLength[IMAGE_LEN];            // 182-191: Size of rootfs partition
         unsigned char flashLayoutVer[4];                // 192-195: Version flash layout
-        unsigned char kernelCRC[4];                     // 196-199: Guessed to be kernel CRC
+        unsigned char fskernelCRC[4];                   // 196-199: Guessed to be kernel CRC
         unsigned char reserved4[16];                    // 200-215: Reserved area; unused at present
        unsigned char imageCRC[4];                      // 216-219: CRC32 of images
         unsigned char reserved2[12];                    // 220-231: Unused at present
index c10a41b..515caea 100644 (file)
@@ -101,7 +101,7 @@ define Image/Build
        $(call Image/Build/CFE,$(1),96345GW2,6345,bc221,,bc221,-y 5)
        $(call Image/Build/CFE,$(1),96345GW2,6345,bc300,,bc300,)
        $(call Image/Build/CFE,$(1),96345GW2,6345,bc310,OpenWRT-$(REVISION),bc310,)
-       $(call Image/Build/CFE,$(1),96348GW,6348,bccfe,,bcfe,)
+       $(call Image/Build/CFE,$(1),96348GW,6348,bccfe,,bccfe,)
        $(call Image/Build/CFE,$(1),96348GW,6348,bc221,,bc221,-y 5)
        # BT Voyager V210_BTR
        $(call Image/Build/CFE,$(1),V210_BB,6348,bc221,,btvgr,-y 5)
index 4d5bb7d..bd62b20 100644 (file)
@@ -135,11 +135,12 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
        union bcm_tag tag;
        struct kernelhdr khdr;
        FILE *kernelfile = NULL, *rootfsfile = NULL, *binfile;
-       size_t kerneloff, kernellen, rootfsoff, rootfslen, read, imagelen, rootfsoffpadlen;
+       size_t kerneloff, kernellen, rootfsoff, rootfslen, read, imagelen, rootfsoffpadlen, kernelfslen;
        uint8_t readbuf[1024];
        uint32_t imagecrc = IMAGETAG_CRC_START;
        uint32_t kernelcrc = IMAGETAG_CRC_START;
        uint32_t rootfscrc = IMAGETAG_CRC_START;
+       uint32_t kernelfscrc = IMAGETAG_CRC_START;
        const uint32_t deadcode = htonl(DEADCODE);
         union int2char intchar;
 
@@ -230,7 +231,7 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
                /* Compute the crc32 of the entire image (deadC0de included) */
                imagecrc = compute_crc32(imagecrc, binfile, kerneloff - fwaddr, imagelen);
                /* Compute the crc32 of the kernel and padding between kernel and rootfs) */
-               kernelcrc = compute_crc32(kernelcrc, binfile, kerneloff - fwaddr, kernellen + rootfsoffpadlen);
+               kernelfscrc = compute_crc32(kernelfscrc, binfile, kerneloff - fwaddr, kernellen + rootfsoffpadlen + rootfslen + sizeof(deadcode));
        } else if ( tagid && (strncmp(tagid, "bc310", TAGID_LEN) == 0) ) {
                /* Compute the crc32 of the entire image (deadC0de included) */
                imagecrc = compute_crc32(imagecrc, binfile, kerneloff - fwaddr, imagelen);
@@ -376,7 +377,7 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
 
          int2tag(tag.bc221.tagIdCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&(tag.bc221.tagId[0]), TAGID_LEN));
          int2tag(tag.bc221.imageCRC, imagecrc);
-         int2tag(tag.bc221.kernelCRC, kernelcrc);
+         int2tag(tag.bc221.fskernelCRC, kernelfscrc);
          int2tag(tag.bc221.headerCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&tag, sizeof(tag) - 20));
        } else if ( tagid && (strcmp(tagid, "bc310") == 0)) {
          /* Build the tag */