If source module INF is not listed in DSC, it will not be built. And it
is listed in FDF, GenFds will fail to find its build output. To reminder
user this issue early, build tool should report failure to user in early
phase.

Cc: Liming Gao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <[email protected]>
---
 BaseTools/Source/Python/AutoGen/AutoGen.py  | 28 ++++++++++++++++++++++++++++
 BaseTools/Source/Python/GenFds/FdfParser.py | 15 +++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 8da441f..9a95014 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -327,10 +327,38 @@ class WorkspaceAutoGen(AutoGen):
             self.FdfProfile = Fdf.Profile
             for fvname in self.FvTargetList:
                 if fvname.upper() not in self.FdfProfile.FvDict:
                     EdkLogger.error("build", OPTION_VALUE_INVALID,
                                     "No such an FV in FDF file: %s" % fvname)
+
+            for key in self.FdfProfile.InfDict:
+                if key == 'ArchTBD':
+                    Platform_cache = {}
+                    for Arch in self.ArchList:
+                        Platform_cache[Arch] = 
self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]
+                    for Inf in self.FdfProfile.InfDict[key]:
+                        ModuleFile = PathClass(NormPath(Inf), 
GlobalData.gWorkspace, Arch)
+                        for Arch in self.ArchList:
+                            if ModuleFile in Platform_cache[Arch].Modules:
+                                break
+                        else:
+                            ModuleData = self.BuildDatabase[ModuleFile, Arch, 
Target, Toolchain]
+                            if not ModuleData.IsBinaryModule:
+                                EdkLogger.error('build', PARSER_ERROR, "Module 
%s NOT found in DSC file; Is it really a binary module?" % ModuleFile)
+
+                else:
+                    for Arch in self.ArchList:
+                        if Arch == key:
+                            Platform = self.BuildDatabase[self.MetaFile, Arch, 
Target, Toolchain]
+                            for Inf in self.FdfProfile.InfDict[key]:
+                                ModuleFile = PathClass(NormPath(Inf), 
GlobalData.gWorkspace, Arch)
+                                if ModuleFile in Platform.Modules:
+                                    continue
+                                ModuleData = self.BuildDatabase[ModuleFile, 
Arch, Target, Toolchain]
+                                if not ModuleData.IsBinaryModule:
+                                    EdkLogger.error('build', PARSER_ERROR, 
"Module %s NOT found in DSC file; Is it really a binary module?" % ModuleFile)
+
         else:
             PcdSet = {}
             ModuleList = []
             self.FdfProfile = None
             if self.FdTargetList:
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py 
b/BaseTools/Source/Python/GenFds/FdfParser.py
index 56303e1..8709cfc 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -229,10 +229,11 @@ class FileProfile :
             EdkLogger.error("FdfParser", FILE_OPEN_FAILURE, ExtraData=FileName)
 
 
         self.PcdDict = {}
         self.InfList = []
+        self.InfDict = {'ArchTBD':[]}
         # ECC will use this Dict and List information
         self.PcdFileLineDict = {}
         self.InfFileLineList = []
         
         self.FdDict = {}
@@ -2470,10 +2471,17 @@ class FdfParser:
 
         if not ffsInf.InfFileName in self.Profile.InfList:
             self.Profile.InfList.append(ffsInf.InfFileName)
             FileLineTuple = GetRealFileLine(self.FileName, 
self.CurrentLineNumber)
             self.Profile.InfFileLineList.append(FileLineTuple)
+            if ffsInf.UseArch:
+                if ffsInf.UseArch not in self.Profile.InfDict:
+                    self.Profile.InfDict[ffsInf.UseArch] = [ffsInf.InfFileName]
+                else:
+                    
self.Profile.InfDict[ffsInf.UseArch].append(ffsInf.InfFileName)
+            else:
+                self.Profile.InfDict['ArchTBD'].append(ffsInf.InfFileName)
 
         if self.__IsToken('|'):
             if self.__IsKeyword('RELOCS_STRIPPED'):
                 ffsInf.KeepReloc = False
             elif self.__IsKeyword('RELOCS_RETAINED'):
@@ -4349,10 +4357,17 @@ class FdfParser:
 
         if not ffsInf.InfFileName in self.Profile.InfList:
             self.Profile.InfList.append(ffsInf.InfFileName)
             FileLineTuple = GetRealFileLine(self.FileName, 
self.CurrentLineNumber)
             self.Profile.InfFileLineList.append(FileLineTuple)
+            if ffsInf.UseArch:
+                if ffsInf.UseArch not in self.Profile.InfDict:
+                    self.Profile.InfDict[ffsInf.UseArch] = [ffsInf.InfFileName]
+                else:
+                    
self.Profile.InfDict[ffsInf.UseArch].append(ffsInf.InfFileName)
+            else:
+                self.Profile.InfDict['ArchTBD'].append(ffsInf.InfFileName)
 
         
         self.__GetOptRomOverrides (ffsInf)
             
         Obj.FfsList.append(ffsInf)
-- 
2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to