summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/GenFds/Region.py
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2015-12-18 06:45:34 +0000
committervanjeff <vanjeff@Edk2>2015-12-18 06:45:34 +0000
commit5fbc2feda298235bd54b38a1e2838db01501aca3 (patch)
tree6b1c2c3d4bbdb78fca1cfdb0ad8a72b6e60d5b46 /BaseTools/Source/Python/GenFds/Region.py
parenta166931e9404a5b42aa9955282d21d09a0a5df6d (diff)
downloadedk2-platforms-5fbc2feda298235bd54b38a1e2838db01501aca3.tar.xz
BaseTools: Add support for INF statement in FD region
FD region today can be file or data, but not a patched image.Add support for an INF statement in an FD region, so the binary from the INF can be patched prior to being added to the FD region. (Sync patch r19136 from main trunk.) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19372 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/GenFds/Region.py')
-rw-r--r--BaseTools/Source/Python/GenFds/Region.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py
index 01e998e54c..8734635fda 100644
--- a/BaseTools/Source/Python/GenFds/Region.py
+++ b/BaseTools/Source/Python/GenFds/Region.py
@@ -1,7 +1,7 @@
## @file
# process FD Region generation
#
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -202,13 +202,20 @@ class Region(RegionClassObject):
for i in range(0, Size):
Buffer.write(pack('B', PadData))
- if self.RegionType == 'FILE':
+ if self.RegionType in ('FILE', 'INF'):
for RegionData in self.RegionDataList:
- RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
- if RegionData[1] != ':' :
- RegionData = mws.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
- if not os.path.exists(RegionData):
- EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)
+ if self.RegionType == 'INF':
+ RegionData.__InfParse__(None)
+ if len(RegionData.BinFileList) != 1:
+ EdkLogger.error('GenFds', GENFDS_ERROR, 'INF in FD region can only contain one binary: %s' % RegionData)
+ File = RegionData.BinFileList[0]
+ RegionData = RegionData.PatchEfiFile(File.Path, File.Type)
+ else:
+ RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
+ if RegionData[1] != ':' :
+ RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
+ if not os.path.exists(RegionData):
+ EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)
#
# Add the file image into FD buffer
#