]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/Region.py
BaseTools: Add support for INF statement in FD region
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / Region.py
index 01e998e54c6fb6c5fa2ec1aa5c4d0f8e47622c54..8734635fda29d0b4993a4d1655bb6d854d63ba29 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process FD Region generation\r
 #\r
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2015, 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
@@ -202,13 +202,20 @@ class Region(RegionClassObject):
                 for i in range(0, Size):\r
                     Buffer.write(pack('B', PadData))\r
 \r
-        if self.RegionType == 'FILE':\r
+        if self.RegionType in ('FILE', 'INF'):\r
             for RegionData in self.RegionDataList:\r
-                RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)\r
-                if RegionData[1] != ':' :\r
-                    RegionData = mws.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)\r
-                if not os.path.exists(RegionData):\r
-                    EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
+                if self.RegionType == 'INF':\r
+                    RegionData.__InfParse__(None)\r
+                    if len(RegionData.BinFileList) != 1:\r
+                        EdkLogger.error('GenFds', GENFDS_ERROR, 'INF in FD region can only contain one binary: %s' % RegionData)\r
+                    File = RegionData.BinFileList[0]\r
+                    RegionData = RegionData.PatchEfiFile(File.Path, File.Type)\r
+                else:\r
+                    RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)\r
+                    if RegionData[1] != ':' :\r
+                        RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)\r
+                    if not os.path.exists(RegionData):\r
+                        EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
                 #\r
                 # Add the file image into FD buffer\r
                 #\r