~ubuntu-branches/ubuntu/maverick/uboot-imx/maverick

« back to all changes in this revision

Viewing changes to tools/mkimage.c

  • Committer: Bazaar Package Importer
  • Author(s): Oliver Grawert
  • Date: 2010-01-06 09:28:25 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100106092825-q8o7x811035syh8k
Tags: 2009.08-0ubuntu1
* move to new upstream (2009.08)
* move to new freescale patchset for the 2009.08 release
* remove README.nios_CONFIG_SYS_NIOS_CPU from debian/docs, 
  this is not shipped upstream anymore
* update 1000_fix_gcc_4.4_compability.patch to apply to the new code
* Makefile target is now mx51_bbg_config, update rules accordingly
* switch everything to to3 (including the binary package)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "mkimage.h"
26
26
#include <image.h>
27
27
 
28
 
extern int errno;
29
 
 
30
 
#ifndef MAP_FAILED
31
 
#define MAP_FAILED (void *)(-1)
32
 
#endif
33
 
 
34
28
extern  unsigned long   crc32 (unsigned long crc, const char *buf, unsigned int len);
35
29
static  void            copy_file (int, const char *, int);
36
30
static  void            usage (void);
502
496
         */
503
497
        memcpy (hdr, ptr, sizeof(image_header_t));
504
498
 
505
 
        if (ntohl(hdr->ih_magic) != IH_MAGIC) {
 
499
        if (be32_to_cpu(hdr->ih_magic) != IH_MAGIC) {
506
500
                fprintf (stderr,
507
501
                        "%s: Bad Magic Number: \"%s\" is no valid image\n",
508
502
                        cmdname, imagefile);
512
506
        data = (char *)hdr;
513
507
        len  = sizeof(image_header_t);
514
508
 
515
 
        checksum = ntohl(hdr->ih_hcrc);
516
 
        hdr->ih_hcrc = htonl(0);        /* clear for re-calculation */
 
509
        checksum = be32_to_cpu(hdr->ih_hcrc);
 
510
        hdr->ih_hcrc = cpu_to_be32(0);  /* clear for re-calculation */
517
511
 
518
512
        if (crc32 (0, data, len) != checksum) {
519
513
                fprintf (stderr,
525
519
        data = ptr + sizeof(image_header_t);
526
520
        len  = image_size - sizeof(image_header_t) ;
527
521
 
528
 
        if (crc32 (0, data, len) != ntohl(hdr->ih_dcrc)) {
 
522
        if (crc32 (0, data, len) != be32_to_cpu(hdr->ih_dcrc)) {
529
523
                fprintf (stderr,
530
524
                        "%s: ERROR: \"%s\" has corrupted data!\n",
531
525
                        cmdname, imagefile);