From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=yunhuax.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 14AE321F0DA4C for ; Mon, 5 Feb 2018 23:20:14 -0800 (PST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Feb 2018 23:25:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,467,1511856000"; d="dat'59?scan'59,208,59";a="25024051" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga003.jf.intel.com with ESMTP; 05 Feb 2018 23:25:56 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 5 Feb 2018 23:25:55 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.124]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.116]) with mapi id 14.03.0319.002; Tue, 6 Feb 2018 15:25:54 +0800 From: "Feng, YunhuaX" To: "edk2-devel@lists.01.org" CC: "Zhu, Yonghong" , "Gao, Liming" Thread-Topic: [PATCH] BaseTools: Fix COMPRESS alignment incorrect issue Thread-Index: AdOfG7h9PhdGrMQvRTSbzO5JY9O+WQ== Date: Tue, 6 Feb 2018 07:25:53 +0000 Message-ID: <47C64442C08CCD4089DC43B6B5E46BC482A761@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: <47C64442C08CCD4089DC43B6B5E46BC482A761@shsmsx102.ccr.corp.intel.com> x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: [PATCH] BaseTools: Fix COMPRESS alignment incorrect issue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Feb 2018 07:20:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Doesn't generate the correct alignment for the leaf section in the compression section. Below FFS rule doesn't work as the expectation. [Rule.Common.PEIM.PE32] FILE PEIM =3D $(NAMED_GUID) { PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex COMPRESS { PE32 PE32 Align=3DAuto $(INF_OUTPUT)/$(MODULE_NAME).efi UI STRING=3D"$(MODULE_NAME)" Optional VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) } } Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/GenFds/CompressSection.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/= Source/Python/GenFds/CompressSection.py index 64ad275d83..98532ed8e6 100644 --- a/BaseTools/Source/Python/GenFds/CompressSection.py +++ b/BaseTools/Source/Python/GenFds/CompressSection.py @@ -59,18 +59,32 @@ class CompressSection (CompressSectionClassObject) : self.CompType =3D FfsInf.__ExtendMacro__(self.CompType) self.Alignment =3D FfsInf.__ExtendMacro__(self.Alignment) =20 SectFiles =3D tuple() Index =3D 0 + MaxAlign =3D None for Sect in self.SectionList: Index =3D Index + 1 SecIndex =3D '%s.%d' %(SecNum, Index) ReturnSectList, AlignValue =3D Sect.GenSection(OutputPath, Mod= uleName, SecIndex, KeyStringList, FfsInf, Dict, IsMakefile=3DIsMakefile) + if AlignValue !=3D None: + if MaxAlign =3D=3D None: + MaxAlign =3D AlignValue + if GenFdsGlobalVariable.GetAlignment (AlignValue) > GenFds= GlobalVariable.GetAlignment (MaxAlign): + MaxAlign =3D AlignValue if ReturnSectList !=3D []: + if AlignValue =3D=3D None: + AlignValue =3D "1" for FileData in ReturnSectList: SectFiles +=3D (FileData,) =20 + if MaxAlign !=3D None: + if self.Alignment =3D=3D None: + self.Alignment =3D MaxAlign + else: + if GenFdsGlobalVariable.GetAlignment (MaxAlign) > GenFdsGl= obalVariable.GetAlignment (self.Alignment): + self.Alignment =3D MaxAlign =20 OutputFile =3D OutputPath + \ os.sep + \ ModuleName + \ 'SEC' + \ --=20 2.12.2.windows.2