]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/Vtf.py
BaseTools: FILE DATA to support relative path under Multiple workspace
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / Vtf.py
index eebc7b1dab4a4a76ae57323291380a5a7d0beacd..06e3d275c381da60d3520cdd2b45ccd5ebef1568 100644 (file)
@@ -1,9 +1,9 @@
 ## @file\r
 # process VTF generation\r
 #\r
-#  Copyright (c) 2007, Intel Corporation\r
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
 #\r
-#  All rights reserved. This program and the accompanying materials\r
+#  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution.  The full text of the license may be found at\r
 #  http://opensource.org/licenses/bsd-license.php\r
@@ -16,8 +16,9 @@
 # Import Modules\r
 #\r
 from GenFdsGlobalVariable import GenFdsGlobalVariable\r
-import os\r
+import Common.LongFilePathOs as os\r
 from CommonDataClass.FdfClass import VtfClassObject\r
+from Common.LongFilePathSupport import OpenLongFilePath as open\r
 T_CHAR_LF = '\n'\r
 \r
 ## generate VTF\r
@@ -66,72 +67,80 @@ class Vtf (VtfClassObject):
     def GenBsfInf (self):\r
         FvList = self.GetFvList()\r
         self.BsfInfName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiName + '.inf')\r
-        BsfInf = open (self.BsfInfName, 'w+')\r
+        BsfInf = open(self.BsfInfName, 'w+')\r
+        if self.ResetBin != None:\r
+            BsfInf.writelines ("[OPTIONS]" + T_CHAR_LF)\r
+            BsfInf.writelines ("IA32_RST_BIN" + \\r
+                               " = " + \\r
+                               GenFdsGlobalVariable.MacroExtend(GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.ResetBin)) + \\r
+                               T_CHAR_LF)\r
+            BsfInf.writelines (T_CHAR_LF)\r
+\r
         BsfInf.writelines ("[COMPONENTS]" + T_CHAR_LF)\r
 \r
         for ComponentObj in self.ComponentStatementList :\r
-            BsfInf.writelines ("COMP_NAME"        + \\r
-                               " = "              + \\r
+            BsfInf.writelines ("COMP_NAME" + \\r
+                               " = " + \\r
                                ComponentObj.CompName + \\r
-                               T_CHAR_LF )\r
+                               T_CHAR_LF)\r
             if ComponentObj.CompLoc.upper() == 'NONE':\r
-                BsfInf.writelines ("COMP_LOC"        + \\r
-                                   " = "             + \\r
-                                   'N'               + \\r
-                                   T_CHAR_LF )\r
-            \r
+                BsfInf.writelines ("COMP_LOC" + \\r
+                                   " = " + \\r
+                                   'N' + \\r
+                                   T_CHAR_LF)\r
+\r
             elif ComponentObj.FilePos != None:\r
-                BsfInf.writelines ("COMP_LOC"        + \\r
-                                   " = "             + \\r
+                BsfInf.writelines ("COMP_LOC" + \\r
+                                   " = " + \\r
                                    ComponentObj.FilePos + \\r
-                                   T_CHAR_LF )\r
+                                   T_CHAR_LF)\r
             else:\r
                 Index = FvList.index(ComponentObj.CompLoc.upper())\r
                 if Index == 0:\r
-                    BsfInf.writelines ("COMP_LOC"        + \\r
-                                       " = "             + \\r
-                                       'F'               + \\r
-                                       T_CHAR_LF )\r
+                    BsfInf.writelines ("COMP_LOC" + \\r
+                                       " = " + \\r
+                                       'F' + \\r
+                                       T_CHAR_LF)\r
                 elif Index == 1:\r
-                    BsfInf.writelines ("COMP_LOC"        + \\r
-                                       " = "             + \\r
-                                       'S'                 + \\r
-                                       T_CHAR_LF )\r
-                \r
-            BsfInf.writelines ("COMP_TYPE"        + \\r
-                               " = "              + \\r
+                    BsfInf.writelines ("COMP_LOC" + \\r
+                                       " = " + \\r
+                                       'S' + \\r
+                                       T_CHAR_LF)\r
+\r
+            BsfInf.writelines ("COMP_TYPE" + \\r
+                               " = " + \\r
                                ComponentObj.CompType + \\r
-                               T_CHAR_LF )\r
-            BsfInf.writelines ("COMP_VER"        + \\r
-                               " = "             + \\r
+                               T_CHAR_LF)\r
+            BsfInf.writelines ("COMP_VER" + \\r
+                               " = " + \\r
                                ComponentObj.CompVer + \\r
-                               T_CHAR_LF )\r
-            BsfInf.writelines ("COMP_CS"        + \\r
-                               " = "            + \\r
+                               T_CHAR_LF)\r
+            BsfInf.writelines ("COMP_CS" + \\r
+                               " = " + \\r
                                ComponentObj.CompCs + \\r
-                               T_CHAR_LF )\r
-            \r
+                               T_CHAR_LF)\r
+\r
             BinPath = ComponentObj.CompBin\r
             if BinPath != '-':\r
                 BinPath = GenFdsGlobalVariable.MacroExtend(GenFdsGlobalVariable.ReplaceWorkspaceMacro(BinPath))\r
-            BsfInf.writelines ("COMP_BIN"        + \\r
-                               " = "             + \\r
+            BsfInf.writelines ("COMP_BIN" + \\r
+                               " = " + \\r
                                BinPath + \\r
-                               T_CHAR_LF )\r
-            \r
+                               T_CHAR_LF)\r
+\r
             SymPath = ComponentObj.CompSym\r
             if SymPath != '-':\r
                 SymPath = GenFdsGlobalVariable.MacroExtend(GenFdsGlobalVariable.ReplaceWorkspaceMacro(SymPath))\r
-            BsfInf.writelines ("COMP_SYM"        + \\r
-                               " = "             + \\r
+            BsfInf.writelines ("COMP_SYM" + \\r
+                               " = " + \\r
                                SymPath + \\r
-                               T_CHAR_LF )\r
-            BsfInf.writelines ("COMP_SIZE"        + \\r
-                               " = "              + \\r
+                               T_CHAR_LF)\r
+            BsfInf.writelines ("COMP_SIZE" + \\r
+                               " = " + \\r
                                ComponentObj.CompSize + \\r
-                               T_CHAR_LF )\r
-            BsfInf.writelines (T_CHAR_LF )\r
-            \r
+                               T_CHAR_LF)\r
+            BsfInf.writelines (T_CHAR_LF)\r
+\r
         BsfInf.close()\r
 \r
     ## GenFvList() method\r
@@ -161,7 +170,7 @@ class Vtf (VtfClassObject):
             (BaseAddress, Size) = FdAddressDict.get(i)\r
             CmdStr += (\r
                 '-r', '0x%x' % BaseAddress,\r
-                '-s', '0x%x' %Size,\r
+                '-s', '0x%x' % Size,\r
                 )\r
         return CmdStr\r
     \r