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


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/mkuimage.py

    ra44ae3dd r5711f6e  
    6060        load_addr = 0
    6161        start_addr = 0
     62        os_type = 5 #Linux is the default
    6263
    6364        while len(args) >= 2 and args[0][0] == '-':
     
    7172                elif opt == 'saddr':
    7273                        start_addr = (int)(optarg, 0)
     74                elif opt == 'ostype':
     75                        os_type = (int)(optarg, 0)
    7376                else:
    7477                        print(base_name + ": Unrecognized option.")
     
    8588
    8689        try:
    87                 mkuimage(inf_name, outf_name, image_name, load_addr, start_addr)
     90                mkuimage(inf_name, outf_name, image_name, load_addr, start_addr, os_type)
    8891        except:
    8992                os.remove(outf_name)
    9093                raise
    9194
    92 def mkuimage(inf_name, outf_name, image_name, load_addr, start_addr):
     95def mkuimage(inf_name, outf_name, image_name, load_addr, start_addr, os_type):
    9396        inf = open(inf_name, 'rb')
    9497        outf = open(outf_name, 'wb')
     
    120123        header.start_addr = start_addr  # Address of entry point
    121124        header.data_crc = data_crc
    122         header.os = 2                   # NetBSD
     125        header.os = os_type
    123126        header.arch = 2                 # ARM
    124127        header.img_type = 2             # Kernel
    125128        header.compression = 0          # None
    126         header.img_name = image_name
     129        header.img_name = image_name.encode('ascii')
    127130
    128131        header_crc = calc_crc32(header.pack())
     
    140143        signed_crc = zlib.crc32(byteseq, 0)
    141144        if signed_crc < 0:
    142                 return (long(signed_crc) + (long(2) ** long(32))) # 2^32L
     145                return signed_crc + (1 << 32)
    143146        else:
    144147                return signed_crc
     
    148151def print_syntax(cmd):
    149152        print("syntax: " + cmd + " [<options>] <raw_image> <uImage>")
    150         print
     153        print()
    151154        print("\traw_image\tInput image name (raw binary data)")
    152155        print("\tuImage\t\tOutput uImage name (U-Boot image)")
    153         print
     156        print()
    154157        print("options:")
    155158        print("\t-name <name>\tImage name (default: 'Noname')")
Note: See TracChangeset for help on using the changeset viewer.