Re: [edk2-devel] [PATCH V5] BaseTools:Make BaseTools support new rules to generate RAW FFS FILE

2019-05-29 Thread Bob Feng
OK. For this patch, Reviewed-by: Bob Feng 


-Original Message-
From: Fan, ZhijuX 
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 generate 
RAW FFS FILE

The Dict parameter is not used in this function, I will enter an BZ: 
https://bugzilla.tianocore.org/show_bug.cgi?id=1858  to clean up the unused 
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 
> generate RAW FFS FILE
> 
> Hi Zhiju,
> 
> For the changes,
> 
> -def __InfParse__(self, Dict = {}):
> +def __InfParse__(self, Dict = None, IsGenFfs=False):
> 
> and
> 
> -def GetFileList(FfsInf, FileType, FileExtension, Dict = {}, 
> IsMakefile=False):
> +def GetFileList(FfsInf, FileType, FileExtension, Dict = None,
> IsMakefile=False, SectionType=None):
> 
> I think you need to add
> If Dict is None:
> Dict = {}
> 
> In the function body.
> 
> 
> Thanks,
> Bob
> 
> -Original Message-
> From: Fan, ZhijuX
> Sent: Wednesday, May 29, 2019 1:30 PM
> To: devel@edk2.groups.io
> Cc: Gao, Liming ; Feng, Bob C 
> 
> Subject: [PATCH V5] BaseTools:Make BaseTools support new rules to 
> generate RAW FFS FILE
> 
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1765
> 
> If RAW FFS File Rule 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) {
> $(INF_OUTPUT)/$(MODULE_NAME).bin
>   }
> [Rule.Common.USER_DEFINED.LOGO]
>   FILE RAW = $(NAMED_GUID) {
>|.bmp
>   }
> 
> 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.
> 
> The patch is to make the BaseTools support these two rules
> 
> 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(-)
> 
> 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 = 'VER'
>  BINARY_FILE_TYPE_UI = 'UI'
>  BINARY_FILE_TYPE_BIN = 'BIN'
>  BINARY_FILE_TYPE_FV = 'FV'
> +BINARY_FILE_TYPE_RAW = 'RAW_BINARY'
> 
>  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..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 = 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
> 
> @@ -217,6 +217,26 @@ class EfiSection (EfiSectionClassObject):
>   Ui=StringData, 
> IsMakefile=IsMakefile)
>  OutputFileList.append(OutputFile)
> 
> +#
> +# If Section Type is BINARY_FILE_TYPE_RAW
> +#
> +elif SectionType == BINARY_FILE_TYPE_RAW:
> +"""If File List is empty"""
> +if FileList == []:
> +if self.Optional == True:
> +GenFdsGlobalVariable.VerboseLogger("Optional 
> + Section don't
> exist!")
> +return [], None
> +else:
> +EdkLogger.error("GenFds", GENFDS_ERROR, "Output 
> + 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 
> + allowed to have more than
> one file in %s[Binaries] section" % (
> +

Re: [edk2-devel] [PATCH V5] BaseTools:Make BaseTools support new rules to generate RAW FFS FILE

2019-05-29 Thread Fan, ZhijuX
The Dict parameter is not used in this function, I will enter an BZ: 
https://bugzilla.tianocore.org/show_bug.cgi?id=1858  to clean up the unused 
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
> generate RAW FFS FILE
> 
> Hi Zhiju,
> 
> For the changes,
> 
> -def __InfParse__(self, Dict = {}):
> +def __InfParse__(self, Dict = None, IsGenFfs=False):
> 
> and
> 
> -def GetFileList(FfsInf, FileType, FileExtension, Dict = {}, 
> IsMakefile=False):
> +def GetFileList(FfsInf, FileType, FileExtension, Dict = None,
> IsMakefile=False, SectionType=None):
> 
> I think you need to add
> If Dict is None:
> Dict = {}
> 
> In the function body.
> 
> 
> Thanks,
> Bob
> 
> -Original Message-
> From: Fan, ZhijuX
> Sent: Wednesday, May 29, 2019 1:30 PM
> To: devel@edk2.groups.io
> Cc: Gao, Liming ; Feng, Bob C 
> Subject: [PATCH V5] BaseTools:Make BaseTools support new rules to
> generate RAW FFS FILE
> 
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1765
> 
> If RAW FFS File Rule 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) {
> $(INF_OUTPUT)/$(MODULE_NAME).bin
>   }
> [Rule.Common.USER_DEFINED.LOGO]
>   FILE RAW = $(NAMED_GUID) {
>|.bmp
>   }
> 
> 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.
> 
> The patch is to make the BaseTools support these two rules
> 
> 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(-)
> 
> 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 = 'VER'
>  BINARY_FILE_TYPE_UI = 'UI'
>  BINARY_FILE_TYPE_BIN = 'BIN'
>  BINARY_FILE_TYPE_FV = 'FV'
> +BINARY_FILE_TYPE_RAW = 'RAW_BINARY'
> 
>  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..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 = 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
> 
> @@ -217,6 +217,26 @@ class EfiSection (EfiSectionClassObject):
>   Ui=StringData, 
> IsMakefile=IsMakefile)
>  OutputFileList.append(OutputFile)
> 
> +#
> +# If Section Type is BINARY_FILE_TYPE_RAW
> +#
> +elif SectionType == BINARY_FILE_TYPE_RAW:
> +"""If File List is empty"""
> +if FileList == []:
> +if self.Optional == True:
> +GenFdsGlobalVariable.VerboseLogger("Optional Section 
> don't
> exist!")
> +return [], None
> +else:
> +EdkLogger.error("GenFds", GENFDS_ERROR, "Output
> + 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 allowed to 
> have more than
> one file in %s[Binaries] section" % (
> +self.FileExtension, InfFileName))
> +else:
> +for File in FileList:
> +File = GenFdsGlobalVariable.MacroExtend(File, Dict)
> +OutputFileList.append(File)
> 
>  else:
>  """If File List is empty"""
> 

Re: [edk2-devel] [PATCH V5] BaseTools:Make BaseTools support new rules to generate RAW FFS FILE

2019-05-29 Thread Bob Feng
Hi Zhiju,

For the changes,

-def __InfParse__(self, Dict = {}):
+def __InfParse__(self, Dict = None, IsGenFfs=False):

and

-def GetFileList(FfsInf, FileType, FileExtension, Dict = {}, 
IsMakefile=False):
+def GetFileList(FfsInf, FileType, FileExtension, Dict = None, 
IsMakefile=False, SectionType=None):

I think you need to add
If Dict is None:
Dict = {}

In the function body.


Thanks,
Bob

-Original Message-
From: Fan, ZhijuX 
Sent: Wednesday, May 29, 2019 1:30 PM
To: devel@edk2.groups.io
Cc: Gao, Liming ; Feng, Bob C 
Subject: [PATCH V5] BaseTools:Make BaseTools support new rules to generate RAW 
FFS FILE

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1765

If RAW FFS File Rule 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) {
$(INF_OUTPUT)/$(MODULE_NAME).bin
  }
[Rule.Common.USER_DEFINED.LOGO]
  FILE RAW = $(NAMED_GUID) {
   |.bmp
  }

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.

The patch is to make the BaseTools support these two rules

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(-)

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 = 'VER'
 BINARY_FILE_TYPE_UI = 'UI'
 BINARY_FILE_TYPE_BIN = 'BIN'
 BINARY_FILE_TYPE_FV = 'FV'
+BINARY_FILE_TYPE_RAW = 'RAW_BINARY'
 
 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..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 = 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
 
@@ -217,6 +217,26 @@ class EfiSection (EfiSectionClassObject):
  Ui=StringData, 
IsMakefile=IsMakefile)
 OutputFileList.append(OutputFile)
 
+#
+# If Section Type is BINARY_FILE_TYPE_RAW
+#
+elif SectionType == BINARY_FILE_TYPE_RAW:
+"""If File List is empty"""
+if FileList == []:
+if self.Optional == True:
+GenFdsGlobalVariable.VerboseLogger("Optional Section don't 
exist!")
+return [], None
+else:
+EdkLogger.error("GenFds", GENFDS_ERROR, "Output 
+ 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 allowed to 
have more than one file in %s[Binaries] section" % (
+self.FileExtension, InfFileName))
+else:
+for File in FileList:
+File = GenFdsGlobalVariable.MacroExtend(File, Dict)
+OutputFileList.append(File)
 
 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 = 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):
+ 

Re: [edk2-devel] [PATCH V5] BaseTools:Make BaseTools support new rules to generate RAW FFS FILE

2019-05-29 Thread Liming Gao
Tested-by: Liming Gao 

>-Original Message-
>From: Fan, ZhijuX
>Sent: Wednesday, May 29, 2019 1:30 PM
>To: devel@edk2.groups.io
>Cc: Gao, Liming ; Feng, Bob C 
>Subject: [PATCH V5] BaseTools:Make BaseTools support new rules to
>generate RAW FFS FILE
>
>BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1765
>
>If RAW FFS File Rule 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) {
>$(INF_OUTPUT)/$(MODULE_NAME).bin
>  }
>[Rule.Common.USER_DEFINED.LOGO]
>  FILE RAW = $(NAMED_GUID) {
>   |.bmp
>  }
>
>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.
>
>The patch is to make the BaseTools support these two rules
>
>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(-)
>
>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 = 'VER'
> BINARY_FILE_TYPE_UI = 'UI'
> BINARY_FILE_TYPE_BIN = 'BIN'
> BINARY_FILE_TYPE_FV = 'FV'
>+BINARY_FILE_TYPE_RAW = 'RAW_BINARY'
>
> 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..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 = 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
>
>@@ -217,6 +217,26 @@ class EfiSection (EfiSectionClassObject):
>  Ui=StringData, 
> IsMakefile=IsMakefile)
> OutputFileList.append(OutputFile)
>
>+#
>+# If Section Type is BINARY_FILE_TYPE_RAW
>+#
>+elif SectionType == BINARY_FILE_TYPE_RAW:
>+"""If File List is empty"""
>+if FileList == []:
>+if self.Optional == True:
>+GenFdsGlobalVariable.VerboseLogger("Optional Section don't
>exist!")
>+return [], None
>+else:
>+EdkLogger.error("GenFds", GENFDS_ERROR, "Output 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 allowed to 
>have more than
>one file in %s[Binaries] section" % (
>+self.FileExtension, InfFileName))
>+else:
>+for File in FileList:
>+File = GenFdsGlobalVariable.MacroExtend(File, Dict)
>+OutputFileList.append(File)
>
> 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 = 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_RAW
>+Obj.SectionList.append(EfiSectionObj)
>+  

[edk2-devel] [PATCH V5] BaseTools:Make BaseTools support new rules to generate RAW FFS FILE

2019-05-28 Thread Fan, ZhijuX
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1765

If RAW FFS File Rule 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) {
$(INF_OUTPUT)/$(MODULE_NAME).bin
  }
[Rule.Common.USER_DEFINED.LOGO]
  FILE RAW = $(NAMED_GUID) {
   |.bmp
  }

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.

The patch is to make the BaseTools support these two rules

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(-)

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 = 'VER'
 BINARY_FILE_TYPE_UI = 'UI'
 BINARY_FILE_TYPE_BIN = 'BIN'
 BINARY_FILE_TYPE_FV = 'FV'
+BINARY_FILE_TYPE_RAW = 'RAW_BINARY'
 
 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..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 = 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
 
@@ -217,6 +217,26 @@ class EfiSection (EfiSectionClassObject):
  Ui=StringData, 
IsMakefile=IsMakefile)
 OutputFileList.append(OutputFile)
 
+#
+# If Section Type is BINARY_FILE_TYPE_RAW
+#
+elif SectionType == BINARY_FILE_TYPE_RAW:
+"""If File List is empty"""
+if FileList == []:
+if self.Optional == True:
+GenFdsGlobalVariable.VerboseLogger("Optional Section don't 
exist!")
+return [], None
+else:
+EdkLogger.error("GenFds", GENFDS_ERROR, "Output 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 allowed to 
have more than one file in %s[Binaries] section" % (
+self.FileExtension, InfFileName))
+else:
+for File in FileList:
+File = GenFdsGlobalVariable.MacroExtend(File, Dict)
+OutputFileList.append(File)
 
 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 = 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_RAW
+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