summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRom Lemarchand2015-06-02 21:01:25 -0500
committerRom Lemarchand2015-06-02 21:01:25 -0500
commit45f2ce1cb86725ac41ba237867390ef806d5a86d (patch)
tree9a3188b0bf99944221ba7d0300ac0271e971539c /mkbootimg
parent98a4dd48bd1e274555394133f03f44eb0390913f (diff)
downloadplatform-system-core-45f2ce1cb86725ac41ba237867390ef806d5a86d.tar.gz
platform-system-core-45f2ce1cb86725ac41ba237867390ef806d5a86d.tar.xz
platform-system-core-45f2ce1cb86725ac41ba237867390ef806d5a86d.zip
mkbootimg: parse hexadecimal ints
Allow passing int arguments as hexadecimal values Change-Id: If5a199007e9868f994dd740ccd15c455eb536327
Diffstat (limited to 'mkbootimg')
-rwxr-xr-xmkbootimg/mkbootimg16
1 files changed, 10 insertions, 6 deletions
diff --git a/mkbootimg/mkbootimg b/mkbootimg/mkbootimg
index 8c27ff795..1e09f4db0 100755
--- a/mkbootimg/mkbootimg
+++ b/mkbootimg/mkbootimg
@@ -93,6 +93,10 @@ def write_padded_file(f_out, f_in, padding):
93 pad_file(f_out, padding) 93 pad_file(f_out, padding)
94 94
95 95
96def parse_int(x):
97 return int(x,0)
98
99
96def parse_cmdline(): 100def parse_cmdline():
97 parser = ArgumentParser() 101 parser = ArgumentParser()
98 parser.add_argument('--kernel', help='path to the kernel', type=FileType('rb'), 102 parser.add_argument('--kernel', help='path to the kernel', type=FileType('rb'),
@@ -101,15 +105,15 @@ def parse_cmdline():
101 parser.add_argument('--second', help='path to the 2nd bootloader', type=FileType('rb')) 105 parser.add_argument('--second', help='path to the 2nd bootloader', type=FileType('rb'))
102 parser.add_argument('--cmdline', help='extra arguments to be passed on the ' 106 parser.add_argument('--cmdline', help='extra arguments to be passed on the '
103 'kernel command line', default='', action=ValidateStrLenAction, maxlen=1536) 107 'kernel command line', default='', action=ValidateStrLenAction, maxlen=1536)
104 parser.add_argument('--base', help='base address', type=int, default=0x10000000) 108 parser.add_argument('--base', help='base address', type=parse_int, default=0x10000000)
105 parser.add_argument('----kernel_offset', help='kernel offset', type=int, default=0x00008000) 109 parser.add_argument('----kernel_offset', help='kernel offset', type=parse_int, default=0x00008000)
106 parser.add_argument('--ramdisk_offset', help='ramdisk offset', type=int, default=0x01000000) 110 parser.add_argument('--ramdisk_offset', help='ramdisk offset', type=parse_int, default=0x01000000)
107 parser.add_argument('--second_offset', help='2nd bootloader offset', type=int, 111 parser.add_argument('--second_offset', help='2nd bootloader offset', type=parse_int,
108 default=0x00f00000) 112 default=0x00f00000)
109 parser.add_argument('--tags_offset', help='tags offset', type=int, default=0x00000100) 113 parser.add_argument('--tags_offset', help='tags offset', type=parse_int, default=0x00000100)
110 parser.add_argument('--board', help='board name', default='', action=ValidateStrLenAction, 114 parser.add_argument('--board', help='board name', default='', action=ValidateStrLenAction,
111 maxlen=16) 115 maxlen=16)
112 parser.add_argument('--pagesize', help='page size', type=int, 116 parser.add_argument('--pagesize', help='page size', type=parse_int,
113 choices=[2**i for i in range(11,15)], default=2048) 117 choices=[2**i for i in range(11,15)], default=2048)
114 parser.add_argument('--id', help='print the image ID on standard output', 118 parser.add_argument('--id', help='print the image ID on standard output',
115 action='store_true') 119 action='store_true')