]> git.proxmox.com Git - mirror_edk2.git/commitdiff
This patch is going to correct the external PCD database generation rule to support...
authorFeng, Bob C <bob.c.feng@intel.com>
Tue, 26 Aug 2014 02:52:24 +0000 (02:52 +0000)
committerbobfeng <bobfeng@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Aug 2014 02:52:24 +0000 (02:52 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng, Bob C <bob.c.feng@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15893 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/Workspace/BuildClassObject.py
BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
BaseTools/Source/Python/build/build.py

index c589e2c0163e97ac55bff51643312d6e2162d312..2b4ba52e0965b1269a1db41f8f97304fa0547bcf 100644 (file)
@@ -269,6 +269,7 @@ class WorkspaceAutoGen(AutoGen):
             GlobalData.gAutoGenPhase = True    \r
             Fdf = FdfParser(self.FdfFile.Path)\r
             Fdf.ParseFile()\r
             GlobalData.gAutoGenPhase = True    \r
             Fdf = FdfParser(self.FdfFile.Path)\r
             Fdf.ParseFile()\r
+            GlobalData.gFdfParser = Fdf\r
             GlobalData.gAutoGenPhase = False\r
             PcdSet = Fdf.Profile.PcdDict\r
             ModuleList = Fdf.Profile.InfList\r
             GlobalData.gAutoGenPhase = False\r
             PcdSet = Fdf.Profile.PcdDict\r
             ModuleList = Fdf.Profile.InfList\r
@@ -298,7 +299,14 @@ class WorkspaceAutoGen(AutoGen):
             DecPcds = {}\r
             DecPcdsKey = set()\r
             PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch)\r
             DecPcds = {}\r
             DecPcdsKey = set()\r
             PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch)\r
-            Pkgs = PGen.PackageList\r
+            PkgSet = set()\r
+            for Inf in ModuleList:\r
+                ModuleFile = PathClass(NormPath(Inf), GlobalData.gWorkspace, Arch)\r
+                if ModuleFile in Platform.Modules:\r
+                    continue\r
+                ModuleData = self.BuildDatabase[ModuleFile, Arch, Target, Toolchain]\r
+                PkgSet.update(ModuleData.Packages)\r
+            Pkgs = list(PkgSet) + list(PGen.PackageList)\r
             for Pkg in Pkgs:\r
                 for Pcd in Pkg.Pcds:\r
                     DecPcds[Pcd[0], Pcd[1]] = Pkg.Pcds[Pcd]\r
             for Pkg in Pkgs:\r
                 for Pcd in Pkg.Pcds:\r
                     DecPcds[Pcd[0], Pcd[1]] = Pkg.Pcds[Pcd]\r
@@ -760,6 +768,8 @@ class PlatformAutoGen(AutoGen):
         self.FdTargetList = self.Workspace.FdTargetList\r
         self.FvTargetList = self.Workspace.FvTargetList\r
         self.AllPcdList = []\r
         self.FdTargetList = self.Workspace.FdTargetList\r
         self.FvTargetList = self.Workspace.FvTargetList\r
         self.AllPcdList = []\r
+        # get the original module/package/platform objects\r
+        self.BuildDatabase = Workspace.BuildDatabase\r
 \r
         # flag indicating if the makefile/C-code file has been created or not\r
         self.IsMakeFileCreated  = False\r
 \r
         # flag indicating if the makefile/C-code file has been created or not\r
         self.IsMakeFileCreated  = False\r
@@ -794,12 +804,22 @@ class PlatformAutoGen(AutoGen):
         self._ModuleAutoGenList  = None\r
         self._LibraryAutoGenList = None\r
         self._BuildCommand = None\r
         self._ModuleAutoGenList  = None\r
         self._LibraryAutoGenList = None\r
         self._BuildCommand = None\r
-\r
+        self._AsBuildInfList = []\r
+        self._AsBuildModuleList = []\r
+        if GlobalData.gFdfParser != None:\r
+            self._AsBuildInfList = GlobalData.gFdfParser.Profile.InfList\r
+            for Inf in self._AsBuildInfList:\r
+                InfClass = PathClass(NormPath(Inf), GlobalData.gWorkspace, self.Arch)\r
+                M = self.BuildDatabase[InfClass, self.Arch, self.BuildTarget, self.ToolChain]\r
+                if not M.IsSupportedArch:\r
+                    continue\r
+                self._AsBuildModuleList.append(InfClass)\r
         # get library/modules for build\r
         self.LibraryBuildDirectoryList = []\r
         self.ModuleBuildDirectoryList = []\r
         # get the original module/package/platform objects\r
         # get library/modules for build\r
         self.LibraryBuildDirectoryList = []\r
         self.ModuleBuildDirectoryList = []\r
         # get the original module/package/platform objects\r
-        self.BuildDatabase = Workspace.BuildDatabase\r
+        self.LibraryBuildDirectoryList = []\r
+        self.ModuleBuildDirectoryList = []\r
         return True\r
 \r
     def __repr__(self):\r
         return True\r
 \r
     def __repr__(self):\r
@@ -886,8 +906,12 @@ class PlatformAutoGen(AutoGen):
     def CollectPlatformDynamicPcds(self):\r
         # for gathering error information\r
         NoDatumTypePcdList = set()\r
     def CollectPlatformDynamicPcds(self):\r
         # for gathering error information\r
         NoDatumTypePcdList = set()\r
-\r
+        PcdNotInDb = []\r
         self._GuidValue = {}\r
         self._GuidValue = {}\r
+        FdfModuleList = []\r
+        for InfName in self._AsBuildInfList:\r
+            InfName = os.path.join(self.WorkspaceDir, InfName)\r
+            FdfModuleList.append(os.path.normpath(InfName))\r
         for F in self.Platform.Modules.keys():\r
             M = ModuleAutoGen(self.Workspace, F, self.BuildTarget, self.ToolChain, self.Arch, self.MetaFile)\r
             #GuidValue.update(M.Guids)\r
         for F in self.Platform.Modules.keys():\r
             M = ModuleAutoGen(self.Workspace, F, self.BuildTarget, self.ToolChain, self.Arch, self.MetaFile)\r
             #GuidValue.update(M.Guids)\r
@@ -899,7 +923,42 @@ class PlatformAutoGen(AutoGen):
                 if PcdFromModule.DatumType == "VOID*" and PcdFromModule.MaxDatumSize in [None, '']:\r
                     NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, F))\r
 \r
                 if PcdFromModule.DatumType == "VOID*" and PcdFromModule.MaxDatumSize in [None, '']:\r
                     NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, F))\r
 \r
+                if M.IsBinaryModule == True:\r
+                    PcdFromModule.IsFromBinaryInf = True\r
+                if (PcdFromModule.TokenCName, PcdFromModule.TokenSpaceGuidCName) in self.Platform.Pcds.keys():\r
+                    PcdFromModule.IsFromDsc = True\r
+                else:\r
+                    PcdFromModule.IsFromDsc = False\r
                 if PcdFromModule.Type in GenC.gDynamicPcd or PcdFromModule.Type in GenC.gDynamicExPcd:\r
                 if PcdFromModule.Type in GenC.gDynamicPcd or PcdFromModule.Type in GenC.gDynamicExPcd:\r
+                    if F.Path not in FdfModuleList:\r
+                        # If one of the Source built modules listed in the DSC is not listed \r
+                        # in FDF modules, and the INF lists a PCD can only use the PcdsDynamic \r
+                        # access method (it is only listed in the DEC file that declares the \r
+                        # PCD as PcdsDynamic), then build tool will report warning message\r
+                        # notify the PI that they are attempting to build a module that must \r
+                        # be included in a flash image in order to be functional. These Dynamic \r
+                        # PCD will not be added into the Database unless it is used by other \r
+                        # modules that are included in the FDF file.\r
+                        if PcdFromModule.Type in GenC.gDynamicPcd and \\r
+                            PcdFromModule.IsFromBinaryInf == False:\r
+                            # Print warning message to let the developer make a determine.\r
+                            if PcdFromModule not in PcdNotInDb:\r
+                                EdkLogger.warn("build",\r
+                                               "A PCD listed in the DSC (%s.%s, %s) is used by a module not in the FDF. If the PCD is not used by any module listed in the FDF this PCD will be ignored. " \\r
+                                               % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, self.Platform.MetaFile.Path),\r
+                                               File=self.MetaFile, \\r
+                                               ExtraData=None)\r
+                                PcdNotInDb.append(PcdFromModule)\r
+                            continue\r
+                        # If one of the Source built modules listed in the DSC is not listed in \r
+                        # FDF modules, and the INF lists a PCD can only use the PcdsDynamicEx \r
+                        # access method (it is only listed in the DEC file that declares the \r
+                        # PCD as PcdsDynamicEx), then DO NOT break the build; DO NOT add the \r
+                        # PCD to the Platform's PCD Database.\r
+                        if PcdFromModule.Type in GenC.gDynamicExPcd:\r
+                            if PcdFromModule not in PcdNotInDb:\r
+                                PcdNotInDb.append(PcdFromModule)\r
+                            continue\r
                     #\r
                     # If a dynamic PCD used by a PEM module/PEI module & DXE module,\r
                     # it should be stored in Pcd PEI database, If a dynamic only\r
                     #\r
                     # If a dynamic PCD used by a PEM module/PEI module & DXE module,\r
                     # it should be stored in Pcd PEI database, If a dynamic only\r
@@ -916,6 +975,68 @@ class PlatformAutoGen(AutoGen):
                         self._DynaPcdList_[Index] = PcdFromModule\r
                 elif PcdFromModule not in self._NonDynaPcdList_:\r
                     self._NonDynaPcdList_.append(PcdFromModule)\r
                         self._DynaPcdList_[Index] = PcdFromModule\r
                 elif PcdFromModule not in self._NonDynaPcdList_:\r
                     self._NonDynaPcdList_.append(PcdFromModule)\r
+                elif PcdFromModule in self._NonDynaPcdList_ and PcdFromModule.IsFromBinaryInf == True:\r
+                    Index = self._NonDynaPcdList_.index(PcdFromModule)\r
+                    if self._NonDynaPcdList_[Index].IsFromBinaryInf == False:\r
+                        #The PCD from Binary INF will override the same one from source INF\r
+                        self._NonDynaPcdList_.remove (self._NonDynaPcdList_[Index])\r
+                        PcdFromModule.Pending = False\r
+                        self._NonDynaPcdList_.append (PcdFromModule)\r
+        # Parse the DynamicEx PCD from the AsBuild INF module list of FDF.\r
+        DscModuleList = []\r
+        for ModuleInf in self.Platform.Modules.keys():\r
+            DscModuleList.append (os.path.normpath(ModuleInf.Path))\r
+        # add the PCD from modules that listed in FDF but not in DSC to Database \r
+        for InfName in FdfModuleList:\r
+            if InfName not in DscModuleList:\r
+                InfClass = PathClass(InfName)\r
+                M = self.BuildDatabase[InfClass, self.Arch, self.BuildTarget, self.ToolChain]\r
+                # If a module INF in FDF but not in current arch's DSC module list, it must be module (either binary or source) \r
+                # for different Arch. PCDs in source module for different Arch is already added before, so skip the source module here. \r
+                # For binary module, if in current arch, we need to list the PCDs into database.   \r
+                if not M.IsSupportedArch:\r
+                    continue\r
+                # Override the module PCD setting by platform setting\r
+                ModulePcdList = self.ApplyPcdSetting(M, M.Pcds)\r
+                for PcdFromModule in ModulePcdList:\r
+                    PcdFromModule.IsFromBinaryInf = True\r
+                    PcdFromModule.IsFromDsc = False\r
+                    # Only allow the DynamicEx and Patchable PCD in AsBuild INF\r
+                    if PcdFromModule.Type not in GenC.gDynamicExPcd and PcdFromModule.Type not in TAB_PCDS_PATCHABLE_IN_MODULE:\r
+                        EdkLogger.error("build", AUTOGEN_ERROR, "PCD setting error",\r
+                                        File=self.MetaFile,\r
+                                        ExtraData="\n\tExisted %s PCD %s in:\n\t\t%s\n"\r
+                                        % (PcdFromModule.Type, PcdFromModule.TokenCName, InfName))\r
+                    # make sure that the "VOID*" kind of datum has MaxDatumSize set\r
+                    if PcdFromModule.DatumType == "VOID*" and PcdFromModule.MaxDatumSize in [None, '']:\r
+                        NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName))\r
+                    if M.ModuleType in ["PEIM", "PEI_CORE"]:\r
+                        PcdFromModule.Phase = "PEI"\r
+                    if PcdFromModule not in self._DynaPcdList_ and PcdFromModule.Type in GenC.gDynamicExPcd:\r
+                        self._DynaPcdList_.append(PcdFromModule)\r
+                    elif PcdFromModule not in self._NonDynaPcdList_ and PcdFromModule.Type in TAB_PCDS_PATCHABLE_IN_MODULE:\r
+                        self._NonDynaPcdList_.append(PcdFromModule)\r
+                    if PcdFromModule in self._DynaPcdList_ and PcdFromModule.Phase == 'PEI' and PcdFromModule.Type in GenC.gDynamicExPcd:\r
+                        Index = self._DynaPcdList_.index(PcdFromModule)\r
+                        self._DynaPcdList_[Index].Phase = PcdFromModule.Phase\r
+                        self._DynaPcdList_[Index].Type = PcdFromModule.Type\r
+        for PcdFromModule in self._NonDynaPcdList_:\r
+            # If a PCD is not listed in the DSC file, but binary INF files used by \r
+            # this platform all (that use this PCD) list the PCD in a [PatchPcds] \r
+            # section, AND all source INF files used by this platform the build \r
+            # that use the PCD list the PCD in either a [Pcds] or [PatchPcds] \r
+            # section, then the tools must NOT add the PCD to the Platform's PCD\r
+            # Database; the build must assign the access method for this PCD as \r
+            # PcdsPatchableInModule.\r
+            if PcdFromModule not in self._DynaPcdList_:\r
+                continue\r
+            Index = self._DynaPcdList_.index(PcdFromModule)\r
+            if PcdFromModule.IsFromDsc == False and \\r
+                PcdFromModule.Type in TAB_PCDS_PATCHABLE_IN_MODULE and \\r
+                PcdFromModule.IsFromBinaryInf == True and \\r
+                self._DynaPcdList_[Index].IsFromBinaryInf == False:\r
+                Index = self._DynaPcdList_.index(PcdFromModule)\r
+                self._DynaPcdList_.remove (self._DynaPcdList_[Index])\r
 \r
         # print out error information and break the build, if error found\r
         if len(NoDatumTypePcdList) > 0:\r
 \r
         # print out error information and break the build, if error found\r
         if len(NoDatumTypePcdList) > 0:\r
@@ -926,8 +1047,19 @@ class PlatformAutoGen(AutoGen):
                                       % NoDatumTypePcdListString)\r
         self._NonDynamicPcdList = self._NonDynaPcdList_\r
         self._DynamicPcdList = self._DynaPcdList_\r
                                       % NoDatumTypePcdListString)\r
         self._NonDynamicPcdList = self._NonDynaPcdList_\r
         self._DynamicPcdList = self._DynaPcdList_\r
-        self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList\r
-        \r
+        # If PCD is listed in a PcdsDynamicHii, PcdsDynamicExHii, PcdsDynamicHii or PcdsDynamicExHii\r
+        # section, and the PCD is not used by any module that is listed in the DSC file, the build \r
+        # provide a warning message.\r
+        for PcdKey in self.Platform.Pcds.keys():\r
+            Pcd = self.Platform.Pcds[PcdKey]\r
+            if Pcd not in self._DynamicPcdList + PcdNotInDb and \\r
+                Pcd.Type in [TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_PCDS_DYNAMIC_HII, TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, TAB_PCDS_DYNAMIC_EX_HII]:\r
+                # Print warning message to let the developer make a determine.\r
+                EdkLogger.warn("build",\r
+                               "A %s PCD listed in the DSC (%s.%s, %s) is not used by any module." \\r
+                               % (Pcd.Type, Pcd.TokenSpaceGuidCName, Pcd.TokenCName, self.Platform.MetaFile.Path),\r
+                               File=self.MetaFile, \\r
+                               ExtraData=None)\r
         #\r
         # Sort dynamic PCD list to:\r
         # 1) If PCD's datum type is VOID* and value is unicode string which starts with L, the PCD item should \r
         #\r
         # Sort dynamic PCD list to:\r
         # 1) If PCD's datum type is VOID* and value is unicode string which starts with L, the PCD item should \r
@@ -1099,7 +1231,7 @@ class PlatformAutoGen(AutoGen):
         self._DynamicPcdList.extend(UnicodePcdArray)\r
         self._DynamicPcdList.extend(HiiPcdArray)\r
         self._DynamicPcdList.extend(OtherPcdArray)\r
         self._DynamicPcdList.extend(UnicodePcdArray)\r
         self._DynamicPcdList.extend(HiiPcdArray)\r
         self._DynamicPcdList.extend(OtherPcdArray)\r
-            \r
+        self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList\r
         \r
     ## Return the platform build data object\r
     def _GetPlatform(self):\r
         \r
     ## Return the platform build data object\r
     def _GetPlatform(self):\r
@@ -1320,7 +1452,14 @@ class PlatformAutoGen(AutoGen):
                 self._PackageList.update(La.DependentPackageList)\r
             for Ma in self.ModuleAutoGenList:\r
                 self._PackageList.update(Ma.DependentPackageList)\r
                 self._PackageList.update(La.DependentPackageList)\r
             for Ma in self.ModuleAutoGenList:\r
                 self._PackageList.update(Ma.DependentPackageList)\r
-            self._PackageList = list(self._PackageList)\r
+            #Collect package set information from INF of FDF\r
+            PkgSet = set()\r
+            for ModuleFile in self._AsBuildModuleList:\r
+                if ModuleFile in self.Platform.Modules:\r
+                    continue\r
+                ModuleData = self.BuildDatabase[ModuleFile, self.Arch, self.BuildTarget, self.ToolChain]\r
+                PkgSet.update(ModuleData.Packages)\r
+            self._PackageList = list(self._PackageList) + list (PkgSet)\r
         return self._PackageList\r
 \r
     def _GetNonDynamicPcdDict(self):\r
         return self._PackageList\r
 \r
     def _GetNonDynamicPcdDict(self):\r
@@ -1428,7 +1567,8 @@ class PlatformAutoGen(AutoGen):
     #  by the platform or current configuration\r
     #\r
     def ValidModule(self, Module):\r
     #  by the platform or current configuration\r
     #\r
     def ValidModule(self, Module):\r
-        return Module in self.Platform.Modules or Module in self.Platform.LibraryInstances\r
+        return Module in self.Platform.Modules or Module in self.Platform.LibraryInstances \\r
+            or Module in self._AsBuildModuleList\r
 \r
     ## Resolve the library classes in a module to library instances\r
     #\r
 \r
     ## Resolve the library classes in a module to library instances\r
     #\r
@@ -3020,6 +3160,8 @@ class ModuleAutoGen(AutoGen):
     #                                       dependent libraries will be created\r
     #\r
     def CreateMakeFile(self, CreateLibraryMakeFile=True):\r
     #                                       dependent libraries will be created\r
     #\r
     def CreateMakeFile(self, CreateLibraryMakeFile=True):\r
+        if self.IsBinaryModule:\r
+            return\r
         if self.IsMakeFileCreated:\r
             return\r
 \r
         if self.IsMakeFileCreated:\r
             return\r
 \r
@@ -3040,6 +3182,11 @@ class ModuleAutoGen(AutoGen):
 \r
         self.IsMakeFileCreated = True\r
 \r
 \r
         self.IsMakeFileCreated = True\r
 \r
+    def CopyBinaryFiles(self):\r
+        for File in self.Module.Binaries:\r
+            SrcPath = File.Path\r
+            DstPath = os.path.join(self.OutputDir , os.path.basename(SrcPath))\r
+            CopyLongFilePath(SrcPath, DstPath)\r
     ## Create autogen code for the module and its dependent libraries\r
     #\r
     #   @param      CreateLibraryCodeFile   Flag indicating if or not the code of\r
     ## Create autogen code for the module and its dependent libraries\r
     #\r
     #   @param      CreateLibraryCodeFile   Flag indicating if or not the code of\r
@@ -3053,6 +3200,9 @@ class ModuleAutoGen(AutoGen):
         if self.IsBinaryModule and self.PcdIsDriver != '':\r
             CreatePcdDatabaseCode(self, TemplateString(), TemplateString())\r
             return\r
         if self.IsBinaryModule and self.PcdIsDriver != '':\r
             CreatePcdDatabaseCode(self, TemplateString(), TemplateString())\r
             return\r
+        if self.IsBinaryModule:\r
+            self.CopyBinaryFiles()\r
+            return\r
 \r
         if not self.IsLibrary and CreateLibraryCodeFile:\r
             for LibraryAutoGen in self.LibraryAutoGenList:\r
 \r
         if not self.IsLibrary and CreateLibraryCodeFile:\r
             for LibraryAutoGen in self.LibraryAutoGenList:\r
index a95e3f39ab34efe3bf04a36e2ea40bbf8ff9688d..8b98f164fd0847e4a3b4304380f7d4c5df4bd509 100644 (file)
@@ -57,6 +57,8 @@ class PcdClassObject(object):
         self.Phase = "DXE"\r
         self.Pending = False\r
         self.IsOverrided = IsOverrided\r
         self.Phase = "DXE"\r
         self.Pending = False\r
         self.IsOverrided = IsOverrided\r
+        self.IsFromBinaryInf = False\r
+        self.IsFromDsc = False\r
         \r
     ## Convert the class to a string\r
     #\r
         \r
     ## Convert the class to a string\r
     #\r
index b4109155a63a32d4d8e49786fa2697183227763c..8252a3180d9512d494c445cbe0d222bd18131c86 100644 (file)
@@ -2008,7 +2008,7 @@ class InfBuildData(ModuleBuildClassObject):
         return self._Defs\r
 \r
     ## Retrieve binary files\r
         return self._Defs\r
 \r
     ## Retrieve binary files\r
-    def _GetBinaryFiles(self):\r
+    def _GetBinaries(self):\r
         if self._Binaries == None:\r
             self._Binaries = []\r
             RecordList = self._RawData[MODEL_EFI_BINARY_FILE, self._Arch, self._Platform]\r
         if self._Binaries == None:\r
             self._Binaries = []\r
             RecordList = self._RawData[MODEL_EFI_BINARY_FILE, self._Arch, self._Platform]\r
@@ -2035,6 +2035,20 @@ class InfBuildData(ModuleBuildClassObject):
                 self._Binaries.append(File)\r
         return self._Binaries\r
 \r
                 self._Binaries.append(File)\r
         return self._Binaries\r
 \r
+    ## Retrieve binary files with error check.\r
+    def _GetBinaryFiles(self):\r
+        Binaries = self._GetBinaries()\r
+        if GlobalData.gIgnoreSource and Binaries == []:\r
+            ErrorInfo = "The INF file does not contain any Binaries to use in creating the image\n"\r
+            EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, ExtraData=ErrorInfo, File=self.MetaFile)\r
+\r
+        return Binaries\r
+    ## Check whether it exists the binaries with current ARCH in AsBuild INF\r
+    def _IsSupportedArch(self):\r
+        if self._GetBinaries() and not self._GetSourceFiles():\r
+            return True\r
+        else:\r
+            return False\r
     ## Retrieve source files\r
     def _GetSourceFiles(self):\r
         if self._Sources == None:\r
     ## Retrieve source files\r
     def _GetSourceFiles(self):\r
         if self._Sources == None:\r
@@ -2537,6 +2551,7 @@ class InfBuildData(ModuleBuildClassObject):
     Depex                   = property(_GetDepex)\r
     DepexExpression         = property(_GetDepexExpression)\r
     IsBinaryModule = property(_IsBinaryModule)\r
     Depex                   = property(_GetDepex)\r
     DepexExpression         = property(_GetDepexExpression)\r
     IsBinaryModule = property(_IsBinaryModule)\r
+    IsSupportedArch = property(_IsSupportedArch)\r
 \r
 ## Database\r
 #\r
 \r
 ## Database\r
 #\r
index 74491f6ee7eab5f2005c6f78ec48d3d3b7fb3547..e463a57a911dc0b55d3cdd521949156fface0258 100644 (file)
@@ -744,6 +744,7 @@ class Build():
         self.Platform       = None\r
         self.LoadFixAddress = 0\r
         self.UniFlag        = BuildOptions.Flag\r
         self.Platform       = None\r
         self.LoadFixAddress = 0\r
         self.UniFlag        = BuildOptions.Flag\r
+        self.BuildModules = []\r
 \r
         # print dot character during doing some time-consuming work\r
         self.Progress = Utils.Progressor()\r
 \r
         # print dot character during doing some time-consuming work\r
         self.Progress = Utils.Progressor()\r
@@ -929,6 +930,7 @@ class Build():
         if BuildModule:\r
             BuildCommand = BuildCommand + [Target]\r
             LaunchCommand(BuildCommand, AutoGenObject.MakeFileDir)\r
         if BuildModule:\r
             BuildCommand = BuildCommand + [Target]\r
             LaunchCommand(BuildCommand, AutoGenObject.MakeFileDir)\r
+            self.CreateAsBuiltInf()\r
             return True\r
 \r
         # build library\r
             return True\r
 \r
         # build library\r
@@ -946,6 +948,7 @@ class Build():
             for Mod in AutoGenObject.ModuleBuildDirectoryList:\r
                 NewBuildCommand = BuildCommand + ['-f', os.path.normpath(os.path.join(Mod, makefile)), 'pbuild']\r
                 LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir)\r
             for Mod in AutoGenObject.ModuleBuildDirectoryList:\r
                 NewBuildCommand = BuildCommand + ['-f', os.path.normpath(os.path.join(Mod, makefile)), 'pbuild']\r
                 LaunchCommand(NewBuildCommand, AutoGenObject.MakeFileDir)\r
+            self.CreateAsBuiltInf()\r
             return True\r
 \r
         # cleanlib\r
             return True\r
 \r
         # cleanlib\r
@@ -1055,6 +1058,7 @@ class Build():
         BuildCommand = BuildCommand + [Target]\r
         if BuildModule:\r
             LaunchCommand(BuildCommand, AutoGenObject.MakeFileDir)\r
         BuildCommand = BuildCommand + [Target]\r
         if BuildModule:\r
             LaunchCommand(BuildCommand, AutoGenObject.MakeFileDir)\r
+            self.CreateAsBuiltInf()\r
             return True\r
 \r
         # build library\r
             return True\r
 \r
         # build library\r
@@ -1407,6 +1411,12 @@ class Build():
                 for Arch in Wa.ArchList:\r
                     GlobalData.gGlobalDefines['ARCH'] = Arch\r
                     Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)\r
                 for Arch in Wa.ArchList:\r
                     GlobalData.gGlobalDefines['ARCH'] = Arch\r
                     Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)\r
+                    for Module in Pa.Platform.Modules:\r
+                        # Get ModuleAutoGen object to generate C code file and makefile\r
+                        Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
+                        if Ma == None:\r
+                            continue\r
+                        self.BuildModules.append(Ma)\r
                     self._BuildPa(self.Target, Pa)\r
 \r
                 # Create MAP file when Load Fix Address is enabled.\r
                     self._BuildPa(self.Target, Pa)\r
 \r
                 # Create MAP file when Load Fix Address is enabled.\r
@@ -1490,6 +1500,7 @@ class Build():
                     Ma = ModuleAutoGen(Wa, self.ModuleFile, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
                     if Ma == None: continue\r
                     MaList.append(Ma)\r
                     Ma = ModuleAutoGen(Wa, self.ModuleFile, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
                     if Ma == None: continue\r
                     MaList.append(Ma)\r
+                    self.BuildModules.append(Ma)\r
                     if not Ma.IsBinaryModule:\r
                         self._Build(self.Target, Ma, BuildModule=True)\r
 \r
                     if not Ma.IsBinaryModule:\r
                         self._Build(self.Target, Ma, BuildModule=True)\r
 \r
@@ -1580,10 +1591,20 @@ class Build():
                     Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)\r
                     if Pa == None:\r
                         continue\r
                     Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)\r
                     if Pa == None:\r
                         continue\r
-                    pModules = []\r
-                    for Module in Pa.Platform.Modules:\r
+                    ModuleList = []\r
+                    for Inf in Pa.Platform.Modules:\r
+                        ModuleList.append(Inf)\r
+                    # Add the INF only list in FDF\r
+                    if GlobalData.gFdfParser != None:\r
+                        for InfName in GlobalData.gFdfParser.Profile.InfList:\r
+                            Inf = PathClass(NormPath(InfName), self.WorkspaceDir, Arch)\r
+                            if Inf in Pa.Platform.Modules:\r
+                                continue\r
+                            ModuleList.append(Inf)\r
+                    for Module in ModuleList:\r
                         # Get ModuleAutoGen object to generate C code file and makefile\r
                         Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
                         # Get ModuleAutoGen object to generate C code file and makefile\r
                         Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
+                        \r
                         if Ma == None:\r
                             continue\r
                         # Not to auto-gen for targets 'clean', 'cleanlib', 'cleanall', 'run', 'fds'\r
                         if Ma == None:\r
                             continue\r
                         # Not to auto-gen for targets 'clean', 'cleanlib', 'cleanall', 'run', 'fds'\r
@@ -1596,15 +1617,15 @@ class Build():
 \r
                             if not self.SkipAutoGen or self.Target == 'genmake':\r
                                 Ma.CreateMakeFile(True)\r
 \r
                             if not self.SkipAutoGen or self.Target == 'genmake':\r
                                 Ma.CreateMakeFile(True)\r
-                                Ma.CreateAsBuiltInf()\r
                             if self.Target == "genmake":\r
                                 continue\r
                             if self.Target == "genmake":\r
                                 continue\r
-                        pModules.append(Ma)\r
+                        self.BuildModules.append(Ma)\r
                     self.Progress.Stop("done!")\r
 \r
                     self.Progress.Stop("done!")\r
 \r
-                    for Ma in pModules:\r
+                    for Ma in self.BuildModules:\r
                         # Generate build task for the module\r
                         # Generate build task for the module\r
-                        Bt = BuildTask.New(ModuleMakeUnit(Ma, self.Target))\r
+                        if not Ma.IsBinaryModule:\r
+                            Bt = BuildTask.New(ModuleMakeUnit(Ma, self.Target))\r
                         # Break build if any build thread has error\r
                         if BuildTask.HasError():\r
                             # we need a full version of makefile for platform\r
                         # Break build if any build thread has error\r
                         if BuildTask.HasError():\r
                             # we need a full version of makefile for platform\r
@@ -1635,6 +1656,7 @@ class Build():
                 #\r
                 ExitFlag.set()\r
                 BuildTask.WaitForComplete()\r
                 #\r
                 ExitFlag.set()\r
                 BuildTask.WaitForComplete()\r
+                self.CreateAsBuiltInf()\r
 \r
                 #\r
                 # Check for build error, and raise exception if one\r
 \r
                 #\r
                 # Check for build error, and raise exception if one\r
@@ -1765,6 +1787,10 @@ class Build():
             self.SpawnMode = False\r
             self._BuildModule()\r
 \r
             self.SpawnMode = False\r
             self._BuildModule()\r
 \r
+    def CreateAsBuiltInf(self):\r
+        for Module in self.BuildModules:\r
+            Module.CreateAsBuiltInf()\r
+        self.BuildModules = []\r
     ## Do some clean-up works when error occurred\r
     def Relinquish(self):\r
         OldLogLevel = EdkLogger.GetLevel()\r
     ## Do some clean-up works when error occurred\r
     def Relinquish(self):\r
         OldLogLevel = EdkLogger.GetLevel()\r