Ignore:
Timestamp:
2010-07-27T17:37:37+02:00 (6 years ago)
Author:
markus
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/firmware-utils/src/trx.c

    r22012 r22396  
    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; 
     
    132132                                } 
    133133                                break; 
     134                        case 'F': 
     135                                fsmark = cur_len; 
    134136                        case 'A': 
    135137                                append = 1; 
     
    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 */ 
Note: See TracChangeset for help on using the changeset viewer.