From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: bob.c.feng@intel.com) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by groups.io with SMTP; Fri, 24 May 2019 01:06:52 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 May 2019 01:06:51 -0700 X-ExtLoop1: 1 Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga001.fm.intel.com with ESMTP; 24 May 2019 01:06:51 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 24 May 2019 01:06:50 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 24 May 2019 01:06:50 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.129]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.70]) with mapi id 14.03.0415.000; Fri, 24 May 2019 16:06:49 +0800 From: "Bob Feng" To: "Fan, ZhijuX" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [PATCH V2] BaseTools:Make BaseTools support the correct RAW FFS FILE generation Thread-Topic: [PATCH V2] BaseTools:Make BaseTools support the correct RAW FFS FILE generation Thread-Index: AdURLEOLANfw3UflQ4yzV9rvXi+QKgA2poUA Date: Fri, 24 May 2019 08:06:48 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D160115496@SHSMSX101.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Zhiju, 1. For line +BINARY_FILE_TYPE_FFS =3D 'FFS' in DataType.py =20 Please use another word for RAW type file. 'FFS' may make people confu= sed with .ffs file 2. For lines in EfiSection.py + if SectionType =3D=3D BINARY_FILE_TYPE_FFS: + OutputFileList.append(File) + return OutputFileList, Align Please move them to the same level of other SectionType checking. Thanks, Bob -----Original Message----- From: Fan, ZhijuX=20 Sent: Thursday, May 23, 2019 1:57 PM To: devel@edk2.groups.io Cc: Gao, Liming ; Feng, Bob C Subject: [PATCH V2] BaseTools:Make BaseTools support the correct RAW FFS FI= LE 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 G= enFfs 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 fil= es 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/So= urce/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' =20 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/Sourc= e/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,=20 + self.FileType, self.FileExtension, Dict, IsMakefile=3DIsMakefile,=20 + SectionType=3DSectionType) if IsSect : return FileList, self.Alignment =20 @@ -227,14 +227,20 @@ class EfiSection (EfiSectionClassObject): else: EdkLogger.error("GenFds", GENFDS_ERROR, "Output file f= or %s section could not be found for %s" % (SectionType, InfFileName)) =20 + elif len(FileList) > 1 and SectionType =3D=3D BINARY_FILE_TYPE= _FFS: + EdkLogger.error("GenFds", GENFDS_ERROR,"Files suffixed=20 + with %s are not allowed to have more than one file in %s[Binaries]=20 + 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 += =20 + SUP_MODULE_SEC + Num + SectionSuffix.get(SectionType)) =20 #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.CurrentOffsetWithinLi= ne:].split()[0].strip() + if self._Token =3D=3D '{' and Obj.FvFileType =3D=3D "RAW" and = TAB_SPLIT in CurrentLine: + if self._IsToken(TAB_VALUE_SPLIT): + EfiSectionObj.FileExtension =3D self._GetFileExtension= () + 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 =20 if SectionName not in { @@ -3816,7 +3827,6 @@ class FdfParser: Obj.SectionList.append(FvImageSectionObj) return True =20 - EfiSectionObj =3D EfiSection() EfiSectionObj.SectionType =3D SectionName =20 if not self._GetNextToken(): diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/P= ython/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 {}, IsMakefi= le=3DFalse): + def GetFileList(FfsInf, FileType, FileExtension, Dict =3D {}, IsMakefi= le=3DFalse, SectionType=3DNone): IsSect =3D FileType in Section.SectFileType =20 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 F= DF" %(FfsInf.CurrentArch, File.File, File.Arch, FfsInf.InfFileName)) =20 + 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(FfsIn= f.EfiOutputPath)) or (IsMakefile and Suffix is not None): # # Get Makefile path and time stamp -- 2.14.1.windows.1