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 | ||
---|---|---|
56 | 56 | -a 0x10000 -f $(KDIR)/root.$(1) |
57 | 57 | endef |
58 | 58 | define 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 | |
60 | 60 | endef |
61 | 61 | |
62 | 62 | define Image/Build/trxV2 |
tools/firmware-utils/src/trx.c | ||
---|---|---|
98 | 98 | int c, i, append = 0; |
99 | 99 | size_t n; |
100 | 100 | ssize_t n2; |
101 | uint32_t cur_len; | |
101 | uint32_t cur_len, fsmark=0; | |
102 | 102 | unsigned long maxlen = TRX_MAX_LEN; |
103 | 103 | struct trx_header *p; |
104 | 104 | char trx_version = 1; |
... | ... | |
131 | 131 | cur_len += 4; |
132 | 132 | } |
133 | 133 | break; |
134 | case 'F': | |
135 | fsmark = cur_len; | |
134 | 136 | case 'A': |
135 | 137 | append = 1; |
136 | 138 | /* fall through */ |
... | ... | |
269 | 271 | } |
270 | 272 | |
271 | 273 | 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)); | |
273 | 275 | p->crc32 = STORE32_LE(p->crc32); |
274 | 276 | |
275 | p->len = STORE32_LE(cur_len); | |
277 | p->len = (fsmark)?fsmark:cur_len - offsetof(struct trx_header, flag_version); | |
276 | 278 | |
277 | 279 | /* restore TRXv2 bin-header */ |
278 | 280 | if (trx_version == 2) { |