mkbootimg: parse hexadecimal ints
Allow passing int arguments as hexadecimal values Change-Id: If5a199007e9868f994dd740ccd15c455eb536327
This commit is contained in:
parent
98a4dd48bd
commit
45f2ce1cb8
1 changed files with 10 additions and 6 deletions
|
@ -93,6 +93,10 @@ def write_padded_file(f_out, f_in, padding):
|
|||
pad_file(f_out, padding)
|
||||
|
||||
|
||||
def parse_int(x):
|
||||
return int(x,0)
|
||||
|
||||
|
||||
def parse_cmdline():
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('--kernel', help='path to the kernel', type=FileType('rb'),
|
||||
|
@ -101,15 +105,15 @@ def parse_cmdline():
|
|||
parser.add_argument('--second', help='path to the 2nd bootloader', type=FileType('rb'))
|
||||
parser.add_argument('--cmdline', help='extra arguments to be passed on the '
|
||||
'kernel command line', default='', action=ValidateStrLenAction, maxlen=1536)
|
||||
parser.add_argument('--base', help='base address', type=int, default=0x10000000)
|
||||
parser.add_argument('----kernel_offset', help='kernel offset', type=int, default=0x00008000)
|
||||
parser.add_argument('--ramdisk_offset', help='ramdisk offset', type=int, default=0x01000000)
|
||||
parser.add_argument('--second_offset', help='2nd bootloader offset', type=int,
|
||||
parser.add_argument('--base', help='base address', type=parse_int, default=0x10000000)
|
||||
parser.add_argument('----kernel_offset', help='kernel offset', type=parse_int, default=0x00008000)
|
||||
parser.add_argument('--ramdisk_offset', help='ramdisk offset', type=parse_int, default=0x01000000)
|
||||
parser.add_argument('--second_offset', help='2nd bootloader offset', type=parse_int,
|
||||
default=0x00f00000)
|
||||
parser.add_argument('--tags_offset', help='tags offset', type=int, default=0x00000100)
|
||||
parser.add_argument('--tags_offset', help='tags offset', type=parse_int, default=0x00000100)
|
||||
parser.add_argument('--board', help='board name', default='', action=ValidateStrLenAction,
|
||||
maxlen=16)
|
||||
parser.add_argument('--pagesize', help='page size', type=int,
|
||||
parser.add_argument('--pagesize', help='page size', type=parse_int,
|
||||
choices=[2**i for i in range(11,15)], default=2048)
|
||||
parser.add_argument('--id', help='print the image ID on standard output',
|
||||
action='store_true')
|
||||
|
|
Loading…
Reference in a new issue