* [PATCH] UefiPayloadPkg:Add new build commands for Universalpayload
@ 2023-03-16 7:01 kasimx.liu
2023-03-16 7:20 ` Guo, Gua
2023-03-23 4:02 ` Lu, James
0 siblings, 2 replies; 3+ messages in thread
From: kasimx.liu @ 2023-03-16 7:01 UTC (permalink / raw)
To: devel; +Cc: KasimX Liu, Guo Dong, Ray Ni, James Lu, Gua Guo
From: KasimX Liu <kasimx.liu@intel.com>
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>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
---
UefiPayloadPkg/UniversalPayloadBuild.py | 78 +++++++++++++------------
1 file changed, 42 insertions(+), 36 deletions(-)
diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/UniversalPayloadBuild.py
index 522855eba4..aad4f7f195 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -65,6 +65,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"))
@@ -95,18 +97,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"
#
@@ -117,33 +120,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'))
@@ -156,6 +160,8 @@ def main():
parser.add_argument('-i', '--ImageId', type=str, help='Specify payload ID (16 bytes maximal).', default ='UEFI')
parser.add_argument('-q', '--Quiet', action='store_true', help='Disable all build messages except FATAL ERRORS.')
parser.add_argument("-p", "--pcd", action="append")
+ 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:
--
2.39.1.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] UefiPayloadPkg:Add new build commands for Universalpayload
2023-03-16 7:01 [PATCH] UefiPayloadPkg:Add new build commands for Universalpayload kasimx.liu
@ 2023-03-16 7:20 ` Guo, Gua
2023-03-23 4:02 ` Lu, James
1 sibling, 0 replies; 3+ messages in thread
From: Guo, Gua @ 2023-03-16 7:20 UTC (permalink / raw)
To: Liu, KasimX, devel@edk2.groups.io; +Cc: Dong, Guo, Ni, Ray, Lu, James
Look like create Case2 and Case3 behavior. It looks good from my view point.
Just minor request, In commit message please use "UniversalPayload" but "Universalpayload"
Case1: > "python UefiPayloadPkg/UniversalPayloadBuild.py", output UefiUpl.elf
Case2: > "python UefiPayloadPkg/UniversalPayloadBuild.py -pb <pre-build >", use pre-build UefiUplEntry.elf to generate UefiUpl.elf
Case3: > "python UefiPayloadPkg/UniversalPayloadBuild.py -e", output UefiUplEntry.elf
Reviewed-by: Gua Guo <gua.guo@intel.com>
-----Original Message-----
From: Liu, KasimX <kasimx.liu@intel.com>
Sent: Thursday, March 16, 2023 3:01 PM
To: devel@edk2.groups.io
Cc: Liu, KasimX <kasimx.liu@intel.com>; Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>
Subject: [PATCH] UefiPayloadPkg:Add new build commands for Universalpayload
From: KasimX Liu <kasimx.liu@intel.com>
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>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
---
UefiPayloadPkg/UniversalPayloadBuild.py | 78 +++++++++++++------------
1 file changed, 42 insertions(+), 36 deletions(-)
diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/UniversalPayloadBuild.py
index 522855eba4..aad4f7f195 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -65,6 +65,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"))
@@ -95,18 +97,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"
#
@@ -117,33 +120,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'))
@@ -156,6 +160,8 @@ def main():
parser.add_argument('-i', '--ImageId', type=str, help='Specify payload ID (16 bytes maximal).', default ='UEFI')
parser.add_argument('-q', '--Quiet', action='store_true', help='Disable all build messages except FATAL ERRORS.')
parser.add_argument("-p", "--pcd", action="append")
+ 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:
--
2.39.1.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] UefiPayloadPkg:Add new build commands for Universalpayload
2023-03-16 7:01 [PATCH] UefiPayloadPkg:Add new build commands for Universalpayload kasimx.liu
2023-03-16 7:20 ` Guo, Gua
@ 2023-03-23 4:02 ` Lu, James
1 sibling, 0 replies; 3+ messages in thread
From: Lu, James @ 2023-03-23 4:02 UTC (permalink / raw)
To: Liu, KasimX, devel@edk2.groups.io; +Cc: Dong, Guo, Ni, Ray, Guo, Gua
Reviewed-by: James Lu <james.lu@intel.com>
Thanks,
James
-----Original Message-----
From: Liu, KasimX <kasimx.liu@intel.com>
Sent: Thursday, March 16, 2023 3:01 PM
To: devel@edk2.groups.io
Cc: Liu, KasimX <kasimx.liu@intel.com>; Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>
Subject: [PATCH] UefiPayloadPkg:Add new build commands for Universalpayload
From: KasimX Liu <kasimx.liu@intel.com>
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>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
---
UefiPayloadPkg/UniversalPayloadBuild.py | 78 +++++++++++++------------
1 file changed, 42 insertions(+), 36 deletions(-)
diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/UniversalPayloadBuild.py
index 522855eba4..aad4f7f195 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -65,6 +65,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"))
@@ -95,18 +97,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"
#
@@ -117,33 +120,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'))
@@ -156,6 +160,8 @@ def main():
parser.add_argument('-i', '--ImageId', type=str, help='Specify payload ID (16 bytes maximal).', default ='UEFI')
parser.add_argument('-q', '--Quiet', action='store_true', help='Disable all build messages except FATAL ERRORS.')
parser.add_argument("-p", "--pcd", action="append")
+ 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:
--
2.39.1.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-23 4:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-16 7:01 [PATCH] UefiPayloadPkg:Add new build commands for Universalpayload kasimx.liu
2023-03-16 7:20 ` Guo, Gua
2023-03-23 4:02 ` Lu, James
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox