public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Lu, James" <james.lu@intel.com>
To: "Liu, KasimX" <kasimx.liu@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Guo" <guo.dong@intel.com>, "Ni, Ray" <ray.ni@intel.com>,
	"Guo, Gua" <gua.guo@intel.com>
Subject: Re: [PATCH] UefiPayloadPkg:Add new build commands for Universalpayload
Date: Thu, 23 Mar 2023 04:02:41 +0000	[thread overview]
Message-ID: <IA0PR11MB7837DBF5603AD5230E8CFD3388879@IA0PR11MB7837.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1629baa064819fae7cf91506b145151f131c5deb.1678949430.git.kasimx.liu@intel.com>

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


      parent reply	other threads:[~2023-03-23  4:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=IA0PR11MB7837DBF5603AD5230E8CFD3388879@IA0PR11MB7837.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox