Skip to content

Commit

Permalink
UefiPayloadPkg: Enhance universal payload build
Browse files Browse the repository at this point in the history
If there is no relocation in the payload it would build failure.
This will fix the build failure.

Signed-off-by: Guo Dong <[email protected]>
  • Loading branch information
gdong1 authored and mergify[bot] committed Dec 19, 2024
1 parent 72b6514 commit c5811ef
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions UefiPayloadPkg/UniversalPayloadBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

#
Expand Down

0 comments on commit c5811ef

Please sign in to comment.