]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
NetworkPkg/NetworkPkg.dsc: Move TLS modules to the supported components
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / GenFdsGlobalVariable.py
index 04bbc300ceda186a13e9fd8ba5c47188fbe470dc..c3f36243f04175eae6eae3930b6c2e92dbf46d40 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # Global variables for GenFds\r
 #\r
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -31,6 +31,7 @@ from AutoGen.BuildEngine import BuildRule
 import Common.DataType as DataType\r
 from Common.Misc import PathClass\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
+from Common.MultipleWorkspace import MultipleWorkspace as mws\r
 \r
 ## Global variables\r
 #\r
@@ -67,6 +68,7 @@ class GenFdsGlobalVariable:
     BuildRuleFamily = "MSFT"\r
     ToolChainFamily = "MSFT"\r
     __BuildRuleDatabase = None\r
+    GuidToolDefinition = {}\r
     \r
     #\r
     # The list whose element are flags to indicate if large FFS or SECTION files exist in FV.\r
@@ -273,7 +275,7 @@ class GenFdsGlobalVariable:
     #   @param  ArchList            The Arch list of platform\r
     #\r
     def SetDir (OutputDir, FdfParser, WorkSpace, ArchList):\r
-        GenFdsGlobalVariable.VerboseLogger( "GenFdsGlobalVariable.OutputDir :%s" %OutputDir)\r
+        GenFdsGlobalVariable.VerboseLogger("GenFdsGlobalVariable.OutputDir :%s" % OutputDir)\r
 #        GenFdsGlobalVariable.OutputDirDict = OutputDir\r
         GenFdsGlobalVariable.FdfParser = FdfParser\r
         GenFdsGlobalVariable.WorkSpace = WorkSpace\r
@@ -283,15 +285,13 @@ class GenFdsGlobalVariable:
         GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')\r
         if not os.path.exists(GenFdsGlobalVariable.FfsDir) :\r
             os.makedirs(GenFdsGlobalVariable.FfsDir)\r
-        if ArchList != None:\r
-            GenFdsGlobalVariable.ArchList = ArchList\r
 \r
         T_CHAR_LF = '\n'\r
         #\r
         # Create FV Address inf file\r
         #\r
         GenFdsGlobalVariable.FvAddressFileName = os.path.join(GenFdsGlobalVariable.FfsDir, 'FvAddress.inf')\r
-        FvAddressFile = open (GenFdsGlobalVariable.FvAddressFileName, 'w')\r
+        FvAddressFile = open(GenFdsGlobalVariable.FvAddressFileName, 'w')\r
         #\r
         # Add [Options]\r
         #\r
@@ -303,7 +303,7 @@ class GenFdsGlobalVariable:
                 break\r
 \r
         FvAddressFile.writelines("EFI_BOOT_DRIVER_BASE_ADDRESS = " + \\r
-                                       BsAddress          + \\r
+                                       BsAddress + \\r
                                        T_CHAR_LF)\r
 \r
         RtAddress = '0'\r
@@ -312,7 +312,7 @@ class GenFdsGlobalVariable:
                 RtAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtBaseAddress\r
 \r
         FvAddressFile.writelines("EFI_RUNTIME_DRIVER_BASE_ADDRESS = " + \\r
-                                       RtAddress          + \\r
+                                       RtAddress + \\r
                                        T_CHAR_LF)\r
 \r
         FvAddressFile.close()\r
@@ -322,12 +322,13 @@ class GenFdsGlobalVariable:
     #   @param  String           String that may contain macro\r
     #\r
     def ReplaceWorkspaceMacro(String):\r
+        String = mws.handleWsMacro(String)\r
         Str = String.replace('$(WORKSPACE)', GenFdsGlobalVariable.WorkSpaceDir)\r
         if os.path.exists(Str):\r
             if not os.path.isabs(Str):\r
                 Str = os.path.abspath(Str)\r
         else:\r
-            Str = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, String)\r
+            Str = mws.join(GenFdsGlobalVariable.WorkSpaceDir, String)\r
         return os.path.normpath(Str)\r
 \r
     ## Check if the input files are newer than output files\r
@@ -384,13 +385,13 @@ class GenFdsGlobalVariable:
         CommandFile = Output + '.txt'\r
         if Ui not in [None, '']:\r
             #Cmd += ["-n", '"' + Ui + '"']\r
-            SectionData = array.array('B', [0,0,0,0])\r
+            SectionData = array.array('B', [0, 0, 0, 0])\r
             SectionData.fromstring(Ui.encode("utf_16_le"))\r
             SectionData.append(0)\r
             SectionData.append(0)\r
             Len = len(SectionData)\r
             GenFdsGlobalVariable.SectionHeader.pack_into(SectionData, 0, Len & 0xff, (Len >> 8) & 0xff, (Len >> 16) & 0xff, 0x15)\r
-            SaveFileOnChange(Output,  SectionData.tostring())\r
+            SaveFileOnChange(Output, SectionData.tostring())\r
         elif Ver not in [None, '']:\r
             Cmd += ["-n", Ver]\r
             if BuildNumber:\r
@@ -459,12 +460,12 @@ class GenFdsGlobalVariable:
         Cmd = ["GenFv"]\r
         if BaseAddress not in [None, '']:\r
             Cmd += ["-r", BaseAddress]\r
-        \r
+\r
         if ForceRebase == False:\r
-            Cmd +=["-F", "FALSE"]\r
+            Cmd += ["-F", "FALSE"]\r
         elif ForceRebase == True:\r
-            Cmd +=["-F", "TRUE"]\r
-            \r
+            Cmd += ["-F", "TRUE"]\r
+\r
         if Capsule:\r
             Cmd += ["-c"]\r
         if Dump:\r
@@ -568,7 +569,7 @@ class GenFdsGlobalVariable:
         if VendorId != None:\r
             Cmd += ["-f", VendorId]\r
 \r
-        Cmd += ["-o", Output]    \r
+        Cmd += ["-o", Output]\r
         GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate option rom")\r
 \r
     @staticmethod\r
@@ -604,7 +605,7 @@ class GenFdsGlobalVariable:
                 sys.stdout.write('\n')\r
 \r
         try:\r
-            PopenObject = subprocess.Popen(' '.join(cmd), stdout=subprocess.PIPE, stderr= subprocess.PIPE, shell=True)\r
+            PopenObject = subprocess.Popen(' '.join(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
         except Exception, X:\r
             EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))\r
         (out, error) = PopenObject.communicate()\r
@@ -616,7 +617,7 @@ class GenFdsGlobalVariable:
             returnValue[0] = PopenObject.returncode\r
             return\r
         if PopenObject.returncode != 0 or GenFdsGlobalVariable.VerboseMode or GenFdsGlobalVariable.DebugLevel != -1:\r
-            GenFdsGlobalVariable.InfLogger ("Return Value = %d" %PopenObject.returncode)\r
+            GenFdsGlobalVariable.InfLogger ("Return Value = %d" % PopenObject.returncode)\r
             GenFdsGlobalVariable.InfLogger (out)\r
             GenFdsGlobalVariable.InfLogger (error)\r
             if PopenObject.returncode != 0:\r
@@ -629,7 +630,7 @@ class GenFdsGlobalVariable:
     def InfLogger (msg):\r
         EdkLogger.info(msg)\r
 \r
-    def ErrorLogger (msg, File = None, Line = None, ExtraData = None):\r
+    def ErrorLogger (msg, File=None, Line=None, ExtraData=None):\r
         EdkLogger.error('GenFds', GENFDS_ERROR, msg, File, Line, ExtraData)\r
 \r
     def DebugLogger (Level, msg):\r
@@ -640,7 +641,7 @@ class GenFdsGlobalVariable:
     #   @param  Str           String that may contain macro\r
     #   @param  MacroDict     Dictionary that contains macro value pair\r
     #\r
-    def MacroExtend (Str, MacroDict = {}, Arch = 'COMMON'):\r
+    def MacroExtend (Str, MacroDict={}, Arch='COMMON'):\r
         if Str == None :\r
             return None\r
 \r
@@ -697,10 +698,10 @@ class GenFdsGlobalVariable:
                         \r
                     PcdValue = PcdObj.DefaultValue\r
                     return PcdValue\r
-                \r
-            for Package in GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform, \r
-                                                                         Arch, \r
-                                                                         GenFdsGlobalVariable.TargetName, \r
+\r
+            for Package in GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform,\r
+                                                                         Arch,\r
+                                                                         GenFdsGlobalVariable.TargetName,\r
                                                                          GenFdsGlobalVariable.ToolChainTag):\r
                 PcdDict = Package.Pcds\r
                 for Key in PcdDict:\r