From: "Bob Feng" <bob.c.feng@intel.com>
To: "Fan, ZhijuX" <zhijux.fan@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH V2] BaseTools:Make BaseTools support the correct RAW FFS FILE generation
Date: Fri, 24 May 2019 08:06:48 +0000 [thread overview]
Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D160115496@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <FAD0D7E0AE0FA54D987F6E72435CAFD50AF62414@SHSMSX101.ccr.corp.intel.com>
Hi Zhiju,
1. For line +BINARY_FILE_TYPE_FFS = 'FFS' in DataType.py
Please use another word for RAW type file. 'FFS' may make people confused with .ffs file
2. For lines in EfiSection.py
+ if SectionType == 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
Sent: Thursday, May 23, 2019 1:57 PM
To: devel@edk2.groups.io
Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
Subject: [PATCH V2] BaseTools:Make BaseTools support the correct RAW FFS FILE generation
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1765
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 = $(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 <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
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 = 'VER'
BINARY_FILE_TYPE_UI = 'UI'
BINARY_FILE_TYPE_BIN = 'BIN'
BINARY_FILE_TYPE_FV = 'FV'
+BINARY_FILE_TYPE_FFS = 'FFS'
PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS = 'LIBRARY_CLASS'
PLATFORM_COMPONENT_TYPE_MODULE = '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 = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension, Dict, IsMakefile=IsMakefile)
+ FileList, IsSect = Section.Section.GetFileList(FfsInf,
+ self.FileType, self.FileExtension, Dict, IsMakefile=IsMakefile,
+ SectionType=SectionType)
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 == BINARY_FILE_TYPE_FFS:
+ EdkLogger.error("GenFds", GENFDS_ERROR,"Files suffixed
+ with %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 = Index + 1
Num = '%s.%d' %(SecNum, Index)
- OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + Num + SectionSuffix.get(SectionType))
File = GenFdsGlobalVariable.MacroExtend(File, Dict)
+ if SectionType == BINARY_FILE_TYPE_FFS:
+ OutputFileList.append(File)
+ return OutputFileList, Align
+ OutputFile = 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 == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == 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 = self.GetFileBufferPos()
+ EfiSectionObj = EfiSection()
if not self._GetNextWord():
- return False
+ CurrentLine = self._CurrentLine()[self.CurrentOffsetWithinLine:].split()[0].strip()
+ if self._Token == '{' and Obj.FvFileType == "RAW" and TAB_SPLIT in CurrentLine:
+ if self._IsToken(TAB_VALUE_SPLIT):
+ EfiSectionObj.FileExtension = self._GetFileExtension()
+ elif self._GetNextToken():
+ EfiSectionObj.FileName = self._Token
+ EfiSectionObj.SectionType = BINARY_FILE_TYPE_FFS
+ Obj.SectionList.append(EfiSectionObj)
+ return True
+ else:
+ return False
SectionName = self._Token
if SectionName not in {
@@ -3816,7 +3827,6 @@ class FdfParser:
Obj.SectionList.append(FvImageSectionObj)
return True
- EfiSectionObj = EfiSection()
EfiSectionObj.SectionType = 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 = {}, IsMakefile=False):
+ def GetFileList(FfsInf, FileType, FileExtension, Dict = {}, IsMakefile=False, SectionType=None):
IsSect = 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 == BINARY_FILE_TYPE_FFS:
+ for File in FfsInf.BinFileList:
+ if File.Ext == 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 None):
#
# Get Makefile path and time stamp
--
2.14.1.windows.1
prev parent reply other threads:[~2019-05-24 8:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 5:56 [PATCH V2] BaseTools:Make BaseTools support the correct RAW FFS FILE generation Fan, ZhijuX
2019-05-24 8:06 ` Bob Feng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=08650203BA1BD64D8AD9B6D5D74A85D160115496@SHSMSX101.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox