]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools: Support Structure PCD value assignment in DEC/DSC
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / AutoGen.py
index 5317921cbe20cb2f184066fefa23f51661d43759..12861399ac8623e8f05ed06f970f56695da8257b 100644 (file)
@@ -316,8 +316,8 @@ class WorkspaceAutoGen(AutoGen):
 \r
         EdkLogger.verbose("\nFLASH_DEFINITION = %s" % self.FdfFile)\r
 \r
-        if Progress:\r
-            Progress.Start("\nProcessing meta-data")\r
+        if Progress:\r
+            Progress.Start("\nProcessing meta-data")\r
 \r
         if self.FdfFile:\r
             #\r
@@ -686,9 +686,6 @@ class WorkspaceAutoGen(AutoGen):
             content += 'Flash Image Definition: '\r
             content += str(self.FdfFile)\r
             content += os.linesep\r
-        if GlobalData.gBinCacheDest:\r
-            content += 'Cache of .efi location: '\r
-            content += str(GlobalData.gBinCacheDest)\r
         SaveFileOnChange(os.path.join(self.BuildDir, 'BuildOptions'), content, False)\r
 \r
         #\r
@@ -1307,12 +1304,15 @@ class PlatformAutoGen(AutoGen):
     #   @param      CreateModuleMakeFile    Flag indicating if the makefile for\r
     #                                       modules will be created as well\r
     #\r
-    def CreateMakeFile(self, CreateModuleMakeFile=False):\r
+    def CreateMakeFile(self, CreateModuleMakeFile=False, FfsCommand = {}):\r
         if CreateModuleMakeFile:\r
             for ModuleFile in self.Platform.Modules:\r
                 Ma = ModuleAutoGen(self.Workspace, ModuleFile, self.BuildTarget,\r
                                    self.ToolChain, self.Arch, self.MetaFile)\r
-                Ma.CreateMakeFile(True)\r
+                if (ModuleFile.File, self.Arch) in FfsCommand:\r
+                    Ma.CreateMakeFile(True, FfsCommand[ModuleFile.File, self.Arch])\r
+                else:\r
+                    Ma.CreateMakeFile(True)\r
                 #Ma.CreateAsBuiltInf()\r
 \r
         # no need to create makefile for the platform more than once\r
@@ -1557,12 +1557,19 @@ class PlatformAutoGen(AutoGen):
             if pcd not in self._PlatformPcds.keys():\r
                 self._PlatformPcds[pcd] = self.Platform.Pcds[pcd]\r
 \r
+        for item in self._PlatformPcds:\r
+            if self._PlatformPcds[item].DatumType and self._PlatformPcds[item].DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
+                self._PlatformPcds[item].DatumType = "VOID*"\r
+\r
         if (self.Workspace.ArchList[-1] == self.Arch): \r
             for Pcd in self._DynamicPcdList:\r
                 # just pick the a value to determine whether is unicode string type\r
                 Sku = Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]]\r
                 Sku.VpdOffset = Sku.VpdOffset.strip()\r
 \r
+                if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
+                    Pcd.DatumType = "VOID*"\r
+\r
                 PcdValue = Sku.DefaultValue\r
                 if Pcd.DatumType == 'VOID*' and PcdValue.startswith("L"):\r
                     # if found PCD which datum value is unicode string the insert to left size of UnicodeIndex\r
@@ -2760,6 +2767,7 @@ class ModuleAutoGen(AutoGen):
 \r
         self._BuildDir        = None\r
         self._OutputDir       = None\r
+        self._FfsOutputDir    = None\r
         self._DebugDir        = None\r
         self._MakeFileDir     = None\r
 \r
@@ -2876,6 +2884,7 @@ class ModuleAutoGen(AutoGen):
             self._Macro["PLATFORM_RELATIVE_DIR" ] = self.PlatformInfo.SourceDir\r
             self._Macro["PLATFORM_DIR"          ] = mws.join(self.WorkspaceDir, self.PlatformInfo.SourceDir)\r
             self._Macro["PLATFORM_OUTPUT_DIR"   ] = self.PlatformInfo.OutputDir\r
+            self._Macro["FFS_OUTPUT_DIR"        ] = self.FfsOutputDir\r
         return self._Macro\r
 \r
     ## Return the module build data object\r
@@ -2966,6 +2975,15 @@ class ModuleAutoGen(AutoGen):
             CreateDirectory(self._OutputDir)\r
         return self._OutputDir\r
 \r
+    ## Return the directory to store ffs file\r
+    def _GetFfsOutputDir(self):\r
+        if self._FfsOutputDir == None:\r
+            if GlobalData.gFdfParser != None:\r
+                self._FfsOutputDir = path.join(self.PlatformInfo.BuildDir, "FV", "Ffs", self.Guid + self.Name)\r
+            else:\r
+                self._FfsOutputDir = ''\r
+        return self._FfsOutputDir\r
+\r
     ## Return the directory to store auto-gened source files of the mdoule\r
     def _GetDebugDir(self):\r
         if self._DebugDir == None:\r
@@ -3267,13 +3285,13 @@ class ModuleAutoGen(AutoGen):
                     EdkLogger.debug(EdkLogger.DEBUG_9, "The toolchain [%s] for processing file [%s] is found, "\r
                                     "but [%s] is needed" % (F.TagName, str(F), self.ToolChain))\r
                     continue\r
-                # match tool chain family\r
-                if F.ToolChainFamily not in ("", "*", self.ToolChainFamily):\r
+                # match tool chain family or build rule family\r
+                if F.ToolChainFamily not in ("", "*", self.ToolChainFamily, self.BuildRuleFamily):\r
                     EdkLogger.debug(\r
                                 EdkLogger.DEBUG_0,\r
                                 "The file [%s] must be built by tools of [%s], " \\r
-                                "but current toolchain family is [%s]" \\r
-                                    % (str(F), F.ToolChainFamily, self.ToolChainFamily))\r
+                                "but current toolchain family is [%s], buildrule family is [%s]" \\r
+                                    % (str(F), F.ToolChainFamily, self.ToolChainFamily, self.BuildRuleFamily))\r
                     continue\r
 \r
                 # add the file path into search path list for file including\r
@@ -3827,7 +3845,13 @@ class ModuleAutoGen(AutoGen):
 \r
     ## Create AsBuilt INF file the module\r
     #\r
-    def CreateAsBuiltInf(self):\r
+    def CreateAsBuiltInf(self, IsOnlyCopy = False):\r
+        self.OutputFile = []\r
+        if IsOnlyCopy:\r
+            if GlobalData.gBinCacheDest:\r
+                self.CopyModuleToCache()\r
+                return\r
+\r
         if self.IsAsBuiltInfCreated:\r
             return\r
             \r
@@ -3960,7 +3984,6 @@ class ModuleAutoGen(AutoGen):
             AsBuiltInfDict['module_pi_specification_version'] += [self.Specification['PI_SPECIFICATION_VERSION']]\r
 \r
         OutputDir = self.OutputDir.replace('\\', '/').strip('/')\r
-        self.OutputFile = []\r
         for Item in self.CodaTargetList:\r
             File = Item.Target.Path.replace('\\', '/').strip('/').replace(OutputDir, '').strip('/')\r
             if File not in self.OutputFile:\r
@@ -4043,7 +4066,7 @@ class ModuleAutoGen(AutoGen):
                     elif BoolValue == 'FALSE':\r
                         Pcd.DefaultValue = '0'\r
 \r
-                if Pcd.DatumType != 'VOID*':\r
+                if Pcd.DatumType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']:\r
                     HexFormat = '0x%02x'\r
                     if Pcd.DatumType == 'UINT16':\r
                         HexFormat = '0x%04x'\r
@@ -4187,8 +4210,12 @@ class ModuleAutoGen(AutoGen):
             shutil.copy2(HashFile, FileDir)\r
         if os.path.exists(ModuleFile):\r
             shutil.copy2(ModuleFile, FileDir)\r
+        if not self.OutputFile:\r
+            Ma = self.Workspace.BuildDatabase[PathClass(ModuleFile), self.Arch, self.BuildTarget, self.ToolChain]\r
+            self.OutputFile = Ma.Binaries\r
         if self.OutputFile:\r
             for File in self.OutputFile:\r
+                File = str(File)\r
                 if not os.path.isabs(File):\r
                     File = os.path.join(self.OutputDir, File)\r
                 if os.path.exists(File):\r
@@ -4222,20 +4249,21 @@ class ModuleAutoGen(AutoGen):
     #   @param      CreateLibraryMakeFile   Flag indicating if or not the makefiles of\r
     #                                       dependent libraries will be created\r
     #\r
-    def CreateMakeFile(self, CreateLibraryMakeFile=True):\r
+    def CreateMakeFile(self, CreateLibraryMakeFile=True, GenFfsList = []):\r
         # Ignore generating makefile when it is a binary module\r
         if self.IsBinaryModule:\r
             return\r
 \r
         if self.IsMakeFileCreated:\r
             return\r
-        if self.CanSkip():\r
-            return\r
-\r
+        self.GenFfsList = GenFfsList\r
         if not self.IsLibrary and CreateLibraryMakeFile:\r
             for LibraryAutoGen in self.LibraryAutoGenList:\r
                 LibraryAutoGen.CreateMakeFile()\r
 \r
+        if self.CanSkip():\r
+            return\r
+\r
         if len(self.CustomMakefile) == 0:\r
             Makefile = GenMake.ModuleMakefile(self)\r
         else:\r
@@ -4263,8 +4291,6 @@ class ModuleAutoGen(AutoGen):
     def CreateCodeFile(self, CreateLibraryCodeFile=True):\r
         if self.IsCodeFileCreated:\r
             return\r
-        if self.CanSkip():\r
-            return\r
 \r
         # Need to generate PcdDatabase even PcdDriver is binarymodule\r
         if self.IsBinaryModule and self.PcdIsDriver != '':\r
@@ -4279,6 +4305,9 @@ class ModuleAutoGen(AutoGen):
             for LibraryAutoGen in self.LibraryAutoGenList:\r
                 LibraryAutoGen.CreateCodeFile()\r
 \r
+        if self.CanSkip():\r
+            return\r
+\r
         AutoGenList = []\r
         IgoredAutoGenList = []\r
 \r
@@ -4455,6 +4484,7 @@ class ModuleAutoGen(AutoGen):
     IsBinaryModule  = property(_IsBinaryModule)\r
     BuildDir        = property(_GetBuildDir)\r
     OutputDir       = property(_GetOutputDir)\r
+    FfsOutputDir    = property(_GetFfsOutputDir)\r
     DebugDir        = property(_GetDebugDir)\r
     MakeFileDir     = property(_GetMakeFileDir)\r
     CustomMakefile  = property(_GetCustomMakefile)\r