Add a command to generate all HWID combinations of a board
Generate CSV format by giving image_id of a board
./gooftool get_hwid_v3_list --board BOARD --image_id 0 > output.csv
./gooftool get_hwid_v3_list --board BOARD --image_id EVT > output.csv
BUG=none
TEST=manaully test
Change-Id: I4d2dbc7548c08ee109de0894b759ac63851d016f
Reviewed-on: https://gerrit.chromium.org/gerrit/62775
Reviewed-by: Heng-ruey Hsu <henryhsu@chromium.org>
Tested-by: Heng-ruey Hsu <henryhsu@chromium.org>
Commit-Queue: Heng-ruey Hsu <henryhsu@chromium.org>
diff --git a/py/gooftool/gooftool.py b/py/gooftool/gooftool.py
index 80df765..0471a60 100755
--- a/py/gooftool/gooftool.py
+++ b/py/gooftool/gooftool.py
@@ -972,6 +972,7 @@
@Command('get_firmware_hash',
CmdArg('--file', metavar='FILE', help='Firmware File.'))
def GetFirmwareHash(options):
+ """Get firmware hash from a file"""
if os.path.exists(options.file):
hashes = CalculateFirmwareHashes(options.file)
for section, value_dict in hashes.iteritems():
@@ -981,6 +982,29 @@
else:
raise Error('File does not exist: %s' % options.file)
+
+@Command('get_hwid_v3_list',
+ _board_cmd_arg,
+ _hwdb_path_cmd_arg,
+ CmdArg('--image_id', metavar='IMAGE_ID', help='Image ID.'))
+def GetHWIDV3List(options):
+ """Generate HWID with all components combination of specified
+ image_id, and output as CSV format.
+
+ Args:
+ board: HWID generated by which board. This parameter is required.
+ image_id: Which image stage should be generated. If this parameter
+ is omitted, The maximum of image_id will be used.
+ This parameter is integer.
+ """
+ if options.board:
+ hwid_dict = GetGooftool(options).GetHWIDV3List(options.image_id)
+ for key, value in iter(sorted(hwid_dict.iteritems())):
+ print "%s,%s" % (key, value)
+ else:
+ raise Error('Board should be speficied')
+
+
def Main():
"""Run sub-command specified by the command line args."""