diff options
author | Konstantin Aladyshev <aladyshev22@gmail.com> | 2021-07-17 00:07:37 +0300 |
---|---|---|
committer | Konstantin Aladyshev <aladyshev22@gmail.com> | 2021-07-17 00:07:37 +0300 |
commit | 403b894424286b13fcdd3e0f5e38af0005dd24ad (patch) | |
tree | ac01a471216661c7dc33984f3f7c1032c36f5ec2 /scripts/replace_guids.py | |
parent | 36c551e36f080a9a2a659e4533650a9027707a2a (diff) | |
download | UEFI-Lessons-403b894424286b13fcdd3e0f5e38af0005dd24ad.tar.gz UEFI-Lessons-403b894424286b13fcdd3e0f5e38af0005dd24ad.tar.bz2 UEFI-Lessons-403b894424286b13fcdd3e0f5e38af0005dd24ad.zip |
Add scripts folder with script
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Diffstat (limited to 'scripts/replace_guids.py')
-rw-r--r-- | scripts/replace_guids.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/replace_guids.py b/scripts/replace_guids.py new file mode 100644 index 0000000..c2d22ea --- /dev/null +++ b/scripts/replace_guids.py @@ -0,0 +1,34 @@ +from shutil import copyfile + +GUIDS_FILE_PATH = "Build/OvmfX64/DEBUG_GCC5/FV/Guid.xref" +EXTRA_GUIDS_FILE_PATH = "" +LOG_IN_FILE_PATH = "debug.log" +LOG_OUT_FILE_PATH = "debug_parsed.log" + +guids = {} + +with open(GUIDS_FILE_PATH) as p: + for line in p: + l = line.split(" ") + if len(l)==2: + guids[l[0].upper()] = l[1][:-1] + +if EXTRA_GUIDS_FILE_PATH: + with open(EXTRA_GUIDS_FILE_PATH) as p: + for line in p: + l = line.split(" ") + if len(l)==2: + guids[l[0].upper()] = l[1][:-1] + +copyfile(LOG_IN_FILE_PATH, LOG_OUT_FILE_PATH) + +f = open(LOG_OUT_FILE_PATH, 'r') +filedata = f.read() +f.close() + +for key,val in guids.items(): + filedata = filedata.replace(key, val) + +f = open(LOG_OUT_FILE_PATH, 'w') +f.write(filedata) +f.close() |