public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UefiPayloadPkg: Fix IA32 entry build failure
@ 2022-04-19  0:51 duntan
  2022-04-19  2:56 ` Ni, Ray
  2022-04-22  1:52 ` Guo Dong
  0 siblings, 2 replies; 3+ messages in thread
From: duntan @ 2022-04-19  0:51 UTC (permalink / raw)
  To: devel; +Cc: Ray Ni, Guo Dong, Benjamin You, Zhiguang Liu

The ObjCopyFlag and EntryOutputDir need to be modified when
building IA32 UniversalPayload Entry

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/UniversalPayloadBuild.py
index 99410d244d..8af381336d 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -54,14 +54,20 @@ def BuildUniversalPayload(Args, MacroList):
     BuildTarget = Args.Target
     ToolChain = Args.ToolChain
     Quiet     = "--quiet"  if Args.Quiet else ""
-    BuildArch = "X64" if Args.Arch == 'X64' else "IA32 -a X64"
     ElfToolChain = 'CLANGDWARF'
+    BuildDir     = os.path.join(os.environ['WORKSPACE'], os.path.normpath("Build/UefiPayloadPkgX64"))
+    if Args.Arch == 'X64':
+        BuildArch      = "X64"
+        ObjCopyFlag    = "elf64-x86-64"
+        EntryOutputDir = os.path.join(BuildDir, f"{BuildTarget}_{ElfToolChain}", os.path.normpath("X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll"))
+    else:
+        BuildArch      = "IA32 -a X64"
+        ObjCopyFlag    = "elf32-i386"
+        EntryOutputDir = os.path.join(BuildDir, f"{BuildTarget}_{ElfToolChain}", os.path.normpath("IA32/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll"))
 
     EntryModuleInf = os.path.normpath("UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf")
     DscPath = os.path.normpath("UefiPayloadPkg/UefiPayloadPkg.dsc")
-    BuildDir = os.path.join(os.environ['WORKSPACE'], os.path.normpath("Build/UefiPayloadPkgX64"))
     FvOutputDir = os.path.join(BuildDir, f"{BuildTarget}_{ToolChain}", os.path.normpath("FV/DXEFV.Fv"))
-    EntryOutputDir = os.path.join(BuildDir, f"{BuildTarget}_{ElfToolChain}", os.path.normpath("X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll"))
     PayloadReportPath = os.path.join(BuildDir, "UefiUniversalPayload.txt")
     ModuleReportPath = os.path.join(BuildDir, "UefiUniversalPayloadEntry.txt")
     UpldInfoFile = os.path.join(BuildDir, "UniversalPayloadInfo.bin")
@@ -105,9 +111,9 @@ def BuildUniversalPayload(Args, MacroList):
     #
     # Copy the DXEFV as a section in elf format Universal Payload entry.
     #
-    remove_section = '"%s" -I elf64-x86-64 -O elf64-x86-64 --remove-section .upld_info --remove-section .upld.uefi_fv %s'%(LlvmObjcopyPath, EntryOutputDir)
-    add_section    = '"%s" -I elf64-x86-64 -O elf64-x86-64 --add-section .upld_info=%s --add-section .upld.uefi_fv=%s %s'%(LlvmObjcopyPath, UpldInfoFile, FvOutputDir, EntryOutputDir)
-    set_section    = '"%s" -I elf64-x86-64 -O elf64-x86-64 --set-section-alignment .upld.upld_info=16 --set-section-alignment .upld.uefi_fv=16 %s'%(LlvmObjcopyPath, EntryOutputDir)
+    remove_section = f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} --remove-section .upld_info --remove-section .upld.uefi_fv {EntryOutputDir}"
+    add_section    = f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} --add-section .upld_info={UpldInfoFile} --add-section .upld.uefi_fv={FvOutputDir} {EntryOutputDir}"
+    set_section    = f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} --set-section-alignment .upld.upld_info=16 --set-section-alignment .upld.uefi_fv=16 {EntryOutputDir}"
     RunCommand(remove_section)
     RunCommand(add_section)
     RunCommand(set_section)
-- 
2.31.1.windows.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] UefiPayloadPkg: Fix IA32 entry build failure
  2022-04-19  0:51 [PATCH] UefiPayloadPkg: Fix IA32 entry build failure duntan
@ 2022-04-19  2:56 ` Ni, Ray
  2022-04-22  1:52 ` Guo Dong
  1 sibling, 0 replies; 3+ messages in thread
From: Ni, Ray @ 2022-04-19  2:56 UTC (permalink / raw)
  To: Tan, Dun, devel@edk2.groups.io; +Cc: Dong, Guo, You, Benjamin, Liu, Zhiguang

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Tan, Dun <dun.tan@intel.com>
> Sent: Tuesday, April 19, 2022 8:51 AM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Dong, Guo <guo.dong@intel.com>; You, Benjamin <benjamin.you@intel.com>; Liu,
> Zhiguang <zhiguang.liu@intel.com>
> Subject: [PATCH] UefiPayloadPkg: Fix IA32 entry build failure
> 
> The ObjCopyFlag and EntryOutputDir need to be modified when
> building IA32 UniversalPayload Entry
> 
> Signed-off-by: Dun Tan <dun.tan@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Guo Dong <guo.dong@intel.com>
> Cc: Benjamin You <benjamin.you@intel.com>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> ---
>  UefiPayloadPkg/UniversalPayloadBuild.py | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/UniversalPayloadBuild.py
> index 99410d244d..8af381336d 100644
> --- a/UefiPayloadPkg/UniversalPayloadBuild.py
> +++ b/UefiPayloadPkg/UniversalPayloadBuild.py
> @@ -54,14 +54,20 @@ def BuildUniversalPayload(Args, MacroList):
>      BuildTarget = Args.Target
>      ToolChain = Args.ToolChain
>      Quiet     = "--quiet"  if Args.Quiet else ""
> -    BuildArch = "X64" if Args.Arch == 'X64' else "IA32 -a X64"
>      ElfToolChain = 'CLANGDWARF'
> +    BuildDir     = os.path.join(os.environ['WORKSPACE'], os.path.normpath("Build/UefiPayloadPkgX64"))
> +    if Args.Arch == 'X64':
> +        BuildArch      = "X64"
> +        ObjCopyFlag    = "elf64-x86-64"
> +        EntryOutputDir = os.path.join(BuildDir, f"{BuildTarget}_{ElfToolChain}",
> os.path.normpath("X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll"))
> +    else:
> +        BuildArch      = "IA32 -a X64"
> +        ObjCopyFlag    = "elf32-i386"
> +        EntryOutputDir = os.path.join(BuildDir, f"{BuildTarget}_{ElfToolChain}",
> os.path.normpath("IA32/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll"))
> 
>      EntryModuleInf = os.path.normpath("UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf")
>      DscPath = os.path.normpath("UefiPayloadPkg/UefiPayloadPkg.dsc")
> -    BuildDir = os.path.join(os.environ['WORKSPACE'], os.path.normpath("Build/UefiPayloadPkgX64"))
>      FvOutputDir = os.path.join(BuildDir, f"{BuildTarget}_{ToolChain}", os.path.normpath("FV/DXEFV.Fv"))
> -    EntryOutputDir = os.path.join(BuildDir, f"{BuildTarget}_{ElfToolChain}",
> os.path.normpath("X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll"))
>      PayloadReportPath = os.path.join(BuildDir, "UefiUniversalPayload.txt")
>      ModuleReportPath = os.path.join(BuildDir, "UefiUniversalPayloadEntry.txt")
>      UpldInfoFile = os.path.join(BuildDir, "UniversalPayloadInfo.bin")
> @@ -105,9 +111,9 @@ def BuildUniversalPayload(Args, MacroList):
>      #
>      # Copy the DXEFV as a section in elf format Universal Payload entry.
>      #
> -    remove_section = '"%s" -I elf64-x86-64 -O elf64-x86-64 --remove-section .upld_info --remove-
> section .upld.uefi_fv %s'%(LlvmObjcopyPath, EntryOutputDir)
> -    add_section    = '"%s" -I elf64-x86-64 -O elf64-x86-64 --add-section .upld_info=%s --add-
> section .upld.uefi_fv=%s %s'%(LlvmObjcopyPath, UpldInfoFile, FvOutputDir, EntryOutputDir)
> -    set_section    = '"%s" -I elf64-x86-64 -O elf64-x86-64 --set-section-alignment .upld.upld_info=16 --set-section-
> alignment .upld.uefi_fv=16 %s'%(LlvmObjcopyPath, EntryOutputDir)
> +    remove_section = f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} --remove-section .upld_info --remove-
> section .upld.uefi_fv {EntryOutputDir}"
> +    add_section    = f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} --add-section .upld_info={UpldInfoFile} --add-
> section .upld.uefi_fv={FvOutputDir} {EntryOutputDir}"
> +    set_section    = f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} --set-section-alignment .upld.upld_info=16 --
> set-section-alignment .upld.uefi_fv=16 {EntryOutputDir}"
>      RunCommand(remove_section)
>      RunCommand(add_section)
>      RunCommand(set_section)
> --
> 2.31.1.windows.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] UefiPayloadPkg: Fix IA32 entry build failure
  2022-04-19  0:51 [PATCH] UefiPayloadPkg: Fix IA32 entry build failure duntan
  2022-04-19  2:56 ` Ni, Ray
@ 2022-04-22  1:52 ` Guo Dong
  1 sibling, 0 replies; 3+ messages in thread
