Re: [edk2] [Patch V2] BaseTools: Fixed issue in MultiThread Genfds function

2019-04-02 Thread Feng, Bob C
If user does not use multiple thread genfds, there will be no problem. 

-Original Message-
From: Gao, Liming 
Sent: Wednesday, April 3, 2019 10:49 AM
To: Feng, Bob C 
Cc: edk2-devel@lists.01.org
Subject: RE: [Patch V2] BaseTools: Fixed issue in MultiThread Genfds function

Bob:
  Thanks for your updating. If user only update BaseTools, and don't update 
Conf\build_rule.txt. What problem will happen?

Thanks
Liming
> -Original Message-
> From: Feng, Bob C
> Sent: Wednesday, April 3, 2019 10:17 AM
> To: edk2-devel@lists.01.org
> Cc: Feng, Bob C ; Gao, Liming 
> 
> Subject: [Patch V2] BaseTools: Fixed issue in MultiThread Genfds 
> function
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1450
> In the Multiple thread Genfds feature, build tool generates GenSec, 
> GenFFS command in Makefile.
> 
> The Non-Hii Driver does not generate .offset file for uni string 
> offset, but the build tool has not knowledge about this in autogen 
> phase. So in this patch, I add a check in Makefile for GenSec command. 
> If the GenSec input file does not exist, the GenSec will not be 
> called. And if GenSec command is not called, its output file, which is 
> also the input file of GenFfs command, will also not exist.So for 
> GenFfs command, I add a new command parameter -oi which means the 
> input file is an optional input file which would not exist. so that I 
> can generate GenFfs command with "-oi" parameter in Makefile.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> ---
>  BaseTools/Conf/build_rule.template  |  8 
>  BaseTools/Source/C/GenFfs/GenFfs.c  | 17 +++--
>  BaseTools/Source/Python/AutoGen/GenMake.py  |  2 +-
>  .../Python/GenFds/GenFdsGlobalVariable.py   | 10 +-
>  .../Source/Python/Workspace/DscBuildData.py |  3 +++
>  BaseTools/Source/Python/build/build.py  | 10 +-
>  6 files changed, 37 insertions(+), 13 deletions(-)
> 
> diff --git a/BaseTools/Conf/build_rule.template 
> b/BaseTools/Conf/build_rule.template
> index e56b1d9c59..17e7353063 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -357,15 +357,15 @@
>  [Dynamic-Library-File]
>  
>  ?.dll
> 
>  
> -$(DEBUG_DIR)(+)$(MODULE_NAME).efi
> +$(OUTPUT_DIR)(+)$(MODULE_NAME).efi
> 
>  
>  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> -$(CP) ${dst} $(OUTPUT_DIR)
> +$(CP) ${dst} $(DEBUG_DIR)
>  $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
>  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
>  -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR)
>  
>  $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
> @@ -376,21 +376,21 @@
>  #
>  -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
>  -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug 
> $(BIN_DIR)(+)$(MODULE_NAME_GUID).debug
> 
>  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> -$(CP) ${dst} $(OUTPUT_DIR)
> +$(CP) ${dst} $(DEBUG_DIR)
>  $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
>  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
> 
>  
>  # tool to convert Mach-O to PE/COFF
>  "$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS)  ${src}  
> $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff
>  # create symbol file for GDB debug
>  -$(DSYMUTIL) ${src}
>  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} 
> $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)
> -$(CP) ${dst} $(OUTPUT_DIR)
> +$(CP) ${dst} $(DEBUG_DIR)
>  $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
>  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
> 
>  [Dependency-Expression-File]
>  
> diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c 
> b/BaseTools/Source/C/GenFfs/GenFfs.c
> index 02c7ac30f0..ea36b22bef 100644
> --- a/BaseTools/Source/C/GenFfs/GenFfs.c
> +++ b/BaseTools/Source/C/GenFfs/GenFfs.c
> @@ -17,10 +17,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
> EXPRESS OR IMPLIED.
>  #include 
>  #include 
>  #include 
>  #endif
> 
> +#ifdef __GNUC__
> +#include 
> +#endif
> +
>  #include 
>  #include 
>  #include 
> 
>  #include 
> @@ -158,10 +162,12 @@ Returns:
>  FileAlign points to file alignment, which only 
> support\n\
>  the following align: 
> 1,2,4,8,16,128,512,1K,4K,32K,64K\n\
>  128K,256K,512K,1M,2M,4M,8M,16M\n");
>fprintf (stdout, &qu

[edk2] [Patch V2] BaseTools: Fixed issue in MultiThread Genfds function

2019-04-02 Thread Feng, Bob C
https://bugzilla.tianocore.org/show_bug.cgi?id=1450
In the Multiple thread Genfds feature, build tool generates
GenSec, GenFFS command in Makefile.

The Non-Hii Driver does not generate .offset file for uni string offset,
but the build tool has not knowledge about this in autogen phase. So
in this patch, I add a check in Makefile for GenSec command. If the GenSec
input file does not exist, the GenSec will not be called. And if GenSec
command is not called, its output file, which is also the input file of
GenFfs command, will also not exist.So for GenFfs command,
I add a new command parameter -oi which means
the input file is an optional input file which would not exist. so
that I can generate GenFfs command with "-oi" parameter in Makefile.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Conf/build_rule.template  |  8 
 BaseTools/Source/C/GenFfs/GenFfs.c  | 17 +++--
 BaseTools/Source/Python/AutoGen/GenMake.py  |  2 +-
 .../Python/GenFds/GenFdsGlobalVariable.py   | 10 +-
 .../Source/Python/Workspace/DscBuildData.py |  3 +++
 BaseTools/Source/Python/build/build.py  | 10 +-
 6 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index e56b1d9c59..17e7353063 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -357,15 +357,15 @@
 [Dynamic-Library-File]
 
 ?.dll
 
 
-$(DEBUG_DIR)(+)$(MODULE_NAME).efi
+$(OUTPUT_DIR)(+)$(MODULE_NAME).efi
 
 
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
-$(CP) ${dst} $(OUTPUT_DIR)
+$(CP) ${dst} $(DEBUG_DIR)
 $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
 -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR) 
 
 $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
@@ -376,21 +376,21 @@
 #
 -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
 -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug 
$(BIN_DIR)(+)$(MODULE_NAME_GUID).debug
 
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
-$(CP) ${dst} $(OUTPUT_DIR)
+$(CP) ${dst} $(DEBUG_DIR)
 $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
 
 
 # tool to convert Mach-O to PE/COFF
 "$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS)  ${src}  
$(DEBUG_DIR)(+)$(MODULE_NAME).pecoff
 # create symbol file for GDB debug
 -$(DSYMUTIL) ${src}
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} 
$(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)
-$(CP) ${dst} $(OUTPUT_DIR)
+$(CP) ${dst} $(DEBUG_DIR)
 $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
 
 [Dependency-Expression-File]
 
diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c 
b/BaseTools/Source/C/GenFfs/GenFfs.c
index 02c7ac30f0..ea36b22bef 100644
--- a/BaseTools/Source/C/GenFfs/GenFfs.c
+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
@@ -17,10 +17,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
 #endif
 
+#ifdef __GNUC__
+#include 
+#endif
+
 #include 
 #include 
 #include 
 
 #include 
@@ -158,10 +162,12 @@ Returns:
 FileAlign points to file alignment, which only 
support\n\
 the following align: 
1,2,4,8,16,128,512,1K,4K,32K,64K\n\
 128K,256K,512K,1M,2M,4M,8M,16M\n");
   fprintf (stdout, "  -i SectionFile, --sectionfile SectionFile\n\
 Section file will be contained in this FFS file.\n");
+  fprintf (stdout, "  -oi SectionFile, --optionalsectionfile SectionFile\n\
+If the Section file exists, it will be contained in 
this FFS file, otherwise, it will be ignored.\n");
   fprintf (stdout, "  -n SectionAlign, --sectionalign SectionAlign\n\
 SectionAlign points to section alignment, which 
support\n\
 the alignment scope 0~16M. If SectionAlign is 
specified\n\
 as 0, tool get alignment value from SectionFile. It 
is\n\
 specified together with sectionfile to point its\n\
@@ -734,19 +740,26 @@ Returns:
   argc -= 2;
   argv += 2;
   continue;
 }
 
-if ((stricmp (argv[0], "-i") == 0) || (stricmp (argv[0], "--sectionfile") 
== 0)) {
+if ((stricmp (argv[0], "-oi") == 0) || (stricmp (argv[0], 
"--optionalsectionfile") == 0) || (stricmp (argv[0], "-i") == 0) || (stricmp 
(argv[0], "--sectionfile") == 0)) {
   //
   // Get Input file name and its alignment
   //
   if (argv[1] == NULL || argv[1][0] == '-') {
 Error (NULL, 0, 1003, "Invalid option value", "in

Re: [edk2] [Patch] BaseTools: Fixed issue in MultiThread Genfds function

2019-04-02 Thread Feng, Bob C
BZ for remove additional copy action. 
https://bugzilla.tianocore.org/show_bug.cgi?id=1673


-Original Message-
From: Gao, Liming 
Sent: Friday, March 29, 2019 10:09 PM
To: Feng, Bob C ; edk2-devel@lists.01.org
Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds function

Yes. Please submit one BZ for it. 

> -Original Message-
> From: Feng, Bob C
> Sent: Friday, March 29, 2019 8:40 PM
> To: Gao, Liming ; edk2-devel@lists.01.org
> Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds 
> function
> 
> That will impact the original GenFds since the command is generate by 
> reusing the GenFds functions. What about enter a new BZ to do that change?
> 
> Thanks,
> Bob
> 
> -Original Message-
> From: Gao, Liming
> Sent: Friday, March 29, 2019 8:33 PM
> To: Feng, Bob C ; edk2-devel@lists.01.org
> Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds 
> function
> 
> Bob:
>   Could you update the rule to depend on EFI image from DEBUG_DIR? I 
> would like to remove the additional copy from DEBUG dir to OUTPUT dir and 
> save the disk and performance.
> 
> $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 : $(DEBUG_DIR)\LogoDxe.efi
>   GenSec -s EFI_SECTION_PE32 -o 
> $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 
> $(DEBUG_DIR)\LogoDxe.efi
> 
> Thanks
> Liming
> > -Original Message-
> > From: Feng, Bob C
> > Sent: Friday, March 29, 2019 8:00 PM
> > To: Gao, Liming ; edk2-devel@lists.01.org
> > Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds 
> > function
> >
> > That's to fix the issue that make will fail if enable multiple thread 
> > genfds.
> >
> > For example, If enable Multiple thread Genfds, there will be GenSec command 
> > in the Makefile like below.
> >
> > $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 : $(OUTPUT_DIR)\LogoDxe.efi
> > GenSec -s EFI_SECTION_PE32 -o
> > $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32
> > $(OUTPUT_DIR)\LogoDxe.efi
> >
> >
> > The $(OUTPUT_DIR)\LogoDxe.efi is the dependency, but there is no make rule 
> > for $(OUTPUT_DIR)\LogoDxe.efi generated in the Makefile.
> > Make program does not know how to make $(OUTPUT_DIR)\LogoDxe.efi.  Make 
> > fails for this case.
> >
> > In the build_rule.txt, the $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi   is 
> > generated by the command $(CP)
> > $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR) under 
> > Dynamic-Library-File section, so $(OUTPUT_DIR)\ 
> > )(+)$(MODULE_NAME).efi should also be a output for 
> > Dynamic-Library-File
> >
> > Thanks,
> > Bob
> >
> > -Original Message-
> > From: Gao, Liming
> > Sent: Friday, March 29, 2019 7:42 PM
> > To: Feng, Bob C ; edk2-devel@lists.01.org
> > Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds 
> > function
> >
> > Bob:
> >   Could you list the more information on why update build_rule.txt?
> >
> > > -Original Message-
> > > From: Feng, Bob C
> > > Sent: Friday, March 29, 2019 7:07 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: Feng, Bob C ; Gao, Liming 
> > > 
> > > Subject: [Patch] BaseTools: Fixed issue in MultiThread Genfds 
> > > function
> > >
> > > https://bugzilla.tianocore.org/show_bug.cgi?id=1450
> > > In the Multiple thread Genfds feature, build tool generates 
> > > GenSec, GenFFS command in Makefile.
> > >
> > > The Non-Hii Driver does not generate .offset file for uni string 
> > > offset, but the build tool has not knowledge about this in autogen 
> > > phase. So in this patch, I add a check in Makefile for GenSec command.
> > > If the GenSec input file does not exist, the GenSec will not be 
> > > called. And if GenSec command is not called, its output file, 
> > > which is also the input file of GenFfs command, will also not 
> > > exist.So for GenFfs command, I add a new command parameter -oi 
> > > which means the input file is an optional input file which would 
> > > not exist. so that I can generate GenFfs command with "-oi" parameter in 
> > > Makefile.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Bob Feng 
> > > Cc: Liming Gao 
> > > ---
> > >  BaseTools/Conf/build_rule.template  | 14 +++---
> > >  BaseTools/Source/C/GenFfs/GenFfs.c  | 17 +++--
> > >  BaseTools/Source/Python/AutoGen/GenMake.py  |  2 +-
> &

Re: [edk2] [Patch] BaseTools:Enable the /MP option of MSVC compiler

2019-04-02 Thread Feng, Bob C
Liming,

I add the performance data on the BZ:
https://bugzilla.tianocore.org/show_bug.cgi?id=1672

Thanks,
Bob

-Original Message-
From: Gao, Liming 
Sent: Friday, March 29, 2019 10:20 PM
To: Feng, Bob C ; edk2-devel@lists.01.org
Cc: Fan, ZhijuX 
Subject: RE: [Patch] BaseTools:Enable the /MP option of MSVC compiler

Bob:
  How about use /MP option without process number? The compiler will retrieves 
the number of effective processors on your computer. 
  And, move this option into CC_FLAGS in tools_def.txt. If so, platform can 
override it in platform DSC file. 

  Last, please provide the performance data with this option. 

Thanks
Liming
> -Original Message-
> From: Feng, Bob C
> Sent: Friday, March 29, 2019 8:30 PM
> To: edk2-devel@lists.01.org
> Cc: Fan, ZhijuX ; Feng, Bob C 
> ; Gao, Liming 
> Subject: [Patch] BaseTools:Enable the /MP option of MSVC compiler
> 
> From: Zhiju Fan 
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1672
> The /MP option of MSVC compiler can reduce the total time to compile 
> the source files on the command line.
> 
> This patch is going to enable this MSVC option in BaseTools.
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhiju.Fan 
> ---
>  BaseTools/Conf/build_rule.template |  2 +-
>  BaseTools/Source/Python/AutoGen/GenMake.py | 81 
> --
>  2 files changed, 75 insertions(+), 8 deletions(-)
> 
> diff --git a/BaseTools/Conf/build_rule.template 
> b/BaseTools/Conf/build_rule.template
> index e56b1d9c59..e7d736740f 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -127,11 +127,11 @@
> 
>  
>  $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
> 
>  
> -"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
> +"$(CC)" /MP7 /Fo${d_path}\ $(CC_FLAGS) $(INC) ${src}
> 
>  
>  # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
>  "$(CC)" $(CC_FLAGS) -c -o ${dst} $(INC) ${src}
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
> b/BaseTools/Source/Python/AutoGen/GenMake.py
> index b441817b52..04951346ad 100644
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -433,11 +433,11 @@ cleanlib:
>  self.BuildTargetList = []   # [target string]
>  self.PendingBuildTargetList = []# [FileBuildRule objects]
>  self.CommonFileDependency = []
>  self.FileListMacros = {}
>  self.ListFileMacros = {}
> -
> +self.ObjTargetDict = {}
>  self.FileCache = {}
>  self.LibraryBuildCommandList = []
>  self.LibraryFileList = []
>  self.LibraryMakefileList = []
>  self.LibraryBuildDirectoryList = [] @@ -616,10 +616,15 @@ 
> cleanlib:
>  ListFileName,
>  "\n".join(self.ListFileMacros[ListFileMacro]),
>  False
>  )
> 
> +# Generate objlist used to create .obj file
> +for Type in self.ObjTargetDict:
> +NewLine = ' '.join(list(self.ObjTargetDict[Type]))
> +FileMacroList.append("OBJLIST_%s = %s" % 
> + (list(self.ObjTargetDict.keys()).index(Type), NewLine))
> +
>  BcTargetList = []
> 
>  MakefileName = self._FILE_NAME_[self._FileType]
>  LibraryMakeCommandList = []
>  for D in self.LibraryBuildDirectoryList:
> @@ -925,17 +930,22 @@ cleanlib:
>  # Extract common files list in the dependency files
>  #
>  for File in DepSet:
>  
> self.CommonFileDependency.append(self.PlaceMacro(File.Path, 
> self.Macros))
> 
> +CmdSumDict = {}
> +CmdTargetDict = {}
> +CmdCppDict = {}
> +DependencyDict = FileDependencyDict.copy()
>  for File in FileDependencyDict:
>  # skip non-C files
>  if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c":
>  continue
>  NewDepSet = set(FileDependencyDict[File])
>  NewDepSet -= DepSet
>  FileDependencyDict[File] = ["$(COMMON_DEPS)"] + 
> list(NewDepSet)
> +DependencyDict[File] = list(NewDepSet)
> 
>  # Convert target description object to target string in makefile
>  for Type in self._AutoGenObject.Targets:
>  for T in self._AutoGenObject.Targets[Type]:
>  # Generate related macros if needed @@ -943,15 
> +953,25 @@ cleanlib:
>  self.FileLis

Re: [edk2] [Patch] BaseTools:Enable the /MP option of MSVC compiler

2019-04-01 Thread Feng, Bob C
Hi Kilian,

It's a good suggestion. Would you please enter a new BZ for this request? I 
think implement this request in a separate patch would be better.

Thanks,
Bob

From: Minnow Ware [mailto:minnoww...@outlook.com]
Sent: Saturday, March 30, 2019 4:15 PM
To: Ni, Ray ; Feng, Bob C ; 
edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: RE: [edk2] [Patch] BaseTools:Enable the /MP option of MSVC compiler


It would also be good, to add a REBUILD target to the makefiles,

that forces the compiler to translate all C-files from a component at once,

w/o dependency check  e.g.:



REBUILD:

cl /c [additional switches] file1.c file2.c file3.c file4.c



so that the compiler itself is invoked only once per component.



This is possible for Microsoft, Intel and GNU C-compiler.



Best regards,

Kilian



https://github.com/MinnowWare




From: edk2-devel 
mailto:edk2-devel-boun...@lists.01.org>> on 
behalf of Ni, Ray mailto:ray...@intel.com>>
Sent: Saturday, March 30, 2019 2:42:21 AM
To: Feng, Bob C; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
Cc: Gao, Liming
Subject: Re: [edk2] [Patch] BaseTools:Enable the /MP option of MSVC compiler

https://devblogs.microsoft.com/cppblog/recommendations-to-speed-c-builds-in-visual-studio/#_PCH
Bob,
Per above article, It seems /Gm needs to be removed when /MP is used.


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Feng,
> Bob C
> Sent: Friday, March 29, 2019 8:30 PM
> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> Cc: Gao, Liming mailto:liming@intel.com>>
> Subject: [edk2] [Patch] BaseTools:Enable the /MP option of MSVC compiler
>
> From: Zhiju Fan mailto:zhijux@intel.com>>
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=1672
> The /MP option of MSVC compiler can reduce the total time to compile the
> source files on the command line.
>
> This patch is going to enable this MSVC option in BaseTools.
>
> Cc: Bob Feng mailto:bob.c.f...@intel.com>>
> Cc: Liming Gao mailto:liming@intel.com>>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhiju.Fan mailto:zhijux@intel.com>>
> ---
>  BaseTools/Conf/build_rule.template |  2 +-
>  BaseTools/Source/Python/AutoGen/GenMake.py | 81 -
> -
>  2 files changed, 75 insertions(+), 8 deletions(-)
>
> diff --git a/BaseTools/Conf/build_rule.template
> b/BaseTools/Conf/build_rule.template
> index e56b1d9c59..e7d736740f 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -127,11 +127,11 @@
>
>  
>  $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
>
>  
> -"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
> +"$(CC)" /MP7 /Fo${d_path}\ $(CC_FLAGS) $(INC) ${src}
>
>  
>  # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
>  "$(CC)" $(CC_FLAGS) -c -o ${dst} $(INC) ${src}
>
> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py
> b/BaseTools/Source/Python/AutoGen/GenMake.py
> index b441817b52..04951346ad 100644
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -433,11 +433,11 @@ cleanlib:
>  self.BuildTargetList = []   # [target string]
>  self.PendingBuildTargetList = []# [FileBuildRule objects]
>  self.CommonFileDependency = []
>  self.FileListMacros = {}
>  self.ListFileMacros = {}
> -
> +self.ObjTargetDict = {}
>  self.FileCache = {}
>  self.LibraryBuildCommandList = []
>  self.LibraryFileList = []
>  self.LibraryMakefileList = []
>  self.LibraryBuildDirectoryList = [] @@ -616,10 +616,15 @@ cleanlib:
>  ListFileName,
>  "\n".join(self.ListFileMacros[ListFileMacro]),
>  False
>  )
>
> +# Generate objlist used to create .obj file
> +for Type in self.ObjTargetDict:
> +NewLine = ' '.join(list(self.ObjTargetDict[Type]))
> +FileMacroList.append("OBJLIST_%s = %s" %
> + (list(self.ObjTargetDict.keys()).index(Type), NewLine))
> +
>  BcTargetList = []
>
>  MakefileName = self._FILE_NAME_[self._FileType]
>  LibraryMakeCommandList = []
>  for D in self.LibraryBuildDirectoryList:
> @@ -925,17 +930,22 @@ cleanlib:
>  # Extract common files list in the dependency files
>  #
>  for File in DepSet:
>  self.CommonFileDependency.append(self.PlaceMacro(File.Path,
> self.Macros))
>

Re: [edk2] [PATCH] BaseTools:Coding problems caused by special characters

2019-03-31 Thread Feng, Bob C
Reviewed-by:  Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Friday, March 29, 2019 1:54 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH] BaseTools:Coding problems caused by special characters

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

During BaseTools compiling under Chinese or Japanese language Windows, python 
exception occurring.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xbd in position 3528: 
ordinal not in range(128)

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/C/Makefiles/NmakeSubdirs.py  | 2 +-
 BaseTools/Source/Python/Capsule/GenerateCapsule.py| 8 
 BaseTools/Source/Python/Common/Misc.py| 2 +-
 BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py| 2 +-
 .../Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py  | 6 +++---
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/BaseTools/Source/C/Makefiles/NmakeSubdirs.py 
b/BaseTools/Source/C/Makefiles/NmakeSubdirs.py
index 29bb5dfa72..abcbea89a4 100644
--- a/BaseTools/Source/C/Makefiles/NmakeSubdirs.py
+++ b/BaseTools/Source/C/Makefiles/NmakeSubdirs.py
@@ -44,7 +44,7 @@ def RunCommand(WorkDir=None, *Args, **kwargs):
 stdout, stderr = p.communicate()
 message = ""
 if stdout is not None:
-message = stdout.decode() #for compatibility in python 2 and 3
+message = stdout.decode(encoding='utf-8', errors='ignore') #for 
+ compatibility in python 2 and 3
 
 if p.returncode != 0:
 raise RuntimeError("Error while execute command \'{0}\' in direcotry 
{1}\n{2}".format(" ".join(Args), WorkDir, message)) diff --git 
a/BaseTools/Source/Python/Capsule/GenerateCapsule.py 
b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
index 7b08918857..5ce5daef68 100644
--- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py
+++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
@@ -94,7 +94,7 @@ def SignPayloadSignTool (Payload, ToolPath, PfxFile):
 
 if Process.returncode != 0:
 shutil.rmtree (TempDirectoryName)
-print (Result[1].decode())
+print (Result[1].decode(encoding='utf-8', errors='ignore'))
 raise ValueError ('GenerateCapsule: error: signtool failed.')
 
 #
@@ -132,12 +132,12 @@ def SignPayloadOpenSsl (Payload, ToolPath, 
SignerPrivateCertFile, OtherPublicCer
 try:
 Process = subprocess.Popen (Command, stdin = subprocess.PIPE, stdout = 
subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
 Result = Process.communicate(input = Payload)
-Signature = Result[0]
+Signature = Result[0].decode(encoding='utf-8', errors='ignore')
 except:
 raise ValueError ('GenerateCapsule: error: can not run openssl.')
 
 if Process.returncode != 0:
-print (Result[1].decode())
+print (Result[1].decode(encoding='utf-8', errors='ignore'))
 raise ValueError ('GenerateCapsule: error: openssl failed.')
 
 return Signature
@@ -186,7 +186,7 @@ def VerifyPayloadOpenSsl (Payload, CertData, ToolPath, 
SignerPrivateCertFile, Ot
 
 if Process.returncode != 0:
 shutil.rmtree (TempDirectoryName)
-print (Result[1].decode())
+print (Result[1].decode(encoding='utf-8', errors='ignore'))
 raise ValueError ('GenerateCapsule: error: openssl failed.')
 
 shutil.rmtree (TempDirectoryName)
diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index c7daf5417c..47f8e45222 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1032,7 +1032,7 @@ def ParseFieldValue (Value):
 p.stderr.close()
 if err:
 raise BadExpression("DevicePath: %s" % str(err))
-out = out.decode()
+out = out.decode(encoding='utf-8', errors='ignore')
 Size = len(out.split())
 out = ','.join(out.split())
 return '{' + out + '}', Size
diff --git a/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py 
b/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
index 003f052a90..706bf28e14 100644
--- a/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
+++ b/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
@@ -122,7 +122,7 @@ if __name__ == '__main__':
   if Process.returncode != 0:
 print('ERROR: Open SSL command not available.  Please verify PATH or set 
OPENSSL_PATH')
 sys.exit(Process.returncode)
-  print(Version[0].decode())
+  print(Version[0].decode(encoding='utf-8', errors='ignore'))
 
   #
   # Read input file into a buffer and sa

Re: [edk2] [Patch] BaseTools:Enable the /MP option of MSVC compiler

2019-03-30 Thread Feng, Bob C
Yes. Commit fb94f83131f032cd5ce027ea706c45513c1a799e removed the /Gm option 
from MSVC tool chain.

-Original Message-
From: Ni, Ray 
Sent: Saturday, March 30, 2019 9:42 AM
To: Feng, Bob C ; edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: RE: [edk2] [Patch] BaseTools:Enable the /MP option of MSVC compiler

https://devblogs.microsoft.com/cppblog/recommendations-to-speed-c-builds-in-visual-studio/#_PCH
Bob,
Per above article, It seems /Gm needs to be removed when /MP is used.


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Feng, Bob C
> Sent: Friday, March 29, 2019 8:30 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: [edk2] [Patch] BaseTools:Enable the /MP option of MSVC 
> compiler
> 
> From: Zhiju Fan 
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1672
> The /MP option of MSVC compiler can reduce the total time to compile 
> the source files on the command line.
> 
> This patch is going to enable this MSVC option in BaseTools.
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhiju.Fan 
> ---
>  BaseTools/Conf/build_rule.template |  2 +-
>  BaseTools/Source/Python/AutoGen/GenMake.py | 81 -
> -
>  2 files changed, 75 insertions(+), 8 deletions(-)
> 
> diff --git a/BaseTools/Conf/build_rule.template
> b/BaseTools/Conf/build_rule.template
> index e56b1d9c59..e7d736740f 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -127,11 +127,11 @@
> 
>  
>  $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
> 
>  
> -"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
> +"$(CC)" /MP7 /Fo${d_path}\ $(CC_FLAGS) $(INC) ${src}
> 
>  
>  # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
>  "$(CC)" $(CC_FLAGS) -c -o ${dst} $(INC) ${src}
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py
> b/BaseTools/Source/Python/AutoGen/GenMake.py
> index b441817b52..04951346ad 100644
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -433,11 +433,11 @@ cleanlib:
>  self.BuildTargetList = []   # [target string]
>  self.PendingBuildTargetList = []# [FileBuildRule objects]
>  self.CommonFileDependency = []
>  self.FileListMacros = {}
>  self.ListFileMacros = {}
> -
> +self.ObjTargetDict = {}
>  self.FileCache = {}
>  self.LibraryBuildCommandList = []
>  self.LibraryFileList = []
>  self.LibraryMakefileList = []
>  self.LibraryBuildDirectoryList = [] @@ -616,10 +616,15 @@ cleanlib:
>  ListFileName,
>  "\n".join(self.ListFileMacros[ListFileMacro]),
>  False
>  )
> 
> +# Generate objlist used to create .obj file
> +for Type in self.ObjTargetDict:
> +NewLine = ' '.join(list(self.ObjTargetDict[Type]))
> +FileMacroList.append("OBJLIST_%s = %s" % 
> + (list(self.ObjTargetDict.keys()).index(Type), NewLine))
> +
>  BcTargetList = []
> 
>  MakefileName = self._FILE_NAME_[self._FileType]
>  LibraryMakeCommandList = []
>  for D in self.LibraryBuildDirectoryList:
> @@ -925,17 +930,22 @@ cleanlib:
>  # Extract common files list in the dependency files
>  #
>  for File in DepSet:
>  
> self.CommonFileDependency.append(self.PlaceMacro(File.Path,
> self.Macros))
> 
> +CmdSumDict = {}
> +CmdTargetDict = {}
> +CmdCppDict = {}
> +DependencyDict = FileDependencyDict.copy()
>  for File in FileDependencyDict:
>  # skip non-C files
>  if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c":
>  continue
>  NewDepSet = set(FileDependencyDict[File])
>  NewDepSet -= DepSet
>  FileDependencyDict[File] = ["$(COMMON_DEPS)"] + 
> list(NewDepSet)
> +DependencyDict[File] = list(NewDepSet)
> 
>  # Convert target description object to target string in makefile
>  for Type in self._AutoGenObject.Targets:
>  for T in self._AutoGenObject.Targets[Type]:
>  # Generate related macros if needed @@ -943,15 
> +953,25 @@
> cleanlib:
>  self.FileListMacros[T.FileListMacro] = []
>  if T.GenListFile and T.ListFileMacro not in 
> 

Re: [edk2] [Patch] BaseTools: Fixed issue in MultiThread Genfds function

2019-03-29 Thread Feng, Bob C
That will impact the original GenFds since the command is generate by reusing 
the GenFds functions. What about enter a new BZ to do that change?

Thanks,
Bob

-Original Message-
From: Gao, Liming 
Sent: Friday, March 29, 2019 8:33 PM
To: Feng, Bob C ; edk2-devel@lists.01.org
Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds function

Bob:
  Could you update the rule to depend on EFI image from DEBUG_DIR? I would like 
to remove the additional copy from DEBUG dir to OUTPUT dir and save the disk 
and performance. 

$(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 : $(DEBUG_DIR)\LogoDxe.efi
GenSec -s EFI_SECTION_PE32 -o 
$(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 $(DEBUG_DIR)\LogoDxe.efi

Thanks
Liming
> -Original Message-
> From: Feng, Bob C
> Sent: Friday, March 29, 2019 8:00 PM
> To: Gao, Liming ; edk2-devel@lists.01.org
> Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds 
> function
> 
> That's to fix the issue that make will fail if enable multiple thread genfds.
> 
> For example, If enable Multiple thread Genfds, there will be GenSec command 
> in the Makefile like below.
> 
> $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 : $(OUTPUT_DIR)\LogoDxe.efi
>   GenSec -s EFI_SECTION_PE32 -o 
> $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 
> $(OUTPUT_DIR)\LogoDxe.efi
> 
> 
> The $(OUTPUT_DIR)\LogoDxe.efi is the dependency, but there is no make rule 
> for $(OUTPUT_DIR)\LogoDxe.efi generated in the Makefile.
> Make program does not know how to make $(OUTPUT_DIR)\LogoDxe.efi.  Make fails 
> for this case.
> 
> In the build_rule.txt, the $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi   is 
> generated by the command $(CP)
> $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR) under 
> Dynamic-Library-File section, so $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi 
> should also be a output for Dynamic-Library-File
> 
> Thanks,
> Bob
> 
> -Original Message-
> From: Gao, Liming
> Sent: Friday, March 29, 2019 7:42 PM
> To: Feng, Bob C ; edk2-devel@lists.01.org
> Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds 
> function
> 
> Bob:
>   Could you list the more information on why update build_rule.txt?
> 
> > -----Original Message-
> > From: Feng, Bob C
> > Sent: Friday, March 29, 2019 7:07 PM
> > To: edk2-devel@lists.01.org
> > Cc: Feng, Bob C ; Gao, Liming 
> > 
> > Subject: [Patch] BaseTools: Fixed issue in MultiThread Genfds 
> > function
> >
> > https://bugzilla.tianocore.org/show_bug.cgi?id=1450
> > In the Multiple thread Genfds feature, build tool generates GenSec, 
> > GenFFS command in Makefile.
> >
> > The Non-Hii Driver does not generate .offset file for uni string 
> > offset, but the build tool has not knowledge about this in autogen 
> > phase. So in this patch, I add a check in Makefile for GenSec command.
> > If the GenSec input file does not exist, the GenSec will not be 
> > called. And if GenSec command is not called, its output file, which 
> > is also the input file of GenFfs command, will also not exist.So for 
> > GenFfs command, I add a new command parameter -oi which means the 
> > input file is an optional input file which would not exist. so that 
> > I can generate GenFfs command with "-oi" parameter in Makefile.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Bob Feng 
> > Cc: Liming Gao 
> > ---
> >  BaseTools/Conf/build_rule.template  | 14 +++---
> >  BaseTools/Source/C/GenFfs/GenFfs.c  | 17 +++--
> >  BaseTools/Source/Python/AutoGen/GenMake.py  |  2 +-
> >  .../Python/GenFds/GenFdsGlobalVariable.py   | 10 +-
> >  .../Source/Python/Workspace/DscBuildData.py |  3 +++
> >  BaseTools/Source/Python/build/build.py  | 10 +-
> >  6 files changed, 40 insertions(+), 16 deletions(-)
> >
> > diff --git a/BaseTools/Conf/build_rule.template
> > b/BaseTools/Conf/build_rule.template
> > index e56b1d9c59..8cd7d0e445 100755
> > --- a/BaseTools/Conf/build_rule.template
> > +++ b/BaseTools/Conf/build_rule.template
> > @@ -357,16 +357,16 @@
> >  [Dynamic-Library-File]
> >  
> >  ?.dll
> >
> >  
> > -$(DEBUG_DIR)(+)$(MODULE_NAME).efi
> > +$(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> > + $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
> >
> >  
> >  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> > -$(CP) ${dst} $(OUTPUT_DIR)
> > -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> > +$

[edk2] [Patch] BaseTools:Enable the /MP option of MSVC compiler

2019-03-29 Thread Feng, Bob C
From: Zhiju Fan 

https://bugzilla.tianocore.org/show_bug.cgi?id=1672
The /MP option of MSVC compiler can reduce the total
time to compile the source files on the command line.

This patch is going to enable this MSVC option in BaseTools.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Conf/build_rule.template |  2 +-
 BaseTools/Source/Python/AutoGen/GenMake.py | 81 --
 2 files changed, 75 insertions(+), 8 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index e56b1d9c59..e7d736740f 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -127,11 +127,11 @@
 
 
 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
 
 
-"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
+"$(CC)" /MP7 /Fo${d_path}\ $(CC_FLAGS) $(INC) ${src}
 
 
 # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
 "$(CC)" $(CC_FLAGS) -c -o ${dst} $(INC) ${src}
 
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index b441817b52..04951346ad 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -433,11 +433,11 @@ cleanlib:
 self.BuildTargetList = []   # [target string]
 self.PendingBuildTargetList = []# [FileBuildRule objects]
 self.CommonFileDependency = []
 self.FileListMacros = {}
 self.ListFileMacros = {}
-
+self.ObjTargetDict = {}
 self.FileCache = {}
 self.LibraryBuildCommandList = []
 self.LibraryFileList = []
 self.LibraryMakefileList = []
 self.LibraryBuildDirectoryList = []
@@ -616,10 +616,15 @@ cleanlib:
 ListFileName,
 "\n".join(self.ListFileMacros[ListFileMacro]),
 False
 )
 
+# Generate objlist used to create .obj file
+for Type in self.ObjTargetDict:
+NewLine = ' '.join(list(self.ObjTargetDict[Type]))
+FileMacroList.append("OBJLIST_%s = %s" % 
(list(self.ObjTargetDict.keys()).index(Type), NewLine))
+
 BcTargetList = []
 
 MakefileName = self._FILE_NAME_[self._FileType]
 LibraryMakeCommandList = []
 for D in self.LibraryBuildDirectoryList:
@@ -925,17 +930,22 @@ cleanlib:
 # Extract common files list in the dependency files
 #
 for File in DepSet:
 self.CommonFileDependency.append(self.PlaceMacro(File.Path, 
self.Macros))
 
+CmdSumDict = {}
+CmdTargetDict = {}
+CmdCppDict = {}
+DependencyDict = FileDependencyDict.copy()
 for File in FileDependencyDict:
 # skip non-C files
 if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c":
 continue
 NewDepSet = set(FileDependencyDict[File])
 NewDepSet -= DepSet
 FileDependencyDict[File] = ["$(COMMON_DEPS)"] + list(NewDepSet)
+DependencyDict[File] = list(NewDepSet)
 
 # Convert target description object to target string in makefile
 for Type in self._AutoGenObject.Targets:
 for T in self._AutoGenObject.Targets[Type]:
 # Generate related macros if needed
@@ -943,15 +953,25 @@ cleanlib:
 self.FileListMacros[T.FileListMacro] = []
 if T.GenListFile and T.ListFileMacro not in 
self.ListFileMacros:
 self.ListFileMacros[T.ListFileMacro] = []
 if T.GenIncListFile and T.IncListFileMacro not in 
self.ListFileMacros:
 self.ListFileMacros[T.IncListFileMacro] = []
+if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT 
and Type == TAB_C_CODE_FILE:
+NewFile = self.PlaceMacro(str(T), self.Macros)
+if self.ObjTargetDict.get(T.Target.SubDir):
+self.ObjTargetDict[T.Target.SubDir].add(NewFile)
+else:
+self.ObjTargetDict[T.Target.SubDir] = set()
+self.ObjTargetDict[T.Target.SubDir].add(NewFile)
 
 Deps = []
+CCodeDeps = []
 # Add force-dependencies
 for Dep in T.Dependencies:
 Deps.append(self.PlaceMacro(str(Dep), self.Macros))
+if Dep != '$(MAKE_FILE)':
+CCodeDeps.append(self.PlaceMacro(str(Dep), 
self.Macros))
 # Add inclusion-dependencies
 if len(T.Inputs) == 1 and T.Inputs[0] in FileDependencyDict:
 for F in FileDependencyDict[T.Inputs[0]]:
 Deps.append(self.PlaceMacro(str(F), self.Macros))
 # Add source-dependencies
@@ -971,16 +991,63 @@ cleanlib:
 i

Re: [edk2] [Patch] BaseTools: Fixed issue in MultiThread Genfds function

2019-03-29 Thread Feng, Bob C
That's to fix the issue that make will fail if enable multiple thread genfds.

For example, If enable Multiple thread Genfds, there will be GenSec command in 
the Makefile like below. 

$(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 : $(OUTPUT_DIR)\LogoDxe.efi
GenSec -s EFI_SECTION_PE32 -o 
$(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 $(OUTPUT_DIR)\LogoDxe.efi


The $(OUTPUT_DIR)\LogoDxe.efi is the dependency, but there is no make rule for 
$(OUTPUT_DIR)\LogoDxe.efi generated in the Makefile. Make program does not know 
how to make $(OUTPUT_DIR)\LogoDxe.efi.  Make fails for this case.

In the build_rule.txt, the $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi   is generated 
by the command $(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR) under 
Dynamic-Library-File section, so $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi  should 
also be a output for Dynamic-Library-File

Thanks,
Bob

-Original Message-
From: Gao, Liming 
Sent: Friday, March 29, 2019 7:42 PM
To: Feng, Bob C ; edk2-devel@lists.01.org
Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds function

Bob:
  Could you list the more information on why update build_rule.txt?

> -Original Message-
> From: Feng, Bob C
> Sent: Friday, March 29, 2019 7:07 PM
> To: edk2-devel@lists.01.org
> Cc: Feng, Bob C ; Gao, Liming 
> 
> Subject: [Patch] BaseTools: Fixed issue in MultiThread Genfds function
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1450
> In the Multiple thread Genfds feature, build tool generates GenSec, 
> GenFFS command in Makefile.
> 
> The Non-Hii Driver does not generate .offset file for uni string 
> offset, but the build tool has not knowledge about this in autogen 
> phase. So in this patch, I add a check in Makefile for GenSec command. 
> If the GenSec input file does not exist, the GenSec will not be 
> called. And if GenSec command is not called, its output file, which is 
> also the input file of GenFfs command, will also not exist.So for 
> GenFfs command, I add a new command parameter -oi which means the 
> input file is an optional input file which would not exist. so that I 
> can generate GenFfs command with "-oi" parameter in Makefile.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> ---
>  BaseTools/Conf/build_rule.template  | 14 +++---
>  BaseTools/Source/C/GenFfs/GenFfs.c  | 17 +++--
>  BaseTools/Source/Python/AutoGen/GenMake.py  |  2 +-
>  .../Python/GenFds/GenFdsGlobalVariable.py   | 10 +-
>  .../Source/Python/Workspace/DscBuildData.py |  3 +++
>  BaseTools/Source/Python/build/build.py  | 10 +-
>  6 files changed, 40 insertions(+), 16 deletions(-)
> 
> diff --git a/BaseTools/Conf/build_rule.template 
> b/BaseTools/Conf/build_rule.template
> index e56b1d9c59..8cd7d0e445 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -357,16 +357,16 @@
>  [Dynamic-Library-File]
>  
>  ?.dll
> 
>  
> -$(DEBUG_DIR)(+)$(MODULE_NAME).efi
> +$(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> + $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
> 
>  
>  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> -$(CP) ${dst} $(OUTPUT_DIR)
> -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> + $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
>  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
>  -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR)
>  
>  $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
>  $(OBJCOPY) --strip-unneeded -R .eh_frame ${src} @@ -376,22 
> +376,22 @@
>  #
>  -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
>  -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug 
> $(BIN_DIR)(+)$(MODULE_NAME_GUID).debug
> 
>  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> -$(CP) ${dst} $(OUTPUT_DIR)
> -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> + $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
>  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
> 
>  
>  # tool to convert Mach-O to PE/COFF
>  "$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS)  ${src}  
> $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff
>  # create symbol file for GDB debug
>  -$(DSYMUTIL) ${src}
>  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} 
> $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)
>

[edk2] [Patch] BaseTools: Fixed issue in MultiThread Genfds function

2019-03-29 Thread Feng, Bob C
https://bugzilla.tianocore.org/show_bug.cgi?id=1450
In the Multiple thread Genfds feature, build tool generates
GenSec, GenFFS command in Makefile.

The Non-Hii Driver does not generate .offset file for uni string offset,
but the build tool has not knowledge about this in autogen phase. So
in this patch, I add a check in Makefile for GenSec command. If the GenSec
input file does not exist, the GenSec will not be called. And if GenSec
command is not called, its output file, which is also the input file of 
GenFfs command, will also not exist.So for GenFfs command, 
I add a new command parameter -oi which means
the input file is an optional input file which would not exist. so
that I can generate GenFfs command with "-oi" parameter in Makefile.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Conf/build_rule.template  | 14 +++---
 BaseTools/Source/C/GenFfs/GenFfs.c  | 17 +++--
 BaseTools/Source/Python/AutoGen/GenMake.py  |  2 +-
 .../Python/GenFds/GenFdsGlobalVariable.py   | 10 +-
 .../Source/Python/Workspace/DscBuildData.py |  3 +++
 BaseTools/Source/Python/build/build.py  | 10 +-
 6 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index e56b1d9c59..8cd7d0e445 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -357,16 +357,16 @@
 [Dynamic-Library-File]
 
 ?.dll
 
 
-$(DEBUG_DIR)(+)$(MODULE_NAME).efi
+$(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
 
 
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
-$(CP) ${dst} $(OUTPUT_DIR)
-$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
+$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
+$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
$(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
 -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR) 
 
 $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
 $(OBJCOPY) --strip-unneeded -R .eh_frame ${src}
@@ -376,22 +376,22 @@
 #
 -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
 -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug 
$(BIN_DIR)(+)$(MODULE_NAME_GUID).debug
 
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
-$(CP) ${dst} $(OUTPUT_DIR)
-$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
+$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
+$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
$(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
 
 
 # tool to convert Mach-O to PE/COFF
 "$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS)  ${src}  
$(DEBUG_DIR)(+)$(MODULE_NAME).pecoff
 # create symbol file for GDB debug
 -$(DSYMUTIL) ${src}
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} 
$(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)
-$(CP) ${dst} $(OUTPUT_DIR)
-$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
+$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
+$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
$(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
 
 [Dependency-Expression-File]
 
 ?.dxs, ?.Dxs, ?.DXS
diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c 
b/BaseTools/Source/C/GenFfs/GenFfs.c
index 02c7ac30f0..ea36b22bef 100644
--- a/BaseTools/Source/C/GenFfs/GenFfs.c
+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
@@ -17,10 +17,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
 #endif
 
+#ifdef __GNUC__
+#include 
+#endif
+
 #include 
 #include 
 #include 
 
 #include 
@@ -158,10 +162,12 @@ Returns:
 FileAlign points to file alignment, which only 
support\n\
 the following align: 
1,2,4,8,16,128,512,1K,4K,32K,64K\n\
 128K,256K,512K,1M,2M,4M,8M,16M\n");
   fprintf (stdout, "  -i SectionFile, --sectionfile SectionFile\n\
 Section file will be contained in this FFS file.\n");
+  fprintf (stdout, "  -oi SectionFile, --optionalsectionfile SectionFile\n\
+If the Section file exists, it will be contained in 
this FFS file, otherwise, it will be ignored.\n");
   fprintf (stdout, "  -n SectionAlign, --sectionalign SectionAlign\n\
 SectionAlign points to section alignment, which 
support\n\
 the alignment scope 0~16M. If SectionAlign is 
specified\n\
 as 0, tool get alignment value from SectionFile. It 
is\n\
 specified together with sectionfile to point its\n\
@@ -734,19 +740,26 @@ Returns:
   argc -= 2;
   argv += 

[edk2] [Patch] BaseTool: Fixed an issue of Structure PCD

2019-03-26 Thread Feng, Bob C
https://bugzilla.tianocore.org/show_bug.cgi?id=1665

Build fail when the structure pcd has
member of flexible size array

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 58286159db..129c0c950b 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1777,21 +1777,21 @@ class DscBuildData(PlatformBuildClassObject):
 Value = 
ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, 
self._GuidDict)(True)
 except BadExpression:
 EdkLogger.error('Build', FORMAT_INVALID, "Invalid 
value format for %s. From %s Line %d " %
 (".".join((Pcd.TokenSpaceGuidCName, 
Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], 
FieldList[FieldName.strip(".")][2]))
 Value, ValueSize = ParseFieldValue(Value)
-if not Pcd.IsArray:
+if not Pcd.IsArray():
 CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d / 
__ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); 
 // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), 
ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, 
FieldName.strip("."), FieldList[FieldName.strip(".")][1], 
FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]);
 else:
 NewFieldName = ''
 FieldName_ori = FieldName.strip('.')
 while '[' in  FieldName:
 NewFieldName = NewFieldName + FieldName.split('[', 
1)[0] + '[0]'
 ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 
1)[0])
 FieldName = FieldName.split(']', 1)[1]
 FieldName = NewFieldName + FieldName
-while '[' in FieldName and not Pcd.IsArray:
+while '[' in FieldName and not Pcd.IsArray():
 FieldName = FieldName.rsplit('[', 1)[0]
 CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); 
// From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), 
ArrayIndex + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], 
FieldList[FieldName_ori][0])
 for skuname in Pcd.SkuOverrideValues:
 if skuname == TAB_COMMON:
 continue
@@ -1809,21 +1809,21 @@ class DscBuildData(PlatformBuildClassObject):
 Value = 
ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, 
self._GuidDict)(True)
 except BadExpression:
 EdkLogger.error('Build', FORMAT_INVALID, 
"Invalid value format for %s. From %s Line %d " %
 
(".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), 
FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2]))
 Value, ValueSize = ParseFieldValue(Value)
-if not Pcd.IsArray:
+if not Pcd.IsArray():
 CApp = CApp + '  __FLEXIBLE_SIZE(*Size, 
%s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, 
%s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, 
FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), 
ValueSize, Pcd.DatumType, FieldName.strip("."), 
FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], 
FieldList[FieldName.strip(".")][0]);
 else:
 NewFieldName = ''
 FieldName_ori = FieldName.strip('.')
 while '[' in  FieldName:
 NewFieldName = NewFieldName + 
FieldName.split('[', 1)[0] + '[0]'
 ArrayIndex = int(FieldName.split('[', 
1)[1].split(']', 1)[0])
 FieldName = FieldName.split(']', 1)[1]
 FieldName = NewFieldName + FieldName
-while '[' in FieldName and not Pcd.IsArray:
+while '[' in FieldName and not Pcd.IsArray():
 FieldName = FieldName.rsplit('[', 1)[0]
 CApp = CApp + '  __FLEXIBLE_SIZE(*Size, 
%s, %s, %d); // From %s Line %d Value %s \n' % (Pcd.DatumType, 
FieldName.strip("."), ArrayIndex + 1, FieldList[FieldName_ori][1]

[edk2] [Patch] BaseTools: Remove EDK_GLOBAL related logic

2019-03-16 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350

Macros defined using EDK_GLOBAL are only valid when processing
EDK libraries and components.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Common/DataType.py|  1 -
 BaseTools/Source/Python/Common/GlobalData.py  |  3 +--
 .../Python/CommonDataClass/DataClass.py   |  1 -
 .../Ecc/MetaFileWorkspace/MetaFileParser.py   | 19 ++
 .../Source/Python/UPT/Library/Parsing.py  |  2 +-
 .../Source/Python/UPT/Logger/StringTable.py   |  2 --
 .../Source/Python/Workspace/InfBuildData.py   |  1 -
 .../Source/Python/Workspace/MetaFileParser.py | 20 ++-
 8 files changed, 6 insertions(+), 43 deletions(-)

diff --git a/BaseTools/Source/Python/Common/DataType.py 
b/BaseTools/Source/Python/Common/DataType.py
index 798c0e353d..99bb60c852 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -415,11 +415,10 @@ TAB_DSC_DEFINES_RT_BASE_ADDRESS = 'RtBaseAddress'
 TAB_DSC_DEFINES_RFC_LANGUAGES = 'RFC_LANGUAGES'
 TAB_DSC_DEFINES_ISO_LANGUAGES = 'ISO_LANGUAGES'
 TAB_DSC_DEFINES_DEFINE = 'DEFINE'
 TAB_DSC_DEFINES_VPD_TOOL_GUID = 'VPD_TOOL_GUID'
 TAB_FIX_LOAD_TOP_MEMORY_ADDRESS = 'FIX_LOAD_TOP_MEMORY_ADDRESS'
-TAB_DSC_DEFINES_EDKGLOBAL = 'EDK_GLOBAL'
 TAB_DSC_PREBUILD = 'PREBUILD'
 TAB_DSC_POSTBUILD = 'POSTBUILD'
 #
 # TargetTxt Definitions
 #
diff --git a/BaseTools/Source/Python/Common/GlobalData.py 
b/BaseTools/Source/Python/Common/GlobalData.py
index f117998b0b..9f42484dc1 100644
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -26,11 +26,10 @@ gPlatformDefines = {}
 gPlatformPcds = {}
 # PCDs with type that are not fixed at build and feature flag
 gPlatformOtherPcds = {}
 gActivePlatform = None
 gCommandLineDefines = {}
-gEdkGlobal = {}
 gOverrideDir = {}
 gCommandMaxLength = 4096
 # for debug trace purpose when problem occurs
 gProcessingFile = ''
 gBuildingModule = ''
@@ -40,11 +39,11 @@ gDefaultStores = []
 # definition for a MACRO name.  used to create regular expressions below.
 _MacroNamePattern = "[A-Z][A-Z0-9_]*"
 
 ## Regular expression for matching macro used in DSC/DEC/INF file inclusion
 gMacroRefPattern = re.compile("\$\(({})\)".format(_MacroNamePattern), 
re.UNICODE)
-gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
+gMacroDefPattern = re.compile("^(DEFINE)[ \t]+")
 gMacroNamePattern = re.compile("^{}$".format(_MacroNamePattern))
 
 # definition for a GUID.  used to create regular expressions below.
 _HexChar = r"[0-9a-fA-F]"
 _GuidPattern = 
r"{Hex}{{8}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{12}}".format(Hex=_HexChar)
diff --git a/BaseTools/Source/Python/CommonDataClass/DataClass.py 
b/BaseTools/Source/Python/CommonDataClass/DataClass.py
index 2d93f79b09..ec5bb194f4 100644
--- a/BaseTools/Source/Python/CommonDataClass/DataClass.py
+++ b/BaseTools/Source/Python/CommonDataClass/DataClass.py
@@ -105,11 +105,10 @@ MODEL_META_DATA_PACKAGE = 5011
 MODEL_META_DATA_NMAKE = 5012
 MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF = 5013
 MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF = 5014
 MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH = 5015
 MODEL_META_DATA_COMMENT = 5016
-MODEL_META_DATA_GLOBAL_DEFINE = 5017
 MODEL_META_DATA_SECTION_HEADER = 5100
 MODEL_META_DATA_SUBSECTION_HEADER = 5200
 MODEL_META_DATA_TAIL_COMMENT = 5300
 
 MODEL_EXTERNAL_DEPENDENCY = 1
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py 
b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
index 862974894a..cba1f40837 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
@@ -40,11 +40,11 @@ from Common.LongFilePathSupport import CodecOpenLongFilePath
 ## A decorator used to parse macro definition
 def ParseMacro(Parser):
 def MacroParser(self):
 Match = GlobalData.gMacroDefPattern.match(self._CurrentLine)
 if not Match:
-# Not 'DEFINE/EDK_GLOBAL' statement, call decorated method
+# Not 'DEFINE' statement, call decorated method
 Parser(self)
 return
 
 TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):], 
TAB_EQUAL_SPLIT, 1)
 # Syntax check
@@ -81,20 +81,10 @@ def ParseMacro(Parser):
 SectionDictKey = self._SectionType, self._Scope[0][0], 
self._Scope[0][1]
 if SectionDictKey not in self._SectionsMacroDict:
 self._SectionsMacroDict[SectionDictKey] = {}
 SectionLocalMacros = self._SectionsMacroDict[SectionDictKey]
 SectionLocalMacros[Name] = Value
-# EDK_GLOBAL defined macros
-elif not isinstance(self, DscParser):
-EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be 
used in .dsc file",
-

[edk2] [Patch] BaseTools: Remove EDKI related logic from Trim tool

2019-03-15 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350

Remove EDKI related logic from Trim tool.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Trim/Trim.py | 160 ---
 1 file changed, 160 deletions(-)

diff --git a/BaseTools/Source/Python/Trim/Trim.py 
b/BaseTools/Source/Python/Trim/Trim.py
index 825ed3e5d5..228779b5a9 100644
--- a/BaseTools/Source/Python/Trim/Trim.py
+++ b/BaseTools/Source/Python/Trim/Trim.py
@@ -59,74 +59,10 @@ gLongNumberPattern = 
re.compile("(?<=[^a-zA-Z0-9_])(0[xX][0-9a-fA-F]+|[0-9]+)U?L
 ## Regular expression for matching "Include ()" in asl file
 gAslIncludePattern = re.compile("^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)", 
re.MULTILINE)
 ## Regular expression for matching C style #include "XXX.asl" in asl file
 gAslCIncludePattern = 
re.compile(r'^(\s*)#include\s*[<"]\s*([-\\/\w.]+)\s*([>"])', re.MULTILINE)
 ## Patterns used to convert EDK conventions to EDK2 ECP conventions
-gImportCodePatterns = [
-[
-re.compile('^(\s*)\(\*\*PeiServices\)\.PciCfg\s*=\s*([^;\s]+);', 
re.MULTILINE),
-'''\\1{
-\\1  STATIC EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = {
-\\1(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-\\1&gEcpPeiPciCfgPpiGuid,
-\\1\\2
-\\1  };
-\\1  (**PeiServices).InstallPpi (PeiServices, &gEcpPeiPciCfgPpiList);
-\\1}'''
-],
-
-[
-re.compile('^(\s*)\(\*PeiServices\)->PciCfg\s*=\s*([^;\s]+);', 
re.MULTILINE),
-'''\\1{
-\\1  STATIC EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = {
-\\1(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-\\1&gEcpPeiPciCfgPpiGuid,
-\\1\\2
-\\1  };
-\\1  (**PeiServices).InstallPpi (PeiServices, &gEcpPeiPciCfgPpiList);
-\\1}'''
-],
-
-[
-re.compile("(\s*).+->Modify[\s\n]*\(", re.MULTILINE),
-'\\1PeiLibPciCfgModify ('
-],
-
-[
-re.compile("(\W*)gRT->ReportStatusCode[\s\n]*\(", re.MULTILINE),
-'\\1EfiLibReportStatusCode ('
-],
-
-[
-re.compile('#include\s+EFI_GUID_DEFINITION\s*\(FirmwareFileSystem\)', 
re.MULTILINE),
-'#include EFI_GUID_DEFINITION (FirmwareFileSystem)\n#include 
EFI_GUID_DEFINITION (FirmwareFileSystem2)'
-],
-
-[
-re.compile('gEfiFirmwareFileSystemGuid', re.MULTILINE),
-'gEfiFirmwareFileSystem2Guid'
-],
-
-[
-re.compile('EFI_FVH_REVISION', re.MULTILINE),
-'EFI_FVH_PI_REVISION'
-],
-
-[
-
re.compile("(\s*)\S*CreateEvent\s*\([\s\n]*EFI_EVENT_SIGNAL_READY_TO_BOOT[^,]*,((?:[^;]+\n)+)(\s*\));",
 re.MULTILINE),
-'\\1EfiCreateEventReadyToBoot (\\2\\3;'
-],
-
-[
-
re.compile("(\s*)\S*CreateEvent\s*\([\s\n]*EFI_EVENT_SIGNAL_LEGACY_BOOT[^,]*,((?:[^;]+\n)+)(\s*\));",
 re.MULTILINE),
-'\\1EfiCreateEventLegacyBoot (\\2\\3;'
-],
-#[
-#re.compile("(\W)(PEI_PCI_CFG_PPI)(\W)", re.MULTILINE),
-#'\\1ECP_\\2\\3'
-#]
-]
 
 ## file cache to avoid circular include in ASL file
 gIncludedAslFile = []
 
 ## Trim preprocessed source code
@@ -492,101 +428,10 @@ def GenerateVfrBinSec(ModuleName, DebugDir, OutputFile):
 EdkLogger.error("Trim", FILE_WRITE_FAILURE, "Write data to file %s 
failed, please check whether the file been locked or using by other 
applications." %OutputFile, None)
 
 fStringIO.close ()
 fInputfile.close ()
 
-## Trim EDK source code file(s)
-#
-#
-# @param  SourceFile or directory to be trimmed
-# @param  TargetFile or directory to store the trimmed content
-#
-def TrimEdkSources(Source, Target):
-if os.path.isdir(Source):
-for CurrentDir, Dirs, Files in os.walk(Source):
-if '.svn' in Dirs:
-Dirs.remove('.svn')
-elif "CVS" in Dirs:
-Dirs.remove("CVS")
-
-for FileName in Files:
-Dummy, Ext = os.path.splitext(FileName)
-if Ext.upper() not in ['.C', '.H']: continue
-if Target is None or Target == '':
-TrimEdkSourceCode(
-os.path.join(CurrentDir, FileName),
-os.path.join(CurrentDir, FileName)
-)
-else:
-TrimEdkSourceCode(
-os.path.join(CurrentDir, FileName),
-os.path.join(Target, CurrentDir[len(Source)+1:], 
FileName)
-)
-else:
-TrimEdkSourceCode(Source, Target)
-
-## Trim one EDK source code file
-#
-# Do following replacement:
-#
-#   (**PeiServices\).PciCfg = <*>;
-#   =>  {
-# STATIC EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = {
-# (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-# &gEcpPeiPciCfgPpiGuid,
-# <*>
-#   };
-#   (**PeiServices).InstallPpi (PeiServices, &gEcpPeiPciCfgPpiList);
-#
-#   <*>Modify(<*>)
-#   =>  PeiL

[edk2] [Patch] BaseTools: Remove the logic SourceOverridePath

2019-03-15 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350
SOURCE_OVERRIDE_PATH is for EDK component INF files.
The corresponding logic should be removed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py| 13 +
 BaseTools/Source/Python/Common/DataType.py|  2 --
 BaseTools/Source/Python/Common/GlobalData.py  |  1 -
 .../Python/CommonDataClass/DataClass.py   |  2 --
 .../Ecc/MetaFileWorkspace/MetaFileParser.py   |  8 
 BaseTools/Source/Python/Eot/EotMain.py|  2 +-
 BaseTools/Source/Python/Eot/InfParserLite.py  |  6 +-
 .../Source/Python/UPT/Library/DataType.py |  3 ---
 .../Python/Workspace/BuildClassObject.py  |  1 -
 .../Source/Python/Workspace/DscBuildData.py   | 19 ---
 .../Source/Python/Workspace/InfBuildData.py   | 11 +--
 .../Source/Python/Workspace/MetaFileParser.py |  8 
 12 files changed, 4 insertions(+), 72 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 568d535754..8c7c20a386 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1139,11 +1139,10 @@ class PlatformAutoGen(AutoGen):
 self.WorkspaceDir = Workspace.WorkspaceDir
 self.ToolChain = Toolchain
 self.BuildTarget = Target
 self.Arch = Arch
 self.SourceDir = PlatformFile.SubDir
-self.SourceOverrideDir = None
 self.FdTargetList = self.Workspace.FdTargetList
 self.FvTargetList = self.Workspace.FvTargetList
 # get the original module/package/platform objects
 self.BuildDatabase = Workspace.BuildDatabase
 self.DscBuildDataObj = Workspace.Platform
@@ -2557,15 +2556,10 @@ class ModuleAutoGen(AutoGen):
 self.PlatformInfo = PlatformAutoGen(Workspace, PlatformFile, Target, 
Toolchain, Arch)
 
 self.SourceDir = self.MetaFile.SubDir
 self.SourceDir = mws.relpath(self.SourceDir, self.WorkspaceDir)
 
-self.SourceOverrideDir = None
-# use overridden path defined in DSC file
-if self.MetaFile.Key in GlobalData.gOverrideDir:
-self.SourceOverrideDir = GlobalData.gOverrideDir[self.MetaFile.Key]
-
 self.ToolChain = Toolchain
 self.BuildTarget = Target
 self.Arch = Arch
 self.ToolChainFamily = self.PlatformInfo.ToolChainFamily
 self.BuildRuleFamily = self.PlatformInfo.BuildRuleFamily
@@ -2766,16 +2760,11 @@ class ModuleAutoGen(AutoGen):
 @cached_property
 def CustomMakefile(self):
 RetVal = {}
 for Type in self.Module.CustomMakefile:
 MakeType = gMakeTypeMap[Type] if Type in gMakeTypeMap else 'nmake'
-if self.SourceOverrideDir is not None:
-File = os.path.join(self.SourceOverrideDir, 
self.Module.CustomMakefile[Type])
-if not os.path.exists(File):
-File = os.path.join(self.SourceDir, 
self.Module.CustomMakefile[Type])
-else:
-File = os.path.join(self.SourceDir, 
self.Module.CustomMakefile[Type])
+File = os.path.join(self.SourceDir, 
self.Module.CustomMakefile[Type])
 RetVal[MakeType] = File
 return RetVal
 
 ## Return the directory of the makefile
 #
diff --git a/BaseTools/Source/Python/Common/DataType.py 
b/BaseTools/Source/Python/Common/DataType.py
index 798c0e353d..685f428862 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -304,12 +304,10 @@ TAB_COMPONENTS_IA32 = TAB_COMPONENTS + TAB_SPLIT + 
TAB_ARCH_IA32
 TAB_COMPONENTS_X64 = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_X64
 TAB_COMPONENTS_ARM = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_ARM
 TAB_COMPONENTS_EBC = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_EBC
 TAB_COMPONENTS_AARCH64 = TAB_COMPONENTS + TAB_SPLIT + TAB_ARCH_AARCH64
 
-TAB_COMPONENTS_SOURCE_OVERRIDE_PATH = 'SOURCE_OVERRIDE_PATH'
-
 TAB_BUILD_OPTIONS = 'BuildOptions'
 
 TAB_DEFINE = 'DEFINE'
 TAB_NMAKE = 'Nmake'
 TAB_USER_EXTENSIONS = 'UserExtensions'
diff --git a/BaseTools/Source/Python/Common/GlobalData.py 
b/BaseTools/Source/Python/Common/GlobalData.py
index f117998b0b..79b21324de 100644
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -27,11 +27,10 @@ gPlatformPcds = {}
 # PCDs with type that are not fixed at build and feature flag
 gPlatformOtherPcds = {}
 gActivePlatform = None
 gCommandLineDefines = {}
 gEdkGlobal = {}
-gOverrideDir = {}
 gCommandMaxLength = 4096
 # for debug trace purpose when problem occurs
 gProcessingFile = ''
 gBuildingModule = ''
 gSkuids = []
diff --git a/BaseTools/Source/Python/CommonDataClass/DataClass.py 
b/BaseTools/Source/Python/CommonDataClass/DataClass.py
index 2d93f79b09..5d0c664f6d 100644
--- a/BaseTools/Source/Python/CommonDataClass/DataClass.py
+++ b/BaseTo

Re: [edk2] [patch] BaseTools: Add missing license and copyright info

2019-03-15 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Bi, Dandan 
Sent: Friday, March 15, 2019 4:23 PM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Gao, Liming ; 
Kinney, Michael D 
Subject: [patch] BaseTools: Add missing license and copyright info

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 .../Conf/Empty_Package_Information_Data_File.ini | 12 
 1 file changed, 12 insertions(+)

diff --git a/BaseTools/Conf/Empty_Package_Information_Data_File.ini 
b/BaseTools/Conf/Empty_Package_Information_Data_File.ini
index fe162568c4..230d858ef9 100644
--- a/BaseTools/Conf/Empty_Package_Information_Data_File.ini
+++ b/BaseTools/Conf/Empty_Package_Information_Data_File.ini
@@ -1,5 +1,17 @@
+;@file
+; Example ini file used for UPT.
+;
+; Copyright (c) 2011 - 2019, Intel Corporation. All rights 
+reserved. ; This program and the accompanying materials ; are 
+licensed and made available under the terms and conditions of the BSD 
+License ; which accompanies this distribution.  The full text of the 
+license may be found at ; 
+http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
 [DistributionHeader]
 Name =
 GUID =
 Version =
 Vendor =
--
2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: Fixed the issue of BaseTools Make cleanall failed.

2019-03-14 Thread Feng, Bob C
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1622
There is duplicated $(PYTHON_COMMAND) in the
command of cleanall

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/C/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/Makefile b/BaseTools/Source/C/Makefile
index 08f0081212..ca71bd1178 100644
--- a/BaseTools/Source/C/Makefile
+++ b/BaseTools/Source/C/Makefile
@@ -65,10 +65,10 @@ clean:
   @if defined PYTHON_COMMAND $(PYTHON_COMMAND) Makefiles\NmakeSubdirs.py clean 
$(LIBRARIES) $(APPLICATIONS)
   @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe 
Makefiles\NmakeSubdirs.py clean $(LIBRARIES) $(APPLICATIONS)
 
 .PHONY: cleanall
 cleanall:
-  @if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(PYTHON_COMMAND) 
Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) $(APPLICATIONS)
-  @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(PYTHON_COMMAND) 
Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) $(APPLICATIONS)
+  @if defined PYTHON_COMMAND $(PYTHON_COMMAND) Makefiles\NmakeSubdirs.py 
cleanall $(LIBRARIES) $(APPLICATIONS)
+  @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe 
Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) $(APPLICATIONS)
 
 !INCLUDE Makefiles\ms.rule
 
-- 
2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTool/Build: Add --disable-include-path-check.

2019-03-14 Thread Feng, Bob C
Reviewed-by: Bob Feng 


-Original Message-
From: Yao, Jiewen 
Sent: Thursday, March 14, 2019 6:11 AM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Gao, Liming ; 
Zhu, Yonghong 
Subject: [PATCH] BaseTool/Build: Add --disable-include-path-check.

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

This option is added to disable the include path check for outside of package.
The original purpose of thie check is to make sure EDK II modules must not 
reference header files outside of the packages they depend on or within the 
module's directory tree.

However, we do see the usage to build EDKII as executable running in the 
operating system which requires include path to outside.
For example, EmulatorPkg. The current solution (soft link) is weird hack - 
EmulatorPkg\Unix\Host\X11IncludeHack.

With this solution, this can be supported easily.

The patch is validated with and without --disable-include-path-check.
If user does not use --disable-include-path-check, the build will fail with 
outside path in the include path.
If user uses --disable-include-path-check, the build will pass with outside 
path in the include path.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 15 ---
 BaseTools/Source/Python/build/build.py |  2 ++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index e7dbf66e2f..568d535754 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -3037,13 +3037,14 @@ class ModuleAutoGen(AutoGen):
 # EDK II modules must not reference header files outside of the 
packages they depend on or
 # within the module's directory tree. Report error if violation.
 #
-for Path in IncPathList:
-if (Path not in self.IncludePathList) and (CommonPath([Path, 
self.MetaFile.Dir]) != self.MetaFile.Dir):
-ErrMsg = "The include directory for the EDK II module in 
this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)
-EdkLogger.error("build",
-PARAMETER_INVALID,
-ExtraData=ErrMsg,
-File=str(self.MetaFile))
+if GlobalData.gDisableIncludePathCheck == False:
+for Path in IncPathList:
+if (Path not in self.IncludePathList) and 
(CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):
+ErrMsg = "The include directory for the EDK II module 
in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, 
FlagOption)
+EdkLogger.error("build",
+PARAMETER_INVALID,
+ExtraData=ErrMsg,
+File=str(self.MetaFile))
 RetVal += IncPathList
 return RetVal
 
diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index 99e79d4dca..de641fb452 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -719,6 +719,7 @@ class Build():
 GlobalData.gBinCacheDest   = BuildOptions.BinCacheDest
 GlobalData.gBinCacheSource = BuildOptions.BinCacheSource
 GlobalData.gEnableGenfdsMultiThread = BuildOptions.GenfdsMultiThread
+GlobalData.gDisableIncludePathCheck = 
+ BuildOptions.DisableIncludePathCheck
 
 if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:
 EdkLogger.error("build", OPTION_NOT_SUPPORTED, 
ExtraData="--binary-destination must be used together with --hash.") @@ -2268,6 
+2269,7 @@ def MyOptionParser():
 Parser.add_option("--binary-destination", action="store", type="string", 
dest="BinCacheDest", help="Generate a cache of binary files in the specified 
directory.")
 Parser.add_option("--binary-source", action="store", type="string", 
dest="BinCacheSource", help="Consume a cache of binary files from the specified 
directory.")
 Parser.add_option("--genfds-multi-thread", action="store_true", 
dest="GenfdsMultiThread", default=False, help="Enable GenFds multi thread to 
generate ffs file.")
+Parser.add_option("--disable-include-path-check", 
+ action="store_true", dest="DisableIncludePathCheck", default=False, 
+ help="Disable the include path check for outside of package.")
 (Opt, Args) = Parser.parse_args()
 return (Opt, Args)
 
--
2.19.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch V2 1/1] Document: Add PCD flexible format value EBNF in Fdf.

2019-03-06 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=541

This patch is to add flexible PCD value format EBNF into Fdf spec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
---
 3_edk_ii_fdf_file_format/32_fdf_definition.md | 25 
+
 3_edk_ii_fdf_file_format/35_[fd]_sections.md  |  4 ++--
 3_edk_ii_fdf_file_format/36_[fv]_sections.md  |  4 ++--
 3_edk_ii_fdf_file_format/37_[capsule]_sections.md |  4 ++--
 README.md |  1 +
 5 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/3_edk_ii_fdf_file_format/32_fdf_definition.md 
b/3_edk_ii_fdf_file_format/32_fdf_definition.md
index db098cf..2b044ab 100644
--- a/3_edk_ii_fdf_file_format/32_fdf_definition.md
+++ b/3_edk_ii_fdf_file_format/32_fdf_definition.md
@@ -1,9 +1,9 @@
 

[edk2] [Patch V2 0/1] Document: Add PCD flexible format value EBNF in Fdf.

2019-03-06 Thread Feng, Bob C
V2:
Update the revision history in README.md

This patch is to add flexible PCD value format EBNF into Fdf spec.

Feng, Bob C (1):
  Document: Add PCD flexible format value EBNF in Fdf.

 3_edk_ii_fdf_file_format/32_fdf_definition.md | 25 
+
 3_edk_ii_fdf_file_format/35_[fd]_sections.md  |  4 ++--
 3_edk_ii_fdf_file_format/36_[fv]_sections.md  |  4 ++--
 3_edk_ii_fdf_file_format/37_[capsule]_sections.md |  4 ++--
 README.md |  1 +
 5 files changed, 28 insertions(+), 10 deletions(-)

-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] EDK II Specifications for edk2-stable201903 tag

2019-03-06 Thread Feng, Bob C
Hi Mike,

Yes. the Revision history need to update. I have sent the spec patches v2 which 
update the Revision History in README.md and table of content in SUMMARY.md for 
INF/FDF/DSC spec.
And I added the BZ in the README.md.

Thanks,
Bob

-Original Message-
From: Kinney, Michael D 
Sent: Thursday, March 7, 2019 12:59 AM
To: Gao, Liming ; Feng, Bob C ; 
edk2-devel@lists.01.org; Kinney, Michael D 
Subject: EDK II Specifications for edk2-stable201903 tag

Hi Liming and Bob,

I see several EDK II specification updates.

I do not see consistent updates to the Revision History In the README.md with 
link to the BZ for the document change.  Please make sure all revision 
histories are up to date with BZ links, and as each BZ is closed put the links 
to commits made in the BZ.  This allows anyone reading the documents to follow 
the link to the BZ from the Revision History, review the change request and 
follow the links to the commits in GitHub and the easily view the document 
changes.

Do you want released versions of these documents to align with the 
edk2-stable201903 tag?  The document release process is documented here:

https://github.com/tianocore-docs/edk2-TemplateSpecification/wiki/TianoCore-Documents-Releasing

If so, please enter BZ for each document with the requested release version 
number along with the SHA hash of on master the release branch is being 
requested.

Thanks,

Mike

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch V2 0/1] Document: Update FDF spec to remove EDK and IPF related contents

2019-03-06 Thread Feng, Bob C
V2:
Update the table of content and update history.
Update commit message and fixed a bug.

Feng, Bob C (1):
  Document: Update FDF spec to remove EDK and IPF related contents

 1_introduction/11_overview.md  
 |  22 +++---
 1_introduction/12_terms.md 
 |   8 +---
 1_introduction/README.md   
 |   9 ++---
 2_fdf_design_discussion/22_flash_description_file_format.md
 |  34 --
 2_fdf_design_discussion/24_[fd]_sections.md
 |   9 ++---
 2_fdf_design_discussion/25_[fv]_sections.md
 |   9 +++--
 2_fdf_design_discussion/{28_[rule]_sections.md => 27_[rule]_sections.md}   
 | 232 

 2_fdf_design_discussion/27_[vtf]_sections.md   
 |  82 
--
 2_fdf_design_discussion/{29_[optionrom]_sections.md => 
28_[optionrom]_sections.md}  | 112 

 2_fdf_design_discussion/README.md  
 |   2 --
 3_edk_ii_fdf_file_format/310_[vtf]_section.md  
 | 203 
---
 3_edk_ii_fdf_file_format/{311_pci_optionrom_section.md => 
310_pci_optionrom_section.md} | 228 
++--
 3_edk_ii_fdf_file_format/31_general_rules.md   
 |  13 +
 3_edk_ii_fdf_file_format/32_fdf_definition.md  
 |  67 
+--
 README.md  
 |   1 +
 SUMMARY.md 
 |   8 +++-
 appendix_a_nt32pkg_flash_description_file.md   
 |   4 ++--
 17 files changed, 321 insertions(+), 722 deletions(-)
 rename 2_fdf_design_discussion/{28_[rule]_sections.md => 
27_[rule]_sections.md} (95%)
 delete mode 100644 2_fdf_design_discussion/27_[vtf]_sections.md
 rename 2_fdf_design_discussion/{29_[optionrom]_sections.md => 
28_[optionrom]_sections.md} (94%)
 delete mode 100644 3_edk_ii_fdf_file_format/310_[vtf]_section.md
 rename 3_edk_ii_fdf_file_format/{311_pci_optionrom_section.md => 
310_pci_optionrom_section.md} (93%)

-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/1] Document: Update FDF spec to remove EDK and IPF related contents

2019-03-06 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453

Remove EDK and IPF related contents inf Fdf spec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 1_introduction/11_overview.md  
 |  22 +++---
 1_introduction/12_terms.md 
 |   8 +---
 1_introduction/README.md   
 |   9 ++---
 2_fdf_design_discussion/22_flash_description_file_format.md
 |  34 --
 2_fdf_design_discussion/24_[fd]_sections.md
 |   9 ++---
 2_fdf_design_discussion/25_[fv]_sections.md
 |   9 +++--
 2_fdf_design_discussion/{28_[rule]_sections.md => 27_[rule]_sections.md}   
 | 232 

 2_fdf_design_discussion/27_[vtf]_sections.md   
 |  82 
--
 2_fdf_design_discussion/{29_[optionrom]_sections.md => 
28_[optionrom]_sections.md}  | 112 

 2_fdf_design_discussion/README.md  
 |   2 --
 3_edk_ii_fdf_file_format/310_[vtf]_section.md  
 | 203 
---
 3_edk_ii_fdf_file_format/{311_pci_optionrom_section.md => 
310_pci_optionrom_section.md} | 228 
++--
 3_edk_ii_fdf_file_format/31_general_rules.md   
 |  13 +
 3_edk_ii_fdf_file_format/32_fdf_definition.md  
 |  67 
+--
 README.md  
 |   1 +
 SUMMARY.md 
 |   8 +++-
 appendix_a_nt32pkg_flash_description_file.md   
 |   4 ++--
 17 files changed, 321 insertions(+), 722 deletions(-)

diff --git a/1_introduction/11_overview.md b/1_introduction/11_overview.md
index 6db8a26..d7dbb20 100644
--- a/1_introduction/11_overview.md
+++ b/1_introduction/11_overview.md
@@ -1,9 +1,9 @@
 
-
-## 2.8 [Rule] Sections
-
-The optional `[Rule]` sections in the FDF file are used for combining binary
-images, not for compiling code. Rules are use with the `[FV]` section's module
-INF type to define how an FFS file is created for a given INF file. The EDK II
-Build Specification defines the default rules that are implicitly used for
-creating FFS files. The implicit rules follow the _PI Specification_ and
-_UEFI Specification_.
-
-The `[Rule]` section of the FDF file is used to define custom rules, which may
-be applied to a given INF file listed in an `[FV]` section. This section is
-also used to define rules for module types that permit the user to define the
-content of the FFS file - when an FFS type is not specified by either PI or
-UEFI specifications.
-
-The Rules can have multiple modifiers as shown below.
-
-`[Rule.ARCH.MODULE_TYPE.TEMPLATE_NAME]`
-
-If no `TEMPLATE_NAME` is given then the match is based on `ARCH` and
-`MODULE_TYPE` modifiers. `BINARY` is a reserved `TEMPLATE_NAME` as a default 
rule
-name for binary modules. The `TEMPLATE_NAME` must be unique to the `ARCH` and
-`MODULE_TYPE`. It is permissible to use the same `TEMPLATE_NAME` for two or
-more `[Rule]` sections if the `ARCH` or the `MODULE_TYPE` listed are different
-for each of the sections.
-
-A `[Rule]` section is terminated by another section header or the end of file.
-
-The content of the `[Rule]` section is based on the `FILE` and section grammar
-of the FV section. The difference is the `FILE` referenced in the `[RULE]` is a
-`MACRO`. The section grammar is extended to include an optional argument,
-`Optional`. The `Optional` argument is used to say a section is optional. That
-is to say, if it does not exist, then it is O.K.
-
-**
-**Note:** The `!include` statement is valid for any part of the

[edk2] [Patch V2 1/1] Document: Update DSC spec to remove EDK and IPF related contents

2019-03-06 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453

Remove EDK and IPF related contents inf Dsc spec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 1_introduction/11_overview.md  
 | 14 --
 2_dsc_overview/{211_[components]_section_processing.md => 
210_[components]_section_processing.md}   | 27 +--
 2_dsc_overview/{212_[userextensions]_section.md => 
211_[userextensions]_section.md} |  4 ++--
 2_dsc_overview/{213_[defaultstores]_section_processing.md => 
212_[defaultstores]_section_processing.md} |  4 ++--
 2_dsc_overview/22_build_description_file_format.md 
 | 50 ++
 2_dsc_overview/23_[defines]_section_processing.md  
 | 12 +++-
 2_dsc_overview/24_[buildoptions]_section.md
 | 72 
+++-
 2_dsc_overview/26_[libraries]_section_processing.md
 | 69 
-
 2_dsc_overview/{27_[libraryclasses]_section_processing.md => 
26_[libraryclasses]_section_processing.md} |  4 ++--
 2_dsc_overview/{28_pcd_section_processing.md => 27_pcd_section_processing.md}  
 | 34 +-
 2_dsc_overview/{29_pcd_sections.md => 28_pcd_sections.md}  
 | 26 +-
 2_dsc_overview/{210_pcd_database.md => 29_pcd_database.md} 
 |  4 ++--
 3_edk_ii_dsc_file_format/{311_[components]_sections.md => 
310_[components]_sections.md} | 62 
+-
 3_edk_ii_dsc_file_format/{312_[userextensions]_sections.md => 
311_[userextensions]_sections.md} |  4 ++--
 3_edk_ii_dsc_file_format/{313_[defaultstores]_section.md => 
312_[defaultstores]_section.md} |  4 ++--
 3_edk_ii_dsc_file_format/32_general_rules.md   
 | 13 +
 3_edk_ii_dsc_file_format/33_platform_dsc_definition.md 
 | 17 +
 3_edk_ii_dsc_file_format/35_[defines]_section.md   
 | 12 +---
 3_edk_ii_dsc_file_format/36_[buildoptions]_sections.md 
 | 19 +--
 3_edk_ii_dsc_file_format/38_[libraries]_sections.md
 | 94 
--
 3_edk_ii_dsc_file_format/{39_[libraryclasses]_sections.md => 
38_[libraryclasses]_sections.md}   |  4 ++--
 3_edk_ii_dsc_file_format/{310_pcd_sections.md => 39_pcd_sections.md}   
 | 14 +++---
 README.md  
 |  1 +
 SUMMARY.md 
 | 26 --
 24 files changed, 114 insertions(+), 476 deletions(-)

diff --git a/1_introduction/11_overview.md b/1_introduction/11_overview.md
index d9006df..ff2b517 100644
--- a/1_introduction/11_overview.md
+++ b/1_introduction/11_overview.md
@@ -1,9 +1,9 @@
 
 
-## 2.11 [Components] Section Processing
+## 2.10 [Components] Section Processing
 
-One or more `[Components]` sections contain lists of EDK components and EDK II
-Modules. The format for specifying the INF file for EDK II modules incorporates
-new scoping capabilities.
+One or more `[Components]` sections contain lists of EDK II Modules. The 
format 
+for specifying the INF file for EDK II modules incorporates new scoping 
capabilities.
 
 This section uses one or more of the following section definitions:
 
 * `[Components]`
 * `[Components.IA32]`
 * `[Components.X64]`
 * `[Components.EBC]`
 * `[Components.common]`
 
-EDK components are specified using a fully qualified path to the EDK INF file.
-
-`$(EDK_SOURCE)/Path/and/Filename.inf`
-
-Because EDK II modules have different requirements than EDK I components,
-specifying the INF filename in the extended DSC file may require more than just
-the INF filename and options. A scoping structure, that binds library class
+A scoping structure, that binds library class
 (with an optional override instance,) PCD settings (also overriding the values
 specified in the `[PcdsPatchableInModule]` or `[PcdsFixedAtBuild]` sections)
 and build options for an EDK II module may be r

[edk2] [Patch V2 0/1] Document: Update DSC spec to remove EDK and IPF related contents

2019-03-06 Thread Feng, Bob C
V2:
Update the table of contents and the update history.

Feng, Bob C (1):
  Document: Update DSC spec to remove EDK and IPF related contents

 1_introduction/11_overview.md  
 | 14 --
 2_dsc_overview/{211_[components]_section_processing.md => 
210_[components]_section_processing.md}   | 27 +--
 2_dsc_overview/{212_[userextensions]_section.md => 
211_[userextensions]_section.md} |  4 ++--
 2_dsc_overview/{213_[defaultstores]_section_processing.md => 
212_[defaultstores]_section_processing.md} |  4 ++--
 2_dsc_overview/22_build_description_file_format.md 
 | 50 ++
 2_dsc_overview/23_[defines]_section_processing.md  
 | 12 +++-
 2_dsc_overview/24_[buildoptions]_section.md
 | 72 
+++-
 2_dsc_overview/26_[libraries]_section_processing.md
 | 69 
-
 2_dsc_overview/{27_[libraryclasses]_section_processing.md => 
26_[libraryclasses]_section_processing.md} |  4 ++--
 2_dsc_overview/{28_pcd_section_processing.md => 27_pcd_section_processing.md}  
 | 34 +-
 2_dsc_overview/{29_pcd_sections.md => 28_pcd_sections.md}  
 | 26 +-
 2_dsc_overview/{210_pcd_database.md => 29_pcd_database.md} 
 |  4 ++--
 3_edk_ii_dsc_file_format/{311_[components]_sections.md => 
310_[components]_sections.md} | 62 
+-
 3_edk_ii_dsc_file_format/{312_[userextensions]_sections.md => 
311_[userextensions]_sections.md} |  4 ++--
 3_edk_ii_dsc_file_format/{313_[defaultstores]_section.md => 
312_[defaultstores]_section.md} |  4 ++--
 3_edk_ii_dsc_file_format/32_general_rules.md   
 | 13 +
 3_edk_ii_dsc_file_format/33_platform_dsc_definition.md 
 | 17 +
 3_edk_ii_dsc_file_format/35_[defines]_section.md   
 | 12 +---
 3_edk_ii_dsc_file_format/36_[buildoptions]_sections.md 
 | 19 +--
 3_edk_ii_dsc_file_format/38_[libraries]_sections.md
 | 94 
--
 3_edk_ii_dsc_file_format/{39_[libraryclasses]_sections.md => 
38_[libraryclasses]_sections.md}   |  4 ++--
 3_edk_ii_dsc_file_format/{310_pcd_sections.md => 39_pcd_sections.md}   
 | 14 +++---
 README.md  
 |  1 +
 SUMMARY.md 
 | 26 --
 24 files changed, 114 insertions(+), 476 deletions(-)
 rename 2_dsc_overview/{211_[components]_section_processing.md => 
210_[components]_section_processing.md} (84%)
 rename 2_dsc_overview/{212_[userextensions]_section.md => 
211_[userextensions]_section.md} (93%)
 rename 2_dsc_overview/{213_[defaultstores]_section_processing.md => 
212_[defaultstores]_section_processing.md} (93%)
 delete mode 100644 2_dsc_overview/26_[libraries]_section_processing.md
 rename 2_dsc_overview/{27_[libraryclasses]_section_processing.md => 
26_[libraryclasses]_section_processing.md} (96%)
 rename 2_dsc_overview/{28_pcd_section_processing.md => 
27_pcd_section_processing.md} (94%)
 rename 2_dsc_overview/{29_pcd_sections.md => 28_pcd_sections.md} (93%)
 rename 2_dsc_overview/{210_pcd_database.md => 29_pcd_database.md} (96%)
 rename 3_edk_ii_dsc_file_format/{311_[components]_sections.md => 
310_[components]_sections.md} (81%)
 rename 3_edk_ii_dsc_file_format/{312_[userextensions]_sections.md => 
311_[userextensions]_sections.md} (94%)
 rename 3_edk_ii_dsc_file_format/{313_[defaultstores]_section.md => 
312_[defaultstores]_section.md} (93%)
 delete mode 100644 3_edk_ii_dsc_file_format/38_[libraries]_sections.md
 rename 3_edk_ii_dsc_file_format/{39_[libraryclasses]_sections.md => 
38_[libraryclasses]_sections.md} (95%)
 rename 3_edk_ii_dsc_file_format/{310_pcd_sections.md => 39_pcd_sections.md} 
(97%)

-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch V2 1/1] Document: Update Inf spec to remove EDK and IPF related contents

2019-03-06 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453

Remove EDK and IPF related contents

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 1_introduction/11_overview.md  
  |   4 ++--
 2_inf_overview/210_[ppis]_section.md   
  |   3 +--
 2_inf_overview/211_[guids]_section.md  
  |   3 +--
 2_inf_overview/212_[libraryclasses]_section.md 
  |   3 +--
 2_inf_overview/213_[packages]_section.md   
  |   3 +--
 2_inf_overview/214_pcd_sections.md 
  |  16 +---
 2_inf_overview/215_[depex]_section.md  
  |   6 +-
 2_inf_overview/21_processing_overview.md   
  |  21 +
 2_inf_overview/22_information_file_general_rules.md
  |  32 +++-
 2_inf_overview/24_[defines]_section.md 
  |   6 +++---
 2_inf_overview/25_[sources]_section.md 
  |   6 +-
 2_inf_overview/26_[buildoptions]_section.md
  |  11 ++-
 2_inf_overview/27_[binaries]_section.md
  |   7 +--
 2_inf_overview/29_[protocols]_section.md   
  |   3 +--
 2_inf_overview/README.md   
  |  13 +
 3_edk_ii_inf_file_format/314_[depex]_sections.md   
  |   8 +++-
 3_edk_ii_inf_file_format/315_[binaries]_section.md 
  |   7 +--
 3_edk_ii_inf_file_format/32_component_inf_definition.md
  |   6 +++---
 3_edk_ii_inf_file_format/34_[defines]_section.md   
  |   8 ++--
 3_edk_ii_inf_file_format/35_[buildoptions]_sections.md 
  |   7 +++
 3_edk_ii_inf_file_format/39_[sources]_sections.md  
  |   9 ++---
 3_edk_ii_inf_file_format/README.md 
  |   6 +-
 README.md  
  |   3 ++-
 SUMMARY.md 
  |  37 +
 appendix_b_build_changes_and_customizations.md => 
appendix_a_build_changes_and_customizations.md |  10 +-
 appendix_a_edk_inf_file_specification/README.md
  |  40 
 appendix_a_edk_inf_file_specification/a1_design_discussion.md  
  | 317 
-
 appendix_a_edk_inf_file_specification/a2_edk_file_specification.md 
  | 461 
-
 appendix_c_symbols.md => appendix_b_symbols.md 
  |   4 ++--
 appendix_d_sample_driver_inf_files.md => appendix_c_sample_driver_inf_files.md 
  |   8 
 appendix_e_sample_library_inf_files.md => 
appendix_d_sample_library_inf_files.md |  10 +-
 appendix_f_sample_binary_inf_files.md => appendix_e_sample_binary_inf_files.md 
  |   8 
 appendix_g_module_types.md => appendix_f_module_types.md   
  |   4 ++--
 33 files changed, 93 insertions(+), 997 deletions(-)

diff --git a/1_introduction/11_overview.md b/1_introduction/11_overview.md
index 9239080..2dcf02f 100644
--- a/1_introduction/11_overview.md

[edk2] [Patch V2 0/1] Document: Update Inf spec to remove EDK and IPF related contents

2019-03-06 Thread Feng, Bob C
V2:
Update the table of content and update history.
Update commit message and fixed a bug.

Feng, Bob C (1):
  Document: Update Inf spec to remove EDK related contents

 1_introduction/11_overview.md  
  |   4 ++--
 2_inf_overview/210_[ppis]_section.md   
  |   3 +--
 2_inf_overview/211_[guids]_section.md  
  |   3 +--
 2_inf_overview/212_[libraryclasses]_section.md 
  |   3 +--
 2_inf_overview/213_[packages]_section.md   
  |   3 +--
 2_inf_overview/214_pcd_sections.md 
  |  16 +---
 2_inf_overview/215_[depex]_section.md  
  |   6 +-
 2_inf_overview/21_processing_overview.md   
  |  21 +
 2_inf_overview/22_information_file_general_rules.md
  |  32 +++-
 2_inf_overview/24_[defines]_section.md 
  |   6 +++---
 2_inf_overview/25_[sources]_section.md 
  |   6 +-
 2_inf_overview/26_[buildoptions]_section.md
  |  11 ++-
 2_inf_overview/27_[binaries]_section.md
  |   7 +--
 2_inf_overview/29_[protocols]_section.md   
  |   3 +--
 2_inf_overview/README.md   
  |  13 +
 3_edk_ii_inf_file_format/314_[depex]_sections.md   
  |   8 +++-
 3_edk_ii_inf_file_format/315_[binaries]_section.md 
  |   7 +--
 3_edk_ii_inf_file_format/32_component_inf_definition.md
  |   6 +++---
 3_edk_ii_inf_file_format/34_[defines]_section.md   
  |   8 ++--
 3_edk_ii_inf_file_format/35_[buildoptions]_sections.md 
  |   7 +++
 3_edk_ii_inf_file_format/39_[sources]_sections.md  
  |   9 ++---
 3_edk_ii_inf_file_format/README.md 
  |   6 +-
 README.md  
  |   3 ++-
 SUMMARY.md 
  |  37 +
 appendix_b_build_changes_and_customizations.md => 
appendix_a_build_changes_and_customizations.md |  10 +-
 appendix_a_edk_inf_file_specification/README.md
  |  40 
 appendix_a_edk_inf_file_specification/a1_design_discussion.md  
  | 317 
-
 appendix_a_edk_inf_file_specification/a2_edk_file_specification.md 
  | 461 
-
 appendix_c_symbols.md => appendix_b_symbols.md 
  |   4 ++--
 appendix_d_sample_driver_inf_files.md => appendix_c_sample_driver_inf_files.md 
  |   8 
 appendix_e_sample_library_inf_files.md => 
appendix_d_sample_library_inf_files.md |  10 +-
 appendix_f_sample_binary_inf_files.md => appendix_e_sample_binary_inf_files.md 
  |   8 
 appendix_g_module_types.md => appendix_f_module_types.md   
  |   4 ++--
 33 files changed, 93 insertions(+), 997 deletions(-)
 rename appendix_b_build_changes_and_customizations.md => 
appendix_a_build_changes_and_customizations.md (91%)
 delete mode 100644 appendix_a_edk_inf_file_sp

Re: [edk2] [Patch] Document: Update Inf spec to remove EDK related contents

2019-03-06 Thread Feng, Bob C
Hi Liming,

I'll update patch for 1) and 2)

For 3)
This patch removed "and are valid for EDK-II modules only."  Because I think 
there is only EDK-II now, we don't need to point out this section is for EDKII 
ONLY here.

Thanks,
Bob
-Original Message-
From: Gao, Liming 
Sent: Wednesday, March 6, 2019 4:02 PM
To: Feng, Bob C ; edk2-devel@lists.01.org
Cc: Carsey, Jaben 
Subject: RE: [edk2] [Patch] Document: Update Inf spec to remove EDK related 
contents

Bob:
  I have some comments. 

1) Please update the commit message. The change is to remove EDK and IPF 
related contents. 
2) The below change should make sure the updated one keep the same alignment. 
-||-
+||
3) Below content is correct. It is for EDKII. No need to change it. 
-These sections are used for specifying PCD information and are valid for EDK
-II modules only. The entries for these sections are looked up from the package
-declaration files (DEC) for generating the `AutoGen.c` and `AutoGen.h` files.
+These sections are used for specifying PCD information. The entries for these 
+sections are looked up from the packagedeclaration files (DEC) for generating 
+the `AutoGen.c` and `AutoGen.h` files.

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Feng, 
> Bob C
> Sent: Monday, March 4, 2019 5:52 AM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben ; Gao, Liming 
> Subject: [edk2] [Patch] Document: Update Inf spec to remove EDK related 
> contents
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453
> 
> Remove EDK related contents
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> Cc: Jaben Carsey 
> ---
>  1_introduction/11_overview.md |   2 +-
>  2_inf_overview/210_[ppis]_section.md  |   1 -
>  2_inf_overview/211_[guids]_section.md |   1 -
>  .../212_[libraryclasses]_section.md   |   1 -
>  2_inf_overview/213_[packages]_section.md  |   1 -
>  2_inf_overview/214_pcd_sections.md|  14 +-
>  2_inf_overview/215_[depex]_section.md |   4 -
>  2_inf_overview/21_processing_overview.md  |  19 +-
>  .../22_information_file_general_rules.md  |  30 +-
>  2_inf_overview/24_[defines]_section.md|   4 +-
>  2_inf_overview/25_[sources]_section.md|   4 -
>  2_inf_overview/26_[buildoptions]_section.md   |   9 +-
>  2_inf_overview/27_[binaries]_section.md   |   5 -
>  2_inf_overview/29_[protocols]_section.md  |   1 -
>  2_inf_overview/README.md  |  11 -
>  .../314_[depex]_sections.md   |   6 +-
>  .../315_[binaries]_section.md |   5 -
>  .../32_component_inf_definition.md|   4 +-
>  .../34_[defines]_section.md   |   6 +-
>  .../35_[buildoptions]_sections.md |   5 +-
>  .../39_[sources]_sections.md  |   7 +-
>  3_edk_ii_inf_file_format/README.md|   4 -
>  ...ndix_a_build_changes_and_customizations.md |   0
>  .../README.md |  40 --
>  .../a1_design_discussion.md   | 317 
>  .../a2_edk_file_specification.md  | 461 --
>  ...ndix_c_symbols.md => appendix_b_symbols.md |   0
>  ...d => appendix_c_sample_driver_inf_files.md |   0
>  ... => appendix_d_sample_library_inf_files.md |   0
>  ...d => appendix_e_sample_binary_inf_files.md |   0
>  ...ule_types.md => appendix_f_module_types.md |   0
>  31 files changed, 30 insertions(+), 932 deletions(-)
>  rename appendix_b_build_changes_and_customizations.md => 
> appendix_a_build_changes_and_customizations.md (100%)
>  delete mode 100644 appendix_a_edk_inf_file_specification/README.md
>  delete mode 100644 
> appendix_a_edk_inf_file_specification/a1_design_discussion.md
>  delete mode 100644 
> appendix_a_edk_inf_file_specification/a2_edk_file_specification.md
>  rename appendix_c_symbols.md => appendix_b_symbols.md (100%)
>  rename appendix_d_sample_driver_inf_files.md => 
> appendix_c_sample_driver_inf_files.md (100%)
>  rename appendix_e_sample_library_inf_files.md => 
> appendix_d_sample_library_inf_files.md (100%)
>  rename appendix_f_sample_binary_inf_files.md => 
> appendix_e_sample_binary_inf_files.md (100%)
>  rename appendix_g_module_types.md => appendix_f_module_types.md (100%)
> 
> diff --git a/1_introduction/11_overview.md b/1_introduction/11_overview.md
> index 9239080..7349614 100644
> --- a/1_introduction/11_overview.md
> +++ b/1_introduction/11_overview.md
> @@ -40,11 +40,11 @@ Backward compatibility with the existing INF file 
> formats. Changes m

[edk2] [Patch V2 0/1] Document: Update DEC spec to remove EDK related contents

2019-03-05 Thread Feng, Bob C
V2:
Update top level README to add update history.

Feng, Bob C (1):
  Document: Update DEC spec to remove EDK related contents

 2_dec_file_overview/210_pcd_usage.md | 4 +---
 2_dec_file_overview/25_[includes]_usage.md   | 6 +-
 2_dec_file_overview/26_[guids]_usage.md  | 6 +-
 2_dec_file_overview/27_[protocols]_usage.md  | 6 +-
 2_dec_file_overview/28_[ppis]_usage.md   | 6 +-
 2_dec_file_overview/29_[libraryclasses]_usage.md | 4 +---
 3_edk_ii_dec_file_format/310_pcd_sections.md | 8 ++--
 3_edk_ii_dec_file_format/35_[includes]_sections.md   | 5 +
 3_edk_ii_dec_file_format/39_[libraryclasses]_sections.md | 5 +
 README.md| 1 +
 10 files changed, 11 insertions(+), 40 deletions(-)

-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch V2 1/1] Document: Update DEC spec to remove EDK related contents

2019-03-05 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453

Remove EDK related contents from DEC spec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 2_dec_file_overview/210_pcd_usage.md | 4 +---
 2_dec_file_overview/25_[includes]_usage.md   | 6 +-
 2_dec_file_overview/26_[guids]_usage.md  | 6 +-
 2_dec_file_overview/27_[protocols]_usage.md  | 6 +-
 2_dec_file_overview/28_[ppis]_usage.md   | 6 +-
 2_dec_file_overview/29_[libraryclasses]_usage.md | 4 +---
 3_edk_ii_dec_file_format/310_pcd_sections.md | 8 ++--
 3_edk_ii_dec_file_format/35_[includes]_sections.md   | 5 +
 3_edk_ii_dec_file_format/39_[libraryclasses]_sections.md | 5 +
 README.md| 1 +
 10 files changed, 11 insertions(+), 40 deletions(-)

diff --git a/2_dec_file_overview/210_pcd_usage.md 
b/2_dec_file_overview/210_pcd_usage.md
index 9b554be..e600db2 100644
--- a/2_dec_file_overview/210_pcd_usage.md
+++ b/2_dec_file_overview/210_pcd_usage.md
@@ -1,9 +1,9 @@
 

[edk2] [Patch V2 1/1] Document: Update Build spec to remove EDK related contents

2019-03-05 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453

Remove EDK related contents from Build spec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 10_post-build_imagegen_stage_-_flash/103_build_intermediate_images.md |  3 +--
 12_build_changes_and_customizations/README.md |  4 ++--
 4_edk_ii_build_process_overview/42_build_process_overview.md  |  6 
++
 4_edk_ii_build_process_overview/46_file_specifications.md | 20 
+---
 6_quick_start/61_environment_variables.md | 24 
+---
 8_pre-build_autogen_stage/82_auto-generation_process.md   | 76 
+++-
 8_pre-build_autogen_stage/83_auto-generated_code.md   | 43 
+++
 8_pre-build_autogen_stage/85_auto-generated_makefiles.md  | 23 
+--
 9_build_or_make_stage/README.md   |  9 
-
 README.md |  1 +
 appendix_a_variables.md   |  3 +--
 11 files changed, 44 insertions(+), 168 deletions(-)

diff --git 
a/10_post-build_imagegen_stage_-_flash/103_build_intermediate_images.md 
b/10_post-build_imagegen_stage_-_flash/103_build_intermediate_images.md
index 5f5aefc..9253cde 100644
--- a/10_post-build_imagegen_stage_-_flash/103_build_intermediate_images.md
+++ b/10_post-build_imagegen_stage_-_flash/103_build_intermediate_images.md
@@ -1,9 +1,9 @@
 
 
 # 12 Build Changes and Customizations
 
 This chapter deals with customizing a build, including options and settings for
-debugging, using custom tools as well as how to customize EDK component builds
+debugging, using custom tools.
diff --git a/4_edk_ii_build_process_overview/42_build_process_overview.md 
b/4_edk_ii_build_process_overview/42_build_process_overview.md
index d0725d3..17ed278 100644
--- a/4_edk_ii_build_process_overview/42_build_process_overview.md
+++ b/4_edk_ii_build_process_overview/42_build_process_overview.md
@@ -1,9 +1,9 @@
 
 
 ## 4.2 Build Process Overview
 
 Prior to executing a build command, specific system environment variables must
-be initialized: `WORKSPACE`, `EDK_TOOLS_PATH` are required for all builds,
-while `ECP_SOURCE`, `EFI_SOURCE` and `EDK_SOURCE` are only required to build
-EDK II platforms that contain EDK components and EDK libraries. Additionally,
+be initialized: `WORKSPACE`, `EDK_TOOLS_PATH` are required for all builds. 
Additionally,
 the provided EDK II tool set must be present in a directory that is in the
 system environment variable: PATH. The edksetup scripts provided in the root
 directory of the EDK II development tree will set the `WORKSPACE` and
 `EDK_TOOLS_PATH`, as well as modify the system environment variable, PATH to
 ensure that the tools can execute. Refer to "_Build Environment_" for more
diff --git a/4_edk_ii_build_process_overview/46_file_specifications.md 
b/4_edk_ii_build_process_overview/46_file_specifications.md
index a606488..f30f806 100644
--- a/4_edk_ii_build_process_overview/46_file_specifications.md
+++ b/4_edk_ii_build_process_overview/46_file_specifications.md
@@ -1,9 +1,9 @@
 

[edk2] [Patch V2 0/1] Document: Update Build spec to remove EDK related

2019-03-05 Thread Feng, Bob C
V2:
Update the top level README to add the update history.

Feng, Bob C (1):
  Document: Update Build spec to remove EDK related contents

 10_post-build_imagegen_stage_-_flash/103_build_intermediate_images.md |  3 +--
 12_build_changes_and_customizations/README.md |  4 ++--
 4_edk_ii_build_process_overview/42_build_process_overview.md  |  6 
++
 4_edk_ii_build_process_overview/46_file_specifications.md | 20 
+---
 6_quick_start/61_environment_variables.md | 24 
+---
 8_pre-build_autogen_stage/82_auto-generation_process.md   | 76 
+++-
 8_pre-build_autogen_stage/83_auto-generated_code.md   | 43 
+++
 8_pre-build_autogen_stage/85_auto-generated_makefiles.md  | 23 
+--
 9_build_or_make_stage/README.md   |  9 
-
 README.md |  1 +
 appendix_a_variables.md   |  3 +--
 11 files changed, 44 insertions(+), 168 deletions(-)

-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools:Guid.xref will change after increment build

2019-03-05 Thread Feng, Bob C
Hi Zhiju,

Since you changed a set() to a list,  I think you need to check if the item is 
already in the list before appending it.

Thanks,
Bob

-Original Message-
From: Fan, ZhijuX 
Sent: Tuesday, March 5, 2019 4:48 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH] BaseTools:Guid.xref will change after increment build

the order of the data may change if set() is used

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 5e7d7dcd63..342b9472a2 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1654,7 +1654,7 @@ class DscBuildData(PlatformBuildClassObject):
 AvailableSkuIdSet = copy.copy(self.SkuIds)
 
 PcdDict = tdict(True, 4)
-PcdSet = set()
+PcdList = []
 # Find out all possible PCD candidates for self._Arch
 RecordList = self._RawData[Type, self._Arch]
 PcdValueDict = OrderedDict()
@@ -1666,10 +1666,10 @@ class DscBuildData(PlatformBuildClassObject):
 File=self.MetaFile, Line=Dummy5)
 if SkuName in (self.SkuIdMgr.SystemSkuId, TAB_DEFAULT, TAB_COMMON):
 if "." not in TokenSpaceGuid and "[" not in PcdCName:
-PcdSet.add((PcdCName, TokenSpaceGuid, SkuName, Dummy5))
+PcdList.append((PcdCName, TokenSpaceGuid, SkuName, 
+ Dummy5))
 PcdDict[Arch, PcdCName, TokenSpaceGuid, SkuName] = Setting
 
-for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdSet:
+for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdList:
 Setting = PcdDict[self._Arch, PcdCName, TokenSpaceGuid, SkuName]
 if Setting is None:
 continue
@@ -2874,7 +2874,7 @@ class DscBuildData(PlatformBuildClassObject):
 # PCD settings for certain ARCH and SKU
 #
 PcdDict = tdict(True, 5)
-PcdSet = set()
+PcdList = []
 RecordList = self._RawData[Type, self._Arch]
 # Find out all possible PCD candidates for self._Arch
 AvailableSkuIdSet = copy.copy(self.SkuIds) @@ -2896,12 +2896,12 @@ 
class DscBuildData(PlatformBuildClassObject):
 EdkLogger.error('build', PARAMETER_INVALID, 'DefaultStores %s 
is not defined in [DefaultStores] section' % DefaultStore,
 File=self.MetaFile, Line=Dummy5)
 if "." not in TokenSpaceGuid and "[" not in PcdCName:
-PcdSet.add((PcdCName, TokenSpaceGuid, SkuName, DefaultStore, 
Dummy5))
+PcdList.append((PcdCName, TokenSpaceGuid, SkuName, 
+ DefaultStore, Dummy5))
 PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid, DefaultStore] = 
Setting
 
 
 # Remove redundant PCD candidates, per the ARCH and SKU
-for PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy4 in PcdSet:
+for PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy4 in PcdList:
 
 Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid, 
DefaultStore]
 if Setting is None:
--
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] Document: Add PCD flexible format value EBNF in Fdf.

2019-03-05 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=541

This patch is to add flexible PCD value format EBNF into Fdf spec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
---
 3_edk_ii_fdf_file_format/32_fdf_definition.md | 25 ---
 3_edk_ii_fdf_file_format/35_[fd]_sections.md  |  4 +--
 3_edk_ii_fdf_file_format/36_[fv]_sections.md  |  4 +--
 .../37_[capsule]_sections.md  |  4 +--
 4 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/3_edk_ii_fdf_file_format/32_fdf_definition.md 
b/3_edk_ii_fdf_file_format/32_fdf_definition.md
index db098cf..2b044ab 100644
--- a/3_edk_ii_fdf_file_format/32_fdf_definition.md
+++ b/3_edk_ii_fdf_file_format/32_fdf_definition.md
@@ -1,9 +1,9 @@
 

[edk2] [Patch] Document: Update Build spec to remove EDK related contents

2019-03-04 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453

Remove EDK related contents from Build spec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 .../103_build_intermediate_images.md  |  3 +-
 12_build_changes_and_customizations/README.md |  4 +-
 .../42_build_process_overview.md  |  6 +-
 .../46_file_specifications.md | 20 +
 6_quick_start/61_environment_variables.md | 24 +-
 .../82_auto-generation_process.md | 76 +++
 .../83_auto-generated_code.md | 43 +++
 .../85_auto-generated_makefiles.md| 23 +++---
 9_build_or_make_stage/README.md   |  9 +--
 appendix_a_variables.md   |  3 +-
 10 files changed, 43 insertions(+), 168 deletions(-)

diff --git 
a/10_post-build_imagegen_stage_-_flash/103_build_intermediate_images.md 
b/10_post-build_imagegen_stage_-_flash/103_build_intermediate_images.md
index 5f5aefc..9253cde 100644
--- a/10_post-build_imagegen_stage_-_flash/103_build_intermediate_images.md
+++ b/10_post-build_imagegen_stage_-_flash/103_build_intermediate_images.md
@@ -1,9 +1,9 @@
 
 
 # 12 Build Changes and Customizations
 
 This chapter deals with customizing a build, including options and settings for
-debugging, using custom tools as well as how to customize EDK component builds
+debugging, using custom tools.
diff --git a/4_edk_ii_build_process_overview/42_build_process_overview.md 
b/4_edk_ii_build_process_overview/42_build_process_overview.md
index d0725d3..17ed278 100644
--- a/4_edk_ii_build_process_overview/42_build_process_overview.md
+++ b/4_edk_ii_build_process_overview/42_build_process_overview.md
@@ -1,9 +1,9 @@
 
 
 ## 4.2 Build Process Overview
 
 Prior to executing a build command, specific system environment variables must
-be initialized: `WORKSPACE`, `EDK_TOOLS_PATH` are required for all builds,
-while `ECP_SOURCE`, `EFI_SOURCE` and `EDK_SOURCE` are only required to build
-EDK II platforms that contain EDK components and EDK libraries. Additionally,
+be initialized: `WORKSPACE`, `EDK_TOOLS_PATH` are required for all builds. 
Additionally,
 the provided EDK II tool set must be present in a directory that is in the
 system environment variable: PATH. The edksetup scripts provided in the root
 directory of the EDK II development tree will set the `WORKSPACE` and
 `EDK_TOOLS_PATH`, as well as modify the system environment variable, PATH to
 ensure that the tools can execute. Refer to "_Build Environment_" for more
diff --git a/4_edk_ii_build_process_overview/46_file_specifications.md 
b/4_edk_ii_build_process_overview/46_file_specifications.md
index a606488..f30f806 100644
--- a/4_edk_ii_build_process_overview/46_file_specifications.md
+++ b/4_edk_ii_build_process_overview/46_file_specifications.md
@@ -1,9 +1,9 @@
 

[edk2] [Patch] Document: Update DSC spec to remove EDK related contents

2019-03-04 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453

Remove EDK related contents inf Dsc spec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 1_introduction/11_overview.md | 14 +--
 ...=> 210_[components]_section_processing.md} | 27 +-
 ...ion.md => 211_[userextensions]_section.md} |  4 +-
 ...212_[defaultstores]_section_processing.md} |  4 +-
 .../22_build_description_file_format.md   | 50 ++
 .../23_[defines]_section_processing.md| 12 +--
 2_dsc_overview/24_[buildoptions]_section.md   | 72 ++
 .../26_[libraries]_section_processing.md  | 69 --
 ...26_[libraryclasses]_section_processing.md} |  4 +-
 ...essing.md => 27_pcd_section_processing.md} | 34 +++
 ...{29_pcd_sections.md => 28_pcd_sections.md} | 26 ++---
 ...210_pcd_database.md => 29_pcd_database.md} |  4 +-
 ...ctions.md => 310_[components]_sections.md} | 62 +---
 ...ns.md => 311_[userextensions]_sections.md} |  4 +-
 ...tion.md => 312_[defaultstores]_section.md} |  4 +-
 3_edk_ii_dsc_file_format/32_general_rules.md  | 13 +--
 .../33_platform_dsc_definition.md | 17 +---
 .../35_[defines]_section.md   | 12 +--
 .../36_[buildoptions]_sections.md | 19 ++--
 .../38_[libraries]_sections.md| 94 ---
 ...ons.md => 38_[libraryclasses]_sections.md} |  4 +-
 ...310_pcd_sections.md => 39_pcd_sections.md} | 14 +--
 22 files changed, 101 insertions(+), 462 deletions(-)
 rename 2_dsc_overview/{211_[components]_section_processing.md => 
210_[components]_section_processing.md} (84%)
 rename 2_dsc_overview/{212_[userextensions]_section.md => 
211_[userextensions]_section.md} (93%)
 rename 2_dsc_overview/{213_[defaultstores]_section_processing.md => 
212_[defaultstores]_section_processing.md} (93%)
 delete mode 100644 2_dsc_overview/26_[libraries]_section_processing.md
 rename 2_dsc_overview/{27_[libraryclasses]_section_processing.md => 
26_[libraryclasses]_section_processing.md} (96%)
 rename 2_dsc_overview/{28_pcd_section_processing.md => 
27_pcd_section_processing.md} (94%)
 rename 2_dsc_overview/{29_pcd_sections.md => 28_pcd_sections.md} (93%)
 rename 2_dsc_overview/{210_pcd_database.md => 29_pcd_database.md} (96%)
 rename 3_edk_ii_dsc_file_format/{311_[components]_sections.md => 
310_[components]_sections.md} (81%)
 rename 3_edk_ii_dsc_file_format/{312_[userextensions]_sections.md => 
311_[userextensions]_sections.md} (94%)
 rename 3_edk_ii_dsc_file_format/{313_[defaultstores]_section.md => 
312_[defaultstores]_section.md} (93%)
 delete mode 100644 3_edk_ii_dsc_file_format/38_[libraries]_sections.md
 rename 3_edk_ii_dsc_file_format/{39_[libraryclasses]_sections.md => 
38_[libraryclasses]_sections.md} (95%)
 rename 3_edk_ii_dsc_file_format/{310_pcd_sections.md => 39_pcd_sections.md} 
(97%)

diff --git a/1_introduction/11_overview.md b/1_introduction/11_overview.md
index d9006df..ff2b517 100644
--- a/1_introduction/11_overview.md
+++ b/1_introduction/11_overview.md
@@ -1,9 +1,9 @@
 
 
-## 2.11 [Components] Section Processing
+## 2.10 [Components] Section Processing
 
-One or more `[Components]` sections contain lists of EDK components and EDK II
-Modules. The format for specifying the INF file for EDK II modules incorporates
-new scoping capabilities.
+One or more `[Components]` sections contain lists of EDK II Modules. The 
format 
+for specifying the INF file for EDK II modules incorporates new scoping 
capabilities.
 
 This section uses one or more of the following section definitions:
 
 * `[Components]`
 * `[Components.IA32]`
 * `[Components.X64]`
 * `[Components.EBC]`
 * `[Components.common]`
 
-EDK components are specified using a fully qualified path to the EDK INF file.
-
-`$(EDK_SOURCE)/Path/and/Filename.inf`
-
-Because EDK II modules have different requirements than EDK I components,
-specifying the INF filename in the extended DSC file may require more than just
-the INF filename and options. A scoping structure, that binds library class
+A scoping structure, that binds library class
 (with an optional override instance,) PCD settings (also overriding the values
 specified in the `[PcdsPatchableInModule]` or `[PcdsFixedAtBuild]` sections)
 and build options for an EDK II module may be required. This scoping structure,
 containing sub-elements, is enclosed within curly braces: "{}". The opening
 curly brace, "{", must appear at the end of the inf filename line, before any
@@ -79,20 +72,10 @@ Path/and/Filename.inf {
 
 There are four valid, optional sub-elements for EDK II modules. These
 sub-element are enclosed within angle brackets: `, `,
 `` and ``.
 
-For EDK component INF files, an optional sub-element of
-`` has been defined. If this element is specified, files
-listed in the directory are used instead of the "same-named" files in the
-component's directory. If an EDK component directory lists files, A.c, B.c and
-C.h, and

Re: [edk2] [PATCH V2] BaseTools:Run packagedoc_cli.py to generate doc failed

2019-03-04 Thread Feng, Bob C
Hi, 

This patch is to fix the a regression issue introduced by python3 patch set. 
I'd like to push this patch for Q1 stable tag.
Would you approve it?

Thanks,
Bob

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Feng, 
Bob C
Sent: Monday, March 4, 2019 3:30 PM
To: Fan, ZhijuX ; edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: Re: [edk2] [PATCH V2] BaseTools:Run packagedoc_cli.py to generate doc 
failed

Reviewed-by: Bob Feng 


-Original Message-
From: Fan, ZhijuX 
Sent: Friday, March 1, 2019 10:52 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH V2] BaseTools:Run packagedoc_cli.py to generate doc failed

The reason for this problem is that the file was opened incorrectly.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 .../plugins/EdkPlugins/edk2/model/doxygengen.py| 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
 
b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
index e31df262bc..73349e2f48 100644
--- 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
+++ 
b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
@@ -376,9 +376,10 @@ class PackageDocumentAction(DoxygenAction):
 return
 
 try:
-f = open(path, 'r')
-lines = f.readlines()
-f.close()
+with open(path, 'r') as f:
+lines = f.readlines()
+except UnicodeDecodeError:
+return
 except IOError:
 ErrorMsg('Fail to open file %s' % path)
 return
-- 
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] Document: Update DEC spec to remove EDK related contents

2019-03-04 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453

Remove EDK related contents from DEC spec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 2_dec_file_overview/210_pcd_usage.md | 4 +---
 2_dec_file_overview/25_[includes]_usage.md   | 6 +-
 2_dec_file_overview/26_[guids]_usage.md  | 6 +-
 2_dec_file_overview/27_[protocols]_usage.md  | 6 +-
 2_dec_file_overview/28_[ppis]_usage.md   | 6 +-
 2_dec_file_overview/29_[libraryclasses]_usage.md | 4 +---
 3_edk_ii_dec_file_format/310_pcd_sections.md | 8 ++--
 3_edk_ii_dec_file_format/35_[includes]_sections.md   | 5 +
 3_edk_ii_dec_file_format/39_[libraryclasses]_sections.md | 5 +
 9 files changed, 10 insertions(+), 40 deletions(-)

diff --git a/2_dec_file_overview/210_pcd_usage.md 
b/2_dec_file_overview/210_pcd_usage.md
index 9b554be..e600db2 100644
--- a/2_dec_file_overview/210_pcd_usage.md
+++ b/2_dec_file_overview/210_pcd_usage.md
@@ -1,9 +1,9 @@
 

[edk2] [Patch] Document: Update FDF spec to remove EDK related contents

2019-03-04 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453

Remove EDK related contents inf Fdf spec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 1_introduction/11_overview.md |  22 +-
 1_introduction/12_terms.md|   8 +-
 1_introduction/README.md  |   9 +-
 .../22_flash_description_file_format.md   |  34 +--
 2_fdf_design_discussion/24_[fd]_sections.md   |   9 +-
 2_fdf_design_discussion/25_[fv]_sections.md   |   9 +-
 ...ule]_sections.md => 27_[rule]_sections.md} | 232 +-
 2_fdf_design_discussion/27_[vtf]_sections.md  |  82 ---
 ...sections.md => 28_[optionrom]_sections.md} | 112 -
 2_fdf_design_discussion/README.md |   2 -
 3_edk_ii_fdf_file_format/310_[vtf]_section.md | 203 ---
 ...ection.md => 310_pci_optionrom_section.md} | 228 -
 3_edk_ii_fdf_file_format/31_general_rules.md  |  13 +-
 3_edk_ii_fdf_file_format/32_fdf_definition.md |  67 +
 appendix_a_nt32pkg_flash_description_file.md  |   4 +-
 15 files changed, 317 insertions(+), 717 deletions(-)
 rename 2_fdf_design_discussion/{28_[rule]_sections.md => 
27_[rule]_sections.md} (96%)
 delete mode 100644 2_fdf_design_discussion/27_[vtf]_sections.md
 rename 2_fdf_design_discussion/{29_[optionrom]_sections.md => 
28_[optionrom]_sections.md} (94%)
 delete mode 100644 3_edk_ii_fdf_file_format/310_[vtf]_section.md
 rename 3_edk_ii_fdf_file_format/{311_pci_optionrom_section.md => 
310_pci_optionrom_section.md} (93%)

diff --git a/1_introduction/11_overview.md b/1_introduction/11_overview.md
index 6db8a26..d7dbb20 100644
--- a/1_introduction/11_overview.md
+++ b/1_introduction/11_overview.md
@@ -1,9 +1,9 @@
 
-
-## 2.8 [Rule] Sections
-
-The optional `[Rule]` sections in the FDF file are used for combining binary
-images, not for compiling code. Rules are use with the `[FV]` section's module
-INF type to define how an FFS file is created for a given INF file. The EDK II
-Build Specification defines the default rules that are implicitly used for
-creating FFS files. The implicit rules follow the _PI Specification_ and
-_UEFI Specification_.
-
-The `[Rule]` section of the FDF file is used to define custom rules, which may
-be applied to a given INF file listed in an `[FV]` section. This section is
-also used to define rules for module types that permit the user to define the
-content of the FFS file - when an FFS type is not specified by either PI or
-UEFI specifications.
-
-The Rules can have multiple modifiers as shown below.
-
-`[Rule.ARCH.MODULE_TYPE.TEMPLATE_NAME]`
-
-If no `TEMPLATE_NAME` is given then the match is based on `ARCH` and
-`MODULE_TYPE` modifiers. `BINARY` is a reserved `TEMPLATE_NAME` as a default 
rule
-name for binary modules. The `TEMPLATE_NAME` must be unique to the `ARCH` and
-`MODULE_TYPE`. It is permissible to use the same `TEMPLATE_NAME` for two or
-more `[Rule]` sections if the `ARCH` or the `MODULE_TYPE` listed are different
-for each of the sections.
-
-A `[Rule]` section is terminated by another section header or the end of file.
-
-The content of the `[Rule]` section is based on the `FILE` and section grammar
-of the FV section. The difference is the `FILE` referenced in the `[RULE]` is a
-`MACRO`. The section grammar is extended to include an optional argument,
-`Optional`. The `Optional` argument is used to say a section is optional. That
-is to say, if it does not exist, then it is O.K.
-
-**
-**Note:** The `!include` statement is valid for any part of the `[Rule]`
-section, including an entire `[Rule]` section.
-**
-
-The generic form of the entries for leaf sections is:
-
-`  [Options] [{} {}]`
-
-When processing the FDF file, the following rules apply (in order):
-
-1. If `` not defined or not a legal name, then error
-2. If `` not defined or not a legal name, then error
-3. If `[FilePath/FileName]`, then:
-   Add one section to FFS with a section type of ``
-4. Else:
-   Find all files defined by the INF file whose file type is `` and
-   add each one to the FFS with a section type of `` in
-   alphabetical order.
-   Add files defined in `[Sources]` followed by files defined in `[Binaries]`
-
-5. If > 1 `UI` section in final FFS, then error
-6. If > 1 `VER` section in final FFS, then error
-7. If > 1 `PEI_DEPEX` section in final FFS, then error
-8. If > 1 `DXE_DEPEX` section in final FFS, then error
-9. If > 1 `SMM_DEPEX` section in final FFS, then error
-
-If a rule specifies a file type, instead of specifying specific file names, the
-files that match the extension must be processed in alphabetical order.
-
- Example
-
-```ini
-[Rule.Common.ACPITABLE]
-  FILE FREEFORM = $(NAMED_GUID) {
-RAW ACPI Optional |.acpi
-RAW ASL  Optional |.aml
-  }
-```
-
-Tools must add the processed .acpi files alphabetically, followed by the .aml
-files which must also be added alphabetically.
-
-The file would

[edk2] [Patch] Document: Update Inf spec to remove EDK related contents

2019-03-04 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453

Remove EDK related contents

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 1_introduction/11_overview.md |   2 +-
 2_inf_overview/210_[ppis]_section.md  |   1 -
 2_inf_overview/211_[guids]_section.md |   1 -
 .../212_[libraryclasses]_section.md   |   1 -
 2_inf_overview/213_[packages]_section.md  |   1 -
 2_inf_overview/214_pcd_sections.md|  14 +-
 2_inf_overview/215_[depex]_section.md |   4 -
 2_inf_overview/21_processing_overview.md  |  19 +-
 .../22_information_file_general_rules.md  |  30 +-
 2_inf_overview/24_[defines]_section.md|   4 +-
 2_inf_overview/25_[sources]_section.md|   4 -
 2_inf_overview/26_[buildoptions]_section.md   |   9 +-
 2_inf_overview/27_[binaries]_section.md   |   5 -
 2_inf_overview/29_[protocols]_section.md  |   1 -
 2_inf_overview/README.md  |  11 -
 .../314_[depex]_sections.md   |   6 +-
 .../315_[binaries]_section.md |   5 -
 .../32_component_inf_definition.md|   4 +-
 .../34_[defines]_section.md   |   6 +-
 .../35_[buildoptions]_sections.md |   5 +-
 .../39_[sources]_sections.md  |   7 +-
 3_edk_ii_inf_file_format/README.md|   4 -
 ...ndix_a_build_changes_and_customizations.md |   0
 .../README.md |  40 --
 .../a1_design_discussion.md   | 317 
 .../a2_edk_file_specification.md  | 461 --
 ...ndix_c_symbols.md => appendix_b_symbols.md |   0
 ...d => appendix_c_sample_driver_inf_files.md |   0
 ... => appendix_d_sample_library_inf_files.md |   0
 ...d => appendix_e_sample_binary_inf_files.md |   0
 ...ule_types.md => appendix_f_module_types.md |   0
 31 files changed, 30 insertions(+), 932 deletions(-)
 rename appendix_b_build_changes_and_customizations.md => 
appendix_a_build_changes_and_customizations.md (100%)
 delete mode 100644 appendix_a_edk_inf_file_specification/README.md
 delete mode 100644 
appendix_a_edk_inf_file_specification/a1_design_discussion.md
 delete mode 100644 
appendix_a_edk_inf_file_specification/a2_edk_file_specification.md
 rename appendix_c_symbols.md => appendix_b_symbols.md (100%)
 rename appendix_d_sample_driver_inf_files.md => 
appendix_c_sample_driver_inf_files.md (100%)
 rename appendix_e_sample_library_inf_files.md => 
appendix_d_sample_library_inf_files.md (100%)
 rename appendix_f_sample_binary_inf_files.md => 
appendix_e_sample_binary_inf_files.md (100%)
 rename appendix_g_module_types.md => appendix_f_module_types.md (100%)

diff --git a/1_introduction/11_overview.md b/1_introduction/11_overview.md
index 9239080..7349614 100644
--- a/1_introduction/11_overview.md
+++ b/1_introduction/11_overview.md
@@ -40,11 +40,11 @@ Backward compatibility with the existing INF file formats. 
Changes made to this
 specification must not require changes to existing INF files.
 
 **Simplified platform build and configuration**
 
 Simplify the build setup and configuration for a given platform. The process of
-adding EDK and EDK II firmware components to a firmware volume on any given
+adding EDK II firmware components to a firmware volume on any given
 platform was also simplified.
 
 **Distributing Modules**
 
 Enable easy distribution of modules, both in source and binary form. Individual
diff --git a/2_inf_overview/210_[ppis]_section.md 
b/2_inf_overview/210_[ppis]_section.md
index bbdd2a4..1ab84eb 100644
--- a/2_inf_overview/210_[ppis]_section.md
+++ b/2_inf_overview/210_[ppis]_section.md
@@ -46,11 +46,10 @@ This section uses one of the following section definitions:
 ```ini
 [Ppis]
 [Ppis.common]
 [Ppis.IA32]
 [Ppis.X64]
-[Ppis.IPF]
 [Ppis.EBC]
 ```
 
 The formats for entries in this section is:
 
diff --git a/2_inf_overview/211_[guids]_section.md 
b/2_inf_overview/211_[guids]_section.md
index 7f53f6c..4176310 100644
--- a/2_inf_overview/211_[guids]_section.md
+++ b/2_inf_overview/211_[guids]_section.md
@@ -46,11 +46,10 @@ This section uses one of the following section definitions:
 ```ini
 [Guids]
 [Guids.common]
 [Guids.IA32]
 [Guids.X64]
-[Guids.IPF]
 [Guids.EBC]
 ```
 
 The formats for entries in this section is:
 
diff --git a/2_inf_overview/212_[libraryclasses]_section.md 
b/2_inf_overview/212_[libraryclasses]_section.md
index 8d2fd06..8a77463 100644
--- a/2_inf_overview/212_[libraryclasses]_section.md
+++ b/2_inf_overview/212_[libraryclasses]_section.md
@@ -46,11 +46,10 @@ This section uses one of the following section definitions:
 ```ini
 [LibraryClasses]
 [LibraryClasses.common]
 [LibraryClasses.IA32]
 [LibraryClasses.X64]
-[LibraryClasses.IPF]
 [LibraryClasses.EBC]
 ```
 
 The format for entries in this section is:
 
diff --git a/2_inf_overview/213_[packages]_section.md 
b/2_inf_overview/213_[packages]_section.md
ind

Re: [edk2] [PATCH V2] BaseTools:Run packagedoc_cli.py to generate doc failed

2019-03-03 Thread Feng, Bob C
Reviewed-by: Bob Feng 


-Original Message-
From: Fan, ZhijuX 
Sent: Friday, March 1, 2019 10:52 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH V2] BaseTools:Run packagedoc_cli.py to generate doc failed

The reason for this problem is that the file was opened incorrectly.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 .../plugins/EdkPlugins/edk2/model/doxygengen.py| 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
 
b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
index e31df262bc..73349e2f48 100644
--- 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
+++ 
b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
@@ -376,9 +376,10 @@ class PackageDocumentAction(DoxygenAction):
 return
 
 try:
-f = open(path, 'r')
-lines = f.readlines()
-f.close()
+with open(path, 'r') as f:
+lines = f.readlines()
+except UnicodeDecodeError:
+return
 except IOError:
 ErrorMsg('Fail to open file %s' % path)
 return
-- 
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] Document: Update Dsc spec to all empty value for HIIPcd

2019-02-28 Thread Feng, Bob C
Please ignore this mail. Sorry. 

-Original Message-
From: Feng, Bob C 
Sent: Friday, March 1, 2019 10:59 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: RE: [Patch] Document: Update Dsc spec to all empty value for HIIPcd

Would you give the reviewed-by?

-Original Message-
From: Feng, Bob C 
Sent: Thursday, February 28, 2019 10:11 AM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Gao, Liming 
Subject: [Patch] Document: Update Dsc spec to all empty value for HIIPcd

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

Update Dsc spec to all empty value for HIIPcd.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 2_dsc_overview/29_pcd_sections.md| 4 ++--
 3_edk_ii_dsc_file_format/310_pcd_sections.md | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/2_dsc_overview/29_pcd_sections.md 
b/2_dsc_overview/29_pcd_sections.md
index 791125f..d84d2f4 100644
--- a/2_dsc_overview/29_pcd_sections.md
+++ b/2_dsc_overview/29_pcd_sections.md
@@ -230,11 +230,11 @@ example:
 `[PcdsDynamicHii.common.Sku1]`
 
 While the format for content of this section is as follows, note that the  
backslash character is used here to indicate the continuation of the line:
 
-`PcdTokenSpaceGuidCName.PcdCName|VariableName|VariableGuid|VariableOffset[|HiiDefaultValue[|HiiAttrubte]]`
+`PcdTokenSpaceGuidCName.PcdCName|VariableName|VariableGuid|VariableOffs
+et[|[HiiDefaultValue][|HiiAttrubte]]`
 
 For VOID* PCDs, the HiiDefaultValue will be a pointer; specifying the optional 
 HiiDefaultValue has no meaning.
 
 The optional HII Attribute entry is a comma separated list of attributes as @@ 
-340,11 +340,11 @@ Specifying a `SKUID` for an HII PCD selection is optional, 
for example:
 `[PcdsDynamicExHii.common.Sku1]`
 
 While the format for content of this section is as follows, note that the  
backslash character is used here to indicate the continuation of the line:
 
-`PcdTokenSpaceGuidCName.PcdCName|VariableName|VariableGuid|VariableOffset[|HiiDefaultValue]`
+`PcdTokenSpaceGuidCName.PcdCName|VariableName|VariableGuid|VariableOffs
+et[|[HiiDefaultValue]]`
 
 The optional HII Attribute entry is a comma separated list of attributes as  
described in Table 9 HII Attributes.
 
 **Note:** The VariableName field in the HII format PCD entry must not be an 
empty string.
diff --git a/3_edk_ii_dsc_file_format/310_pcd_sections.md 
b/3_edk_ii_dsc_file_format/310_pcd_sections.md
index f9f1359..f982d60 100644
--- a/3_edk_ii_dsc_file_format/310_pcd_sections.md
+++ b/3_edk_ii_dsc_file_format/310_pcd_sections.md
@@ -503,11 +503,11 @@ sections of the DSC file.
  ::= {} {} [ ]
::= 
   ::= {} {}
  ::= []
::= 
- ::=   [ ]
+ ::=  [] [ ]
  ::= 
::= if (pcddatumtype == "BOOLEAN"):
{} {}
  elif (pcddatumtype == "UINT8"):
{} {} @@ -721,11 +721,11 @@ 
sections of the DSC file.
  ::= {} {} [ ]
::= 
   ::= {} {}
  ::= []
::= 
- ::=   [ ]
+ ::=  [] [ ]
  ::= 
::= if (pcddatumtype == "BOOLEAN"):
{} {}
  elif (pcddatumtype == "UINT8"):
{} {}
--
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] Document: Update Dsc spec to all empty value for HIIPcd

2019-02-28 Thread Feng, Bob C
Would you give the reviewed-by?

-Original Message-
From: Feng, Bob C 
Sent: Thursday, February 28, 2019 10:11 AM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Gao, Liming 
Subject: [Patch] Document: Update Dsc spec to all empty value for HIIPcd

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

Update Dsc spec to all empty value for HIIPcd.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 2_dsc_overview/29_pcd_sections.md| 4 ++--
 3_edk_ii_dsc_file_format/310_pcd_sections.md | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/2_dsc_overview/29_pcd_sections.md 
b/2_dsc_overview/29_pcd_sections.md
index 791125f..d84d2f4 100644
--- a/2_dsc_overview/29_pcd_sections.md
+++ b/2_dsc_overview/29_pcd_sections.md
@@ -230,11 +230,11 @@ example:
 `[PcdsDynamicHii.common.Sku1]`
 
 While the format for content of this section is as follows, note that the  
backslash character is used here to indicate the continuation of the line:
 
-`PcdTokenSpaceGuidCName.PcdCName|VariableName|VariableGuid|VariableOffset[|HiiDefaultValue[|HiiAttrubte]]`
+`PcdTokenSpaceGuidCName.PcdCName|VariableName|VariableGuid|VariableOffs
+et[|[HiiDefaultValue][|HiiAttrubte]]`
 
 For VOID* PCDs, the HiiDefaultValue will be a pointer; specifying the optional 
 HiiDefaultValue has no meaning.
 
 The optional HII Attribute entry is a comma separated list of attributes as @@ 
-340,11 +340,11 @@ Specifying a `SKUID` for an HII PCD selection is optional, 
for example:
 `[PcdsDynamicExHii.common.Sku1]`
 
 While the format for content of this section is as follows, note that the  
backslash character is used here to indicate the continuation of the line:
 
-`PcdTokenSpaceGuidCName.PcdCName|VariableName|VariableGuid|VariableOffset[|HiiDefaultValue]`
+`PcdTokenSpaceGuidCName.PcdCName|VariableName|VariableGuid|VariableOffs
+et[|[HiiDefaultValue]]`
 
 The optional HII Attribute entry is a comma separated list of attributes as  
described in Table 9 HII Attributes.
 
 **Note:** The VariableName field in the HII format PCD entry must not be an 
empty string.
diff --git a/3_edk_ii_dsc_file_format/310_pcd_sections.md 
b/3_edk_ii_dsc_file_format/310_pcd_sections.md
index f9f1359..f982d60 100644
--- a/3_edk_ii_dsc_file_format/310_pcd_sections.md
+++ b/3_edk_ii_dsc_file_format/310_pcd_sections.md
@@ -503,11 +503,11 @@ sections of the DSC file.
  ::= {} {} [ ]
::= 
   ::= {} {}
  ::= []
::= 
- ::=   [ ]
+ ::=  [] [ ]
  ::= 
::= if (pcddatumtype == "BOOLEAN"):
{} {}
  elif (pcddatumtype == "UINT8"):
{} {} @@ -721,11 +721,11 @@ 
sections of the DSC file.
  ::= {} {} [ ]
::= 
   ::= {} {}
  ::= []
::= 
- ::=   [ ]
+ ::=  [] [ ]
  ::= 
::= if (pcddatumtype == "BOOLEAN"):
{} {}
  elif (pcddatumtype == "UINT8"):
{} {}
--
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools:Run packagedoc_cli.py to generate doc failed

2019-02-28 Thread Feng, Bob C
Zhiju, 

If the file is binary, it's no need to do more process since this function is 
to get "include" information.

Thanks,
Bob

-Original Message-
From: Fan, ZhijuX 
Sent: Friday, March 1, 2019 9:33 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [PATCH] BaseTools:Run packagedoc_cli.py to generate doc failed

The reason for this problem is that the file was opened incorrectly.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 .../plugins/EdkPlugins/edk2/model/doxygengen.py| 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
 
b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
index e31df262bc..f5a62f6c6f 100644
--- 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
+++ 
b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
@@ -376,9 +376,13 @@ class PackageDocumentAction(DoxygenAction):
 return
 
 try:
-f = open(path, 'r')
-lines = f.readlines()
-f.close()
+with open(path, 'r') as f:
+lines = f.readlines()
+except UnicodeDecodeError:
+with open(path, 'rb') as f:
+lines = f.readlines()
+for Index, Line in enumerate(lines[:]):
+lines[Index] = str(Line)[2:-1]
 except IOError:
 ErrorMsg('Fail to open file %s' % path)
 return
-- 
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch V3] BaseTools: Add python3-distutils Ubuntu package checking

2019-02-28 Thread Feng, Bob C
Hi Phil,

Your suggested code is good but it still print the call stack. I changed it a 
little, it only print the error message now.

Thanks,
Bob 

-Original Message-
From: Feng, Bob C 
Sent: Thursday, February 28, 2019 9:19 PM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Gao, Liming 
Subject: [Patch V3] BaseTools: Add python3-distutils Ubuntu package checking

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

Add python3-distutils Ubuntu package checking.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Tests/RunTests.py | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/BaseTools/Tests/RunTests.py b/BaseTools/Tests/RunTests.py index 
0dd65632d0..356c1d600c 100644
--- a/BaseTools/Tests/RunTests.py
+++ b/BaseTools/Tests/RunTests.py
@@ -17,10 +17,17 @@
 #
 import os
 import sys
 import unittest
 
+try:
+import distutils.util
+except ModuleNotFoundError:
+sys.exit('''
+Python reported: "No module named 'distutils.uitl'"
+''')
+
 import TestTools
 
 def GetCTestSuite():
 import CToolsTests
 return CToolsTests.TheTestSuite()
--
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch V3] BaseTools: Add python3-distutils Ubuntu package checking

2019-02-28 Thread Feng, Bob C
https://bugzilla.tianocore.org/show_bug.cgi?id=1509

Add python3-distutils Ubuntu package checking.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Tests/RunTests.py | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/BaseTools/Tests/RunTests.py b/BaseTools/Tests/RunTests.py
index 0dd65632d0..356c1d600c 100644
--- a/BaseTools/Tests/RunTests.py
+++ b/BaseTools/Tests/RunTests.py
@@ -17,10 +17,17 @@
 #
 import os
 import sys
 import unittest
 
+try:
+import distutils.util
+except ModuleNotFoundError:
+sys.exit('''
+Python reported: "No module named 'distutils.uitl'"
+''')
+
 import TestTools
 
 def GetCTestSuite():
 import CToolsTests
 return CToolsTests.TheTestSuite()
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] Document: Update the INF spec about [Depex] section

2019-02-27 Thread Feng, Bob C
 ::= {"BEFORE"} {"AFTER"}  should be
 ::= [{"BEFORE"} {"AFTER"}]

The "BEFORE" or "AFTER" is optional key words in current implementation.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 3_edk_ii_inf_file_format/314_[depex]_sections.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/3_edk_ii_inf_file_format/314_[depex]_sections.md 
b/3_edk_ii_inf_file_format/314_[depex]_sections.md
index 942bcf9..3c0820a 100644
--- a/3_edk_ii_inf_file_format/314_[depex]_sections.md
+++ b/3_edk_ii_inf_file_format/314_[depex]_sections.md
@@ -179,11 +179,11 @@ and VOID* datum type, and the size of the PCD must be 16 
bytes.
  ::= {} {} {}
::= *
  ["END" ]
  ::= {} {}
::= 
-  ::= {"BEFORE"} {"AFTER"}  []
+  ::= [{"BEFORE"} {"AFTER"}]  []
   ::= {} {}
 ::= "PUSH"  []
 ::= "SOR"  []
::= {} {}
::= {"TRUE"} {"FALSE"} {} {} []
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] Document: Update Dsc spec to all empty value for HIIPcd

2019-02-27 Thread Feng, Bob C
https://bugzilla.tianocore.org/show_bug.cgi?id=1466

Update Dsc spec to all empty value for HIIPcd.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 2_dsc_overview/29_pcd_sections.md| 4 ++--
 3_edk_ii_dsc_file_format/310_pcd_sections.md | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/2_dsc_overview/29_pcd_sections.md 
b/2_dsc_overview/29_pcd_sections.md
index 791125f..d84d2f4 100644
--- a/2_dsc_overview/29_pcd_sections.md
+++ b/2_dsc_overview/29_pcd_sections.md
@@ -230,11 +230,11 @@ example:
 `[PcdsDynamicHii.common.Sku1]`
 
 While the format for content of this section is as follows, note that the
 backslash character is used here to indicate the continuation of the line:
 
-`PcdTokenSpaceGuidCName.PcdCName|VariableName|VariableGuid|VariableOffset[|HiiDefaultValue[|HiiAttrubte]]`
+`PcdTokenSpaceGuidCName.PcdCName|VariableName|VariableGuid|VariableOffset[|[HiiDefaultValue][|HiiAttrubte]]`
 
 For VOID* PCDs, the HiiDefaultValue will be a pointer; specifying the optional
 HiiDefaultValue has no meaning.
 
 The optional HII Attribute entry is a comma separated list of attributes as
@@ -340,11 +340,11 @@ Specifying a `SKUID` for an HII PCD selection is 
optional, for example:
 `[PcdsDynamicExHii.common.Sku1]`
 
 While the format for content of this section is as follows, note that the
 backslash character is used here to indicate the continuation of the line:
 
-`PcdTokenSpaceGuidCName.PcdCName|VariableName|VariableGuid|VariableOffset[|HiiDefaultValue]`
+`PcdTokenSpaceGuidCName.PcdCName|VariableName|VariableGuid|VariableOffset[|[HiiDefaultValue]]`
 
 The optional HII Attribute entry is a comma separated list of attributes as
 described in Table 9 HII Attributes.
 
 **Note:** The VariableName field in the HII format PCD entry must not be an 
empty string.
diff --git a/3_edk_ii_dsc_file_format/310_pcd_sections.md 
b/3_edk_ii_dsc_file_format/310_pcd_sections.md
index f9f1359..f982d60 100644
--- a/3_edk_ii_dsc_file_format/310_pcd_sections.md
+++ b/3_edk_ii_dsc_file_format/310_pcd_sections.md
@@ -503,11 +503,11 @@ sections of the DSC file.
  ::= {} {} [ ]
::= 
   ::= {} {}
  ::= []
::= 
- ::=   [ ]
+ ::=  [] [ ]
  ::= 
::= if (pcddatumtype == "BOOLEAN"):
{} {}
  elif (pcddatumtype == "UINT8"):
{} {}
@@ -721,11 +721,11 @@ sections of the DSC file.
  ::= {} {} [ ]
::= 
   ::= {} {}
  ::= []
::= 
- ::=   [ ]
+ ::=  [] [ ]
  ::= 
::= if (pcddatumtype == "BOOLEAN"):
{} {}
  elif (pcddatumtype == "UINT8"):
{} {}
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] Revert "BaseTools:BaseTools supports to the driver combination."

2019-02-27 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Liming 
Gao
Sent: Monday, February 25, 2019 8:15 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] Revert "BaseTools:BaseTools supports to the driver 
combination."

This reverts commit 838bc257bae3f9fc6723f41f3980f6cfbedb77e5.
After further evaluation, there are the unclear behavior in for the driver 
combination feature. To not impact Q1 stable tag, remove it first.
1. If the drivers to be combined have the different PCD or library instance
   setting, build should not combine them and report build break. But this
   commit doesn't consider this case.
2. When start the sub driver fail, continue to start other sub driver. This
   behavior is required to be clarifed in build spec. 
3. Unload the sub driver when the combined driver start fail. This case need 
   to call the sub driver unload function for the driver start fail only.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
---
 BaseTools/Source/Python/AutoGen/GenC.py| 32 --
 .../Source/Python/Workspace/WorkspaceCommon.py |  8 --
 2 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenC.py 
b/BaseTools/Source/Python/AutoGen/GenC.py
index 0f1b3bb9a3..a922464f56 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1457,25 +1457,10 @@ def CreateLibraryDestructorCode(Info, AutoGenC, 
AutoGenH):
 def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
 if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, 
SUP_MODULE_SEC]:
 return
-ModuleEntryPointList = []
-for Lib in Info.DependentLibraryList:
-if len(Lib.ModuleEntryPointList) > 0:
-if Lib.ModuleType == Info.ModuleType:
-ModuleEntryPointList = ModuleEntryPointList + 
Lib.ModuleEntryPointList
-else:
-EdkLogger.error(
-"build",
-PREBUILD_ERROR,
-"Driver's ModuleType must be consistent [%s]"%(str(Lib)),
-File=str(Info.PlatformInfo),
-ExtraData="consumed by [%s]" % str(Info.MetaFile)
-)
-ModuleEntryPointList = ModuleEntryPointList + 
Info.Module.ModuleEntryPointList
-
 #
 # Module Entry Points
 #
-NumEntryPoints = len(ModuleEntryPointList)
+NumEntryPoints = len(Info.Module.ModuleEntryPointList)
 if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification:
 PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION']
 else:
@@ -1485,7 +1470,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
 else:
 UefiSpecVersion = '0x'
 Dict = {
-'Function'   :   ModuleEntryPointList,
+'Function'   :   Info.Module.ModuleEntryPointList,
 'PiSpecVersion'  :   PiSpecVersion + 'U',
 'UefiSpecVersion':   UefiSpecVersion + 'U'
 }
@@ -1498,7 +1483,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
   AUTOGEN_ERROR,
   '%s must have exactly one entry point' % Info.ModuleType,
   File=str(Info),
-  ExtraData= ", ".join(ModuleEntryPointList)
+  ExtraData= ", 
+ ".join(Info.Module.ModuleEntryPointList)
   )
 if Info.ModuleType == SUP_MODULE_PEI_CORE:
 AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict))
@@ -1552,18 +1537,11 @@ def CreateModuleEntryPointCode(Info, AutoGenC, 
AutoGenH):
 def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
 if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, 
SUP_MODULE_BASE, SUP_MODULE_SEC]:
 return
-
-ModuleUnloadImageList = []
-for Lib in Info.DependentLibraryList:
-if len(Lib.ModuleUnloadImageList) > 0:
-ModuleUnloadImageList = ModuleUnloadImageList + 
Lib.ModuleUnloadImageList
-ModuleUnloadImageList = ModuleUnloadImageList + 
Info.Module.ModuleUnloadImageList
-
 #
 # Unload Image Handlers
 #
-NumUnloadImage = len(ModuleUnloadImageList)
-Dict = {'Count':str(NumUnloadImage) + 'U', 
'Function':ModuleUnloadImageList}
+NumUnloadImage = len(Info.Module.ModuleUnloadImageList)
+Dict = {'Count':str(NumUnloadImage) + 'U', 
+ 'Function':Info.Module.ModuleUnloadImageList}
 if NumUnloadImage < 2:
 AutoGenC.Append(gUefiUnloadImageString[NumUnloadImage].Replace(Dict))
 else:
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py 
b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
index 22abda8743..b79280bc2e 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
@@ -20,8 +20,6 @@ from Workspace.BuildClassObject import StructurePcd  from 
Common.BuildToolError import RESOURCE_NO

[edk2] [Patch V2] BaseTools: Add python3-distutils Ubuntu package checking

2019-02-27 Thread Feng, Bob C
https://bugzilla.tianocore.org/show_bug.cgi?id=1509
V2:
Remove OS/Package specific words. Print the error info which
is from python error message.

Add python3-distutils Ubuntu package checking.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Tests/RunTests.py | 12 
 1 file changed, 12 insertions(+)

diff --git a/BaseTools/Tests/RunTests.py b/BaseTools/Tests/RunTests.py
index 0dd65632d0..f6d3f43653 100644
--- a/BaseTools/Tests/RunTests.py
+++ b/BaseTools/Tests/RunTests.py
@@ -17,10 +17,22 @@
 #
 import os
 import sys
 import unittest
 
+distutils_exist = True
+try:
+import distutils.util
+except:
+distutils_exist = False
+
+if not distutils_exist:
+print("""
+Python report "No module named 'distutils.uitl'"
+""")
+sys.exit(-1)
+
 import TestTools
 
 def GetCTestSuite():
 import CToolsTests
 return CToolsTests.TheTestSuite()
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Add python3-distutils Ubuntu package checking

2019-02-27 Thread Feng, Bob C
Thanks for comments. I think the print message is not good. It's based on 
Ubutun OS. It's not right. 

I think the import error need to be caught and then print some messages, 
otherwise the build tool will break and print the call stack which is not 
friendly to user.

Thanks,
Bob 

-Original Message-
From: Leif Lindholm [mailto:leif.lindh...@linaro.org] 
Sent: Wednesday, February 27, 2019 4:26 PM
To: Feng, Bob C 
Cc: Ard Biesheuvel ; edk2-devel@lists.01.org; Gao, 
Liming 
Subject: Re: [edk2] [Patch] BaseTools: Add python3-distutils Ubuntu package 
checking

On Wed, Feb 27, 2019 at 09:07:49AM +0100, Ard Biesheuvel wrote:
> On Tue, 26 Feb 2019 at 02:05, Feng, Bob C  wrote:
> >
> > https://bugzilla.tianocore.org/show_bug.cgi?id=1509
> >
> > Add python3-distutils Ubuntu package checking.
> >
> 
> Hi Bob,
> 
> This assumes that all Linux systems are Ubuntu based, which is not 
> true. The apt tool is specific to Debian/Ubuntu, Fedora/Redhat and 
> Suse all use something else.
> 
> In general, I don't think we should validate the Python environment to 
> this extent, since we cannot fix the problem for the user anyway, only 
> flag it, and since python explodes rather loudly in this case, I think 
> we should be able to leave it up to developers that are savvy enough 
> to build EDK2 to also find the python distutils package for their 
> platform.
> 
> Note that that doesn't mean we shouldn't document this, and not just 
> for Ubuntu. But I think putting it in the script is overkill.

Yes, I agree

It is also worth noting that python3-distutils is the current debian/ubuntu 
package name. So if we *do* print a message...

> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Bob Feng 
> > Cc: Liming Gao 
> > ---
> >  BaseTools/Tests/RunTests.py | 14 ++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/BaseTools/Tests/RunTests.py 
> > b/BaseTools/Tests/RunTests.py index 0dd65632d0..64778db981 100644
> > --- a/BaseTools/Tests/RunTests.py
> > +++ b/BaseTools/Tests/RunTests.py
> > @@ -17,10 +17,24 @@
> >  #
> >  import os
> >  import sys
> >  import unittest
> >
> > +distutils_exist = True
> > +try:
> > +import distutils.util
> > +except:
> > +distutils_exist = False
> > +
> > +if not distutils_exist:
> > +print("""
> > +python3-distutil packages is missing. Please install it with the following 
> > command:

... printing "missing python distutils package" and possibly python version 
would be more reliable.

But as Ard points out - this is effectively what python itself will say.

/
Leif

> > +
> > +bash$ sudo apt-get install python3-distutil
> > +""")
> > +sys.exit(-1)
> > +
> >  import TestTools
> >
> >  def GetCTestSuite():
> >  import CToolsTests
> >  return CToolsTests.TheTestSuite()
> > --
> > 2.20.1.windows.1
> >
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH V2] BaseTools:PackageDocumentTools import lib error occurs.

2019-02-26 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Monday, February 25, 2019 1:13 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH V2] BaseTools:PackageDocumentTools import lib error 
occurs.

Steps:
 1. Download edk2 tree
 2. Build BaseTools
 3. Go to edk2\BaseTools\Scripts\PackageDocumentTools
to run packagedoc_cli.py

An error occurs if relative imports are used when running a file alone

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py   |  4 ++--
 .../plugins/EdkPlugins/basemodel/doxygen.py|  2 +-
 .../plugins/EdkPlugins/basemodel/ini.py|  4 ++--
 .../plugins/EdkPlugins/edk2/model/baseobject.py| 14 +++---
 .../plugins/EdkPlugins/edk2/model/dec.py   |  4 ++--
 .../plugins/EdkPlugins/edk2/model/doxygengen.py|  8 
 .../plugins/EdkPlugins/edk2/model/doxygengen_spec.py   |  8 
 .../plugins/EdkPlugins/edk2/model/dsc.py   |  4 ++--
 .../plugins/EdkPlugins/edk2/model/inf.py   |  4 ++--
 9 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py 
b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py
index e404a07cd7..5c65842a72 100644
--- a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py
+++ b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py
@@ -16,8 +16,8 @@ from __future__ import print_function  import os, sys, 
logging, traceback, subprocess  from optparse import OptionParser
 
-from .plugins.EdkPlugins.edk2.model import baseobject -from 
.plugins.EdkPlugins.edk2.model import doxygengen
+from plugins.EdkPlugins.edk2.model import baseobject from 
+plugins.EdkPlugins.edk2.model import doxygengen
 
 gArchMarcoDict = {'ALL'  : 'MDE_CPU_IA32 MDE_CPU_X64 MDE_CPU_EBC 
MDE_CPU_IPF _MSC_EXTENSIONS __GNUC__ __INTEL_COMPILER',
   'IA32_MSFT': 'MDE_CPU_IA32 _MSC_EXTENSIONS', diff --git 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py
 
b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py
index ae47ff1344..a510808842 100644
--- 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemode
+++ l/doxygen.py
@@ -92,7 +92,7 @@ class Page(BaseDoxygeItem):
 self.mText.insert(endIndex, '')
 endIndex += 1
 if self.mIsSort:
-self.mSubPages.sort(cmp=lambda x, y: cmp(x.mName.lower(), 
y.mName.lower()))
+self.mSubPages.sort(key=lambda x: x.mName.lower())
 for page in self.mSubPages:
 self.mText.insert(endIndex, '\subpage %s \"%s\" ' % 
(page.mTag, page.mName))
 endIndex += 1
diff --git 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py 
b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py
index 6e6f3f4b97..bac2f5e2e6 100644
--- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemode
+++ l/ini.py
@@ -25,7 +25,7 @@ class BaseINIFile(object):
 @return: instance of this class
 
 """
-if len(args) == 0: return object.__new__(cls, *args, **kwargs)
+if len(args) == 0: return object.__new__(cls)
 filename = args[0]
 parent   = None
 if len(args) > 1:
@@ -33,7 +33,7 @@ class BaseINIFile(object):
 
 key = os.path.normpath(filename)
 if key not in cls._objs.keys():
-cls._objs[key] = object.__new__(cls, *args, **kwargs)
+cls._objs[key] = object.__new__(cls)
 
 if parent is not None:
 cls._objs[key].AddParent(parent) diff --git 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
 
b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
index 0159bd5269..7b47fd76b9 100644
--- 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/mod
+++ el/baseobject.py
@@ -10,12 +10,12 @@
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,  # 
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
-from ...basemodel import ini
-from ...edk2.model import dsc
-from ...edk2.model import inf
-from ...edk2.model import dec
+from plugins.EdkPlugins.basemodel import ini from 
+plugins.EdkPlugins.edk2.model import dsc from 
+plugins.EdkPlugins.edk2.model import inf from 
+plugins.EdkPlugins.edk2.model import dec
 import o

Re: [edk2] [PATCH] BaseTools:The BOM character is processed when python reads a file

2019-02-26 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Tuesday, February 26, 2019 2:58 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH] BaseTools:The BOM character is processed when python 
reads a file

When python3 reads an XML file it will parse the file in error if the file has 
a BOM

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py 
b/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py
index 4294016ae3..00cbc4e55e 100644
--- a/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py
+++ b/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py
@@ -17,6 +17,7 @@
 #
 from __future__ import print_function
 import xml.dom.minidom
+import codecs
 from Common.LongFilePathSupport import OpenLongFilePath as open
 
 ## Create a element of XML
@@ -211,7 +212,7 @@ def XmlNodeName(Dom):
 #
 def XmlParseFile(FileName):
 try:
-XmlFile = open(FileName)
+XmlFile = codecs.open(FileName,encoding='utf_8_sig')
 Dom = xml.dom.minidom.parse(XmlFile)
 XmlFile.close()
 return Dom
--
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] Convert PosixLike scripts to sh, reduce duplication and fix some bugs

2019-02-25 Thread Feng, Bob C
Hi Rebecca,

I like the change of moving duplicated code into common files and the bug fix 
looks good.

I tested this patch on our CI system, it break the build on MacOS. There is no 
realpath command on MacOs shell.

For the patch itself, it need to pass the check of 
BaseTools/Scripts/PatchCheck.py.

Is there actual problem that need to be resolved by using sh instead of bash?

Thanks,
Bob

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Rebecca 
Cran via edk2-devel
Sent: Friday, February 22, 2019 1:13 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH] Convert PosixLike scripts to sh, reduce duplication and 
fix some bugs

Since the scripts in the PosixLike directory are very simple, convert them to 
use /bin/sh, and move duplicated code into common files (one for python 
scripts, one for C binaries).

Fix some bugs in edksetup.sh and BuildEnv: `test` uses single equals instead of 
double equals, and should have a space before the ending bracket. Fix some 
indentation, and if the user runs edksetup.sh with --help etc., quit after 
displaying the help message.
---
 BaseTools/BinWrappers/PosixLike/BPDG  | 15 ++
 BaseTools/BinWrappers/PosixLike/Brotli| 30 ++-
 .../BinWrappers/PosixLike/BrotliCompress  | 12 
 BaseTools/BinWrappers/PosixLike/DevicePath| 30 ++-
 BaseTools/BinWrappers/PosixLike/Ecc   | 15 ++
 BaseTools/BinWrappers/PosixLike/EfiRom| 30 ++-
 BaseTools/BinWrappers/PosixLike/GenCrc32  | 30 ++-
 BaseTools/BinWrappers/PosixLike/GenDepex  | 15 ++
 BaseTools/BinWrappers/PosixLike/GenFds| 15 ++
 BaseTools/BinWrappers/PosixLike/GenFfs| 30 ++-
 BaseTools/BinWrappers/PosixLike/GenFv | 30 ++-
 BaseTools/BinWrappers/PosixLike/GenFw | 30 ++-
 .../BinWrappers/PosixLike/GenPatchPcdTable| 15 ++
 BaseTools/BinWrappers/PosixLike/GenSec| 30 ++-
 .../BinWrappers/PosixLike/GenerateCapsule | 15 ++
 BaseTools/BinWrappers/PosixLike/LzmaCompress  | 30 ++-
 .../BinWrappers/PosixLike/LzmaF86Compress |  2 +-
 BaseTools/BinWrappers/PosixLike/PatchPcdValue | 15 ++
 BaseTools/BinWrappers/PosixLike/Pkcs7Sign | 15 ++
 .../PosixLike/Rsa2048Sha256GenerateKeys   | 15 ++
 .../BinWrappers/PosixLike/Rsa2048Sha256Sign   | 15 ++
 BaseTools/BinWrappers/PosixLike/Split | 30 ++-
 BaseTools/BinWrappers/PosixLike/TargetTool| 15 ++
 BaseTools/BinWrappers/PosixLike/TianoCompress | 30 ++-
 BaseTools/BinWrappers/PosixLike/Trim  | 15 ++
 BaseTools/BinWrappers/PosixLike/UPT   | 15 ++
 BaseTools/BinWrappers/PosixLike/VfrCompile| 30 ++-
 BaseTools/BinWrappers/PosixLike/VolInfo   | 30 ++-
 BaseTools/BinWrappers/PosixLike/build | 15 ++
 BaseTools/BinWrappers/PosixLike/common.sh | 12 
 BaseTools/BinWrappers/PosixLike/commonbin.sh  | 28 +
 BaseTools/BuildEnv|  3 +-
 edksetup.sh   | 12 
 33 files changed, 110 insertions(+), 559 deletions(-)  create mode 100644 
BaseTools/BinWrappers/PosixLike/common.sh
 create mode 100644 BaseTools/BinWrappers/PosixLike/commonbin.sh

diff --git a/BaseTools/BinWrappers/PosixLike/BPDG 
b/BaseTools/BinWrappers/PosixLike/BPDG
index c894384908..a9da3afb4b 100755
--- a/BaseTools/BinWrappers/PosixLike/BPDG
+++ b/BaseTools/BinWrappers/PosixLike/BPDG
@@ -1,14 +1,3 @@
-#!/usr/bin/env bash
-#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+#!/bin/sh
 
-# If a ${PYTHON_COMMAND} command is available, use it in preference to python 
-if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
-python_exe=${PYTHON_COMMAND}
-fi
-
-full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") 
-cmd=${full_cmd##*/}
-
-export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
-exec "${python_exe:-python}" -m $cmd.$cmd "$@"
+. "$(dirname "$(realpath "$0")")/common.sh"
diff --git a/BaseTools/BinWrappers/PosixLike/Brotli 
b/BaseTools/BinWrappers/PosixLike/Brotli
index 0945d86d92..3dfa26e517 100755
--- a/BaseTools/BinWrappers/PosixLike/Brotli
+++ b/BaseTools/BinWrappers/PosixLike/Brotli
@@ -1,29 +1,3 @@
-#!/usr/bin/env bash
-
-full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") 
-cmd=${full_cmd##*/}
-
-if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then
-  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
-elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then
-  if [ ! -e "$

Re: [edk2] [PATCH] BaseTools:PackageDocumentTools import lib error occurs.

2019-02-25 Thread Feng, Bob C
Reviewed-by: Bob Feng  

-Original Message-
From: Fan, ZhijuX 
Sent: Friday, February 22, 2019 2:14 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH] BaseTools:PackageDocumentTools import lib error occurs.

Steps:
 1. Download edk2 tree
 2. Build BaseTools
 3. Go to edk2\BaseTools\Scripts\PackageDocumentTools
to run packagedoc_cli.py

An error occurs if relative imports are used when running a file alone

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py   |  4 ++--
 .../plugins/EdkPlugins/edk2/model/baseobject.py| 10 +-
 .../PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py  |  4 ++--
 .../plugins/EdkPlugins/edk2/model/doxygengen.py|  8 
 .../plugins/EdkPlugins/edk2/model/doxygengen_spec.py   |  8 
 .../PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py  |  4 ++--  
.../PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py  |  4 ++--
 7 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py 
b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py
index e404a07cd7..5c65842a72 100644
--- a/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py
+++ b/BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py
@@ -16,8 +16,8 @@ from __future__ import print_function  import os, sys, 
logging, traceback, subprocess  from optparse import OptionParser
 
-from .plugins.EdkPlugins.edk2.model import baseobject -from 
.plugins.EdkPlugins.edk2.model import doxygengen
+from plugins.EdkPlugins.edk2.model import baseobject from 
+plugins.EdkPlugins.edk2.model import doxygengen
 
 gArchMarcoDict = {'ALL'  : 'MDE_CPU_IA32 MDE_CPU_X64 MDE_CPU_EBC 
MDE_CPU_IPF _MSC_EXTENSIONS __GNUC__ __INTEL_COMPILER',
   'IA32_MSFT': 'MDE_CPU_IA32 _MSC_EXTENSIONS', diff --git 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
 
b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
index 0159bd5269..de15efd3f8 100644
--- 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/mod
+++ el/baseobject.py
@@ -10,12 +10,12 @@
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,  # 
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
-from ...basemodel import ini
-from ...edk2.model import dsc
-from ...edk2.model import inf
-from ...edk2.model import dec
+from plugins.EdkPlugins.basemodel import ini from 
+plugins.EdkPlugins.edk2.model import dsc from 
+plugins.EdkPlugins.edk2.model import inf from 
+plugins.EdkPlugins.edk2.model import dec
 import os
-from ...basemodel.message import *
+from plugins.EdkPlugins.basemodel.message import *
 
 class SurfaceObject(object):
 _objs = {}
diff --git 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py 
b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py
index 3d210f72ac..568076547b 100644
--- 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/mod
+++ el/dec.py
@@ -11,9 +11,9 @@
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
 
-from ...basemodel import ini
+from plugins.EdkPlugins.basemodel import ini
 import re, os
-from ...basemodel.message import *
+from plugins.EdkPlugins.basemodel.message import *
 
 class DECFile(ini.BaseINIFile):
 
diff --git 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
 
b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
index 9c299fbfc5..e31df262bc 100644
--- 
a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/mod
+++ el/doxygengen.py
@@ -16,7 +16,7 @@
 """This file produce action class to generate doxygen document for edk2 
codebase.
The action classes are shared by GUI and command line tools.
 """
-from ...basemodel import doxygen
+from plugins.EdkPlugins.basemodel import doxygen
 import os
 try:
 import wx
@@ -24,9 +24,9 @@ try:
 except:
 gInGui = False
 import re
-from ...edk2.model import inf
-from ...edk2.model import dec
-from ...basemodel.message import *
+from plugins.EdkPlugins.edk2.model import inf from 
+plugins.EdkPlugins.edk2.model import dec from 
+plugins.EdkPlugins.basemodel.message import *
 
 _ignore_dir = ['.svn', '_svn', 'cvs']
 _inf_key_description_mapping_table = {
diff --git 
a/BaseTools/Scripts/PackageDocumentTools/plugins/Edk

[edk2] [Patch] BaseTools: Add python3-distutils Ubuntu package checking

2019-02-25 Thread Feng, Bob C
https://bugzilla.tianocore.org/show_bug.cgi?id=1509

Add python3-distutils Ubuntu package checking.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Tests/RunTests.py | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/BaseTools/Tests/RunTests.py b/BaseTools/Tests/RunTests.py
index 0dd65632d0..64778db981 100644
--- a/BaseTools/Tests/RunTests.py
+++ b/BaseTools/Tests/RunTests.py
@@ -17,10 +17,24 @@
 #
 import os
 import sys
 import unittest
 
+distutils_exist = True
+try:
+import distutils.util
+except:
+distutils_exist = False
+
+if not distutils_exist:
+print("""
+python3-distutil packages is missing. Please install it with the following 
command:
+
+bash$ sudo apt-get install python3-distutil
+""")
+sys.exit(-1)
+
 import TestTools
 
 def GetCTestSuite():
 import CToolsTests
 return CToolsTests.TheTestSuite()
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/2] BaseTools: Fix a Eot issue.

2019-02-25 Thread Feng, Bob C
FirmwareVolume.UnDispatchedFfsDict is mutated during iteration,
convert the FirmwareVolume.UnDispatchedFfsDict.keys() to a new list
 to resolve this problem.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Eot/EotMain.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Eot/EotMain.py 
b/BaseTools/Source/Python/Eot/EotMain.py
index 3020f6525e..4802aea8b1 100644
--- a/BaseTools/Source/Python/Eot/EotMain.py
+++ b/BaseTools/Source/Python/Eot/EotMain.py
@@ -389,11 +389,11 @@ class FirmwareVolume(Image):
 FfsSecCoreGuid = None
 FfsPeiCoreGuid = None
 FfsDxeCoreGuid = None
 FfsPeiPrioriGuid = None
 FfsDxePrioriGuid = None
-for FfsID in self.UnDispatchedFfsDict.keys():
+for FfsID in list(self.UnDispatchedFfsDict.keys()):
 Ffs = self.UnDispatchedFfsDict[FfsID]
 if Ffs.Type == 0x03:
 FfsSecCoreGuid = FfsID
 continue
 if Ffs.Type == 0x04:
@@ -495,11 +495,11 @@ class FirmwareVolume(Image):
 EotGlobalData.gPpiList[Record[0].lower()] = ModuleGuid
 
 def DisPatchDxe(self, Db):
 IsInstalled = False
 ScheduleList = sdict()
-for FfsID in self.UnDispatchedFfsDict.keys():
+for FfsID in list(self.UnDispatchedFfsDict.keys()):
 CouldBeLoaded = False
 DepexString = ''
 FileDepex = None
 Ffs = self.UnDispatchedFfsDict[FfsID]
 if Ffs.Type == 0x07:
@@ -560,11 +560,11 @@ class FirmwareVolume(Image):
 if IsInstalled:
 self.DisPatchDxe(Db)
 
 def DisPatchPei(self, Db):
 IsInstalled = False
-for FfsID in self.UnDispatchedFfsDict.keys():
+for FfsID in list(self.UnDispatchedFfsDict.keys()):
 CouldBeLoaded = True
 DepexString = ''
 FileDepex = None
 Ffs = self.UnDispatchedFfsDict[FfsID]
 if Ffs.Type == 0x06 or Ffs.Type == 0x08:
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/2] BaseTools: Eot failed when enable python3

2019-02-25 Thread Feng, Bob C
The Eot will report error when python3 enabled.
We replaced sdict with collections.OrderedDict in python3
patch set, but the sdict implement "append" method which is not
implemented in collections.OrderedDict.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Eot/EotMain.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Eot/EotMain.py 
b/BaseTools/Source/Python/Eot/EotMain.py
index 56aa48d2a1..3020f6525e 100644
--- a/BaseTools/Source/Python/Eot/EotMain.py
+++ b/BaseTools/Source/Python/Eot/EotMain.py
@@ -1103,11 +1103,11 @@ class MultipleFv(FirmwareVolume):
 
 Fv = FirmwareVolume(FvName)
 Fv.frombuffer(Buf, 0, len(Buf))
 
 self.BasicInfo.append([Fv.Name, Fv.FileSystemGuid, Fv.Size])
-self.FfsDict.append(Fv.FfsDict)
+self.FfsDict.update(Fv.FfsDict)
 
 ## Class Eot
 #
 # This class is used to define Eot main entrance
 #
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch V2] BaseTools: Add parameter check for the AsciiStringToUint64

2019-02-23 Thread Feng, Bob C
If the input parameter AsciiString length is greater
than 255, the GenFv will hang.

This patch is to fix this issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/C/Common/ParseInf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/Common/ParseInf.c 
b/BaseTools/Source/C/Common/ParseInf.c
index 3907f44331..c5d79c89fa 100644
--- a/BaseTools/Source/C/Common/ParseInf.c
+++ b/BaseTools/Source/C/Common/ParseInf.c
@@ -506,11 +506,11 @@ Returns:
   Index = 0;
 
   //
   // Check input parameter
   //
-  if (AsciiString == NULL || ReturnValue == NULL) {
+  if (AsciiString == NULL || ReturnValue == NULL || strlen(AsciiString) > 
0xFF) {
 return EFI_INVALID_PARAMETER;
   }
   while (AsciiString[Index] == ' ') {
 Index ++;
   }
-- 
2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Enable component override functionality

2019-02-23 Thread Feng, Bob C
Felix,

I agree. I filed a new  BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1557 
to track the document update.
I think this new behavior would be better to be recorded in the Build spec.

Thanks,
Bob
-Original Message-
From: Felix Polyudov [mailto:fel...@ami.com] 
Sent: Saturday, February 23, 2019 6:06 AM
To: Feng, Bob C ; edk2-devel@lists.01.org
Cc: Carsey, Jaben ; Gao, Liming 
Subject: RE: [edk2] [Patch] BaseTools: Enable component override functionality

Bob,

Do you know if DSC specification has been updated to document this new behavior?
If not, it should be updated.

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of BobCF
Sent: Thursday, January 10, 2019 9:39 PM
To: edk2-devel@lists.01.org
Cc: Carsey Jaben; Liming Gao
Subject: [edk2] [Patch] BaseTools: Enable component override functionality

https://bugzilla.tianocore.org/show_bug.cgi?id=1449
This patch enable build tools to recognize that when two given files have the 
same GUID, file path and ARCH in Dsc, The later one's definition will be used.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Carsey Jaben 
---
 .../Source/Python/Workspace/DscBuildData.py   | 24 ---
 .../Source/Python/Workspace/MetaFileParser.py |  5   
.../Source/Python/Workspace/MetaFileTable.py  |  7 --
 3 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 7e82e8e934..f9805f58f5 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -704,36 +704,44 @@ class DscBuildData(PlatformBuildClassObject):
 if TAB_DEFAULT_STORES_DEFAULT not in self.DefaultStores:
 self.DefaultStores[TAB_DEFAULT_STORES_DEFAULT] = (0, 
TAB_DEFAULT_STORES_DEFAULT)
 GlobalData.gDefaultStores = sorted(self.DefaultStores.keys())
 return self.DefaultStores
 
+def OverrideDuplicateModule(self):
+RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch]
+Macros = self._Macros
+Macros["EDK_SOURCE"] = GlobalData.gEcpSource
+Components = {}
+for Record in RecordList:
+ModuleId = Record[6]
+file_guid = self._RawData[MODEL_META_DATA_HEADER, self._Arch, 
None, ModuleId]
+file_guid_str = file_guid[0][2] if file_guid else "NULL"
+ModuleFile = PathClass(NormPath(Record[0], Macros), 
GlobalData.gWorkspace, Arch=self._Arch)
+if self._Arch != TAB_ARCH_COMMON and 
(file_guid_str,str(ModuleFile)) in Components:
+
self._RawData.DisableOverrideComponent(Components[(file_guid_str,str(ModuleFile))])
+Components[(file_guid_str,str(ModuleFile))] = ModuleId
+self._RawData._PostProcessed = False
 ## Retrieve [Components] section information
 @property
 def Modules(self):
 if self._Modules is not None:
 return self._Modules
-
+self.OverrideDuplicateModule()
 self._Modules = OrderedDict()
 RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch]
 Macros = self._Macros
 Macros["EDK_SOURCE"] = GlobalData.gEcpSource
 for Record in RecordList:
-DuplicatedFile = False
-
 ModuleFile = PathClass(NormPath(Record[0], Macros), 
GlobalData.gWorkspace, Arch=self._Arch)
 ModuleId = Record[6]
 LineNo = Record[7]
 
 # check the file validation
 ErrorCode, ErrorInfo = ModuleFile.Validate('.inf')
 if ErrorCode != 0:
 EdkLogger.error('build', ErrorCode, File=self.MetaFile, 
Line=LineNo,
 ExtraData=ErrorInfo)
-# Check duplication
-# If arch is COMMON, no duplicate module is checked since all 
modules in all component sections are selected
-if self._Arch != TAB_ARCH_COMMON and ModuleFile in self._Modules:
-DuplicatedFile = True
 
 Module = ModuleBuildClassObject()
 Module.MetaFile = ModuleFile
 
 # get module private library instance @@ -792,12 +800,10 @@ class 
DscBuildData(PlatformBuildClassObject):
 else:
 OptionString = Module.BuildOptions[ToolChainFamily, 
ToolChain]
 Module.BuildOptions[ToolChainFamily, ToolChain] = 
OptionString + " " + Option
 
 RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, 
None, ModuleId]
-if DuplicatedFile and not RecordList:
-EdkLogger.error('build', FILE_DUPLICATED, File=self.MetaFile, 
ExtraData=str(ModuleFile), Line=LineNo)
 if RecordList:
 if len(RecordList) != 1:
 EdkLogge

[edk2] [Patch] BaseTools: Add parameter check for the AsciiStringToUint64

2019-02-22 Thread Feng, Bob C
If the input parameter AsciiString length is greater
than 255, the GenFv will hang.

This patch is to fix this issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/C/Common/ParseInf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/Common/ParseInf.c 
b/BaseTools/Source/C/Common/ParseInf.c
index 3907f44331..b29f4c2f93 100644
--- a/BaseTools/Source/C/Common/ParseInf.c
+++ b/BaseTools/Source/C/Common/ParseInf.c
@@ -493,11 +493,11 @@ Returns:
   EFI_SUCCESS   Number successfully converted.
   EFI_ABORTED   Invalid character encountered.
 
 --*/
 {
-  UINT8   Index;
+  UINT32   Index;
   UINT64  Value;
   CHAR8   CurrentChar;
 
   //
   // Initialize the result
@@ -506,11 +506,11 @@ Returns:
   Index = 0;
 
   //
   // Check input parameter
   //
-  if (AsciiString == NULL || ReturnValue == NULL) {
+  if (AsciiString == NULL || ReturnValue == NULL || strlen(AsciiString) > 
0x) {
 return EFI_INVALID_PARAMETER;
   }
   while (AsciiString[Index] == ' ') {
 Index ++;
   }
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH V2] BaseTool/GenC: Fix build error when type is BASE or USER_DEFINED.

2019-02-21 Thread Feng, Bob C
Reviewed-by: Bob Feng  

-Original Message-
From: Yao, Jiewen 
Sent: Thursday, February 21, 2019 9:38 AM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Gao, Liming ; 
Zhu, Yonghong 
Subject: [PATCH V2] BaseTool/GenC: Fix build error when type is BASE or 
USER_DEFINED.

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

=
V2: (Feedback from Liming) Add filter for 1) below:
Only constructor/destructor with BASE type is included here.
The constructor/destructor with PEI/DXE/SMM type is still excluded to keep 
original behavior.

Test: NT32 build and boot successfully.

=

1) The GenC tool does not include the constructor/destructor for USER_DEFINED 
module. It should be included.
Only constructor/destructor with BASE type is included here.
The constructor/destructor with PEI/DXE/SMM type is still excluded to keep 
original behavior.

2) The GenC tool includes the UnloadImage code for BASE module.
It should NOT be included.

3) The GenC tool uses EFI_STATUS and ASSERT_EFI_ERROR for BASE type.
It should use RETURN_STATUS and ASSERT_RETURN_ERROR.

4) The GenC tool miss DebugLib.h for BASE or USER_DEFINED module AutoGen.c. 
Only Base.h is there. It should add Library/DebugLib.h.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao 
---
 BaseTools/Source/Python/AutoGen/GenC.py | 56 ++--
 1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenC.py 
b/BaseTools/Source/Python/AutoGen/GenC.py
index 9700bf8527..a922464f56 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -684,7 +684,7 @@ ${Function} (
 gLibraryStructorCall = {
 SUP_MODULE_BASE  : TemplateString("""${BEGIN}
   Status = ${Function} ();
-  ASSERT_EFI_ERROR (Status);${END}
+  ASSERT_RETURN_ERROR (Status);${END}
 """),
 
 'PEI'   : TemplateString("""${BEGIN}
@@ -714,7 +714,7 @@ ProcessLibrary${Type}List (
   VOID
   )
 {
-${BEGIN}  EFI_STATUS  Status;
+${BEGIN}  RETURN_STATUS  Status;
 ${FunctionCall}${END}
 }
 """),
@@ -768,7 +768,7 @@ ${FunctionCall}${END}  gBasicHeaderFile = "Base.h"
 
 gModuleTypeHeaderFile = {
-SUP_MODULE_BASE  :   [gBasicHeaderFile],
+SUP_MODULE_BASE  :   [gBasicHeaderFile, "Library/DebugLib.h"],
 SUP_MODULE_SEC   :   ["PiPei.h", "Library/DebugLib.h"],
 SUP_MODULE_PEI_CORE  :   ["PiPei.h", "Library/DebugLib.h", 
"Library/PeiCoreEntryPoint.h"],
 SUP_MODULE_PEIM  :   ["PiPei.h", "Library/DebugLib.h", 
"Library/PeimEntryPoint.h"],
@@ -782,7 +782,7 @@ gModuleTypeHeaderFile = {
 SUP_MODULE_SMM_CORE  :   ["PiDxe.h", "Library/BaseLib.h", 
"Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
 SUP_MODULE_MM_STANDALONE :   ["PiMm.h", "Library/BaseLib.h", 
"Library/DebugLib.h", "Library/StandaloneMmDriverEntryPoint.h"],
 SUP_MODULE_MM_CORE_STANDALONE :  ["PiMm.h", "Library/BaseLib.h", 
"Library/DebugLib.h", "Library/StandaloneMmCoreEntryPoint.h"],
-SUP_MODULE_USER_DEFINED  :   [gBasicHeaderFile]
+SUP_MODULE_USER_DEFINED  :   [gBasicHeaderFile, "Library/DebugLib.h"]
 }
 
 ## Autogen internal worker macro to define DynamicEx PCD name includes both 
the TokenSpaceGuidName @@ -1345,16 +1345,17 @@ def 
CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
 if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
 
ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))
 
ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))
-elif Lib.ModuleType in SUP_MODULE_SET_PEI:
-
ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
-
ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
-elif Lib.ModuleType in [SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER, 
SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER,
-SUP_MODULE_DXE_SAL_DRIVER, 
SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]:
-
ConstructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict))
-
ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))
-elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE, 
SUP_MODULE_MM_CORE_STANDALONE]:
-
ConstructorPrototypeString.Append(gLibraryStructorPrototype['MM'].Replace(Dict))
-
ConstructorCallingString.Append(gLibraryStructo

[edk2] [Patch V2] BaseTools: Correct the value assignment for StructurePcd

2019-02-21 Thread Feng, Bob C
This patch is to fix the code bug in StructurePcd overall
value assignment logic. If a Pcd Array size is fixed but the
size of actual value in Dsc or Dec is bigger than the Pcd
array size, the tool will report error about such setting and
stop build.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Common/Misc.py|   1 +
 .../Python/Workspace/BuildClassObject.py  |  78 ---
 .../Source/Python/Workspace/DecBuildData.py   |   2 +-
 .../Source/Python/Workspace/DscBuildData.py   | 211 ++
 4 files changed, 218 insertions(+), 74 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index c7daf5417c..526aa2dd54 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -40,10 +40,11 @@ from Common.Parsing import GetSplitValueList
 from Common.LongFilePathSupport import OpenLongFilePath as open
 from Common.MultipleWorkspace import MultipleWorkspace as mws
 from CommonDataClass.Exceptions import BadExpression
 from Common.caching import cached_property
 
+ArrayIndex = re.compile("\[\s*[0-9a-fA-FxX]*\s*\]")
 ## Regular expression used to find out place holders in string template
 gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE | 
re.UNICODE)
 
 ## regular expressions for map file processing
 startPatternGeneral = re.compile("^Start[' ']+Length[' ']+Name[' ']+Class")
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index b82af49236..b50e250cfb 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -14,14 +14,16 @@
 from collections import OrderedDict, namedtuple
 from Common.DataType import *
 import collections
 import re
 from collections import OrderedDict
-from Common.Misc import CopyDict
+from Common.Misc import CopyDict,ArrayIndex
 import copy
+import Common.EdkLogger as EdkLogger
+from Common.BuildToolError import OPTION_VALUE_INVALID
 StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_\[\]]*$')
-ArrayIndex = re.compile("\[\s*[0-9a-fA-FxX]*\s*\]")
+
 ## PcdClassObject
 #
 # This Class is used for PcdObject
 #
 # @param object: Inherited from object class
@@ -66,44 +68,62 @@ class PcdClassObject(object):
 self.validateranges = validateranges if validateranges is not None 
else []
 self.validlists = validlists if validlists is not None else []
 self.expressions = expressions if expressions is not None else []
 self.DscDefaultValue = None
 self.DscRawValue = {}
+self.DscRawValueInfo = {}
 if IsDsc:
 self.DscDefaultValue = Value
 self.PcdValueFromComm = ""
 self.PcdValueFromFdf = ""
 self.CustomAttribute = {}
 self.UserDefinedDefaultStoresFlag = UserDefinedDefaultStoresFlag
 self._Capacity = None
 
 @property
 def Capacity(self):
-self._Capacity = []
-dimension = ArrayIndex.findall(self._DatumType)
-for item in dimension:
-maxsize = item.lstrip("[").rstrip("]").strip()
-if not maxsize:
-maxsize = "-1"
-maxsize = str(int(maxsize,16)) if maxsize.startswith(("0x","0X")) 
else maxsize
-self._Capacity.append(maxsize)
-if hasattr(self, "SkuOverrideValues"):
-for sku in self.SkuOverrideValues:
-for defaultstore in self.SkuOverrideValues[sku]:
-fields = self.SkuOverrideValues[sku][defaultstore]
-for demesionattr in fields:
-deme = ArrayIndex.findall(demesionattr)
-for i in range(len(deme)-1):
-if int(deme[i].lstrip("[").rstrip("]").strip()) > 
int(self._Capacity[i]):
-print ("error")
-if hasattr(self,"DefaultValues"):
-for demesionattr in self.DefaultValues:
-deme = ArrayIndex.findall(demesionattr)
-for i in range(len(deme)-1):
-if int(deme[i].lstrip("[").rstrip("]").strip()) > 
int(self._Capacity[i]):
-print ("error")
+if self._Capacity is None:
+self._Capacity = []
+dimension = ArrayIndex.findall(self._DatumType)
+for item in dimension:
+maxsize = item.lstrip("[").rstrip("]").strip()
+if not maxsize:
+maxsize = "-1"
+maxsize = str(int(maxsize,16)) if 
maxsize.startswith(("0x","0X")) else maxsize
+self._Capacity.append(maxsize)
+if hasattr(self, "SkuOverrideValues"):
+for sku in self.SkuOverrideValues:
+for defaultstore in self.SkuOverrideValues[sku]:
+fields = self.SkuOverr

Re: [edk2] [PATCH] BaseTools:Some build generated files content are not ordered on linux

2019-02-20 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Thursday, February 21, 2019 1:18 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH] BaseTools:Some build generated files content are not 
ordered on linux

If the WORKSPACE environment variable has been set,The variables that control 
stable sorting will not be set.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 edksetup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/edksetup.sh b/edksetup.sh
index a8897d10f8..39f62a29bd 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -49,6 +49,7 @@ function SetWorkspace()
   #
   # If WORKSPACE is already set, then we can return right now
   #
+  export PYTHONHASHSEED=1
   if [ -n "$WORKSPACE" ]
   then
 return 0
@@ -77,7 +78,6 @@ function SetWorkspace()
   # Set $WORKSPACE
   #
   export WORKSPACE=`pwd`
-  export PYTHONHASHSEED=1
   return 0
 }
 
--
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools:Build fail if define [DEPEX] in library inf

2019-02-20 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Thursday, February 21, 2019 9:34 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [PATCH] BaseTools:Build fail if define [DEPEX] in library inf

When define [DEPEX] in lib inf to build, it will fail and report"
gUefiOvmfPkgTokenSpaceGuid.test1 used in [Depex] section should be used as 
FixedAtBuild type and VOID* datum type in the module."
But we define this PCD to FixedAtBuild type and VOID* datum type indeed.

DEC:
[PcdsFixedAtBuild]
gUefiOvmfPkgTokenSpaceGuid.test1 |
{GUID("4096267b-da0a-42eb-b5eb-fef31d207cb4")}|VOID*|0x3c

DSC:
add pcd under lib inf as below:

NULL|TestPkg/TestLib/TestLib.inf
 
gUefiOvmfPkgTokenSpaceGuid.test1 | {GUID(gUefiOvmfPkgTokenSpaceGuid)}

Lib inf:(TestPkg/TestLib/TestLib.inf)
[Depex]
gUefiOvmfPkgTokenSpaceGuid.test1
[FixedPcd]
gUefiOvmfPkgTokenSpaceGuid.test1

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 2452ecbcba..81361559b3 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2892,10 +2892,16 @@ class ModuleAutoGen(AutoGen):
 if '.' not in item:
 NewList.append(item)
 else:
-if item not in self.FixedVoidTypePcds:
+FixedVoidTypePcds = {}
+if item in self.FixedVoidTypePcds:
+FixedVoidTypePcds = self.FixedVoidTypePcds
+elif M in self.PlatformInfo.LibraryAutoGenList:
+Index = 
self.PlatformInfo.LibraryAutoGenList.index(M)
+FixedVoidTypePcds = 
self.PlatformInfo.LibraryAutoGenList[Index].FixedVoidTypePcds
+if item not in FixedVoidTypePcds:
 EdkLogger.error("build", FORMAT_INVALID, "{} used 
in [Depex] section should be used as FixedAtBuild type and VOID* datum type in 
the module.".format(item))
 else:
-Value = self.FixedVoidTypePcds[item]
+Value = FixedVoidTypePcds[item]
 if len(Value.split(',')) != 16:
 EdkLogger.error("build", FORMAT_INVALID,
 "{} used in [Depex] section 
should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the 
module.".format(item))
--
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch V2] BaseTool: Fixed incremental rebuild issue.

2019-02-20 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1540

This issue in introduced by commit
d943b0c339fe3d35ffdf9f580ccb7a55915c6854

To convert bytes to string, we need to use bytes.decode()
instead of using str(bytes). 

If the source file is not a txt file, ignore that file. 

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/AutoGen/GenMake.py  | 16 
 .../Source/Python/Workspace/DscBuildData.py | 17 -
 2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 53c5b8577d..b441817b52 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1043,18 +1043,18 @@ cleanlib:
 Fd.close()
 except BaseException as X:
 EdkLogger.error("build", FILE_OPEN_FAILURE, 
ExtraData=F.Path + "\n\t" + str(X))
 if len(FileContent) == 0:
 continue
-
-if FileContent[0] == 0xff or FileContent[0] == 0xfe:
-FileContent = FileContent.decode('utf-16')
-else:
-try:
-FileContent = str(FileContent)
-except:
-pass
+try:
+if FileContent[0] == 0xff or FileContent[0] == 0xfe:
+FileContent = FileContent.decode('utf-16')
+else:
+FileContent = FileContent.decode()
+except:
+# The file is not txt file. for example .mcb file
+continue
 IncludedFileList = gIncludePattern.findall(FileContent)
 
 for Inc in IncludedFileList:
 Inc = Inc.strip()
 # if there's macro used to reference header file, expand it
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 1ffefe6e7e..7221946062 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -153,19 +153,18 @@ def GetDependencyList(FileStack, SearchPathList):
 Fd.close()
 
 if len(FileContent) == 0:
 continue
 
-if FileContent[0] == 0xff or FileContent[0] == 0xfe:
-FileContent = FileContent.decode('utf-16')
-IncludedFileList = gIncludePattern.findall(FileContent)
-else:
-try:
-FileContent = str(FileContent)
-IncludedFileList = gIncludePattern.findall(FileContent)
-except:
-pass
+try:
+if FileContent[0] == 0xff or FileContent[0] == 0xfe:
+FileContent = FileContent.decode('utf-16')
+else:
+FileContent = FileContent.decode()
+except:
+# The file is not txt file. for example .mcb file
+continue
 IncludedFileList = gIncludePattern.findall(FileContent)
 
 for Inc in IncludedFileList:
 Inc = Inc.strip()
 Inc = os.path.normpath(Inc)
-- 
2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTool: Fixed incremental rebuild issue.

2019-02-20 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1540

This issue in introduced by commit
d943b0c339fe3d35ffdf9f580ccb7a55915c6854

To convert bytes to string, we need to use bytes.decode()
instead of using str(bytes)

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/AutoGen/GenMake.py| 2 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 53c5b8577d..641ed8305f 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1048,11 +1048,11 @@ cleanlib:
 
 if FileContent[0] == 0xff or FileContent[0] == 0xfe:
 FileContent = FileContent.decode('utf-16')
 else:
 try:
-FileContent = str(FileContent)
+FileContent = FileContent.decode()
 except:
 pass
 IncludedFileList = gIncludePattern.findall(FileContent)
 
 for Inc in IncludedFileList:
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 1ffefe6e7e..74bc333144 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -158,11 +158,11 @@ def GetDependencyList(FileStack, SearchPathList):
 if FileContent[0] == 0xff or FileContent[0] == 0xfe:
 FileContent = FileContent.decode('utf-16')
 IncludedFileList = gIncludePattern.findall(FileContent)
 else:
 try:
-FileContent = str(FileContent)
+FileContent = FileContent.decode()
 IncludedFileList = gIncludePattern.findall(FileContent)
 except:
 pass
 IncludedFileList = gIncludePattern.findall(FileContent)
 
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools:PCD value error in structure pcd sku case.

2019-02-19 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Monday, February 18, 2019 5:53 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [PATCH] BaseTools:PCD value error in structure pcd sku case.

Defined 2 PCDs(Test4 & Test401) and 2 SKUs(DEFAULT & _), then set 
"SKUID_Defines" to ALL, for FixedAtBuild gEfiStructuredPcdPkgTokenSpaceGuid. 
Test401 in this case, its value should get from "Default" SKU, not from "_" 
SKU, but we does not set value in SKU "_" in dsc, so Test401 should only 
display the value get from dec.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/Common/GlobalData.py  | 2 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py | 3 +++
 BaseTools/Source/Python/build/BuildReport.py  | 5 -
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Common/GlobalData.py 
b/BaseTools/Source/Python/Common/GlobalData.py
index 5eaee06694..f117998b0b 100644
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -103,7 +103,7 @@ MixedPcd = {}
 
 # Structure Pcd dict
 gStructurePcd = {}
-
+gPcdSkuOverrides={}
 # Pcd name for the Pcd which used in the Conditional directives  
gConditionalPcds = []
 
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 1fd1639ab6..5daefe835e 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1537,6 +1537,9 @@ class DscBuildData(PlatformBuildClassObject):
 stru_pcd.SkuOverrideValues[skuid] = 
copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else 
copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for defaultstorename in 
DefaultStores} if DefaultStores else {}) 
#{TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues})
 if not NoDefault:
 stru_pcd.ValueChain.add((skuid, ''))
+if 'DEFAULT' in stru_pcd.SkuOverrideValues and not 
GlobalData.gPcdSkuOverrides.get((stru_pcd.TokenCName, 
stru_pcd.TokenSpaceGuidCName)):
+GlobalData.gPcdSkuOverrides.update(
+{(stru_pcd.TokenCName, 
+ stru_pcd.TokenSpaceGuidCName): 
+ {'DEFAULT':stru_pcd.SkuOverrideValues['DEFAULT']}})
 if stru_pcd.Type in 
[self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], 
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
 for skuid in SkuIds:
 nextskuid = skuid
diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index 0b98d62cb6..358fdd82d6 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -1295,7 +1295,10 @@ class PcdReport(object):
 FileWrite(File, ' %-*s   : %6s %10s = %s' % (self.MaxLen, Flag 
+ ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value))
 if IsStructure:
 FiledOverrideFlag = False
-OverrideValues = Pcd.SkuOverrideValues
+if (Pcd.TokenCName,Pcd.TokenSpaceGuidCName) in 
GlobalData.gPcdSkuOverrides:
+OverrideValues = 
GlobalData.gPcdSkuOverrides[(Pcd.TokenCName,Pcd.TokenSpaceGuidCName)]
+else:
+OverrideValues = Pcd.SkuOverrideValues
 if OverrideValues:
 for Data in OverrideValues.values():
 Struct = list(Data.values())
--
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch V2] BaseTools: replace Sdict with OrderedDict in UPT

2019-02-19 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1504

V2: import OrderredDict as Sdict in Misc.py instead 
updating all the py files.

Sdict class is removed on the commit
174a9d3cc8f74f7a731ac5f16ce6864c8eb359ec
but there are still some py files import it.

This patch is to use collections.OrderedDict to replace Sdict.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Jaben Carsey 
---
 BaseTools/Source/Python/UPT/Library/Misc.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/UPT/Library/Misc.py 
b/BaseTools/Source/Python/UPT/Library/Misc.py
index e7ee27cc53..0967ea53d1 100644
--- a/BaseTools/Source/Python/UPT/Library/Misc.py
+++ b/BaseTools/Source/Python/UPT/Library/Misc.py
@@ -1,9 +1,9 @@
 ## @file
 # Common routines used by all tools
 #
-# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
 #
 # This program and the accompanying materials are licensed and made available
 # under the terms and conditions of the BSD License which accompanies this
 # distribution. The full text of the license may be found at
 # http://opensource.org/licenses/bsd-license.php
@@ -30,11 +30,11 @@ from os import remove
 from os import rmdir
 from os import linesep
 from os import walk
 from os import environ
 import re
-from collections import OrderedDict
+from collections import OrderedDict as Sdict
 
 import Logger.Log as Logger
 from Logger import StringTable as ST
 from Logger import ToolError
 from Library import GlobalData
-- 
2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: replace Sdict with OrderedDict in UPT

2019-02-19 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1504
Sdict class is removed on the commit
174a9d3cc8f74f7a731ac5f16ce6864c8eb359ec
but there are still some py files import it.

This patch is to use collections.OrderedDict to replace Sdict.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py  | 4 ++--
 BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py | 4 ++--
 BaseTools/Source/Python/UPT/InstallPkg.py | 4 ++--
 BaseTools/Source/Python/UPT/Object/POM/PackageObject.py   | 4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/DecObject.py| 4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py  | 4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py  | 4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py| 4 ++--
 .../Python/UPT/Object/Parser/InfLibraryClassesObject.py   | 4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py  | 4 ++--
 .../Source/Python/UPT/Object/Parser/InfPackagesObject.py  | 4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py | 4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py | 4 ++--
 .../Source/Python/UPT/Object/Parser/InfProtocolObject.py  | 4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py  | 4 ++--
 .../Source/Python/UPT/Object/Parser/InfUserExtensionObject.py | 4 ++--
 BaseTools/Source/Python/UPT/PomAdapter/DecPomAlignment.py | 4 ++--
 BaseTools/Source/Python/UPT/Xml/XmlParser.py  | 4 ++--
 18 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py 
b/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py
index 873e2b4de4..13f5cd951b 100644
--- a/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py
+++ b/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py
@@ -1,9 +1,9 @@
 ## @file
 # This file is used to define a class object to describe a distribution package
 #
-# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
 #
 # This program and the accompanying materials are licensed and made available
 # under the terms and conditions of the BSD License which accompanies this
 # distribution. The full text of the license may be found at
 # http://opensource.org/licenses/bsd-license.php
@@ -18,11 +18,11 @@ DistributionPackageClass
 ##
 # Import Modules
 #
 import os.path
 
-from Library.Misc import Sdict
+from collections import OrderedDict as Sdict
 from Library.Misc import GetNonMetaDataFiles
 from PomAdapter.InfPomAlignment import InfPomAlignment
 from PomAdapter.DecPomAlignment import DecPomAlignment
 import Logger.Log as Logger
 from Logger import StringTable as ST
diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py 
b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
index 40346b0b3a..1ef2714c5e 100644
--- a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
+++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
@@ -1,10 +1,10 @@
 ## @file GenInfFile.py
 #
 # This file contained the logical of transfer package object to INF files.
 #
-# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
 #
 # This program and the accompanying materials are licensed and made available
 # under the terms and conditions of the BSD License which accompanies this
 # distribution. The full text of the license may be found at
 # http://opensource.org/licenses/bsd-license.php
@@ -24,11 +24,11 @@ from Library.StringUtils import GetSplitValueList
 from Library.Parsing import GenSection
 from Library.Parsing import GetWorkspacePackage
 from Library.Parsing import ConvertArchForInstall
 from Library.Misc import SaveFileOnChange
 from Library.Misc import IsAllModuleList
-from Library.Misc import Sdict
+from collections import OrderedDict as Sdict
 from Library.Misc import ConvertPath
 from Library.Misc import ConvertSpec
 from Library.Misc import GetRelativePath
 from Library.Misc import GetLocalValue
 from Library.CommentGenerating import GenHeaderCommentSection
diff --git a/BaseTools/Source/Python/UPT/InstallPkg.py 
b/BaseTools/Source/Python/UPT/InstallPkg.py
index cbc54f9407..91c7f040b1 100644
--- a/BaseTools/Source/Python/UPT/InstallPkg.py
+++ b/BaseTools/Source/Python/UPT/InstallPkg.py
@@ -1,9 +1,9 @@
 ## @file
 # Install distribution package.
 #
-# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
 #
 # This program and the accompanying materials are licensed and made available
 # under the terms and conditions of the BSD License which accompanies this
 # distribution. The full text of the license may be found at
 # http://opensource.or

Re: [edk2] [PATCH] BaseTools:Fixed build failure when specifying multiple BUILDTARGET

2019-02-19 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Tuesday, February 19, 2019 6:56 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH] BaseTools:Fixed build failure when specifying multiple 
BUILDTARGET

With Python3, the dict.value() method returns an iterator.
If a dictionary is updated while an iterator on its keys is used, a 
RuntimeError is generated.
Converting the iterator to a list() forces a copy of the mutable keys in an 
immutable list which can be safely iterated.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 2452ecbcba..7969e46d87 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -580,7 +580,7 @@ class WorkspaceAutoGen(AutoGen):
 if NewPcd2 not in GlobalData.MixedPcd[item]:
 GlobalData.MixedPcd[item].append(NewPcd2)
 
-for BuildData in PGen.BuildDatabase._CACHE_.values():
+for BuildData in list(PGen.BuildDatabase._CACHE_.values()):
 if BuildData.Arch != Arch:
 continue
 for key in BuildData.Pcds:
--
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Remove unused txt files

2019-02-19 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Liming 
Gao
Sent: Friday, February 15, 2019 10:32 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] BaseTools: Remove unused txt files

externals.txt is to refer to the binary Win32. It is not used any longer.
BuildNotes.txt is to freeze BaseTools python. It is not used any longer.
BinaryFiles.txt is to list the file in Bin directory. But, Bin dir is empty.
building-gcc.txt and gcc is for mingw-gcc. It is not used any longer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
---
 BaseTools/Bin/externals.txt  |   1 -
 BaseTools/BuildNotes.txt |  83 --
 BaseTools/Source/BinaryFiles.txt |  79 --
 BaseTools/building-gcc.txt   |  15 --
 BaseTools/gcc/README.txt |  71 -
 BaseTools/gcc/mingw-gcc-build.py | 565 ---
 6 files changed, 814 deletions(-)
 delete mode 100644 BaseTools/Bin/externals.txt  delete mode 100644 
BaseTools/BuildNotes.txt  delete mode 100644 BaseTools/Source/BinaryFiles.txt  
delete mode 100644 BaseTools/building-gcc.txt  delete mode 100644 
BaseTools/gcc/README.txt  delete mode 100755 BaseTools/gcc/mingw-gcc-build.py

diff --git a/BaseTools/Bin/externals.txt b/BaseTools/Bin/externals.txt deleted 
file mode 100644 index c2c4ab7297..00
--- a/BaseTools/Bin/externals.txt
+++ /dev/null
@@ -1 +0,0 @@
-Win32  https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32
diff --git a/BaseTools/BuildNotes.txt b/BaseTools/BuildNotes.txt deleted file 
mode 100644 index e2b10fddc3..00
--- a/BaseTools/BuildNotes.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-Intel(R) Platform Innovation Framework for EFI -BuildTools Project, BaseTools 
Sub-Project -Root Package 1.00
-2007-08-31
-
-Intel is a trademark or registered trademark of Intel Corporation or its 
-subsidiaries in the United States and other countries.
-* Other names and brands may be claimed as the property of others.
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-

-Quick Start

-
-Windows:
-  a) Go to the /BaseTools and run "toolsetup" script
-
-Unix-like:
-  a) make -C /BaseTools
-  b) Look over 
https://github.com/tianocore/tianocore.github.io/wiki/Getting%20Started%20with%20EDK%20II
- for a helpful step-by-step guide for building 'Hello World' on
- various operating systems with edk2.
-
-Supported build targets (toolsetup)

-
-build(or none)  - Incremental Build of all C based tools. This is the default 
target
-rebuild - Clean all generated files and directories during build, and 
rebuild all tools
-

-Tools in Python

-* Convert Python source to exe file
-
-  The tools written in Python can be converted into executable program which 
can
-  be executed without installing a Python interpreter. (Generally it is easier
-  to run the scripts from their source on operating systems other than 
Windows.)
-
-  For Windows and Linux, the conversion tool package is called cx_Freeze, its
-  home page is:
-
-http://sourceforge.net/projects/cx-freeze/
-
-  If you have installed cx_Freeze at c:\cx_Freeze-3.0.3. Use following command
-  lines to convert MyBuild.py to MyBuild.exe (note this is an example, there is
-  no MyBuild Python project in the BaseTools\Python tree.
-
-set PYTHONPATH=\Source\Python
-c:\cx_Freeze-3.0.3\FreezePython.exe 
--include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8
 --install-dir=.\mybuild MyBuild.py
-
-  The generated .exe (and .dll) files are put in "mybuild" subdirectory.
-
-  The following is a real example with the BuildTools/trunk/BaseTools project
-  installed in: C:\Work\BaseTools
-
-
-  C:\Work\BaseTools\Source\Python> set 
PYTHONPATH=C:\Work\BaseTools\Source\Python
-  C:\Work\BaseTools\Source\Python> c:\cx_Freeze-3.0.3\FreezePython.exe 
--include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8
 --install-dir=C:\Work\BaseTools\Bin\Win32 build\build.py
-

-* Execute tools written in Python without conversion
-
-Unix-like systems:
-
-The edk2/edksetup.sh script will setup everything which is needed to -run the 
scripts from their source.
-
-Windows:
-
-  The tools written in Python can be executed directly from its source 
directory -as long as the Python interpreter (Python 2.5) has been installed. 
Before the execution, -please make sure the environment variable PYTHONPATH is 
set to
-
-/BaseTools/Source/Python
-
-  There're five tools written in Python. The entrance file of each tool is 
listed -below.
-
-  build   
/BaseTools/Source/Python/build/build.py
-  GenFds  
/BaseTo

[edk2] [Patch] BaseTools: Fix a bug about Structure PCD

2019-02-19 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1535
If there is Hii Structure Pcd, build will fail, root cause is that
there is an incorrect variable access method used in code.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index e45beb3924..2e6eb16b08 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -2392,11 +2392,11 @@ class DscBuildData(PlatformBuildClassObject):
 skuinfo = Pcd.SkuInfoList[skuname]
 if skuinfo.VariableName:
 for defaultstore in skuinfo.DefaultStoreDict:
 pcddscrawdefaultvalue = 
self.GetPcdDscRawDefaultValue(Pcd, skuname, defaultstore)
 if pcddscrawdefaultvalue:
-Value = skuinfo[defaultstore]
+Value = skuinfo.DefaultStoreDict[defaultstore]
 if "{CODE(" in Value:
 realvalue = Value.strip()[6:-2] # 
"{CODE(").rstrip(")}"
 CApp += "static %s %s_%s_%s_%s_Value%s = 
%s;\n" % 
(Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,defaultstore,Demesion,realvalue)
 else:
 pcddscrawdefaultvalue = self.GetPcdDscRawDefaultValue(Pcd, 
skuname, TAB_DEFAULT_STORES_DEFAULT)
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools:Fix a ECC issue

2019-02-18 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Monday, February 18, 2019 2:24 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH] BaseTools:Fix a ECC issue

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

A property error occurred because the property of the function was not defined. 
a property is now redefined.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/Ecc/CodeFragmentCollector.py | 2 +-
 BaseTools/Source/Python/Ecc/Configuration.py | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py 
b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
index 21fed59cad..f844b4a0b3 100644
--- a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
+++ b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
@@ -27,7 +27,7 @@ if sys.version_info.major == 3:
 from Ecc.CParser4.CParser import CParser
 else:
 import antlr3 as antlr
-antlr.InputString = antlr.StringStream
+antlr.InputStream = antlr.StringStream
 from Ecc.CParser3.CLexer import CLexer
 from Ecc.CParser3.CParser import CParser
 
diff --git a/BaseTools/Source/Python/Ecc/Configuration.py 
b/BaseTools/Source/Python/Ecc/Configuration.py
index c19a3990c7..f2b2b86487 100644
--- a/BaseTools/Source/Python/Ecc/Configuration.py
+++ b/BaseTools/Source/Python/Ecc/Configuration.py
@@ -192,6 +192,8 @@ class Configuration(object):
 self.GeneralCheckLineEnding = 1
 # Check if there is no trailing white space in one line.
 self.GeneralCheckTrailingWhiteSpaceLine = 1
+
+self.CFunctionLayoutCheckNoDeprecated = 1
 
 ## Space Checking
 self.SpaceCheckAll = 1
--
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Correct the value assignment for StructurePcd

2019-02-18 Thread Feng, Bob C
Hi Felix,

Good point. I'll update the patch.

Thanks,
Bob

-Original Message-
From: Felix Polyudov [mailto:fel...@ami.com] 
Sent: Tuesday, February 19, 2019 12:57 AM
To: Feng, Bob C ; edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: RE: [edk2] [Patch] BaseTools: Correct the value assignment for 
StructurePcd

Bob,

I think silent trimming of input data is not a good idea.
The build tool should either report an error (my preference) or a warning that 
DSC or DEC input value is too long.

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Feng, 
Bob C
Sent: Saturday, February 16, 2019 12:55 AM
To: edk2-devel@lists.01.org
Cc: Liming Gao
Subject: [edk2] [Patch] BaseTools: Correct the value assignment for StructurePcd

This patch is to fix the code bug in StructurePcd overall value assignment 
logic. If a Pcd Array size is fixed but the size of actual value in Dsc or Dec 
is bigger than the Pcd array size, the tool only copy the data as same as that 
Pcd Array size.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 .../Python/Workspace/BuildClassObject.py  |  57 ---
 .../Source/Python/Workspace/DscBuildData.py   | 145 ++
 2 files changed, 147 insertions(+), 55 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 1df042f41c..d6168b62d5 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -76,34 +76,45 @@ class PcdClassObject(object):
 self.UserDefinedDefaultStoresFlag = UserDefinedDefaultStoresFlag
 self._Capacity = None
 
 @property
 def Capacity(self):
-self._Capacity = []
-dimension = ArrayIndex.findall(self._DatumType)
-for item in dimension:
-maxsize = item.lstrip("[").rstrip("]").strip()
-if not maxsize:
-maxsize = "-1"
-maxsize = str(int(maxsize,16)) if maxsize.startswith(("0x","0X")) 
else maxsize
-self._Capacity.append(maxsize)
-if hasattr(self, "SkuOverrideValues"):
-for sku in self.SkuOverrideValues:
-for defaultstore in self.SkuOverrideValues[sku]:
-fields = self.SkuOverrideValues[sku][defaultstore]
-for demesionattr in fields:
-deme = ArrayIndex.findall(demesionattr)
-for i in range(len(deme)-1):
-if int(deme[i].lstrip("[").rstrip("]").strip()) > 
int(self._Capacity[i]):
-print ("error")
-if hasattr(self,"DefaultValues"):
-for demesionattr in self.DefaultValues:
-deme = ArrayIndex.findall(demesionattr)
-for i in range(len(deme)-1):
-if int(deme[i].lstrip("[").rstrip("]").strip()) > 
int(self._Capacity[i]):
-print ("error")
+if self._Capacity is None:
+self._Capacity = []
+dimension = ArrayIndex.findall(self._DatumType)
+for item in dimension:
+maxsize = item.lstrip("[").rstrip("]").strip()
+if not maxsize:
+maxsize = "-1"
+maxsize = str(int(maxsize,16)) if 
maxsize.startswith(("0x","0X")) else maxsize
+self._Capacity.append(maxsize)
+if hasattr(self, "SkuOverrideValues"):
+for sku in self.SkuOverrideValues:
+for defaultstore in self.SkuOverrideValues[sku]:
+fields = self.SkuOverrideValues[sku][defaultstore]
+for demesionattr in fields:
+deme = ArrayIndex.findall(demesionattr)
+for i in range(len(deme)):
+if 
int(deme[i].lstrip("[").rstrip("]").strip()) >= int(self._Capacity[i]):
+if self._Capacity[i] != "-1":
+raise ("error")
+if hasattr(self,"DefaultValues"):
+for demesionattr in self.DefaultValues:
+deme = ArrayIndex.findall(demesionattr)
+for i in range(len(deme)):
+if int(deme[i].lstrip("[").rstrip("]").strip()) >= 
int(self._Capacity[i]):
+if self._Capacity[i] != "-1":
+raise ("error")
 return self._Capacity
+
+def PcdArraySize(self):
+if self.Capacity[-1] == "-1"

[edk2] [Patch] BaseTools: Fixed a bug in Vpd handling

2019-02-18 Thread Feng, Bob C
If there are multiple sku used in a platform and
gEfiMdeModulePkgTokenSpaceGuid.PcdNvStoreDefaultValueBuffer PCD
is used, build will fail.

This is a regression issue introduced by the commit:
5695877ec8f636bd4ad873ef50eceb9da7a0f382 which only update the
Vpd offset for default SKU but not other SKUs.

This patch is going to fix this issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 2452ecbcba..8370ee0c93 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1686,11 +1686,11 @@ class PlatformAutoGen(AutoGen):
 PcdNvStoreDfBuffer = [item for item in self._DynamicPcdList if 
item.TokenCName == "PcdNvStoreDefaultValueBuffer" and item.TokenSpaceGuidCName 
== "gEfiMdeModulePkgTokenSpaceGuid"]
 if PcdNvStoreDfBuffer:
 PcdName,PcdGuid = PcdNvStoreDfBuffer[0].TokenCName, 
PcdNvStoreDfBuffer[0].TokenSpaceGuidCName
 if (PcdName,PcdGuid) in VpdSkuMap:
 DefaultSku = 
PcdNvStoreDfBuffer[0].SkuInfoList.get(TAB_DEFAULT)
-VpdSkuMap[(PcdName,PcdGuid)] = 
{DefaultSku.DefaultValue:[DefaultSku]}
+VpdSkuMap[(PcdName,PcdGuid)] = 
{DefaultSku.DefaultValue:[SkuObj for SkuObj in 
PcdNvStoreDfBuffer[0].SkuInfoList.values() ]}
 
 # Process VPD map file generated by third party BPDG tool
 if NeedProcessVpdMapFile:
 VpdMapFilePath = os.path.join(self.BuildDir, 
TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)
 if os.path.exists(VpdMapFilePath):
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: Fix a ParseDevPathValue function issue.

2019-02-16 Thread Feng, Bob C
In ParseDevPathValue, the binary data need to convert to string
for python3 and python2 compatiblity.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Common/Misc.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 565a5ad40b..c7daf5417c 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1030,10 +1030,11 @@ def ParseFieldValue (Value):
 subprocess._cleanup()
 p.stdout.close()
 p.stderr.close()
 if err:
 raise BadExpression("DevicePath: %s" % str(err))
+out = out.decode()
 Size = len(out.split())
 out = ','.join(out.split())
 return '{' + out + '}', Size
 
 if "{CODE(" in Value:
-- 
2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: Add MaxSizeUserSet to Pcd deepcopy function

2019-02-16 Thread Feng, Bob C
MaxSizeUserSet is missing in Pcd deepcopy function.
This patch is to add it back to Pcd deepcopy function.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Workspace/BuildClassObject.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 1df042f41c..d7ca9e8cf1 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -220,10 +220,11 @@ class PcdClassObject(object):
 new_pcd.Type = self.Type
 new_pcd.DatumType = self.DatumType
 new_pcd.DefaultValue = self.DefaultValue
 new_pcd.TokenValue = self.TokenValue
 new_pcd.MaxDatumSize = self.MaxDatumSize
+new_pcd.MaxSizeUserSet = self.MaxSizeUserSet
 
 new_pcd.Phase = self.Phase
 new_pcd.Pending = self.Pending
 new_pcd.IsOverrided = self.IsOverrided
 new_pcd.IsFromBinaryInf = self.IsFromBinaryInf
-- 
2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: Correct the value assignment for StructurePcd

2019-02-15 Thread Feng, Bob C
This patch is to fix the code bug in StructurePcd overall
value assignment logic. If a Pcd Array size is fixed but the
size of actual value in Dsc or Dec is bigger than the Pcd
array size, the tool only copy the data as same as that
Pcd Array size.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 .../Python/Workspace/BuildClassObject.py  |  57 ---
 .../Source/Python/Workspace/DscBuildData.py   | 145 ++
 2 files changed, 147 insertions(+), 55 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 1df042f41c..d6168b62d5 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -76,34 +76,45 @@ class PcdClassObject(object):
 self.UserDefinedDefaultStoresFlag = UserDefinedDefaultStoresFlag
 self._Capacity = None
 
 @property
 def Capacity(self):
-self._Capacity = []
-dimension = ArrayIndex.findall(self._DatumType)
-for item in dimension:
-maxsize = item.lstrip("[").rstrip("]").strip()
-if not maxsize:
-maxsize = "-1"
-maxsize = str(int(maxsize,16)) if maxsize.startswith(("0x","0X")) 
else maxsize
-self._Capacity.append(maxsize)
-if hasattr(self, "SkuOverrideValues"):
-for sku in self.SkuOverrideValues:
-for defaultstore in self.SkuOverrideValues[sku]:
-fields = self.SkuOverrideValues[sku][defaultstore]
-for demesionattr in fields:
-deme = ArrayIndex.findall(demesionattr)
-for i in range(len(deme)-1):
-if int(deme[i].lstrip("[").rstrip("]").strip()) > 
int(self._Capacity[i]):
-print ("error")
-if hasattr(self,"DefaultValues"):
-for demesionattr in self.DefaultValues:
-deme = ArrayIndex.findall(demesionattr)
-for i in range(len(deme)-1):
-if int(deme[i].lstrip("[").rstrip("]").strip()) > 
int(self._Capacity[i]):
-print ("error")
+if self._Capacity is None:
+self._Capacity = []
+dimension = ArrayIndex.findall(self._DatumType)
+for item in dimension:
+maxsize = item.lstrip("[").rstrip("]").strip()
+if not maxsize:
+maxsize = "-1"
+maxsize = str(int(maxsize,16)) if 
maxsize.startswith(("0x","0X")) else maxsize
+self._Capacity.append(maxsize)
+if hasattr(self, "SkuOverrideValues"):
+for sku in self.SkuOverrideValues:
+for defaultstore in self.SkuOverrideValues[sku]:
+fields = self.SkuOverrideValues[sku][defaultstore]
+for demesionattr in fields:
+deme = ArrayIndex.findall(demesionattr)
+for i in range(len(deme)):
+if 
int(deme[i].lstrip("[").rstrip("]").strip()) >= int(self._Capacity[i]):
+if self._Capacity[i] != "-1":
+raise ("error")
+if hasattr(self,"DefaultValues"):
+for demesionattr in self.DefaultValues:
+deme = ArrayIndex.findall(demesionattr)
+for i in range(len(deme)):
+if int(deme[i].lstrip("[").rstrip("]").strip()) >= 
int(self._Capacity[i]):
+if self._Capacity[i] != "-1":
+raise ("error")
 return self._Capacity
+
+def PcdArraySize(self):
+if self.Capacity[-1] == "-1":
+return -1
+size = 1
+for de in self.Capacity:
+size = size * int(de)
+return size
 @property
 def DatumType(self):
 return self._DatumType
 
 @DatumType.setter
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index e45beb3924..09d917c5db 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1763,27 +1763,41 @@ class DscBuildData(PlatformBuildClassObject):
 return Result
 
 def GenerateSizeFunction(self, Pcd):
 CApp = "// Default Value in Dec \n"
 CApp = CApp + "void Cal_%s_%s_Size(UINT32 *Size){\n" % 
(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
-if Pcd.IsArray():
+
+if Pcd.IsArray() and Pcd.Capacity[-1] != "-1":
+CApp += "  *Size = (sizeof (%s) > *Size ? sizeof (%s) : *Size);\n" 
% (Pcd.DatumType,Pcd.DatumType)
+else:
+if "{CODE(" in Pcd.DefaultValueFromDec:
+CApp += "  *Size = (size

[edk2] [Patch] BaseTools: Fixed a code bug for Pcd Array.

2019-02-15 Thread Feng, Bob C
For example, PCD gUefiOvmfPkgTokenSpaceGuid.Test001 datatype is Array:
TEST1[2]
and the filed TEST1UINT64ARRAY in TEST1 is also an array:
UINT64 TEST1UINT64ARRAY[2];

Then the following filed assignment in DSC will cause build failure.
gUefiOvmfPkgTokenSpaceGuid.Test001[0].TEST1UINT64ARRAY|{'A','B'}

The root cause is build tool generate incorrect PcdValueInit.c File.

This patch is going to fix this issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 1fd1639ab6..e45beb3924 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -2015,14 +2015,13 @@ class DscBuildData(PlatformBuildClassObject):
 indicator = self.GetIndicator(index, FieldName,Pcd)
 if IsArray:
 #
 # Use memcpy() to copy value into field
 #
-CApp = CApp + '  FieldSize = __FIELD_SIZE(%s, %s);\n' % 
(Pcd.DatumType, FieldName)
+CApp = CApp + '  FieldSize = __FIELD_SIZE(%s, %s);\n' % 
(Pcd.BaseDatumType, FieldName)
 CApp = CApp + '  Value = %s; // From %s Line %d Value 
%s\n' % (DscBuildData.IntToCString(Value, ValueSize), FieldList[FieldName][1], 
FieldList[FieldName][2], FieldList[FieldName][0])
-CApp = CApp + '  __STATIC_ASSERT((__FIELD_SIZE(%s, %s) >= 
%d) || (__FIELD_SIZE(%s, %s) == 0), "Input buffer exceeds the buffer array"); 
// From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName, ValueSize, 
Pcd.DatumType, FieldName, FieldList[FieldName][1], FieldList[FieldName][2], 
FieldList[FieldName][0])
-CApp = CApp + '  memcpy (&Pcd->%s, Value, (FieldSize > 0 
&& FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSize)
+CApp = CApp + '  __STATIC_ASSERT((__FIELD_SIZE(%s, %s) >= 
%d) || (__FIELD_SIZE(%s, %s) == 0), "Input buffer exceeds the buffer array"); 
// From %s Line %d Value %s\n' % (Pcd.BaseDatumType, FieldName, ValueSize, 
Pcd.BaseDatumType, FieldName, FieldList[FieldName][1], FieldList[FieldName][2], 
FieldList[FieldName][0])
 CApp = CApp + '  memcpy (&%s, Value, (FieldSize > 0 && 
FieldSize < %d) ? FieldSize : %d);\n' % (indicator, ValueSize, ValueSize)
 elif isinstance(Value, str):
 CApp = CApp + '  %s = %s; // From %s Line %d Value %s\n' % 
(indicator, Value, FieldList[FieldName][1], FieldList[FieldName][2], 
FieldList[FieldName][0])
 else:
 if '[' in FieldName and ']' in FieldName:
@@ -2130,12 +2129,11 @@ class DscBuildData(PlatformBuildClassObject):
 #
 # Use memcpy() to copy value into field
 #
 CApp = CApp + '  FieldSize = __FIELD_SIZE(%s, %s);\n' 
% (Pcd.BaseDatumType, FieldName)
 CApp = CApp + '  Value = %s; // From %s Line %d 
Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), 
FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
-CApp = CApp + '  __STATIC_ASSERT((__FIELD_SIZE(%s, %s) 
>= %d) || (__FIELD_SIZE(%s, %s) == 0), "Input buffer exceeds the buffer 
array"); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName, ValueSize, 
Pcd.DatumType, FieldName, FieldList[FieldName][1], FieldList[FieldName][2], 
FieldList[FieldName][0])
-CApp = CApp + '  memcpy (&Pcd->%s, Value, (FieldSize > 
0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSize)
+CApp = CApp + '  __STATIC_ASSERT((__FIELD_SIZE(%s, %s) 
>= %d) || (__FIELD_SIZE(%s, %s) == 0), "Input buffer exceeds the buffer 
array"); // From %s Line %d Value %s\n' % (Pcd.BaseDatumType, FieldName, 
ValueSize, Pcd.BaseDatumType, FieldName, FieldList[FieldName][1], 
FieldList[FieldName][2], FieldList[FieldName][0])
 CApp = CApp + '  memcpy (&%s, Value, (FieldSize > 0 && 
FieldSize < %d) ? FieldSize : %d);\n' % (indicator, ValueSize, ValueSize)
 else:
 if '[' in FieldName and ']' in FieldName:
 Index = int(FieldName.split('[')[1].split(']')[0])
 CApp = CApp + '  __STATIC_ASSERT((%d < 
__ARRAY_SIZE(Pcd->%s)) || (__ARRAY_SIZE(Pcd->%s) == 0), "array index exceeds 
the array number"); // From %s Line %d Index of %s\n' % (Index, 
FieldName.split('[')[0], FieldName.split('[')[0], FieldList[FieldName][1], 
FieldList[FieldName][2], FieldName)
@@ -2200,11 +2198,11 @@ class DscBuildData(PlatformBuildClassObject):
 #
 # Use memc

Re: [edk2] [Patch 0/3] BaseTools: Implement splitquoted function

2019-02-14 Thread Feng, Bob C
Hi Laszlo,

Thanks for you detailed clarification. 

This patch will not be pushed to edk2 master and Ubuntu user need to install 
python3-distutils package via "sudo apt-get install python3-distutils" to 
resolve this issue.

Thanks,
Bob

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Thursday, February 14, 2019 11:32 PM
To: Feng, Bob C 
Cc: Gao, Liming ; Bi, Dandan ; 
Carsey, Jaben ; edk2-devel@lists.01.org
Subject: Re: [edk2] [Patch 0/3] BaseTools: Implement splitquoted function

Hi Bob,

On 02/14/19 03:51, Feng, Bob C wrote:
> Hi Laszlo, Liming, Jaben and Dandan,
>
> I found this is a Ubuntu18 bug. Refer to
> https://bugs.launchpad.net/ubuntu/+source/fdroidserver/+bug/1762183

That Ubuntu bug is *related*, but it's not a bug that matters for us.

The bug above is about another package; it is called "fdroidserver". The 
"fdroidserver" package has a hard runtime dependency on the python 
"distutils.util" module.

Package management systems on Linux distributions track inter-package 
dependencies. That is, if the meta-data on the "fdroidserver" package 
explicitly lists the "python3-distutils" package as a dependency, then the 
package management system will automatically install in "python3-distutils" 
when the user requests "fdroidserver".

However, if the meta-data on the "fdroidserver" package are incorrect (buggy), 
then the package management system will have no clue. And, if the 
"python3-distutils" package is not already installed for some other reason, 
then the user will get an installation or runtime error, when they try to 
install or run "fdroidserver".

So, to be clear, the bug report you reference describes a *similar* situation 
to ours (a missing dependency), but it's not the same case.
The bug you refer to is in the "fdroidserver" package, and they fixed it in 
Ubuntu by updating / correcting the meta-data on the "fdroidserver"
package. The "python3-distutils" package, or other parts of the OS, were not 
touched.

> And Ubuntu fixed this bug via a Ubuntu18.04.1 update package which was 
> published on 2018-08-09. Refer to
> https://launchpad.net/ubuntu/+source/fdroidserver/1.0.9-1~18.04.1

The link you provide confirms what I wrote above. It is a changelog for the 
"fdroidserver" package, and the relevant entry says "fix missing Python 
distutils dependency".

> While the latest Ubuntu 18.04 release
> (ubuntu-18.04.1-desktop-amd64.iso)  on 
> http://releases.ubuntu.com/18.04/ was published on 2018-07-25.  So 
> there is no distutils.util library on Ubuntu18.04 default 
> installation.

No, this statement can't be correct. I'm pretty sure that the 
"python3-distutils" package *was* available when Ubuntu 18.04 -- not
18.04.1 -- was originally released.

I've just downloaded

  http://old-releases.ubuntu.com/releases/bionic/ubuntu-18.04-desktop-amd64.iso

While the package is not on the ISO, a whole lot of *other* packages are also 
not there -- for example I can't see any python at all. So I'm thinking that 
python3-distutils was only available from the network.

But, I'm pretty sure python3-distutils *was* available from the network, when 
18.04 was originally released.

What was indeed broken in the original Ubuntu 18.04 release was the meta-data 
on the "fdroidserver" package.

> But I think it's clear that distutils.util is not *3rd party* python 
> library.

I agree; and that is what matters.

> I have tried that the command "sudo apt upgrade"  can't fix this bug

This "apt" command would only be relevant if you had the *old* fdroidserver 
package installed (with the missing dependency in its meta-data). Then, "apt" 
would install the *new* fdroidserver package for you, and it would also act on 
the now-visible "python3-distutils"
dependency. Thus, "apt" would automatically install in python3-distutils, as a 
dependency.

For installing "python3-distutils" *in itself*, the above "apt" command is 
totally useless.

> while the command "sudo apt-get install python3-distutils" works.

Yes, it does, because here you are specifically requesting the 
python3-distutils package.

And that's what matters. Ubuntu users simply need to install python3-distutils 
manually, from their official package repositories, if they want to use 
BaseTools (as part of the upstream edk2 git repo).

So I think this edk2 patch set is not necessary, after all.

Thanks,
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch 0/3] BaseTools: Implement splitquoted function

2019-02-13 Thread Feng, Bob C
Hi Laszlo, Liming, Jaben and Dandan,

I found this is a Ubuntu18 bug. Refer to 
https://bugs.launchpad.net/ubuntu/+source/fdroidserver/+bug/1762183

And Ubuntu fixed this bug via a Ubuntu18.04.1 update package which was 
published on 2018-08-09. Refer to 
https://launchpad.net/ubuntu/+source/fdroidserver/1.0.9-1~18.04.1

While the latest Ubuntu 18.04 release (ubuntu-18.04.1-desktop-amd64.iso)  on 
http://releases.ubuntu.com/18.04/ was published on 2018-07-25.  So there is no 
distutils.util library on Ubuntu18.04 default installation. But I think it's 
clear that distutils.util is not *3rd party* python library. 

I have tried that the command "sudo apt upgrade"  can't fix this bug while the 
command "sudo apt-get install python3-distutils" works.

Thanks,
Bob

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Tuesday, February 12, 2019 10:02 PM
To: Gao, Liming ; Feng, Bob C ; Bi, 
Dandan 
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] [Patch 0/3] BaseTools: Implement splitquoted function

On 02/12/19 14:33, Gao, Liming wrote:
> Laszlo:
>  To install python3-distutils should resolve this issue. I expect BaseTools 
> build functionality doesn't depend on the third party python lib.

I completely agree with your expectation, regarding *3rd party* python 
packages. We shouldn't expect developers to install packages from repositories 
that fall outside of their normal distro repos.

However, my understanding was that python3-distutils should be available as a 
normal (not 3rd party) component on Ubuntu 18. I think we can expect developers 
to install additional packages if those packages are readily available in their 
normal (distro-provided) repos.

> So, I suggest to check whether python3-distutils is the native python 
> library. If it is native python library, why Ubuntu18 doesn't include it. I 
> will work with Dandan to collect more information. 

Right, that's exactly what I'm asking for. Thank you very much!
Laszlo

>> -Original Message-
>> From: Laszlo Ersek [mailto:ler...@redhat.com]
>> Sent: Tuesday, February 12, 2019 8:24 PM
>> To: Feng, Bob C ; Bi, Dandan 
>> 
>> Cc: edk2-devel@lists.01.org; Gao, Liming 
>> Subject: Re: [edk2] [Patch 0/3] BaseTools: Implement splitquoted 
>> function
>>
>> On 02/04/19 20:12, Laszlo Ersek wrote:
>>> On 02/03/19 06:55, Feng, Bob C wrote:
>>>> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1509
>>>> On some Linux environment, there may be no distutils.util library 
>>>> for python3 that will cause build tool crash.
>>>> This patch implement distutils.util.split_quoted in BaseTools so 
>>>> that the Basetools will be independent with distutils.util library.
>>>>
>>>> Feng, Bob C (3):
>>>>   BaseTools: Implement splitquoted function in Build tool
>>>>   BaseTools: Implement splitquoted function in UPT
>>>>   BaseTools: unit test for splitquoted function
>>>>
>>>>  BaseTools/Source/Python/AutoGen/UniClassObject.py | 50 
>>>> ++
>>>>  BaseTools/Source/Python/UPT/Library/UniClassObject.py | 47 
>>>> ---
>>>>  BaseTools/Tests/TestStringSplit.py| 38 
>>>> ++
>>>>  3 files changed, 128 insertions(+), 7 deletions(-)  create mode 
>>>> 100644 BaseTools/Tests/TestStringSplit.py
>>>>
>>>
>>> Is this really necessary? BZ#1509 references Ubuntu18; however it 
>>> looks like the issue can be resolved by a simple package 
>>> installation on Ubuntu 18:
>>>
>>> https://superuser.com/questions/1319047/cant-install-virtual-interpr
>>> eter-in-pycharm-in-linux
>>>
>>> """
>>> sudo apt-get install python3-distutils """
>>>
>>> I'm not a Ubuntu user myself; so all I can do here (without 
>>> installing a
>>> Ubuntu18 VM) is check the Ubuntu package directory:
>>>
>>> https://packages.ubuntu.com/search?keywords=python3-distutils&search
>>> on=names&suite=all§ion=all
>>>
>>> python3-distutils appears available for both "bionic (18.04LTS)" and 
>>> "cosmic (18.10)".
>>>
>>> Dandan, if you install python3-distutils, does that solve the issue for you?
>>
>> I'd still like to get an answer to my question, before the series is pushed.
>>
>> Thanks,
>> Laszlo

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 3/3] BaseTools: Fix a bug about PcdArray

2019-02-03 Thread Feng, Bob C
This patch is going to fix the bug that
there is an incorrect variable access method.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index f472fa177f..a286232f7c 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -2394,11 +2394,11 @@ class DscBuildData(PlatformBuildClassObject):
 skuinfo = Pcd.SkuInfoList[skuname]
 if skuinfo.VariableName:
 for defaultstore in skuinfo.DefaultStoreDict:
 pcddscrawdefaultvalue = 
self.GetPcdDscRawDefaultValue(Pcd, skuname, defaultstore)
 if pcddscrawdefaultvalue:
-Value = skuinfo[defaultstore]
+Value = skuinfo.DefaultStoreDict[defaultstore]
 if "{CODE(" in Value:
 realvalue = Value.strip()[6:-2] # 
"{CODE(").rstrip(")}"
 CApp += "static %s %s_%s_%s_%s_Value%s = 
%s;\n" % 
(Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,defaultstore,Demesion,realvalue)
 else:
 pcddscrawdefaultvalue = self.GetPcdDscRawDefaultValue(Pcd, 
skuname, TAB_DEFAULT_STORES_DEFAULT)
-- 
2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/3] BaseTools: Fixed a build report issue.

2019-02-03 Thread Feng, Bob C
Generate report fail when -Y EXECUTION_ORDER in build command.
This patch is going to fix this issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Eot/EotMain.py   | 3 ++-
 BaseTools/Source/Python/build/BuildReport.py | 8 
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/Python/Eot/EotMain.py 
b/BaseTools/Source/Python/Eot/EotMain.py
index fd4bee6f90..57f96c89c9 100644
--- a/BaseTools/Source/Python/Eot/EotMain.py
+++ b/BaseTools/Source/Python/Eot/EotMain.py
@@ -19,11 +19,12 @@ import Common.LongFilePathOs as os, time, glob
 import Common.EdkLogger as EdkLogger
 import Eot.EotGlobalData as EotGlobalData
 from optparse import OptionParser
 from Common.StringUtils import NormPath
 from Common import BuildToolError
-from Common.Misc import GuidStructureStringToGuidString, sdict
+from Common.Misc import GuidStructureStringToGuidString
+from collections import OrderedDict as sdict
 from Eot.Parser import *
 from Eot.InfParserLite import EdkInfParser
 from Common.StringUtils import GetSplitValueList
 from Eot import c
 from Eot import Database
diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index e457660fce..52764a6c55 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -1650,18 +1650,18 @@ class PredictionReport(object):
 #
 SourceList = os.path.join(self._EotDir, "SourceFile.txt")
 GuidList = os.path.join(self._EotDir, "GuidList.txt")
 DispatchList = os.path.join(self._EotDir, "Dispatch.txt")
 
-TempFile = open(SourceList, "w+")
+TempFile = []
 for Item in self._SourceList:
 FileWrite(TempFile, Item)
-TempFile.close()
-TempFile = open(GuidList, "w+")
+SaveFileOnChange(SourceList, "".join(TempFile), False)
+TempFile = []
 for Key in self._GuidMap:
 FileWrite(TempFile, "%s %s" % (Key, self._GuidMap[Key]))
-TempFile.close()
+SaveFileOnChange(GuidList, "".join(TempFile), False)
 
 try:
 from Eot.EotMain import Eot
 
 #
-- 
2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/3] BaseTools: Fixed an issue about StructurePcd

2019-02-03 Thread Feng, Bob C
If use a structure pcd in fdf, build tool crash
This is a regression issue introduced by py3 patch set.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Workspace/BuildClassObject.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index cff77a71ae..41759b8785 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -268,10 +268,11 @@ class StructurePcd(PcdClassObject):
 self.PkgPath = ""
 self.DefaultValueFromDec = ""
 self.ValueChain = set()
 self.PcdFieldValueFromComm = OrderedDict()
 self.PcdFieldValueFromFdf = OrderedDict()
+self.DefaultFromDSC=None
 def __repr__(self):
 return self.TypeName
 
 def AddDefaultValue (self, FieldName, Value, FileName="", 
LineNo=0,DimensionAttr ="-1"):
 if DimensionAttr not in self.DefaultValues:
@@ -324,11 +325,10 @@ class StructurePcd(PcdClassObject):
 if isinstance(PcdObject, StructurePcd):
 self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile 
if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile
 self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs 
else self.PackageDecs
 self.DefaultValues = PcdObject.DefaultValues if 
PcdObject.DefaultValues else self.DefaultValues
 self.PcdMode = PcdObject.PcdMode if PcdObject.PcdMode else 
self.PcdMode
-self.DefaultFromDSC=None
 self.DefaultValueFromDec = PcdObject.DefaultValueFromDec if 
PcdObject.DefaultValueFromDec else self.DefaultValueFromDec
 self.SkuOverrideValues = PcdObject.SkuOverrideValues if 
PcdObject.SkuOverrideValues else self.SkuOverrideValues
 self.StructName = PcdObject.DatumType if PcdObject.DatumType else 
self.StructName
 self.PcdDefineLineNo = PcdObject.PcdDefineLineNo if 
PcdObject.PcdDefineLineNo else self.PcdDefineLineNo
 self.PkgPath = PcdObject.PkgPath if PcdObject.PkgPath else 
self.PkgPath
-- 
2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/3] BaseTools: Implement splitquoted function

2019-02-02 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1509
On some Linux environment, there may be no distutils.util
library for python3 that will cause build tool crash.
This patch implement distutils.util.split_quoted
in BaseTools so that the Basetools will be independent with
distutils.util library.

Feng, Bob C (3):
  BaseTools: Implement splitquoted function in Build tool
  BaseTools: Implement splitquoted function in UPT
  BaseTools: unit test for splitquoted function

 BaseTools/Source/Python/AutoGen/UniClassObject.py | 50 
++
 BaseTools/Source/Python/UPT/Library/UniClassObject.py | 47 
---
 BaseTools/Tests/TestStringSplit.py| 38 
++
 3 files changed, 128 insertions(+), 7 deletions(-)
 create mode 100644 BaseTools/Tests/TestStringSplit.py

-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 3/3] BaseTools: unit test for splitquoted function

2019-02-02 Thread Feng, Bob C
unit test for splitquoted function

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Tests/TestStringSplit.py | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/BaseTools/Tests/TestStringSplit.py 
b/BaseTools/Tests/TestStringSplit.py
new file mode 100644
index 00..f24200ecfc
--- /dev/null
+++ b/BaseTools/Tests/TestStringSplit.py
@@ -0,0 +1,38 @@
+## @file
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD 
License
+# which accompanies this distribution.  The full text of the license may be 
found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+import unittest
+from AutoGen.UniClassObject import splitquoted
+
+class TestStringSplit(unittest.TestCase):
+def test_split_string(self):
+TestStr1 = """ 'hello "world"' """
+ExpStr1 = ['hello "world"']
+self.assertEqual(ExpStr1, splitquoted(TestStr1))
+
+TestStr1 = """ "hello 'world'" """
+ExpStr1 = ["hello 'world'"]
+self.assertEqual(ExpStr1, splitquoted(TestStr1))
+
+TestStr1 = """ "hello 'world'"  'hello "abcd"' """
+ExpStr1 = ["hello 'world'", 'hello "abcd"']
+self.assertEqual(ExpStr1, splitquoted(TestStr1))
+
+TestStr1 = """ "hello 'world'"  'hello "abcd"'  \t\n\r\v\f  \x64 """
+ExpStr1 = ["hello 'world'", 'hello "abcd"', '\x64']
+self.assertEqual(ExpStr1, splitquoted(TestStr1))
+
+TestStr1 = """ "hello 'world'"  'hello "abcd"  \t\n\r\v\f  \x64' """
+ExpStr1 = ["hello 'world'", 'hello "abcd"  \t\n\r\v\f  \x64']
+self.assertEqual(ExpStr1, splitquoted(TestStr1))
+
+if __name__ == '__main__':
+unittest.main()
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/3] BaseTools: Implement splitquoted function in Build tool

2019-02-02 Thread Feng, Bob C
https://bugzilla.tianocore.org/show_bug.cgi?id=1509
On some Linux environment, there may be no distutils.util
library for python3 that will cause build tool crash.
This patch implement distutils.util.split_quoted
in BaseTools so that the build tool will be independent with
distutils.util library.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/AutoGen/UniClassObject.py | 50 
++
 1 file changed, 46 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py 
b/BaseTools/Source/Python/AutoGen/UniClassObject.py
index d162387cc5..c4b39d25d4 100644
--- a/BaseTools/Source/Python/AutoGen/UniClassObject.py
+++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py
@@ -16,11 +16,10 @@
 ##
 # Import Modules
 #
 from __future__ import print_function
 import Common.LongFilePathOs as os, codecs, re
-import distutils.util
 import Common.EdkLogger as EdkLogger
 from io import BytesIO
 from Common.BuildToolError import *
 from Common.StringUtils import GetLineNo
 from Common.Misc import PathClass
@@ -41,11 +40,11 @@ NON_BREAKING_CHAR = u'\uFFF2'
 CR = u'\u000D'
 LF = u'\u000A'
 NULL = u'\u'
 TAB = u'\t'
 BACK_SLASH_PLACEHOLDER = u'\u0006'
-
+WHITESPACE = ' \t\n\r\v\f'
 gIncludePattern = re.compile("^#include +[\"<]+([^\"< >]+)[>\"]+$", 
re.MULTILINE | re.UNICODE)
 
 ## Convert a unicode string to a Hex list
 #
 # Convert a unicode string to a Hex list
@@ -216,10 +215,54 @@ def StripComments(Line):
 CommentPos = Line.find (Comment, CommentPos + 1)
 else:
 return Line[:CommentPos].strip()
 return Line.strip()
 
+#
+# This function implement distutils.util.split_quoted in another way.
+#
+def splitquoted(s):
+words = []
+word = []
+InQuoted = False
+escaped = False
+CurrentQ = ""
+s = s.strip()
+for ch in s:
+if escaped:
+# preserve whatever is escaped;
+# This char will become part of the current word
+word.append(ch)
+escaped = False
+continue
+
+if ch in WHITESPACE and not InQuoted:
+# unescaped, unquoted whitespace: now
+# we definitely have a word delimiter
+if "".join(word):
+words.append("".join(word))
+word = []
+continue
+elif ch == "\\":
+escaped = True
+if not InQuoted:
+continue
+else:
+# handle singly-quoted string or doubly-quoted string
+if ch =='"' or ch == "'":
+if not InQuoted:
+InQuoted = True
+CurrentQ = ch
+continue
+elif ch == CurrentQ:
+InQuoted = False
+continue
+word.append(ch)
+if word:
+words.append("".join(word))
+return words
+
 ## UniFileClassObject
 #
 # A structure for .uni file definition
 #
 class UniFileClassObject(object):
@@ -232,16 +275,15 @@ class UniFileClassObject(object):
 self.OrderedStringListByToken = {}  #{ u'LanguageIdentifier' : 
{Token: StringDefClassObject} }
 self.IsCompatibleMode = IsCompatibleMode
 self.IncludePathList = IncludePathList
 if len(self.FileList) > 0:
 self.LoadUniFiles(FileList)
-
 #
 # Get Language definition
 #
 def GetLangDef(self, File, Line):
-Lang = distutils.util.split_quoted((Line.split(u"//")[0]))
+Lang = splitquoted((Line.split(u"//")[0]))
 if len(Lang) != 3:
 try:
 FileIn = 
UniFileClassObject.OpenUniFile(LongFilePath(File.Path))
 except UnicodeError as X:
 EdkLogger.error("build", FILE_READ_FAILURE, "File read 
failure: %s" % str(X), ExtraData=File);
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/3] BaseTools: Implement splitquoted function in UPT

2019-02-02 Thread Feng, Bob C
On some Linux environment, there may be no distutils.util
library for python3 that will cause UPT crash.
This patch implement distutils.util.split_quoted
in BaseTools so that the UPT tool will be independent with
distutils.util library.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/UPT/Library/UniClassObject.py | 47 
---
 1 file changed, 44 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/UPT/Library/UniClassObject.py 
b/BaseTools/Source/Python/UPT/Library/UniClassObject.py
index bd7804b753..79aa252507 100644
--- a/BaseTools/Source/Python/UPT/Library/UniClassObject.py
+++ b/BaseTools/Source/Python/UPT/Library/UniClassObject.py
@@ -18,11 +18,10 @@ from __future__ import print_function
 
 ##
 # Import Modules
 #
 import os, codecs, re
-import distutils.util
 from Logger import ToolError
 from Logger import Log as EdkLogger
 from Logger import StringTable as ST
 from Library.StringUtils import GetLineNo
 from Library.Misc import PathClass
@@ -36,11 +35,11 @@ from Library.ParserValidate import CheckUTF16FileHeader
 UNICODE_WIDE_CHAR = u'\\wide'
 UNICODE_NARROW_CHAR = u'\\narrow'
 UNICODE_NON_BREAKING_CHAR = u'\\nbr'
 UNICODE_UNICODE_CR = '\r'
 UNICODE_UNICODE_LF = '\n'
-
+WHITESPACE = ' \t\n\r\v\f'
 NARROW_CHAR = u'\uFFF0'
 WIDE_CHAR = u'\uFFF1'
 NON_BREAKING_CHAR = u'\uFFF2'
 CR = u'\u000D'
 LF = u'\u000A'
@@ -296,11 +295,53 @@ class StringDefClassObject(object):
 self.StringValue = self.StringValue + '\r\n' + Value
 else:
 self.StringValue = Value
 self.StringValueByteList = UniToHexList(self.StringValue)
 self.Length = len(self.StringValueByteList)
+#
+# This function implement distutils.util.split_quoted in another way.
+#
+def splitquoted(s):
+words = []
+word = []
+InQuoted = False
+escaped = False
+CurrentQ = ""
+s = s.strip()
+for ch in s:
+if escaped:
+# preserve whatever is escaped;
+# This char will become part of the current word
+word.append(ch)
+escaped = False
+continue
 
+if ch in WHITESPACE and not InQuoted:
+# unescaped, unquoted whitespace: now
+# we definitely have a word delimiter
+if "".join(word):
+words.append("".join(word))
+word = []
+continue
+elif ch == "\\":
+escaped = True
+if not InQuoted:
+continue
+else:
+# handle singly-quoted string or doubly-quoted string
+if ch =='"' or ch == "'":
+if not InQuoted:
+InQuoted = True
+CurrentQ = ch
+continue
+elif ch == CurrentQ:
+InQuoted = False
+continue
+word.append(ch)
+if word:
+words.append("".join(word))
+return words
 ## UniFileClassObject
 #
 # A structure for .uni file definition
 #
 class UniFileClassObject(object):
@@ -324,11 +365,11 @@ class UniFileClassObject(object):
 
 #
 # Get Language definition
 #
 def GetLangDef(self, File, Line):
-Lang = distutils.util.split_quoted((Line.split(u"//")[0]))
+Lang = splitquoted((Line.split(u"//")[0]))
 if len(Lang) != 3:
 try:
 FileIn = codecs.open(File.Path, mode='rb', 
encoding='utf_8').readlines()
 except UnicodeError as Xstr:
 FileIn = codecs.open(File.Path, mode='rb', 
encoding='utf_16').readlines()
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: Correct the PcdDatabase Info in AutoGen

2019-02-01 Thread Feng, Bob C
From: Zhaozh1x 

PcdDriver AutoGen code shows PCD DB format for debug purpose only.
But now, AutoGen code doesn't exactly match the generated
PCD DB binary file. It brings the complex for Pcd driver debug.

This patch is going to fix that issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/AutoGen/GenPcdDb.py | 41 +
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py 
b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index cbf7a39dd5..2ca9001417 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -52,23 +52,32 @@ ${END}
 ${BEGIN}{ ${EXMAPPING_TABLE_EXTOKEN}, ${EXMAPPING_TABLE_LOCAL_TOKEN}, 
${EXMAPPING_TABLE_GUID_INDEX} },
 ${END}
   },
   /* LocalTokenNumberTable */
   {
-${BEGIN}offsetof(${PHASE}_PCD_DATABASE, 
${TOKEN_INIT}.${TOKEN_CNAME}_${TOKEN_GUID}${VARDEF_HEADER}) | ${TOKEN_TYPE},
+${BEGIN}${LOCAL_TOKEN_NUMBER_DB_VALUE}, /* offsetof(${PHASE}_PCD_DATABASE, 
${TOKEN_INIT}.${TOKEN_CNAME}_${TOKEN_GUID}${VARDEF_HEADER}) | ${TOKEN_TYPE} */
 ${END}
   },
   /* GuidTable */
   {
 ${BEGIN}${GUID_STRUCTURE},
 ${END}
   },
+  /* StringHead */
 ${BEGIN}  { ${STRING_HEAD_VALUE} }, /* 
${STRING_HEAD_CNAME_DECL}_${STRING_HEAD_GUID_DECL}[${STRING_HEAD_NUMSKUS_DECL}] 
*/
 ${END}
+  /* PcdNameTable */
+  /* TokenSpaceCNameIndex, PcdCNameIndex, TokenSpaceCNameIndex, PcdCNameIndex, 
.. */
+  {
+${BEGIN}${PCD_NAME_OFFSET},
+${END}
+  },
+  /* VariableHead */
+  /* StringIndex, DefaultValueOffset, GuidTableIndex, Offset, Attributes, 
Property */
 ${BEGIN}  /* 
${VARIABLE_HEAD_CNAME_DECL}_${VARIABLE_HEAD_GUID_DECL}_Variable_Header[${VARIABLE_HEAD_NUMSKUS_DECL}]
 */
   {
-${VARIABLE_HEAD_VALUE}
+${VARIABLE_DB_VALUE}
   },
 ${END}
 /* SkuHead */
   {
   ${BEGIN} offsetof (${PHASE}_PCD_DATABASE, 
${TOKEN_INIT}.${TOKEN_CNAME}_${TOKEN_GUID}${VARDEF_HEADER}) | ${TOKEN_TYPE}, /* 
*/
@@ -76,10 +85,20 @@ ${END}
   ${END}
   },
  /* StringTable */
 ${BEGIN}  ${STRING_TABLE_VALUE}, /* ${STRING_TABLE_CNAME}_${STRING_TABLE_GUID} 
*/
 ${END}
+  /* PcdTokenTable */
+   {
+${BEGIN}${PCD_TOKENSPACE}, /* PCD_TOKENSPACE */
+${END}
+  },
+  /* PcdCNameTable */
+  {
+${BEGIN}${PCD_CNAME}, /* PCD_CNAME */
+${END}
+  },
   /* SizeTable */
   {
 ${BEGIN}${SIZE_TABLE_MAXIMUM_LENGTH}, ${SIZE_TABLE_CURRENT_LENGTH}, /* 
${SIZE_TABLE_CNAME}_${SIZE_TABLE_GUID} */
 ${END}
   },
@@ -1221,18 +1240,10 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, 
DynamicPcdList, Phase):
 if VariableGuid not in GuidList:
 GuidList.append(VariableGuid)
 Dict['GUID_STRUCTURE'].append(VariableGuidStructure)
 VariableHeadGuidIndex = GuidList.index(VariableGuid)
 
-if "PCD_TYPE_STRING" in Pcd.TokenTypeList:
-VariableHeadValueList.append('%dU, 
offsetof(%s_PCD_DATABASE, Init.%s_%s), %dU, %sU' %
- (VariableHeadStringIndex, 
Phase, CName, TokenSpaceGuid,
- VariableHeadGuidIndex, 
Sku.VariableOffset))
-else:
-VariableHeadValueList.append('%dU, 
offsetof(%s_PCD_DATABASE, Init.%s_%s_VariableDefault_%s), %dU, %sU' %
- (VariableHeadStringIndex, 
Phase, CName, TokenSpaceGuid, SkuIdIndex,
- VariableHeadGuidIndex, 
Sku.VariableOffset))
 Dict['VARDEF_CNAME_'+Pcd.DatumType].append(CName)
 Dict['VARDEF_GUID_'+Pcd.DatumType].append(TokenSpaceGuid)
 Dict['VARDEF_SKUID_'+Pcd.DatumType].append(SkuIdIndex)
 if "PCD_TYPE_STRING" in  Pcd.TokenTypeList:
 Dict['VARDEF_VALUE_' + Pcd.DatumType].append("%s_%s[%d]" % 
(Pcd.TokenCName, TokenSpaceGuid, SkuIdIndex))
@@ -1571,13 +1582,11 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, 
DynamicPcdList, Phase):
 if AvailableSkuNumber not in Dict['SKUID_VALUE']:
 Dict['SKUID_VALUE'].append(AvailableSkuNumber)
 Dict['SKUID_VALUE'][0] = len(Dict['SKUID_VALUE']) - 1
 
 AutoGenH.Append(gPcdDatabaseAutoGenH.Replace(Dict))
-if NumberOfLocalTokens == 0:
-AutoGenC.Append(gEmptyPcdDatabaseAutoGenC.Replace(Dict))
-else:
+if NumberOfLocalTokens != 0:
 #
 # Update Size Table to the right order, it should be same with 
LocalTokenNumberTable
 #
 SizeCNameTempList = []
 SizeGuidTempList = []
@@ -1603,15 +1612,17 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, 
DynamicPcdList, Phase):
 Dict['SIZE_TABLE_CNAME'][Count] = SizeCNameTempList[Count]
 Dict['SIZE_TABLE_GUID'][Count] = SizeGuidTempList[Count]
 Dict['SIZE_TABLE_CURRENT_LENGTH'][Count] = 
SizeCur

[edk2] [Patch] BaseTools: Correct the error message for UPT

2019-02-01 Thread Feng, Bob C
This patch is going to correct the error message
for UPT.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hess Chen 
Cc: Liming Gao 
---
 .../Python/UPT/Library/UniClassObject.py   | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/BaseTools/Source/Python/UPT/Library/UniClassObject.py 
b/BaseTools/Source/Python/UPT/Library/UniClassObject.py
index cd575d5a34..7a056b349f 100644
--- a/BaseTools/Source/Python/UPT/Library/UniClassObject.py
+++ b/BaseTools/Source/Python/UPT/Library/UniClassObject.py
@@ -1,9 +1,9 @@
 ## @file
 # Collect all defined strings in multiple uni files.
 #
-# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
 #
 # This program and the accompanying materials are licensed and made available
 # under the terms and conditions of the BSD License which accompanies this
 # distribution. The full text of the license may be found at
 # http://opensource.org/licenses/bsd-license.php
@@ -593,10 +593,19 @@ class UniFileClassObject(object):
 StringEntryExistsFlag = 1
 if not Line.endswith('"'):
 EdkLogger.Error("Unicode File Parser", 
ToolError.FORMAT_INVALID,
 ExtraData='''The line %s misses '"' at the 
end of it in file %s'''
   % (LineCount, File.Path))
+
+#
+# Check the situation that there has more than 2 '"' for the 
language entry
+#
+if Line.strip() and Line.replace(u'\\"', '').count(u'"') > 2:
+EdkLogger.Error("Unicode File Parser", 
ToolError.FORMAT_INVALID,
+ExtraData='''The line %s has more than 2 
'"' for language entry in file %s'''
+% (LineCount, File.Path))
+
 elif Line.startswith(u'#language'):
 if StringEntryExistsFlag == 2:
 EdkLogger.Error("Unicode File Parser", 
ToolError.FORMAT_INVALID,
 Message=ST.ERR_UNI_MISS_STRING_ENTRY % 
Line, ExtraData=File.Path)
 StringEntryExistsFlag = 0
@@ -741,17 +750,10 @@ class UniFileClassObject(object):
 NewLines.append((Line[:Line.find(u'"')]).strip())
 NewLines.append((Line[Line.find(u'"'):]).strip())
 else:
 EdkLogger.Error("Unicode File Parser", 
ToolError.FORMAT_INVALID, ExtraData=File.Path)
 elif Line.startswith(u'"'):
-#
-# Check the situation that there has more than 2 '"' for the 
language entry
-#
-if Line.replace(u'\\"', '').count(u'"') > 2:
-EdkLogger.Error("Unicode File Parser", 
ToolError.FORMAT_INVALID,
-ExtraData='''The line %s has more than 2 
'"' for language entry in file %s'''
-% (LineCount, File.Path))
 if u'#string' in Line  or u'#language' in Line:
 EdkLogger.Error("Unicode File Parser", 
ToolError.FORMAT_INVALID, ExtraData=File.Path)
 NewLines.append(Line)
 else:
 print(Line)
-- 
2.19.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH V2] BaseTools: PCD value incorrect in structure pcd sku case.

2019-02-01 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Friday, February 1, 2019 3:41 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH V2] BaseTools: PCD value incorrect in structure pcd sku 
case.

Defined 2 PCDs(Test4 & Test401) and 2 SKUs(DEFAULT & _), then set 
"SKUID_Defines" to ALL, for FixedAtBuild gEfiStructuredPcdPkgTokenSpaceGuid. 
Test401 in this case, its value should get from "Default" SKU, not from "_" 
SKU, but we does not set value in SKU "_" in dsc, so Test401 should only 
display the value get from dec.

Missing the map() function causes SKU specific items to not be deleted

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index a96502b4bf..afcf99e66b 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1613,7 +1613,7 @@ class DscBuildData(PlatformBuildClassObject):
 elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in 
pcd.SkuInfoList:
 del pcd.SkuInfoList[TAB_COMMON]
 
-list((self.FilterSkuSettings, [Pcds[pcdkey] for pcdkey in Pcds if 
Pcds[pcdkey].Type in DynamicPcdType]))
+list(map(self.FilterSkuSettings, [Pcds[pcdkey] for pcdkey in 
+ Pcds if Pcds[pcdkey].Type in DynamicPcdType]))
 return Pcds
 @cached_property
 def PlatformUsedPcds(self):
--
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools:StructurePCD value display incorrect in "Not used" section.

2019-02-01 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: Fan, ZhijuX 
Sent: Friday, February 1, 2019 10:11 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Feng, Bob C 
Subject: [edk2][PATCH] BaseTools:StructurePCD value display incorrect in "Not 
used" section.

StructurePCD value display incorrect in "Not used" section, that the value 
defined in structure does not show.

StructurePCD will not display in "Not Used" section if main structure not 
define in dsc and pcd not in inf

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++--
 BaseTools/Source/Python/build/BuildReport.py  | 7 +++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 0dad04212e..661852b1d5 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1511,9 +1511,9 @@ class DscBuildData(PlatformBuildClassObject):
 else:
 str_pcd_obj_str.DefaultFromDSC = 
{skuname:{defaultstore: 
str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, 
str_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in 
DefaultStores} for skuname in str_pcd_obj.SkuInfoList}
 S_pcd_set[Pcd] = str_pcd_obj_str
-self.FilterStrcturePcd(S_pcd_set)
 if S_pcd_set:
-GlobalData.gStructurePcd[self.Arch] = S_pcd_set
+GlobalData.gStructurePcd[self.Arch] = S_pcd_set.copy()
+self.FilterStrcturePcd(S_pcd_set)
 for stru_pcd in S_pcd_set.values():
 for skuid in SkuIds:
 if skuid in stru_pcd.SkuOverrideValues:
diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index ae37a6ce0e..4094c9c488 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -780,6 +780,13 @@ class PcdReport(object):
 # Collect the PCD defined in DSC/FDF file, but not used in module
 #
 UnusedPcdFullList = []
+StructPcdDict = GlobalData.gStructurePcd[self.Arch]
+for Name, Guid in StructPcdDict:
+if (Name, Guid) not in Pa.Platform.Pcds:
+Pcd = StructPcdDict[(Name, Guid)]
+PcdList = self.AllPcds.setdefault(Guid, 
{}).setdefault(Pcd.Type, [])
+if Pcd not in PcdList and Pcd not in UnusedPcdFullList:
+UnusedPcdFullList.append(Pcd)
 for item in Pa.Platform.Pcds:
 Pcd = Pa.Platform.Pcds[item]
 if not Pcd.Type:
--
2.14.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools/ECC: Add a new type of exception

2019-02-01 Thread Feng, Bob C
Reviewed-by: Bob Feng 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Feng, 
Bob C
Sent: Wednesday, January 30, 2019 4:49 PM
To: edk2-devel@lists.01.org
Cc: Chen, Hess 
Subject: [edk2] [PATCH] BaseTools/ECC: Add a new type of exception

From: Hess Chen 

Add a new type of exception for function body checkpoint.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen 
---
 BaseTools/Source/Python/Ecc/c.py | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index b8d6adde16..577d92744c 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -1,7 +1,7 @@
 ## @file
 # This file is used to be the c coding style checking of ECC tool  # -# 
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2019, Intel Corporation. All rights 
+reserved.
 # This program and the accompanying materials  # are licensed and made 
available under the terms and conditions of the BSD License  # which 
accompanies this distribution.  The full text of the license may be found at @@ 
-1511,7 +1511,7 @@ def CheckFuncLayoutBody(FullFileName):
 
 FileTable = 'Identifier' + str(FileID)
 Db = GetDB()
-SqlStatement = """ select BodyStartColumn, EndColumn, ID
+SqlStatement = """ select BodyStartColumn, EndColumn, ID, Name
from Function
where BelongsToFile = %d
""" % (FileID)
@@ -1520,9 +1520,15 @@ def CheckFuncLayoutBody(FullFileName):
 return ErrorMsgList
 for Result in ResultSet:
 if Result[0] != 0:
-PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY, 'open 
brace should be at the very beginning of a line.', 'Function', Result[2])
+if not 
EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY,
 Result[3]):
+PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY,
+  'The open brace should be at the very beginning 
of a line for the function [%s].' % Result[3],
+  'Function', Result[2])
 if Result[1] != 0:
-PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY, 'close 
brace should be at the very beginning of a line.', 'Function', Result[2])
+if not 
EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY,
 Result[3]):
+PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY,
+  'The close brace should be at the very beginning 
of a line for the function [%s].' % Result[3],
+  'Function', Result[2])
 
 def CheckFuncLayoutLocalVariable(FullFileName):
 ErrorMsgList = []
--
2.14.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: Fix the build report issue about Structure PCD

2019-02-01 Thread Feng, Bob C
https://bugzilla.tianocore.org/show_bug.cgi?id=1472
build report use incorrect method to parse DynamicDefault/DynamicExDefault
and DynamicVpd/DynamicExVpd structure Pcd value.

This patch is to fix this issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/build/BuildReport.py | 21 +++-
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index 8d3b030151..64f8a68516 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -1109,24 +1109,17 @@ class PcdReport(object):
 break
 else:
 SkuList = sorted(Pcd.SkuInfoList.keys())
 for Sku in SkuList:
 SkuInfo = Pcd.SkuInfoList[Sku]
-if TypeName in ('DYNHII', 'DEXHII'):
-if SkuInfo.DefaultStoreDict:
-DefaultStoreList = 
sorted(SkuInfo.DefaultStoreDict.keys())
-for DefaultStore in 
DefaultStoreList:
-OverrideValues = 
Pcd.SkuOverrideValues[Sku]
-DscOverride = 
self.ParseStruct(OverrideValues[DefaultStore])
-if DscOverride:
-break
-else:
-OverrideValues = 
Pcd.SkuOverrideValues[Sku]
-if OverrideValues:
-Keys = 
list(OverrideValues.keys())
-OverrideFieldStruct = 
self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]])
-DscOverride = 
self.ParseStruct(OverrideFieldStruct)
+if SkuInfo.DefaultStoreDict:
+DefaultStoreList = 
sorted(SkuInfo.DefaultStoreDict.keys())
+for DefaultStore in 
DefaultStoreList:
+OverrideValues = 
Pcd.SkuOverrideValues[Sku]
+DscOverride = 
self.ParseStruct(OverrideValues[DefaultStore])
+if DscOverride:
+break
 if DscOverride:
 break
 if DscOverride:
 DscDefaultValue = True
 DscMatch = True
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch v2 00/33] BaseTools python3 migration patch set

2019-01-31 Thread Feng, Bob C
I have pushed py3 patch set to edk2 master.

Thanks,
Bob

-Original Message-
From: Gao, Liming 
Sent: Thursday, January 31, 2019 4:24 PM
To: Feng, Bob C ; Laszlo Ersek 
Cc: edk2-devel@lists.01.org
Subject: RE: [edk2] [Patch v2 00/33] BaseTools python3 migration patch set

Bob:
  I have no other comments on this patch set. Reviewed-by: Liming Gao 


Thanks
Liming
> -Original Message-
> From: Feng, Bob C
> Sent: Wednesday, January 30, 2019 1:25 PM
> To: Gao, Liming ; Laszlo Ersek 
> 
> Cc: edk2-devel@lists.01.org
> Subject: RE: [edk2] [Patch v2 00/33] BaseTools python3 migration patch 
> set
> 
> I agree this proposal.
> I plan to push python3 patch set to edk2 master in this Friday 
> morning, Feb.1 PRC time if there is no more comments or no critical issues 
> found.
> 
> Thanks,
> Bob
> 
> -Original Message-
> From: Gao, Liming
> Sent: Wednesday, January 30, 2019 9:53 AM
> To: Laszlo Ersek ; Feng, Bob C 
> 
> Cc: edk2-devel@lists.01.org
> Subject: RE: [edk2] [Patch v2 00/33] BaseTools python3 migration patch 
> set
> 
> Laszlo:
>  I agree your proposal. Push this patch set first if no other comments, then 
> continue to do minor bug fix.
> 
> Thanks
> Liming
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf 
> > Of Laszlo Ersek
> > Sent: Tuesday, January 29, 2019 9:07 PM
> > To: Feng, Bob C 
> > Cc: edk2-devel@lists.01.org
> > Subject: Re: [edk2] [Patch v2 00/33] BaseTools python3 migration 
> > patch set
> >
> > Hi Bob,
> >
> > On 01/29/19 03:05, Feng, Bob C wrote:
> > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=55
> > >
> > > V2:
> > > The python files under CParser4 folder of ECC/Eot tool are 
> > > generated by antlr4 and forpython3 usage.
> > > They have python3 specific syntax, for example the data type 
> > > declaration for the arguments of a function. That is not 
> > > compitable with python2. this patch is to remove these syntax.
> > >
> > > The version2 patch set is commit to 
> > > https://github.com/BobCF/edk2.git branch py3basetools_v2
> >
> > (reusing the "test plan" from my email at 
> > <http://mid.mail-archive.com/cab4fed6-4c5d-94a9-b29f-da41ad7f320e@re
> > dh
> > at.com>:)
> >
> > I ran the following tests, at commit 6edb6bd9f182 ("BaseTools: Eot 
> > tool
> > Python3 adaption", 2019-01-29). Each test was performed in a clean 
> > tree (after running "git clean -ffdx") and clean environment (I 
> > re-sourced "edksetup.sh" for each test in separation). In addition, 
> > the base tools were rebuilt (again from a clean tree) for each test, 
> > with the following command [1]:
> >
> >   nice make -C "$EDK_TOOLS_PATH" -j $(getconf _NPROCESSORS_ONLN)
> >
> > (a) On my RHEL7.5 Workstation laptop, I have both the system-level 
> > python packages installed (python-2.7.5-69.el7_5.x86_64), and the 
> > extra
> > python-3.4 stuff from EPEL-7 (python34-3.4.9-1.el7.x86_64).
> >
> > (a1) Didn't set either PYTHON3_ENABLE or PYTHON_COMMAND. The build 
> > utility picked
> >
> >   PYTHON_COMMAND   = /usr/bin/python3.4
> >
> > and I successfully built OvmfPkg for IA32, IA32X64, and X64; also 
> > ArmVirtQemu for AARCH64. The built firmware images passed a smoke 
> > test too.
> >
> > (a2) I removed all the python34 packages (and the dependent 
> > packages) from my laptop. Didn't set either of PYTHON3_ENABLE and 
> > PYTHON_COMMAND.
> > (This is the configuration what a "normal" RHEL7 environment would
> > provide.) The "build" utility didn't print any PYTHON_COMMAND 
> > setting, but the same fw platform builds as in (a1) completed fine. 
> > The smoke tests passed again as well.
> >
> > (b) RHEL-8 virtual machine, with "/usr/bin/python3.6" from 
> > python36-3.6.6-18.el8.x86_64, and "/usr/libexec/platform-python" 
> > from platform-python-3.6.8-1.el8.x86_64.
> >
> > (b1) Didn't set either PYTHON3_ENABLE or PYTHON_COMMAND. The build 
> > utility picked
> >
> >   PYTHON_COMMAND   = /usr/bin/python3.6
> >
> > and I successfully built OvmfPkg for IA32, IA32X64, and X64. (I 
> > don't have a cross-compiler installed in this environment yet, nor a 
> > RHEL8
> > aarch64 KVM guest, so I couldn't test ArmVirtQemu for now).
> >
> > (b2) I set PYTHON_COMMAND to "/usr/libexec/platform-python". Didn't 
> > set PYTHON3_ENABLE. The same builds as in (b1) succeeded.
> >
> >
> > For the series:
> >
> > Tested-by: Laszlo Ersek 
> >
> > Given that the testing is quite time consuming, I suggest that we 
> > push
> > v2 (assuming reviewers don't find critical issues), and address 
> > small issues incrementally.
> >
> > Thanks!
> > Laszlo
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: Fixed incorrect line number in PcdValueInit.c

2019-01-30 Thread Feng, Bob C
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1435
This patch is going to fix the issue of incorrect line
number in PcdValueInit.c

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Workspace/MetaFileTable.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileTable.py 
b/BaseTools/Source/Python/Workspace/MetaFileTable.py
index 823a87e057..8832fc0a8f 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileTable.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileTable.py
@@ -391,11 +391,11 @@ class PlatformTable(MetaFileTable):
 else:
 result = [item for item in result if item[8] < 0]
 if FromItem is not None:
 result = [item for item in result if item[9] == FromItem]
 
-result = [ [r[2],r[3],r[4],r[5],r[6],r[7],r[0],r[9]] for r in result ]
+result = [ [r[2],r[3],r[4],r[5],r[6],r[7],r[0],r[10]] for r in result ]
 return result
 
 def DisableComponent(self,comp_id):
 for item in self.CurrentContent:
 if item[0] == comp_id or item[8] == comp_id:
-- 
2.20.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] BaseTools/ECC: Add a new type of exception

2019-01-30 Thread Feng, Bob C
From: Hess Chen 

Add a new type of exception for function body checkpoint.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen 
---
 BaseTools/Source/Python/Ecc/c.py | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index b8d6adde16..577d92744c 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -1,7 +1,7 @@
 ## @file
 # This file is used to be the c coding style checking of ECC tool
 #
-# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
 # which accompanies this distribution.  The full text of the license may be 
found at
@@ -1511,7 +1511,7 @@ def CheckFuncLayoutBody(FullFileName):
 
 FileTable = 'Identifier' + str(FileID)
 Db = GetDB()
-SqlStatement = """ select BodyStartColumn, EndColumn, ID
+SqlStatement = """ select BodyStartColumn, EndColumn, ID, Name
from Function
where BelongsToFile = %d
""" % (FileID)
@@ -1520,9 +1520,15 @@ def CheckFuncLayoutBody(FullFileName):
 return ErrorMsgList
 for Result in ResultSet:
 if Result[0] != 0:
-PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY, 'open 
brace should be at the very beginning of a line.', 'Function', Result[2])
+if not 
EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY,
 Result[3]):
+PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY,
+  'The open brace should be at the very beginning 
of a line for the function [%s].' % Result[3],
+  'Function', Result[2])
 if Result[1] != 0:
-PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY, 'close 
brace should be at the very beginning of a line.', 'Function', Result[2])
+if not 
EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY,
 Result[3]):
+PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY,
+  'The close brace should be at the very beginning 
of a line for the function [%s].' % Result[3],
+  'Function', Result[2])
 
 def CheckFuncLayoutLocalVariable(FullFileName):
 ErrorMsgList = []
-- 
2.14.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch v2 00/33] BaseTools python3 migration patch set

2019-01-29 Thread Feng, Bob C
I agree this proposal. 
I plan to push python3 patch set to edk2 master in this Friday morning, Feb.1 
PRC time if there is no more comments or no critical issues found.

Thanks,
Bob

-Original Message-
From: Gao, Liming 
Sent: Wednesday, January 30, 2019 9:53 AM
To: Laszlo Ersek ; Feng, Bob C 
Cc: edk2-devel@lists.01.org
Subject: RE: [edk2] [Patch v2 00/33] BaseTools python3 migration patch set

Laszlo:
 I agree your proposal. Push this patch set first if no other comments, then 
continue to do minor bug fix. 
 
Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Laszlo Ersek
> Sent: Tuesday, January 29, 2019 9:07 PM
> To: Feng, Bob C 
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] [Patch v2 00/33] BaseTools python3 migration patch 
> set
> 
> Hi Bob,
> 
> On 01/29/19 03:05, Feng, Bob C wrote:
> > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=55
> >
> > V2:
> > The python files under CParser4 folder of ECC/Eot tool are generated 
> > by antlr4 and forpython3 usage.
> > They have python3 specific syntax, for example the data type 
> > declaration for the arguments of a function. That is not compitable 
> > with python2. this patch is to remove these syntax.
> >
> > The version2 patch set is commit to 
> > https://github.com/BobCF/edk2.git branch py3basetools_v2
> 
> (reusing the "test plan" from my email at
> <http://mid.mail-archive.com/cab4fed6-4c5d-94a9-b29f-da41ad7f320e@redh
> at.com>:)
> 
> I ran the following tests, at commit 6edb6bd9f182 ("BaseTools: Eot 
> tool
> Python3 adaption", 2019-01-29). Each test was performed in a clean 
> tree (after running "git clean -ffdx") and clean environment (I 
> re-sourced "edksetup.sh" for each test in separation). In addition, 
> the base tools were rebuilt (again from a clean tree) for each test, 
> with the following command [1]:
> 
>   nice make -C "$EDK_TOOLS_PATH" -j $(getconf _NPROCESSORS_ONLN)
> 
> (a) On my RHEL7.5 Workstation laptop, I have both the system-level 
> python packages installed (python-2.7.5-69.el7_5.x86_64), and the 
> extra
> python-3.4 stuff from EPEL-7 (python34-3.4.9-1.el7.x86_64).
> 
> (a1) Didn't set either PYTHON3_ENABLE or PYTHON_COMMAND. The build 
> utility picked
> 
>   PYTHON_COMMAND   = /usr/bin/python3.4
> 
> and I successfully built OvmfPkg for IA32, IA32X64, and X64; also 
> ArmVirtQemu for AARCH64. The built firmware images passed a smoke test 
> too.
> 
> (a2) I removed all the python34 packages (and the dependent packages) 
> from my laptop. Didn't set either of PYTHON3_ENABLE and PYTHON_COMMAND.
> (This is the configuration what a "normal" RHEL7 environment would
> provide.) The "build" utility didn't print any PYTHON_COMMAND setting, 
> but the same fw platform builds as in (a1) completed fine. The smoke 
> tests passed again as well.
> 
> (b) RHEL-8 virtual machine, with "/usr/bin/python3.6" from 
> python36-3.6.6-18.el8.x86_64, and "/usr/libexec/platform-python" from 
> platform-python-3.6.8-1.el8.x86_64.
> 
> (b1) Didn't set either PYTHON3_ENABLE or PYTHON_COMMAND. The build 
> utility picked
> 
>   PYTHON_COMMAND   = /usr/bin/python3.6
> 
> and I successfully built OvmfPkg for IA32, IA32X64, and X64. (I don't 
> have a cross-compiler installed in this environment yet, nor a RHEL8
> aarch64 KVM guest, so I couldn't test ArmVirtQemu for now).
> 
> (b2) I set PYTHON_COMMAND to "/usr/libexec/platform-python". Didn't 
> set PYTHON3_ENABLE. The same builds as in (b1) succeeded.
> 
> 
> For the series:
> 
> Tested-by: Laszlo Ersek 
> 
> Given that the testing is quite time consuming, I suggest that we push
> v2 (assuming reviewers don't find critical issues), and address small 
> issues incrementally.
> 
> Thanks!
> Laszlo
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch v2 00/33] BaseTools python3 migration patch set

2019-01-29 Thread Feng, Bob C
Hi Laszlo,

Thank you very much for the testing.

Thanks!
Bob

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Tuesday, January 29, 2019 9:07 PM
To: Feng, Bob C 
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] [Patch v2 00/33] BaseTools python3 migration patch set

Hi Bob,

On 01/29/19 03:05, Feng, Bob C wrote:
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=55
>
> V2:
> The python files under CParser4 folder of ECC/Eot tool are generated 
> by antlr4 and forpython3 usage.
> They have python3 specific syntax, for example the data type 
> declaration for the arguments of a function. That is not compitable 
> with python2. this patch is to remove these syntax.
>
> The version2 patch set is commit to https://github.com/BobCF/edk2.git 
> branch py3basetools_v2

(reusing the "test plan" from my email at
<cab4fed6-4c5d-94a9-b29f-da41ad7f320e@redhat.com">http://mid.mail-archive.com/cab4fed6-4c5d-94a9-b29f-da41ad7f320e@redhat.com>:)

I ran the following tests, at commit 6edb6bd9f182 ("BaseTools: Eot tool
Python3 adaption", 2019-01-29). Each test was performed in a clean tree (after 
running "git clean -ffdx") and clean environment (I re-sourced "edksetup.sh" 
for each test in separation). In addition, the base tools were rebuilt (again 
from a clean tree) for each test, with the following command [1]:

  nice make -C "$EDK_TOOLS_PATH" -j $(getconf _NPROCESSORS_ONLN)

(a) On my RHEL7.5 Workstation laptop, I have both the system-level python 
packages installed (python-2.7.5-69.el7_5.x86_64), and the extra
python-3.4 stuff from EPEL-7 (python34-3.4.9-1.el7.x86_64).

(a1) Didn't set either PYTHON3_ENABLE or PYTHON_COMMAND. The build utility 
picked

  PYTHON_COMMAND   = /usr/bin/python3.4

and I successfully built OvmfPkg for IA32, IA32X64, and X64; also ArmVirtQemu 
for AARCH64. The built firmware images passed a smoke test too.

(a2) I removed all the python34 packages (and the dependent packages) from my 
laptop. Didn't set either of PYTHON3_ENABLE and PYTHON_COMMAND.
(This is the configuration what a "normal" RHEL7 environment would
provide.) The "build" utility didn't print any PYTHON_COMMAND setting, but the 
same fw platform builds as in (a1) completed fine. The smoke tests passed again 
as well.

(b) RHEL-8 virtual machine, with "/usr/bin/python3.6" from 
python36-3.6.6-18.el8.x86_64, and "/usr/libexec/platform-python" from 
platform-python-3.6.8-1.el8.x86_64.

(b1) Didn't set either PYTHON3_ENABLE or PYTHON_COMMAND. The build utility 
picked

  PYTHON_COMMAND   = /usr/bin/python3.6

and I successfully built OvmfPkg for IA32, IA32X64, and X64. (I don't have a 
cross-compiler installed in this environment yet, nor a RHEL8
aarch64 KVM guest, so I couldn't test ArmVirtQemu for now).

(b2) I set PYTHON_COMMAND to "/usr/libexec/platform-python". Didn't set 
PYTHON3_ENABLE. The same builds as in (b1) succeeded.


For the series:

Tested-by: Laszlo Ersek 

Given that the testing is quite time consuming, I suggest that we push
v2 (assuming reviewers don't find critical issues), and address small issues 
incrementally.

Thanks!
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


  1   2   3   >