[edk2] [PATCH] BaseTools: Guid.xref doesn't specify the correct GUID value for Driver

Yonghong Zhu posted 1 patch 5 years, 8 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/GenFds/GenFds.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
[edk2] [PATCH] BaseTools: Guid.xref doesn't specify the correct GUID value for Driver
Posted by Yonghong Zhu 5 years, 8 months ago
From: Yunhua Feng <yunhuax.feng@intel.com>

In DSC, we can define the driver with the different FILE GUID. So,
this driver name and its FILE GUID should also be listed in Build
output Guid.xref. But now, Guid.xref still lists the driver
MODULE_GUID.

The case in Platform.dsc:
  MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {
    <Defines>
      FILE_GUID = 3A4A354F-6935-40fa-B19C-500EEEBF0BC2
    <LibraryClasses>
      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
  }

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/Python/GenFds/GenFds.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index a7c1e6c853..156aae1d0e 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -603,19 +603,28 @@ class GenFds :
         GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref")
         GuidXRefFile = BytesIO('')
         GuidDict = {}
         ModuleList = []
         FileGuidList = []
+        GuidPattern = re.compile("\s*([0-9a-fA-F]){8}-"
+                                       "([0-9a-fA-F]){4}-"
+                                       "([0-9a-fA-F]){4}-"
+                                       "([0-9a-fA-F]){4}-"
+                                       "([0-9a-fA-F]){12}\s*")
         for Arch in ArchList:
             PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
             for ModuleFile in PlatformDataBase.Modules:
                 Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
                 if Module in ModuleList:
                     continue
                 else:
                     ModuleList.append(Module)
-                GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
+                GuidMatch = GuidPattern.match(ModuleFile.BaseName)
+                if GuidMatch is not None:
+                    GuidXRefFile.write("%s %s\n" % (ModuleFile.BaseName, Module.BaseName))
+                else:
+                    GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
                 for key, item in Module.Protocols.items():
                     GuidDict[key] = item
                 for key, item in Module.Guids.items():
                     GuidDict[key] = item
                 for key, item in Module.Ppis.items():
-- 
2.12.2.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] BaseTools: Guid.xref doesn't specify the correct GUID value for Driver
Posted by Zhu, Yonghong 5 years, 8 months ago
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yonghong Zhu
Sent: Tuesday, July 31, 2018 8:19 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>
Subject: [edk2] [PATCH] BaseTools: Guid.xref doesn't specify the correct GUID value for Driver

From: Yunhua Feng <yunhuax.feng@intel.com>

In DSC, we can define the driver with the different FILE GUID. So, this driver name and its FILE GUID should also be listed in Build output Guid.xref. But now, Guid.xref still lists the driver MODULE_GUID.

The case in Platform.dsc:
  MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {
    <Defines>
      FILE_GUID = 3A4A354F-6935-40fa-B19C-500EEEBF0BC2
    <LibraryClasses>
      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
  }

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/Python/GenFds/GenFds.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index a7c1e6c853..156aae1d0e 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -603,19 +603,28 @@ class GenFds :
         GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref")
         GuidXRefFile = BytesIO('')
         GuidDict = {}
         ModuleList = []
         FileGuidList = []
+        GuidPattern = re.compile("\s*([0-9a-fA-F]){8}-"
+                                       "([0-9a-fA-F]){4}-"
+                                       "([0-9a-fA-F]){4}-"
+                                       "([0-9a-fA-F]){4}-"
+                                       "([0-9a-fA-F]){12}\s*")
         for Arch in ArchList:
             PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
             for ModuleFile in PlatformDataBase.Modules:
                 Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
                 if Module in ModuleList:
                     continue
                 else:
                     ModuleList.append(Module)
-                GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
+                GuidMatch = GuidPattern.match(ModuleFile.BaseName)
+                if GuidMatch is not None:
+                    GuidXRefFile.write("%s %s\n" % (ModuleFile.BaseName, Module.BaseName))
+                else:
+                    GuidXRefFile.write("%s %s\n" % (Module.Guid, 
+ Module.BaseName))
                 for key, item in Module.Protocols.items():
                     GuidDict[key] = item
                 for key, item in Module.Guids.items():
                     GuidDict[key] = item
                 for key, item in Module.Ppis.items():
--
2.12.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