From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web09.4040.1650329491505346366 for ; Mon, 18 Apr 2022 17:51:31 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=Wspw2kRp; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: dun.tan@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650329491; x=1681865491; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Wu//ECS81PXWbG/QPfylWkqS8HVL5DwML8/5LxWwT1w=; b=Wspw2kRphtzVeRGRQToKufgJtWECRUYItfjZCGlrL1D57vxkA2FE5aZk IuA/Fk/Rf5Wwsoe1xO9ExyQULsZST7z3SqPfN60UmSq3Xjy4FqDn7MeAn Ete8SOk/gdb8kpmoI5JVuKJWzsrG0BhVKiRx04VoPtSiP3ofpBKiYtdFz Zm4JZysNSlodsJmap0yQCG37FZxKYWMc7crnVmdz97u98ZyedNfMuE+8e j9AkLsLfMoAhJ3PZvD1ZXC9D/JxpryJwh+yqUUn4imHogF5EQ29rGURRE Q0H89oegmLNO3tuRWvqfRkKPpPGzUWK27C3DU+PoWMtTvIa8l1DcJTVUo Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10321"; a="245535322" X-IronPort-AV: E=Sophos;i="5.90,271,1643702400"; d="scan'208";a="245535322" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2022 17:51:30 -0700 X-IronPort-AV: E=Sophos;i="5.90,271,1643702400"; d="scan'208";a="575830557" Received: from danwei-mobl4.ccr.corp.intel.com (HELO duntan-mobl.ccr.corp.intel.com) ([10.249.171.201]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2022 17:51:28 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Ray Ni , Guo Dong , Benjamin You , Zhiguang Liu Subject: [PATCH] UefiPayloadPkg: Fix IA32 entry build failure Date: Tue, 19 Apr 2022 08:51:10 +0800 Message-Id: <20220419005110.369-1-dun.tan@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The ObjCopyFlag and EntryOutputDir need to be modified when building IA32 UniversalPayload Entry Signed-off-by: Dun Tan Cc: Ray Ni Cc: Guo Dong Cc: Benjamin You Cc: Zhiguang Liu --- 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