]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/EfiSection.py
BaseTools: Add a keyword FvNameString in FDF
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / EfiSection.py
index ad953facb98f04166c9065e56943d70f4c4e11cb..09fb28f32d78c227895af41176c2594e1b6a8c27 100644 (file)
@@ -1,9 +1,9 @@
 ## @file\r
 # process rule section 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
@@ -20,12 +20,13 @@ import Section
 from GenFdsGlobalVariable import GenFdsGlobalVariable\r
 import subprocess\r
 from Ffs import Ffs\r
-import os\r
+import Common.LongFilePathOs as os\r
 from CommonDataClass.FdfClass import EfiSectionClassObject\r
-import shutil\r
 from Common import EdkLogger\r
 from Common.BuildToolError import *\r
 from Common.Misc import PeImageClass\r
+from Common.LongFilePathSupport import OpenLongFilePath as open\r
+from Common.LongFilePathSupport import CopyLongFilePath\r
 \r
 ## generate rule section\r
 #\r
@@ -80,11 +81,11 @@ class EfiSection (EfiSectionClassObject):
         FileList = []\r
         if Filename != None:\r
             Filename = GenFdsGlobalVariable.MacroExtend(Filename, Dict)\r
-            # check if the path is absolute or relative
-            if os.path.isabs(Filename):
-                Filename = os.path.normpath(Filename)
-            else:
-                Filename = os.path.normpath(os.path.join(FfsInf.EfiOutputPath, Filename))
+            # check if the path is absolute or relative\r
+            if os.path.isabs(Filename):\r
+                Filename = os.path.normpath(Filename)\r
+            else:\r
+                Filename = os.path.normpath(os.path.join(FfsInf.EfiOutputPath, Filename))\r
 \r
             if not self.Optional:\r
                 FileList.append(Filename)\r
@@ -96,6 +97,7 @@ class EfiSection (EfiSectionClassObject):
                 return FileList, self.Alignment\r
 \r
         Index = 0\r
+        Align = self.Alignment\r
 \r
         """ If Section type is 'VERSION'"""\r
         OutputFileList = []\r
@@ -210,10 +212,10 @@ class EfiSection (EfiSectionClassObject):
             """If File List is empty"""\r
             if FileList == [] :\r
                 if self.Optional == True:\r
-                     GenFdsGlobalVariable.VerboseLogger( "Optional Section don't exist!")\r
-                     return [], None\r
+                    GenFdsGlobalVariable.VerboseLogger("Optional Section don't exist!")\r
+                    return [], None\r
                 else:\r
-                     EdkLogger.error("GenFds", GENFDS_ERROR, "Output file for %s section could not be found for %s" % (SectionType, InfFileName))\r
+                    EdkLogger.error("GenFds", GENFDS_ERROR, "Output file for %s section could not be found for %s" % (SectionType, InfFileName))\r
 \r
             else:\r
                 """Convert the File to Section file one by one """\r
@@ -228,23 +230,23 @@ class EfiSection (EfiSectionClassObject):
                     if self.Alignment == 'Auto' and (SectionType == 'PE32' or SectionType == 'TE'):\r
                         ImageObj = PeImageClass (File)\r
                         if ImageObj.SectionAlignment < 0x400:\r
-                            self.Alignment = str (ImageObj.SectionAlignment)\r
+                            Align = str (ImageObj.SectionAlignment)\r
                         else:\r
-                            self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K'\r
+                            Align = str (ImageObj.SectionAlignment / 0x400) + 'K'\r
 \r
                     if File[(len(File)-4):] == '.efi':\r
                         MapFile = File.replace('.efi', '.map')\r
                         if os.path.exists(MapFile):\r
                             CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')\r
                             if not os.path.exists(CopyMapFile) or \\r
-                                (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):\r
-                                shutil.copyfile(MapFile, CopyMapFile)\r
+                                   (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):\r
+                                CopyLongFilePath(MapFile, CopyMapFile)\r
 \r
                     if not NoStrip:\r
                         FileBeforeStrip = os.path.join(OutputPath, ModuleName + '.efi')\r
                         if not os.path.exists(FileBeforeStrip) or \\r
                             (os.path.getmtime(File) > os.path.getmtime(FileBeforeStrip)):\r
-                            shutil.copyfile(File, FileBeforeStrip)\r
+                            CopyLongFilePath(File, FileBeforeStrip)\r
                         StrippedFile = os.path.join(OutputPath, ModuleName + '.stripped')\r
                         GenFdsGlobalVariable.GenerateFirmwareImage(\r
                                                 StrippedFile,\r
@@ -271,4 +273,4 @@ class EfiSection (EfiSectionClassObject):
                                                          )\r
                     OutputFileList.append(OutputFile)\r
 \r
-        return OutputFileList, self.Alignment\r
+        return OutputFileList, Align\r