scripts: add --input argument to tee_bin_parser.py
Adds an optional --input argument to tee_bin_parser.py to select a
different file to parse than the default "../out/arm/core/tee.bin".
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/scripts/tee_bin_parser.py b/scripts/tee_bin_parser.py
index 635b18e..04bfb9f 100755
--- a/scripts/tee_bin_parser.py
+++ b/scripts/tee_bin_parser.py
@@ -3,10 +3,23 @@
#
# Copyright (c) 2016, Linaro Limited
import struct
+import argparse
+
+
+def get_args():
+ parser = argparse.ArgumentParser()
+
+ parser.add_argument('--input', required=False, dest='inf',
+ default='../out/arm/core/tee.bin',
+ help='The input tee.bin')
+
+ return parser.parse_args()
def main():
- with open("../out/arm/core/tee.bin", "rb") as f:
+ args = get_args()
+
+ with open(args.inf, "rb") as f:
data = f.read(4)
magic = struct.unpack('<I', data)[0]
print("Magic: \t\t0x{:08x}".format(magic))