]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/Region.py
BaseTools: Update FMP Capsule support to follow FDF spec
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / Region.py
index 01e998e54c6fb6c5fa2ec1aa5c4d0f8e47622c54..6015e24e25a52b3262b0b407b559d30e775f3aa3 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
@@ -73,7 +73,7 @@ class Region(RegionClassObject):
                     RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)\r
                     GenFdsGlobalVariable.InfLogger('   Region FV File Name = .fv : %s' % RegionData)\r
                     if RegionData[1] != ':' :\r
-                        RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)\r
+                        RegionData = mws.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)\r
                     if not os.path.exists(RegionData):\r
                         EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
 \r
@@ -152,7 +152,7 @@ class Region(RegionClassObject):
                     RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)\r
                     GenFdsGlobalVariable.InfLogger('   Region CAPSULE Image Name = .cap : %s' % RegionData)\r
                     if RegionData[1] != ':' :\r
-                        RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)\r
+                        RegionData = mws.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)\r
                     if not os.path.exists(RegionData):\r
                         EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
 \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 = mws.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