Changes in tools/mkuimage.py [5711f6e:a44ae3dd] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/mkuimage.py

    r5711f6e ra44ae3dd  
    6060        load_addr = 0
    6161        start_addr = 0
    62         os_type = 5 #Linux is the default
    6362
    6463        while len(args) >= 2 and args[0][0] == '-':
     
    7271                elif opt == 'saddr':
    7372                        start_addr = (int)(optarg, 0)
    74                 elif opt == 'ostype':
    75                         os_type = (int)(optarg, 0)
    7673                else:
    7774                        print(base_name + ": Unrecognized option.")
     
    8885
    8986        try:
    90                 mkuimage(inf_name, outf_name, image_name, load_addr, start_addr, os_type)
     87                mkuimage(inf_name, outf_name, image_name, load_addr, start_addr)
    9188        except:
    9289                os.remove(outf_name)
    9390                raise
    9491
    95 def mkuimage(inf_name, outf_name, image_name, load_addr, start_addr, os_type):
     92def mkuimage(inf_name, outf_name, image_name, load_addr, start_addr):
    9693        inf = open(inf_name, 'rb')
    9794        outf = open(outf_name, 'wb')
     
    123120        header.start_addr = start_addr  # Address of entry point
    124121        header.data_crc = data_crc
    125         header.os = os_type
     122        header.os = 2                   # NetBSD
    126123        header.arch = 2                 # ARM
    127124        header.img_type = 2             # Kernel
    128125        header.compression = 0          # None
    129         header.img_name = image_name.encode('ascii')
     126        header.img_name = image_name
    130127
    131128        header_crc = calc_crc32(header.pack())
     
    143140        signed_crc = zlib.crc32(byteseq, 0)
    144141        if signed_crc < 0:
    145                 return signed_crc + (1 << 32)
     142                return (long(signed_crc) + (long(2) ** long(32))) # 2^32L
    146143        else:
    147144                return signed_crc
     
    151148def print_syntax(cmd):
    152149        print("syntax: " + cmd + " [<options>] <raw_image> <uImage>")
    153         print()
     150        print
    154151        print("\traw_image\tInput image name (raw binary data)")
    155152        print("\tuImage\t\tOutput uImage name (U-Boot image)")
    156         print()
     153        print
    157154        print("options:")
    158155        print("\t-name <name>\tImage name (default: 'Noname')")
Note: See TracChangeset for help on using the changeset viewer.