Ignore:
Timestamp:
2011-02-12T14:17:47+01:00 (6 years ago)
Author:
hauke
Message:

brcm47xx: fix error when build firmware on x86_64 host (closes #7672)

File:
1 edited

Legend:

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

    r24217 r25472  
    2424 
    2525 
    26 #define EDIMAX_PS16     0x36315350 
    27 #define EDIMAX_HDR_LEN 0xc 
     26#define EDIMAX_PS16     0x36315350      /* "PS16" */ 
     27#define EDIMAX_HDR_LEN  0xc 
    2828 
    2929 
     
    9595        FILE *fpOut = NULL; 
    9696        long  nImgSize; 
    97         uint32_t sign = EDIMAX_PS16;    /* signature for header */ 
    98         uint32_t start_addr = 0x80500000; /* start address but doesn't seems to be used... */ 
    99         uint32_t length; /* length of data, not used too ...*/ 
     97        uint32_t sign = EDIMAX_PS16;            /* signature for header */ 
     98        uint32_t start_addr = 0x80500000;       /* start address but doesn't seems to be used... */ 
     99        uint32_t length;                        /* length of data, not used too ...*/ 
    100100        size_t res; 
    101101 
     
    114114                return EXIT_FAILURE; 
    115115        } 
     116        /* compute the length of the file */ 
    116117        fseek(fpIn, 0, SEEK_END); 
    117118        length = ftell(fpIn); 
    118  
     119        /* alloc enough memory to store the file */ 
    119120        buf = (char *)malloc(length); 
    120121        if (!buf) { 
     
    122123                return EXIT_FAILURE; 
    123124        } 
    124  
     125         
    125126        rewind(fpIn); 
     127        /* read the whole file*/ 
    126128        res = fread(buf, 1, length, fpIn); 
    127129 
     
    141143        /* make the 3 partition beeing 12 bytes closer from the header */ 
    142144        memcpy(buf + p->offsets[2] - EDIMAX_HDR_LEN, buf + p->offsets[2], length - p->offsets[2]); 
     145        /* recompute the crc32 check */ 
    143146        p->crc32 = crc32buf((char *) &p->flag_version, length - offsetof(struct trx_header, flag_version)); 
    144  
    145         fwrite(&sign,  sizeof(long), 1, fpOut); 
    146         fwrite(&length, sizeof(long), 1, fpOut); 
    147         fwrite(&start_addr, sizeof(long), 1, fpOut); 
     147        /* write the modified file */ 
     148        fwrite(&sign,  sizeof(uint32_t), 1, fpOut); 
     149        fwrite(&length, sizeof(uint32_t), 1, fpOut); 
     150        fwrite(&start_addr, sizeof(uint32_t), 1, fpOut); 
    148151        fwrite(buf, sizeof(char), length, fpOut); 
    149152        fclose(fpOut); 
Note: See TracChangeset for help on using the changeset viewer.