Changeset 24009 for branches/backfire


Ignore:
Timestamp:
2010-11-15T19:38:58+01:00 (6 years ago)
Author:
florian
Message:

backport r21848 and r24000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/backfire/tools/firmware-utils/src/imagetag.c

    r20652 r24009  
    3333}; 
    3434 
    35 /* This appears to be necessary due to alignment issues */ 
     35/* Convert uint32_t CRC to bigendian and copy it into a character array */ 
    3636#define int2tag(tag, value)  intchar.input = htonl(value);      \ 
    37           strncpy(tag, intchar.output, sizeof(union int2char)) 
     37          memcpy(tag, intchar.output, sizeof(union int2char)) 
    3838 
    3939/* Kernel header */ 
     
    9595 
    9696        fseek(binfile, compute_start, SEEK_SET); 
    97          
     97 
    9898        /* read block of 1024 bytes */ 
    9999        while (binfile && !feof(binfile) && !ferror(binfile) && (compute_len >= sizeof(readbuf))) { 
     
    222222        fseek(binfile, rootfsoff + rootfslen - fwaddr, SEEK_SET); 
    223223        fwrite(&deadcode, sizeof(uint32_t), 1, binfile); 
    224          
     224 
    225225        /* Flush the binfile buffer so that when we read from file, it contains 
    226226         * everything in the buffer 
     
    244244         */ 
    245245        rootfscrc = compute_crc32(rootfscrc, binfile, kerneloff - fwaddr, rootfslen + sizeof(deadcode)); 
    246          
     246 
    247247        /* Close the files */ 
    248248        fclose(kernelfile); 
     
    307307        uint32_t fwaddr, flash_bs; 
    308308        int tagidfound = 0; 
    309          
     309 
    310310        kernel = rootfs = bin = boardid = chipid = magic2 = ver = rsignature = layoutver = NULL; 
    311311        entry = 0; 
     
    395395                return 1; 
    396396        } 
    397          
     397 
    398398        /* Fallback to defaults */ 
    399399 
    400400        fwaddr = flashstart + fwoffset; 
    401          
     401 
    402402        if (!magic2) { 
    403403                magic2 = malloc(sizeof(char) * 14); 
     
    417417                strcpy(ver, IMAGETAG_VER); 
    418418        } 
    419                  
     419 
    420420 
    421421        return tagfile(kernel, rootfs, bin, boardid, chipid, fwaddr, loadaddr, entry, ver, magic2, flash_bs, rsignature, layoutver); 
Note: See TracChangeset for help on using the changeset viewer.