Date:2010-07-27 17:37:37 (13 years 8 months ago)
Author:markus
Commit:3c05ba24723fa368dd070c212376b7dbaa4269a6
Message:fix CRC32 calculation for sysupgrade

* reduce image size for CRC calculation by fs_mark size

sysupgrade sometimes failed for me and I noticed that it was due
to incorrect CRC values in trx-header after performing it.
It seems that the fs_mark was completely included in the calculation
and that it was nevertheless modified by sysupgrade while appending
the jffs data.
This only occurs for the first boot after sysupgrade as the flashmap
driver recalculates the CRC to an even smaller area when it boots.



git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22396 3c298f89-4303-0410-b956-a3cf2f4a3e73
Files: target/linux/brcm47xx/image/Makefile (1 diff)
tools/firmware-utils/src/trx.c (3 diffs)

Change Details

target/linux/brcm47xx/image/Makefile
5656-a 0x10000 -f $(KDIR)/root.$(1)
5757endef
5858define trxalign/squashfs
59-a 1024 -f $(KDIR)/root.$(1) $(if $(2),-f $(2)) -a 0x10000 -A $(KDIR)/fs_mark
59-a 1024 -f $(KDIR)/root.$(1) $(if $(2),-f $(2)) -a 0x10000 -F $(KDIR)/fs_mark
6060endef
6161
6262define Image/Build/trxV2
tools/firmware-utils/src/trx.c
9898    int c, i, append = 0;
9999    size_t n;
100100    ssize_t n2;
101    uint32_t cur_len;
101    uint32_t cur_len, fsmark=0;
102102    unsigned long maxlen = TRX_MAX_LEN;
103103    struct trx_header *p;
104104    char trx_version = 1;
...... 
131131                    cur_len += 4;
132132                }
133133                break;
134            case 'F':
135                fsmark = cur_len;
134136            case 'A':
135137                append = 1;
136138                /* fall through */
...... 
269271    }
270272
271273    p->crc32 = crc32buf((char *) &p->flag_version,
272                        cur_len - offsetof(struct trx_header, flag_version));
274                        (fsmark)?fsmark:cur_len - offsetof(struct trx_header, flag_version));
273275    p->crc32 = STORE32_LE(p->crc32);
274276
275    p->len = STORE32_LE(cur_len);
277    p->len = (fsmark)?fsmark:cur_len - offsetof(struct trx_header, flag_version);
276278
277279    /* restore TRXv2 bin-header */
278280    if (trx_version == 2) {

Archive Download the corresponding diff file



interactive