From: Guo Dong @ 2022-04-22  1:52 UTC (permalink / raw)
  To: Tan, Dun, devel@edk2.groups.io; +Cc: Ni, Ray, You, Benjamin, Liu, Zhiguang


Reviewed-by: Guo Dong <guo.dong@intel.com>

-----Original Message-----
From: Tan, Dun <dun.tan@intel.com> 
Sent: Monday, April 18, 2022 5:51 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Dong, Guo <guo.dong@intel.com>; You, Benjamin <benjamin.you@intel.com>; Liu, Zhiguang <zhiguang.liu@intel.com>
Subject: [PATCH] UefiPayloadPkg: Fix IA32 entry build failure

The ObjCopyFlag and EntryOutputDir need to be modified when building IA32 UniversalPayload Entry

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
---
 UefiPayloadPkg/UniversalPayloadBuild.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/UniversalPayloadBuild.py
index 99410d244d..8af381336d 100644
--- a/UefiPayloadPkg/UniversalPayloadBuild.py
+++ b/UefiPayloadPkg/UniversalPayloadBuild.py
@@ -54,14 +54,20 @@ def BuildUniversalPayload(Args, MacroList):
     BuildTarget = Args.Target
     ToolChain = Args.ToolChain
     Quiet     = "--quiet"  if Args.Quiet else ""
-    BuildArch = "X64" if Args.Arch == 'X64' else "IA32 -a X64"
     ElfToolChain = 'CLANGDWARF'
+    BuildDir     = os.path.join(os.environ['WORKSPACE'], os.path.normpath("Build/UefiPayloadPkgX64"))
+    if Args.Arch == 'X64':
+        BuildArch      = "X64"
+        ObjCopyFlag    = "elf64-x86-64"
+        EntryOutputDir = os.path.join(BuildDir, f"{BuildTarget}_{ElfToolChain}", os.path.normpath("X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll"))
+    else:
+        BuildArch      = "IA32 -a X64"
+        ObjCopyFlag    = "elf32-i386"
+        EntryOutputDir = os.path.join(BuildDir, 
+ f"{BuildTarget}_{ElfToolChain}", 
+ os.path.normpath("IA32/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloa
+ dEntry/DEBUG/UniversalPayloadEntry.dll"))
 
     EntryModuleInf = os.path.normpath("UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf")
     DscPath = os.path.normpath("UefiPayloadPkg/UefiPayloadPkg.dsc")
-    BuildDir = os.path.join(os.environ['WORKSPACE'], os.path.normpath("Build/UefiPayloadPkgX64"))
     FvOutputDir = os.path.join(BuildDir, f"{BuildTarget}_{ToolChain}", os.path.normpath("FV/DXEFV.Fv"))
-    EntryOutputDir = os.path.join(BuildDir, f"{BuildTarget}_{ElfToolChain}", os.path.normpath("X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll"))
     PayloadReportPath = os.path.join(BuildDir, "UefiUniversalPayload.txt")
     ModuleReportPath = os.path.join(BuildDir, "UefiUniversalPayloadEntry.txt")
     UpldInfoFile = os.path.join(BuildDir, "UniversalPayloadInfo.bin") @@ -105,9 +111,9 @@ def BuildUniversalPayload(Args, MacroList):
     #
     # Copy the DXEFV as a section in elf format Universal Payload entry.
     #
-    remove_section = '"%s" -I elf64-x86-64 -O elf64-x86-64 --remove-section .upld_info --remove-section .upld.uefi_fv %s'%(LlvmObjcopyPath, EntryOutputDir)
-    add_section    = '"%s" -I elf64-x86-64 -O elf64-x86-64 --add-section .upld_info=%s --add-section .upld.uefi_fv=%s %s'%(LlvmObjcopyPath, UpldInfoFile, FvOutputDir, EntryOutputDir)
-    set_section    = '"%s" -I elf64-x86-64 -O elf64-x86-64 --set-section-alignment .upld.upld_info=16 --set-section-alignment .upld.uefi_fv=16 %s'%(LlvmObjcopyPath, EntryOutputDir)
+    remove_section = f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} --remove-section .upld_info --remove-section .upld.uefi_fv {EntryOutputDir}"
+    add_section    = f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} --add-section .upld_info={UpldInfoFile} --add-section .upld.uefi_fv={FvOutputDir} {EntryOutputDir}"
+    set_section    = f"{LlvmObjcopyPath} -I {ObjCopyFlag} -O {ObjCopyFlag} --set-section-alignment .upld.upld_info=16 --set-section-alignment .upld.uefi_fv=16 {EntryOutputDir}"
     RunCommand(remove_section)
     RunCommand(add_section)
     RunCommand(set_section)
--
2.31.1.windows.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-22  1:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-19  0:51 [PATCH] UefiPayloadPkg: Fix IA32 entry build failure duntan
2022-04-19  2:56 ` Ni, Ray
2022-04-22  1:52 ` Guo Dong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox