public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Fix a bug for different FV use same FILE statement Guid
@ 2017-12-28 17:40 Yonghong Zhu
  2017-12-29  2:30 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2017-12-28 17:40 UTC (permalink / raw)
  To: edk2-devel

We meet a case that different FV use same FILE statement Guid, but the
FILE content is different. current we use the Guid value as Ffs file
dir which cause the ffs file will be override. This patch use Guid
value and Fv name as ffs dir for FILE statement.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/GenFds/FfsFileStatement.py | 7 +++++--
 BaseTools/Source/Python/GenFds/FfsInfStatement.py  | 2 +-
 BaseTools/Source/Python/GenFds/Fv.py               | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/FfsFileStatement.py b/BaseTools/Source/Python/GenFds/FfsFileStatement.py
index edb1312..12ec95b 100644
--- a/BaseTools/Source/Python/GenFds/FfsFileStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsFileStatement.py
@@ -55,11 +55,11 @@ class FileStatement (FileStatementClassObject) :
     #   @param  Dict         dictionary contains macro and value pair
     #   @param  FvChildAddr  Array of the inside FvImage base address
     #   @param  FvParentAddr Parent Fv base address
     #   @retval string       Generated FFS file name
     #
-    def GenFfs(self, Dict = {}, FvChildAddr=[], FvParentAddr=None, IsMakefile=False):
+    def GenFfs(self, Dict = {}, FvChildAddr=[], FvParentAddr=None, IsMakefile=False, FvName=None):
         
         if self.NameGuid != None and self.NameGuid.startswith('PCD('):
             PcdValue = GenFdsGlobalVariable.GetPcdValue(self.NameGuid)
             if len(PcdValue) == 0:
                 EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT defined.' \
@@ -70,11 +70,14 @@ class FileStatement (FileStatementClassObject) :
             if len(RegistryGuidStr) == 0:
                 EdkLogger.error("GenFds", GENFDS_ERROR, 'GUID value for %s in wrong format.' \
                             % (self.NameGuid))
             self.NameGuid = RegistryGuidStr
         
-        OutputDir = os.path.join(GenFdsGlobalVariable.FfsDir, self.NameGuid)
+        Str = self.NameGuid
+        if FvName:
+            Str += FvName
+        OutputDir = os.path.join(GenFdsGlobalVariable.FfsDir, Str)
         if not os.path.exists(OutputDir):
             os.makedirs(OutputDir)
 
         Dict.update(self.DefineVarDict)
         SectionAlignments = None
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 4b47817..baee543 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -420,11 +420,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #   @param  Dict         dictionary contains macro and value pair
     #   @param  FvChildAddr  Array of the inside FvImage base address
     #   @param  FvParentAddr Parent Fv base address
     #   @retval string       Generated FFS file name
     #
-    def GenFfs(self, Dict = {}, FvChildAddr = [], FvParentAddr=None, IsMakefile=False):
+    def GenFfs(self, Dict = {}, FvChildAddr = [], FvParentAddr=None, IsMakefile=False, FvName=None):
         #
         # Parse Inf file get Module related information
         #
 
         self.__InfParse__(Dict)
diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py
index d5922c0..a69abb3 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -119,11 +119,11 @@ class FV (FvClassObject):
             if Flag:
                 if isinstance(FfsFile, FfsFileStatement.FileStatement):
                     continue
             if GenFdsGlobalVariable.EnableGenfdsMultiThread and GenFdsGlobalVariable.ModuleFile and GenFdsGlobalVariable.ModuleFile.Path.find(os.path.normpath(FfsFile.InfFileName)) == -1:
                 continue
-            FileName = FfsFile.GenFfs(MacroDict, FvParentAddr=BaseAddress, IsMakefile=Flag)
+            FileName = FfsFile.GenFfs(MacroDict, FvParentAddr=BaseAddress, IsMakefile=Flag, FvName=self.UiFvName)
             FfsFileList.append(FileName)
             if not Flag:
                 self.FvInfFile.writelines("EFI_FILE_NAME = " + \
                                             FileName          + \
                                             T_CHAR_LF)
-- 
2.6.1.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] BaseTools: Fix a bug for different FV use same FILE statement Guid
  2017-12-28 17:40 [Patch] BaseTools: Fix a bug for different FV use same FILE statement Guid Yonghong Zhu
@ 2017-12-29  2:30 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2017-12-29  2:30 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>Yonghong Zhu
>Sent: Friday, December 29, 2017 1:41 AM
>To: edk2-devel@lists.01.org
>Subject: [edk2] [Patch] BaseTools: Fix a bug for different FV use same FILE
>statement Guid
>
>We meet a case that different FV use same FILE statement Guid, but the
>FILE content is different. current we use the Guid value as Ffs file
>dir which cause the ffs file will be override. This patch use Guid
>value and Fv name as ffs dir for FILE statement.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
>---
> BaseTools/Source/Python/GenFds/FfsFileStatement.py | 7 +++++--
> BaseTools/Source/Python/GenFds/FfsInfStatement.py  | 2 +-
> BaseTools/Source/Python/GenFds/Fv.py               | 2 +-
> 3 files changed, 7 insertions(+), 4 deletions(-)
>
>diff --git a/BaseTools/Source/Python/GenFds/FfsFileStatement.py
>b/BaseTools/Source/Python/GenFds/FfsFileStatement.py
>index edb1312..12ec95b 100644
>--- a/BaseTools/Source/Python/GenFds/FfsFileStatement.py
>+++ b/BaseTools/Source/Python/GenFds/FfsFileStatement.py
>@@ -55,11 +55,11 @@ class FileStatement (FileStatementClassObject) :
>     #   @param  Dict         dictionary contains macro and value pair
>     #   @param  FvChildAddr  Array of the inside FvImage base address
>     #   @param  FvParentAddr Parent Fv base address
>     #   @retval string       Generated FFS file name
>     #
>-    def GenFfs(self, Dict = {}, FvChildAddr=[], FvParentAddr=None,
>IsMakefile=False):
>+    def GenFfs(self, Dict = {}, FvChildAddr=[], FvParentAddr=None,
>IsMakefile=False, FvName=None):
>
>         if self.NameGuid != None and self.NameGuid.startswith('PCD('):
>             PcdValue = GenFdsGlobalVariable.GetPcdValue(self.NameGuid)
>             if len(PcdValue) == 0:
>                 EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT defined.' \
>@@ -70,11 +70,14 @@ class FileStatement (FileStatementClassObject) :
>             if len(RegistryGuidStr) == 0:
>                 EdkLogger.error("GenFds", GENFDS_ERROR, 'GUID value for %s in
>wrong format.' \
>                             % (self.NameGuid))
>             self.NameGuid = RegistryGuidStr
>
>-        OutputDir = os.path.join(GenFdsGlobalVariable.FfsDir, self.NameGuid)
>+        Str = self.NameGuid
>+        if FvName:
>+            Str += FvName
>+        OutputDir = os.path.join(GenFdsGlobalVariable.FfsDir, Str)
>         if not os.path.exists(OutputDir):
>             os.makedirs(OutputDir)
>
>         Dict.update(self.DefineVarDict)
>         SectionAlignments = None
>diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>index 4b47817..baee543 100644
>--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>@@ -420,11 +420,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
>     #   @param  Dict         dictionary contains macro and value pair
>     #   @param  FvChildAddr  Array of the inside FvImage base address
>     #   @param  FvParentAddr Parent Fv base address
>     #   @retval string       Generated FFS file name
>     #
>-    def GenFfs(self, Dict = {}, FvChildAddr = [], FvParentAddr=None,
>IsMakefile=False):
>+    def GenFfs(self, Dict = {}, FvChildAddr = [], FvParentAddr=None,
>IsMakefile=False, FvName=None):
>         #
>         # Parse Inf file get Module related information
>         #
>
>         self.__InfParse__(Dict)
>diff --git a/BaseTools/Source/Python/GenFds/Fv.py
>b/BaseTools/Source/Python/GenFds/Fv.py
>index d5922c0..a69abb3 100644
>--- a/BaseTools/Source/Python/GenFds/Fv.py
>+++ b/BaseTools/Source/Python/GenFds/Fv.py
>@@ -119,11 +119,11 @@ class FV (FvClassObject):
>             if Flag:
>                 if isinstance(FfsFile, FfsFileStatement.FileStatement):
>                     continue
>             if GenFdsGlobalVariable.EnableGenfdsMultiThread and
>GenFdsGlobalVariable.ModuleFile and
>GenFdsGlobalVariable.ModuleFile.Path.find(os.path.normpath(FfsFile.InfFile
>Name)) == -1:
>                 continue
>-            FileName = FfsFile.GenFfs(MacroDict, FvParentAddr=BaseAddress,
>IsMakefile=Flag)
>+            FileName = FfsFile.GenFfs(MacroDict, FvParentAddr=BaseAddress,
>IsMakefile=Flag, FvName=self.UiFvName)
>             FfsFileList.append(FileName)
>             if not Flag:
>                 self.FvInfFile.writelines("EFI_FILE_NAME = " + \
>                                             FileName          + \
>                                             T_CHAR_LF)
>--
>2.6.1.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-29  2:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-28 17:40 [Patch] BaseTools: Fix a bug for different FV use same FILE statement Guid Yonghong Zhu
2017-12-29  2:30 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox