summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKasimX Liu <kasimx.liu@intel.com>2023-03-16 14:25:52 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-04-07 03:47:30 +0000
commitcdf6ff1719a9453351baec4bd32fcfc30e9ceeac (patch)
treeccc5a9caed1231f41a17117fb3def8e69611933c
parent3e3be2cbc286e773ed5bd3afd5942440546888de (diff)
downloadedk2-cdf6ff1719a9453351baec4bd32fcfc30e9ceeac.tar.gz
edk2-cdf6ff1719a9453351baec4bd32fcfc30e9ceeac.tar.bz2
edk2-cdf6ff1719a9453351baec4bd32fcfc30e9ceeac.zip
UefiPayloadPkg:Add new build commands for UniversalPayload
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4375 add '-pb' command of build bios with exist PreUniversalPayload file. '-e' command of olny build the UniversalPayloadentry file. Cc: Guo Dong <guo.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: James Lu <james.lu@intel.com> Reviewed-by: Gua Guo <gua.guo@intel.com> Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
-rw-r--r--UefiPayloadPkg/UniversalPayloadBuild.py78
1 files changed, 42 insertions, 36 deletions
diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/UniversalPayloadBuild.py
index 7cd04fdceb..db7ce0500b 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -102,6 +102,8 @@ def BuildUniversalPayload(Args, MacroList):
ObjCopyFlag = "elf32-i386"
EntryOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, ElfToolChain), os.path.normpath("IA32/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll"))
+ if Args.PreBuildUplBinary is not None:
+ EntryOutputDir = os.path.abspath(Args.PreBuildUplBinary)
EntryModuleInf = os.path.normpath("UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf")
DscPath = os.path.normpath("UefiPayloadPkg/UefiPayloadPkg.dsc")
DxeFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, ToolChain), os.path.normpath("FV/DXEFV.Fv"))
@@ -132,18 +134,19 @@ def BuildUniversalPayload(Args, MacroList):
#
# Building DXE core and DXE drivers as DXEFV.
#
- BuildPayload = "build -p {} -b {} -a X64 -t {} -y {} {}".format (DscPath, BuildTarget, ToolChain, PayloadReportPath, Quiet)
- BuildPayload += Pcds
- BuildPayload += Defines
- RunCommand(BuildPayload)
+ if Args.BuildEntryOnly == False:
+ BuildPayload = "build -p {} -b {} -a X64 -t {} -y {} {}".format (DscPath, BuildTarget, ToolChain, PayloadReportPath, Quiet)
+ BuildPayload += Pcds
+ BuildPayload += Defines
+ RunCommand(BuildPayload)
#
# Building Universal Payload entry.
#
- BuildModule = "build -p {} -b {} -a {} -m {} -t {} -y {} {}".format (DscPath, BuildTarget, BuildArch, EntryModuleInf, ElfToolChain, ModuleReportPath, Quiet)
- BuildModule += Pcds
- BuildModule += Defines
- RunCommand(BuildModule)
-
+ if Args.PreBuildUplBinary is None:
+ BuildModule = "build -p {} -b {} -a {} -m {} -t {} -y {} {}".format (DscPath, BuildTarget, BuildArch, EntryModuleInf, ElfToolChain, ModuleReportPath, Quiet)
+ BuildModule += Pcds
+ BuildModule += Defines
+ RunCommand(BuildModule)
#
# Buid Universal Payload Information Section ".upld_info"
#
@@ -157,33 +160,34 @@ def BuildUniversalPayload(Args, MacroList):
fp.write(bytearray(upld_info_hdr))
fp.close()
- #
- # Copy the DXEFV as a section in elf format Universal Payload entry.
- #
- remove_section = '"{}" -I {} -O {} --remove-section .upld_info --remove-section .upld.uefi_fv --remove-section .upld.bds_fv {}'.format (
- LlvmObjcopyPath,
- ObjCopyFlag,
- ObjCopyFlag,
- EntryOutputDir
- )
- add_section = '"{}" -I {} -O {} --add-section .upld_info={} --add-section .upld.uefi_fv={} --add-section .upld.bds_fv={} {}'.format (
- LlvmObjcopyPath,
- ObjCopyFlag,
- ObjCopyFlag,
- UpldInfoFile,
- DxeFvOutputDir,
- BdsFvOutputDir,
- EntryOutputDir
- )
- set_section = '"{}" -I {} -O {} --set-section-alignment .upld_info=4 --set-section-alignment .upld.uefi_fv=16 --set-section-alignment .upld.bds_fv=16 {}'.format (
- LlvmObjcopyPath,
- ObjCopyFlag,
- ObjCopyFlag,
- EntryOutputDir
- )
- RunCommand(remove_section)
- RunCommand(add_section)
- RunCommand(set_section)
+ if Args.BuildEntryOnly == False:
+ #
+ # Copy the DXEFV as a section in elf format Universal Payload entry.
+ #
+ remove_section = '"{}" -I {} -O {} --remove-section .upld_info --remove-section .upld.uefi_fv --remove-section .upld.bds_fv {}'.format (
+ LlvmObjcopyPath,
+ ObjCopyFlag,
+ ObjCopyFlag,
+ EntryOutputDir
+ )
+ add_section = '"{}" -I {} -O {} --add-section .upld_info={} --add-section .upld.uefi_fv={} --add-section .upld.bds_fv={} {}'.format (
+ LlvmObjcopyPath,
+ ObjCopyFlag,
+ ObjCopyFlag,
+ UpldInfoFile,
+ DxeFvOutputDir,
+ BdsFvOutputDir,
+ EntryOutputDir
+ )
+ set_section = '"{}" -I {} -O {} --set-section-alignment .upld_info=4 --set-section-alignment .upld.uefi_fv=16 --set-section-alignment .upld.bds_fv=16 {}'.format (
+ LlvmObjcopyPath,
+ ObjCopyFlag,
+ ObjCopyFlag,
+ EntryOutputDir
+ )
+ RunCommand(remove_section)
+ RunCommand(add_section)
+ RunCommand(set_section)
shutil.copy (EntryOutputDir, os.path.join(BuildDir, 'UniversalPayload.elf'))
@@ -199,6 +203,8 @@ def main():
parser.add_argument("-s", "--SpecRevision", type=GenSpecRevision, default ='0.7', help='Indicates compliance with a revision of this specification in the BCD format.')
parser.add_argument("-r", "--Revision", type=Validate32BitInteger, default ='0x0000010105', help='Revision of the Payload binary. Major.Minor.Revision.Build')
parser.add_argument("-o", "--ProducerId", default ='INTEL', help='A null-terminated OEM-supplied string that identifies the payload producer (16 bytes maximal).')
+ parser.add_argument("-e", "--BuildEntryOnly", action='store_true', help='Build UniversalPayload Entry file')
+ parser.add_argument("-pb", "--PreBuildUplBinary", default=None, help='Specify the UniversalPayload file')
MacroList = {}
args = parser.parse_args()
if args.Macro is not None: