]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/GuidSection.py
Add support for ${s_*} and ${d_*} macros for in FDF file for the INF files, and for...
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / GuidSection.py
index 0ef5a23716a1000c7bfc05e988909431c4da2e13..0e5bb3b27072289c43c58e1de59fd0e4047ccaf4 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process GUIDed section generation\r
 #\r
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2014, 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
@@ -18,7 +18,7 @@
 import Section\r
 import subprocess\r
 from Ffs import Ffs\r
-import os\r
+import Common.LongFilePathOs as os\r
 from GenFdsGlobalVariable import GenFdsGlobalVariable\r
 from CommonDataClass.FdfClass import GuidSectionClassObject\r
 from Common import ToolDefClassObject\r
@@ -26,6 +26,7 @@ import sys
 from Common import EdkLogger\r
 from Common.BuildToolError import *\r
 from FvImageSection import FvImageSection\r
+from Common.LongFilePathSupport import OpenLongFilePath as open\r
 \r
 ## generate GUIDed section\r
 #\r
@@ -193,16 +194,20 @@ class GuidSection(GuidSectionClassObject) :
 \r
             Attribute = []\r
             HeaderLength = None\r
-            if TempFileSize > InputFileSize and TempFileSize % 4 == 0:\r
-                FileHandleIn.seek(0)\r
-                BufferIn  = FileHandleIn.read()\r
-                FileHandleOut.seek(0)\r
-                BufferOut = FileHandleOut.read()\r
-                if BufferIn == BufferOut[TempFileSize - InputFileSize:]:\r
-                    HeaderLength = str(TempFileSize - InputFileSize)\r
-            #auto sec guided attribute with process required\r
-            if HeaderLength == None:\r
-                Attribute.append('PROCESSING_REQUIRED')\r
+            if self.ExtraHeaderSize != -1:\r
+                HeaderLength = str(self.ExtraHeaderSize)\r
+\r
+            if self.ProcessRequired == "NONE" and HeaderLength == None:\r
+                if TempFileSize > InputFileSize:\r
+                    FileHandleIn.seek(0)\r
+                    BufferIn  = FileHandleIn.read()\r
+                    FileHandleOut.seek(0)\r
+                    BufferOut = FileHandleOut.read()\r
+                    if BufferIn == BufferOut[TempFileSize - InputFileSize:]:\r
+                        HeaderLength = str(TempFileSize - InputFileSize)\r
+                #auto sec guided attribute with process required\r
+                if HeaderLength == None:\r
+                    Attribute.append('PROCESSING_REQUIRED')\r
 \r
             FileHandleIn.close()\r
             FileHandleOut.close()\r
@@ -217,7 +222,7 @@ class GuidSection(GuidSectionClassObject) :
             if self.ProcessRequired in ("TRUE", "1"):\r
                 if 'PROCESSING_REQUIRED' not in Attribute:\r
                     Attribute.append('PROCESSING_REQUIRED')\r
-                HeaderLength = None\r
+  \r
             if self.AuthStatusValid in ("TRUE", "1"):\r
                 Attribute.append('AUTH_STATUS_VALID')\r
             GenFdsGlobalVariable.GenerateSection(OutputFile, [TempFile], Section.Section.SectionType['GUIDED'],\r
@@ -242,15 +247,15 @@ class GuidSection(GuidSectionClassObject) :
         if self.KeyStringList == None or self.KeyStringList == []:\r
             Target = GenFdsGlobalVariable.TargetName\r
             ToolChain = GenFdsGlobalVariable.ToolChainTag\r
-            ToolDb = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.WorkSpaceDir).ToolsDefTxtDatabase\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
             self.KeyStringList = [Target+'_'+ToolChain+'_'+self.CurrentArchList[0]]\r
             for Arch in self.CurrentArchList:\r
-                if Target+'_'+ToolChain+'_'+Arch not in self.KeyStringList:\r
-                    self.KeyStringList.append(Target+'_'+ToolChain+'_'+Arch)\r
-                    \r
-        ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.WorkSpaceDir).ToolsDefTxtDictionary\r
+                if Target + '_' + ToolChain + '_' + Arch not in self.KeyStringList:\r
+                    self.KeyStringList.append(Target + '_' + ToolChain + '_' + Arch)\r
+\r
+        ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary\r
         ToolPathTmp = None\r
         for ToolDef in ToolDefinition.items():\r
             if self.NameGuid == ToolDef[1]:\r