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>
This commit is contained in:
KasimX Liu 2023-03-16 14:25:52 +08:00 committed by mergify[bot]
parent 3e3be2cbc2
commit cdf6ff1719
1 changed files with 42 additions and 36 deletions

View File

@ -102,6 +102,8 @@ def BuildUniversalPayload(Args, MacroList):
ObjCopyFlag = "elf32-i386" ObjCopyFlag = "elf32-i386"
EntryOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, ElfToolChain), os.path.normpath("IA32/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll")) 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") EntryModuleInf = os.path.normpath("UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf")
DscPath = os.path.normpath("UefiPayloadPkg/UefiPayloadPkg.dsc") DscPath = os.path.normpath("UefiPayloadPkg/UefiPayloadPkg.dsc")
DxeFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, ToolChain), os.path.normpath("FV/DXEFV.Fv")) DxeFvOutputDir = os.path.join(BuildDir, "{}_{}".format (BuildTarget, ToolChain), os.path.normpath("FV/DXEFV.Fv"))
@ -132,6 +134,7 @@ def BuildUniversalPayload(Args, MacroList):
# #
# Building DXE core and DXE drivers as DXEFV. # Building DXE core and DXE drivers as DXEFV.
# #
if Args.BuildEntryOnly == False:
BuildPayload = "build -p {} -b {} -a X64 -t {} -y {} {}".format (DscPath, BuildTarget, ToolChain, PayloadReportPath, Quiet) BuildPayload = "build -p {} -b {} -a X64 -t {} -y {} {}".format (DscPath, BuildTarget, ToolChain, PayloadReportPath, Quiet)
BuildPayload += Pcds BuildPayload += Pcds
BuildPayload += Defines BuildPayload += Defines
@ -139,11 +142,11 @@ def BuildUniversalPayload(Args, MacroList):
# #
# Building Universal Payload entry. # Building Universal Payload entry.
# #
if Args.PreBuildUplBinary is None:
BuildModule = "build -p {} -b {} -a {} -m {} -t {} -y {} {}".format (DscPath, BuildTarget, BuildArch, EntryModuleInf, ElfToolChain, ModuleReportPath, Quiet) BuildModule = "build -p {} -b {} -a {} -m {} -t {} -y {} {}".format (DscPath, BuildTarget, BuildArch, EntryModuleInf, ElfToolChain, ModuleReportPath, Quiet)
BuildModule += Pcds BuildModule += Pcds
BuildModule += Defines BuildModule += Defines
RunCommand(BuildModule) RunCommand(BuildModule)
# #
# Buid Universal Payload Information Section ".upld_info" # Buid Universal Payload Information Section ".upld_info"
# #
@ -157,6 +160,7 @@ def BuildUniversalPayload(Args, MacroList):
fp.write(bytearray(upld_info_hdr)) fp.write(bytearray(upld_info_hdr))
fp.close() fp.close()
if Args.BuildEntryOnly == False:
# #
# Copy the DXEFV as a section in elf format Universal Payload entry. # Copy the DXEFV as a section in elf format Universal Payload entry.
# #
@ -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("-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("-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("-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 = {} MacroList = {}
args = parser.parse_args() args = parser.parse_args()
if args.Macro is not None: if args.Macro is not None: