]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/GenFds.py
BaseTools: Enhance BaseTools supports FixedAtBuild usage in VFR file
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / GenFds.py
index 68232c5e6d74fd8fee7dd0f7b2022bb0d1a6dfc7..c2e9418b84caaa219e08fb257fd5cd797a1538ee 100644 (file)
@@ -152,8 +152,11 @@ def main():
                 # This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf\r
                 ConfDirectoryPath = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ConfDirectoryPath)\r
         else:\r
-            # Get standard WORKSPACE/Conf, use the absolute path to the WORKSPACE/Conf\r
-            ConfDirectoryPath = mws.join(GenFdsGlobalVariable.WorkSpaceDir, 'Conf')\r
+            if "CONF_PATH" in os.environ.keys():\r
+                ConfDirectoryPath = os.path.normcase(os.environ["CONF_PATH"])\r
+            else:\r
+                # Get standard WORKSPACE/Conf, use the absolute path to the WORKSPACE/Conf\r
+                ConfDirectoryPath = mws.join(GenFdsGlobalVariable.WorkSpaceDir, 'Conf')\r
         GenFdsGlobalVariable.ConfDir = ConfDirectoryPath\r
         BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt"))\r
         if os.path.isfile(BuildConfigurationFile) == True:\r
@@ -412,7 +415,64 @@ def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, Val
             Value = '0'\r
     return  Value\r
 \r
-        \r
+## FindExtendTool()\r
+#\r
+#  Find location of tools to process data\r
+#\r
+#  @param  KeyStringList    Filter for inputs of section generation\r
+#  @param  CurrentArchList  Arch list\r
+#  @param  NameGuid         The Guid name\r
+#\r
+def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):\r
+    # if user not specify filter, try to deduce it from global data.\r
+    if KeyStringList == None or KeyStringList == []:\r
+        Target = GenFdsGlobalVariable.TargetName\r
+        ToolChain = GenFdsGlobalVariable.ToolChainTag\r
+        ToolDb = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDatabase\r
+        if ToolChain not in ToolDb['TOOL_CHAIN_TAG']:\r
+            EdkLogger.error("GenFds", GENFDS_ERROR, "Can not find external tool because tool tag %s is not defined in tools_def.txt!" % ToolChain)\r
+        KeyStringList = [Target + '_' + ToolChain + '_' + CurrentArchList[0]]\r
+        for Arch in CurrentArchList:\r
+            if Target + '_' + ToolChain + '_' + Arch not in KeyStringList:\r
+                KeyStringList.append(Target + '_' + ToolChain + '_' + Arch)\r
+\r
+    if GenFdsGlobalVariable.GuidToolDefinition:\r
+        if NameGuid in GenFdsGlobalVariable.GuidToolDefinition.keys():\r
+            return GenFdsGlobalVariable.GuidToolDefinition[NameGuid]\r
+\r
+    ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary\r
+    ToolPathTmp = None\r
+    ToolOption = None\r
+    for ToolDef in ToolDefinition.items():\r
+        if NameGuid == ToolDef[1]:\r
+            KeyList = ToolDef[0].split('_')\r
+            Key = KeyList[0] + \\r
+                  '_' + \\r
+                  KeyList[1] + \\r
+                  '_' + \\r
+                  KeyList[2]\r
+            if Key in KeyStringList and KeyList[4] == 'GUID':\r
+\r
+                ToolPath = ToolDefinition.get(Key + \\r
+                                               '_' + \\r
+                                               KeyList[3] + \\r
+                                               '_' + \\r
+                                               'PATH')\r
+\r
+                ToolOption = ToolDefinition.get(Key + \\r
+                                                '_' + \\r
+                                                KeyList[3] + \\r
+                                                '_' + \\r
+                                                'FLAGS')\r
+                if ToolPathTmp == None:\r
+                    ToolPathTmp = ToolPath\r
+                else:\r
+                    if ToolPathTmp != ToolPath:\r
+                        EdkLogger.error("GenFds", GENFDS_ERROR, "Don't know which tool to use, %s or %s ?" % (ToolPathTmp, ToolPath))\r
+\r
+    GenFdsGlobalVariable.GuidToolDefinition[NameGuid] = (ToolPathTmp, ToolOption)\r
+    return ToolPathTmp, ToolOption\r
+\r
 ## Parse command line options\r
 #\r
 # Using standard Python module optparse to parse command line option of this tool.\r