diff options
author | Guo Dong <guo.dong@intel.com> | 2024-11-19 15:46:11 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-12-19 02:25:24 +0000 |
commit | c5811ef1b3ac753ac40cbb624216d4d52a9b033b (patch) | |
tree | 718b3b19d15fcf02b1626da337cada63b35f3d17 | |
parent | 72b65146bf141308c9d5dc109600ab2fee6d5a48 (diff) | |
download | edk2-c5811ef1b3ac753ac40cbb624216d4d52a9b033b.tar.gz |
UefiPayloadPkg: Enhance universal payload build
If there is no relocation in the payload it would build failure.
This will fix the build failure.
Signed-off-by: Guo Dong <guo.dong@intel.com>
-rw-r--r-- | UefiPayloadPkg/UniversalPayloadBuild.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/UniversalPayloadBuild.py index 404edfb57b..c56194e231 100644 --- a/UefiPayloadPkg/UniversalPayloadBuild.py +++ b/UefiPayloadPkg/UniversalPayloadBuild.py @@ -266,13 +266,14 @@ def BuildUniversalPayload(Args): #
RelocBinary = b''
PeCoff = pefile.PE (TargetRebaseFile)
- for reloc in PeCoff.DIRECTORY_ENTRY_BASERELOC:
- for entry in reloc.entries:
- if (entry.type == 0):
- continue
- Type = entry.type
- Offset = entry.rva + fit_image_info_header.DataOffset
- RelocBinary += Offset.to_bytes (8, 'little') + Type.to_bytes (8, 'little')
+ if hasattr(PeCoff, 'DIRECTORY_ENTRY_BASERELOC'):
+ for reloc in PeCoff.DIRECTORY_ENTRY_BASERELOC:
+ for entry in reloc.entries:
+ if (entry.type == 0):
+ continue
+ Type = entry.type
+ Offset = entry.rva + fit_image_info_header.DataOffset
+ RelocBinary += Offset.to_bytes (8, 'little') + Type.to_bytes (8, 'little')
RelocBinary += b'\x00' * (0x1000 - (len(RelocBinary) % 0x1000))
#
|