From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: liming.gao@intel.com) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by groups.io with SMTP; Wed, 22 May 2019 22:37:47 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2019 22:37:47 -0700 X-ExtLoop1: 1 Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga007.fm.intel.com with ESMTP; 22 May 2019 22:37:47 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 22 May 2019 22:37:44 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 22 May 2019 22:37:43 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.33]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.150]) with mapi id 14.03.0415.000; Thu, 23 May 2019 13:37:41 +0800 From: "Liming Gao" To: "Fan, ZhijuX" , "devel@edk2.groups.io" CC: "Feng, Bob C" Subject: Re: [PATCH] BaseTools:Make BaseTools support the correct RAW FFS FILE generation Thread-Topic: [PATCH] BaseTools:Make BaseTools support the correct RAW FFS FILE generation Thread-Index: AdURF92FTi1gCeVzRpWQzY7Lig872wAEbNmA Date: Thu, 23 May 2019 05:37:40 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E44FF8D@SHSMSX104.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Zhiju: This usage is only valid when FILE type RAW. Please add this check.=20 Thanks Liming >-----Original Message----- >From: Fan, ZhijuX >Sent: Thursday, May 23, 2019 11:30 AM >To: devel@edk2.groups.io >Cc: Gao, Liming ; Feng, Bob C >Subject: [PATCH] BaseTools:Make BaseTools support the correct RAW FFS FILE >generation > >BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1765 > >RAW FFS File has no section for its data. For RAW FFS File, >directly call GenFfs tool to generate FFS file. > >Ffs Rule: >[Rule.Common.USER_DEFINED.MicroCode] > FILE RAW =3D $(NAMED_GUID) { > SectionType FileType $(INF_OUTPUT)/$(MODULE_NAME).bin > } >As shown in the rule above,if SectionType and FileType not defined, >FFS files are generated directly, and no other type of file is >generated. > >Cc: Bob Feng >Cc: Liming Gao >Signed-off-by: Zhiju.Fan >--- > BaseTools/Source/Python/Common/DataType.py | 1 + > BaseTools/Source/Python/GenFds/EfiSection.py | 10 ++++++++-- > BaseTools/Source/Python/GenFds/FdfParser.py | 14 ++++++++++++-- > BaseTools/Source/Python/GenFds/Section.py | 7 ++++++- > 4 files changed, 27 insertions(+), 5 deletions(-) > >diff --git a/BaseTools/Source/Python/Common/DataType.py >b/BaseTools/Source/Python/Common/DataType.py >index 780711bf8e..1879aea665 100644 >--- a/BaseTools/Source/Python/Common/DataType.py >+++ b/BaseTools/Source/Python/Common/DataType.py >@@ -121,6 +121,7 @@ BINARY_FILE_TYPE_VER =3D 'VER' > BINARY_FILE_TYPE_UI =3D 'UI' > BINARY_FILE_TYPE_BIN =3D 'BIN' > BINARY_FILE_TYPE_FV =3D 'FV' >+BINARY_FILE_TYPE_FFS =3D 'FFS' > > PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS =3D 'LIBRARY_CLASS' > PLATFORM_COMPONENT_TYPE_MODULE =3D 'MODULE' >diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py >b/BaseTools/Source/Python/GenFds/EfiSection.py >index 302f244faf..5346a0569f 100644 >--- a/BaseTools/Source/Python/GenFds/EfiSection.py >+++ b/BaseTools/Source/Python/GenFds/EfiSection.py >@@ -93,7 +93,7 @@ class EfiSection (EfiSectionClassObject): > if '.depex' in SuffixMap: > FileList.append(Filename) > else: >- FileList, IsSect =3D Section.Section.GetFileList(FfsInf, self= .FileType, >self.FileExtension, Dict, IsMakefile=3DIsMakefile) >+ FileList, IsSect =3D Section.Section.GetFileList(FfsInf, self= .FileType, >self.FileExtension, Dict, IsMakefile=3DIsMakefile, SectionType=3DSectionTy= pe) > if IsSect : > return FileList, self.Alignment > >@@ -227,14 +227,20 @@ class EfiSection (EfiSectionClassObject): > else: > EdkLogger.error("GenFds", GENFDS_ERROR, "Output file = for %s >section could not be found for %s" % (SectionType, InfFileName)) > >+ elif len(FileList) > 1 and SectionType =3D=3D BINARY_FILE_TYP= E_FFS: >+ EdkLogger.error("GenFds", GENFDS_ERROR,"Files suffixed wi= th %s >are not allowed to have more than one file in %s[Binaries] section" % >(self.FileExtension, InfFileName)) >+ > else: > """Convert the File to Section file one by one """ > for File in FileList: > """ Copy Map file to FFS output path """ > Index =3D Index + 1 > Num =3D '%s.%d' %(SecNum, Index) >- OutputFile =3D os.path.join( OutputPath, ModuleName + >SUP_MODULE_SEC + Num + SectionSuffix.get(SectionType)) > File =3D GenFdsGlobalVariable.MacroExtend(File, Dict) >+ if SectionType =3D=3D BINARY_FILE_TYPE_FFS: >+ OutputFileList.append(File) >+ return OutputFileList, Align >+ OutputFile =3D os.path.join( OutputPath, ModuleName + >SUP_MODULE_SEC + Num + SectionSuffix.get(SectionType)) > > #Get PE Section alignment when align is set to AUTO > if self.Alignment =3D=3D 'Auto' and (SectionType =3D= =3D >BINARY_FILE_TYPE_PE32 or SectionType =3D=3D BINARY_FILE_TYPE_TE): >diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py >b/BaseTools/Source/Python/GenFds/FdfParser.py >index ea1c3eeb30..8446e3be4c 100644 >--- a/BaseTools/Source/Python/GenFds/FdfParser.py >+++ b/BaseTools/Source/Python/GenFds/FdfParser.py >@@ -3749,8 +3749,19 @@ class FdfParser: > # > def _GetEfiSection(self, Obj): > OldPos =3D self.GetFileBufferPos() >+ EfiSectionObj =3D EfiSection() > if not self._GetNextWord(): >- return False >+ CurrentLine =3D >self._CurrentLine()[self.CurrentOffsetWithinLine:].split()[0].strip() >+ if self._Token =3D=3D '{' and TAB_SPLIT in CurrentLine: >+ if self._IsToken(TAB_VALUE_SPLIT): >+ EfiSectionObj.FileExtension =3D self._GetFileExtensio= n() >+ elif self._GetNextToken(): >+ EfiSectionObj.FileName =3D self._Token >+ EfiSectionObj.SectionType =3D BINARY_FILE_TYPE_FFS >+ Obj.SectionList.append(EfiSectionObj) >+ return True >+ else: >+ return False > SectionName =3D self._Token > > if SectionName not in { >@@ -3816,7 +3827,6 @@ class FdfParser: > Obj.SectionList.append(FvImageSectionObj) > return True > >- EfiSectionObj =3D EfiSection() > EfiSectionObj.SectionType =3D SectionName > > if not self._GetNextToken(): >diff --git a/BaseTools/Source/Python/GenFds/Section.py >b/BaseTools/Source/Python/GenFds/Section.py >index c49a1ac84b..ae03828fef 100644 >--- a/BaseTools/Source/Python/GenFds/Section.py >+++ b/BaseTools/Source/Python/GenFds/Section.py >@@ -106,7 +106,7 @@ class Section (SectionClassObject): > # @param Dict dictionary contains macro and its value > # @retval tuple (File list, boolean) > # >- def GetFileList(FfsInf, FileType, FileExtension, Dict =3D {}, IsMakef= ile=3DFalse): >+ def GetFileList(FfsInf, FileType, FileExtension, Dict =3D {}, IsMakef= ile=3DFalse, >SectionType=3DNone): > IsSect =3D FileType in Section.SectFileType > > if FileExtension is not None: >@@ -134,6 +134,11 @@ class Section (SectionClassObject): > else: > GenFdsGlobalVariable.InfLogger ("\nCurrent ARCH \'%s\= ' of File %s >is not in the Support Arch Scope of %s specified by INF %s in >FDF" %(FfsInf.CurrentArch, File.File, File.Arch, FfsInf.InfFileName)) > >+ elif FileType is None and SectionType =3D=3D BINARY_FILE_TYPE_FFS= : >+ for File in FfsInf.BinFileList: >+ if File.Ext =3D=3D Suffix: >+ FileList.append(File.Path) >+ > if (not IsMakefile and Suffix is not None and >os.path.exists(FfsInf.EfiOutputPath)) or (IsMakefile and Suffix is not Non= e): > # > # Get Makefile path and time stamp >-- >2.14.1.windows.1