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.20, mailfrom: bob.c.feng@intel.com) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by groups.io with SMTP; Wed, 29 May 2019 19:16:16 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2019 19:16:15 -0700 X-ExtLoop1: 1 Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by FMSMGA003.fm.intel.com with ESMTP; 29 May 2019 19:16:15 -0700 Received: from fmsmsx161.amr.corp.intel.com (10.18.125.9) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 29 May 2019 19:16:15 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX161.amr.corp.intel.com (10.18.125.9) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 29 May 2019 19:16:14 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.10]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.120]) with mapi id 14.03.0415.000; Thu, 30 May 2019 10:16:11 +0800 From: "Bob Feng" To: "Fan, ZhijuX" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [PATCH V5] BaseTools:Make BaseTools support new rules to generate RAW FFS FILE Thread-Topic: [PATCH V5] BaseTools:Make BaseTools support new rules to generate RAW FFS FILE Thread-Index: AdUV338Ca0P0rxYRQIiCRwHh/8O6mQADl33gAAF+aFAAJmn+wA== Date: Thu, 30 May 2019 02:16:11 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D160126091@SHSMSX101.ccr.corp.intel.com> References: <08650203BA1BD64D8AD9B6D5D74A85D160117721@SHSMSX101.ccr.corp.intel.com> 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 OK. For this patch, Reviewed-by: Bob Feng -----Original Message----- From: Fan, ZhijuX=20 Sent: Wednesday, May 29, 2019 4:25 PM To: Feng, Bob C ; devel@edk2.groups.io Cc: Gao, Liming Subject: RE: [PATCH V5] BaseTools:Make BaseTools support new rules to gener= ate RAW FFS FILE The Dict parameter is not used in this function, I will enter an BZ:=20 https://bugzilla.tianocore.org/show_bug.cgi?id=3D1858 to clean up the unus= ed parameters Any question, please let me know. Thanks. Best Regards Fan Zhiju > -----Original Message----- > From: Feng, Bob C > Sent: Wednesday, May 29, 2019 3:16 PM > To: Fan, ZhijuX ; devel@edk2.groups.io > Cc: Gao, Liming > Subject: RE: [PATCH V5] BaseTools:Make BaseTools support new rules to=20 > generate RAW FFS FILE >=20 > Hi Zhiju, >=20 > For the changes, >=20 > - def __InfParse__(self, Dict =3D {}): > + def __InfParse__(self, Dict =3D None, IsGenFfs=3DFalse): >=20 > and >=20 > - def GetFileList(FfsInf, FileType, FileExtension, Dict =3D {}, IsMake= file=3DFalse): > + def GetFileList(FfsInf, FileType, FileExtension, Dict =3D None, > IsMakefile=3DFalse, SectionType=3DNone): >=20 > I think you need to add > If Dict is None: > Dict =3D {} >=20 > In the function body. >=20 >=20 > Thanks, > Bob >=20 > -----Original Message----- > From: Fan, ZhijuX > Sent: Wednesday, May 29, 2019 1:30 PM > To: devel@edk2.groups.io > Cc: Gao, Liming ; Feng, Bob C=20 > > Subject: [PATCH V5] BaseTools:Make BaseTools support new rules to=20 > generate RAW FFS FILE >=20 > BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1765 >=20 > If RAW FFS File Rule has no section for its data.For RAW FFS File,=20 > directly call GenFfs tool to generate FFS file. >=20 > Ffs Rule: > [Rule.Common.USER_DEFINED.MicroCode] > FILE RAW =3D $(NAMED_GUID) { > $(INF_OUTPUT)/$(MODULE_NAME).bin > } > [Rule.Common.USER_DEFINED.LOGO] > FILE RAW =3D $(NAMED_GUID) { > |.bmp > } >=20 > As shown in the rule above,if SectionType and FileType not defined,=20 > FFS files are generated directly, and no other type of file is generated. >=20 > The patch is to make the BaseTools support these two rules >=20 > Cc: Bob Feng > Cc: Liming Gao > Signed-off-by: Zhiju.Fan > --- > BaseTools/Source/Python/Common/DataType.py | 1 + > BaseTools/Source/Python/GenFds/EfiSection.py | 22 > +++++++++++++++++++++- > BaseTools/Source/Python/GenFds/FdfParser.py | 14 ++++++++++++-- > BaseTools/Source/Python/GenFds/FfsInfStatement.py | 9 ++++++--- > BaseTools/Source/Python/GenFds/Section.py | 7 ++++++- > 5 files changed, 46 insertions(+), 7 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/Common/DataType.py > b/BaseTools/Source/Python/Common/DataType.py > index 7cd67bc01a..83ec36c235 100644 > --- a/BaseTools/Source/Python/Common/DataType.py > +++ b/BaseTools/Source/Python/Common/DataType.py > @@ -122,6 +122,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_RAW =3D 'RAW_BINARY' >=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/Source/Python/GenFds/EfiSection.py > index 302f244faf..74f176cfef 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, sel= f.FileType, > self.FileExtension, Dict, IsMakefile=3DIsMakefile) > + FileList, IsSect =3D Section.Section.GetFileList(FfsInf, > + self.FileType, self.FileExtension, Dict, IsMakefile=3DIsMakefile, > + SectionType=3DSectionType) > if IsSect : > return FileList, self.Alignment >=20 > @@ -217,6 +217,26 @@ class EfiSection (EfiSectionClassObject): > Ui=3DStringData, Is= Makefile=3DIsMakefile) > OutputFileList.append(OutputFile) >=20 > + # > + # If Section Type is BINARY_FILE_TYPE_RAW > + # > + elif SectionType =3D=3D BINARY_FILE_TYPE_RAW: > + """If File List is empty""" > + if FileList =3D=3D []: > + if self.Optional =3D=3D True: > + GenFdsGlobalVariable.VerboseLogger("Optional=20 > + Section don't > exist!") > + return [], None > + else: > + EdkLogger.error("GenFds", GENFDS_ERROR, "Output=20 > + file for %s section could not be found for %s" % (SectionType, > + InfFileName)) > + > + elif len(FileList) > 1: > + EdkLogger.error("GenFds", GENFDS_ERROR, > + "Files suffixed with %s are not=20 > + allowed to have more than > one file in %s[Binaries] section" % ( > + self.FileExtension, InfFileName)) > + else: > + for File in FileList: > + File =3D GenFdsGlobalVariable.MacroExtend(File, Dict= ) > + OutputFileList.append(File) >=20 > else: > """If File List is empty""" > diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py > b/BaseTools/Source/Python/GenFds/FdfParser.py > index ea1c3eeb30..fb5fd85e0a 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 Obj.FvFileType =3D=3D "RAW" an= d=20 > + TAB_SPLIT in > CurrentLine: > + if self._IsToken(TAB_VALUE_SPLIT): > + EfiSectionObj.FileExtension =3D self._GetFileExtensi= on() > + elif self._GetNextToken(): > + EfiSectionObj.FileName =3D self._Token > + EfiSectionObj.SectionType =3D BINARY_FILE_TYPE_RAW > + 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/FfsInfStatement.py > b/BaseTools/Source/Python/GenFds/FfsInfStatement.py > index 78dd7cd51a..cd3b0f6477 100644 > --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py > +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py > @@ -147,7 +147,7 @@ class FfsInfStatement(FfsInfStatementClassObject): > # @param self The object pointer > # @param Dict dictionary contains macro and value pair > # > - def __InfParse__(self, Dict =3D {}): > + def __InfParse__(self, Dict =3D None, IsGenFfs=3DFalse): >=20 > GenFdsGlobalVariable.VerboseLogger( " Begine parsing INf file=20 > : %s" %self.InfFileName) >=20 > @@ -348,7 +348,10 @@ class FfsInfStatement(FfsInfStatementClassObject): > # > # Set OutputPath =3D ${WorkSpace}\Build\Fv\Ffs\${ModuleGuid}+ > ${ModuleName}\ > # > - > + if IsGenFfs: > + Rule =3D self.__GetRule__() > + if GlobalData.gGuidPatternEnd.match(Rule.NameGuid): > + self.ModuleGuid =3D Rule.NameGuid > self.OutputPath =3D os.path.join(GenFdsGlobalVariable.FfsDir, \ > self.ModuleGuid + self.BaseName) > if not os.path.exists(self.OutputPath) : > @@ -438,7 +441,7 @@ class FfsInfStatement(FfsInfStatementClassObject): > # Parse Inf file get Module related information > # >=20 > - self.__InfParse__(Dict) > + self.__InfParse__(Dict, IsGenFfs=3DTrue) > Arch =3D self.GetCurrentArch() > SrcFile =3D mws.join( GenFdsGlobalVariable.WorkSpaceDir, > self.InfFileName); > DestFile =3D os.path.join( self.OutputPath, self.ModuleGuid +=20 > '.ffs') diff -- git a/BaseTools/Source/Python/GenFds/Section.py > b/BaseTools/Source/Python/GenFds/Section.py > index c49a1ac84b..b238956634 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 {}, IsMake= file=3DFalse): > + def GetFileList(FfsInf, FileType, FileExtension, Dict =3D None, > IsMakefile=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=20 > \'%s\' of File %s is not in the Support Arch Scope of %s specified by=20 > INF %s in FDF" %(FfsInf.CurrentArch, File.File, File.Arch,=20 > FfsInf.InfFileName)) >=20 > + elif FileType is None and SectionType =3D=3D BINARY_FILE_TYPE_RA= W: > + 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 No= ne): > # > # Get Makefile path and time stamp > -- > 2.14.1.windows.1