diff options
author | Konstantin Aladyshev <aladyshev22@gmail.com> | 2022-06-08 13:20:34 +0300 |
---|---|---|
committer | Konstantin Aladyshev <aladyshev22@gmail.com> | 2022-06-08 13:20:34 +0300 |
commit | dbdbac8dbf07e1efb1ce397145a6aa106263036d (patch) | |
tree | ba5ae63507506550082350b4e6fd54c08127cd51 /scripts | |
parent | 9fad570f2302cd38426907d81b9b622a3aed53ff (diff) | |
download | UEFI-Lessons-dbdbac8dbf07e1efb1ce397145a6aa106263036d.tar.gz UEFI-Lessons-dbdbac8dbf07e1efb1ce397145a6aa106263036d.tar.bz2 UEFI-Lessons-dbdbac8dbf07e1efb1ce397145a6aa106263036d.zip |
Make replace_guids.py generic
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/replace_guids.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/scripts/replace_guids.py b/scripts/replace_guids.py index 632aa47..f1ad59e 100644 --- a/scripts/replace_guids.py +++ b/scripts/replace_guids.py @@ -4,12 +4,24 @@ # SPDX-License-Identifier: MIT ## +from argparse import ArgumentParser from shutil import copyfile -GUIDS_FILE_PATH = "Build/OvmfX64/DEBUG_GCC5/FV/Guid.xref" -EXTRA_GUIDS_FILE_PATH = "Guid_extra.xref" -LOG_IN_FILE_PATH = "debug.log" -LOG_OUT_FILE_PATH = "debug_parsed.log" +parser = ArgumentParser(description="Convert GUIDs to text identifiers in UEFI firmware boot log") +parser.add_argument('-g', '--guids', help="Guid.xref file location", required=True) +parser.add_argument('-e', '--guids_extra', help="additional Guid.xref file location") +parser.add_argument('-i', '--log_input', help="input log file location", required=True) +parser.add_argument('-o', '--log_output', help="output log file location (by default input file is changed in place)") +args = parser.parse_args() + +GUIDS_FILE_PATH = args.guids +EXTRA_GUIDS_FILE_PATH = args.guids_extra + +LOG_IN_FILE_PATH = args.log_input +if args.log_output: + LOG_OUT_FILE_PATH = args.log_output +else: + LOG_OUT_FILE_PATH = args.log_input guids = {} @@ -26,7 +38,8 @@ if EXTRA_GUIDS_FILE_PATH: if len(l)==2: guids[l[0].upper()] = l[1][:-1] -copyfile(LOG_IN_FILE_PATH, LOG_OUT_FILE_PATH) +if LOG_IN_FILE_PATH != LOG_OUT_FILE_PATH: + copyfile(LOG_IN_FILE_PATH, LOG_OUT_FILE_PATH) f = open(LOG_OUT_FILE_PATH, 'r') filedata = f.read() |