~martin-decky/helenos/rcu

« back to all changes in this revision

Viewing changes to tools/mkuimage.py

  • Committer: Vojtech Horky
  • Date: 2012-05-23 12:03:26 UTC
  • mfrom: (1443.1.19 misc)
  • mto: This revision was merged to the branch mainline in revision 1479.
  • Revision ID: vojtechhorky@users.sourceforge.net-20120523120326-jv50stjymxmh598s
Merge GSOC-originated patches 

Merge from lp:~vojtech-horky/helenos/misc.

The merge includes:
 * Switching to previous directory with `cd -' in Bdsh
 * Interactive mode for cp module in Bdsh
 * Implementation of sleep command
 * printf and echo for Bdsh
 * Rewrite of the mkdir module
 * Ctrl-arrow jumps over words in the editor
 * The scripts work with Python 3

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
        header.arch = 2                 # ARM
124
124
        header.img_type = 2             # Kernel
125
125
        header.compression = 0          # None
126
 
        header.img_name = image_name
 
126
        header.img_name = image_name.encode('ascii')
127
127
 
128
128
        header_crc = calc_crc32(header.pack())
129
129
        header.header_crc = header_crc
139
139
def calc_crc32(byteseq):
140
140
        signed_crc = zlib.crc32(byteseq, 0)
141
141
        if signed_crc < 0:
142
 
                return (long(signed_crc) + (long(2) ** long(32))) # 2^32L
 
142
                return signed_crc + (1 << 32)
143
143
        else:
144
144
                return signed_crc
145
145
 
147
147
#
148
148
def print_syntax(cmd):
149
149
        print("syntax: " + cmd + " [<options>] <raw_image> <uImage>")
150
 
        print
 
150
        print()
151
151
        print("\traw_image\tInput image name (raw binary data)")
152
152
        print("\tuImage\t\tOutput uImage name (U-Boot image)")
153
 
        print
 
153
        print()
154
154
        print("options:")
155
155
        print("\t-name <name>\tImage name (default: 'Noname')")
156
156
        print("\t-laddr <name>\tLoad address (default: 0x00000000)")