BaseTools: fix the bug to build a compressed ROM image via .INF file

Fix the bug that always use the '-e' as OPTROM_FLAGS even the .INF file
has statement 'PCI_COMPRESS  = TRUE'.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Yonghong Zhu 2016-06-03 10:01:53 +08:00
parent 570ae1ebc8
commit 9ccb26bc99
2 changed files with 18 additions and 1 deletions

View File

@ -488,6 +488,11 @@ cleanlib:
if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():
self._AutoGenObject.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint
PCI_COMPRESS_Flag = False
for k, v in self._AutoGenObject.Module.Defines.iteritems():
if 'PCI_COMPRESS' == k and 'TRUE' == v:
PCI_COMPRESS_Flag = True
# tools definitions
ToolsDef = []
IncPrefix = self._INC_FLAG_[self._AutoGenObject.ToolChainFamily]
@ -505,6 +510,14 @@ cleanlib:
# Remove duplicated include path, if any
if Attr == "FLAGS":
Value = RemoveDupOption(Value, IncPrefix, self._AutoGenObject.IncludePathList)
if Tool == "OPTROM" and PCI_COMPRESS_Flag:
ValueList = Value.split()
if ValueList:
for i, v in enumerate(ValueList):
if '-e' == v:
ValueList[i] = '-ec'
Value = ' '.join(ValueList)
ToolsDef.append("%s_%s = %s" % (Tool, Attr, Value))
ToolsDef.append("")

View File

@ -1930,8 +1930,12 @@ class InfBuildData(ModuleBuildClassObject):
if self._ModuleType == SUP_MODULE_SMM_CORE:
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.MetaFile)
if self._Defs and 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \
and 'PCI_CLASS_CODE' in self._Defs:
and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in self._Defs:
self._BuildType = 'UEFI_OPTIONROM'
if 'PCI_COMPRESS' in self._Defs:
if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):
EdkLogger.error("build", FORMAT_INVALID, "Expected TRUE/FALSE for PCI_COMPRESS: %s" %self.MetaFile)
elif self._Defs and 'UEFI_HII_RESOURCE_SECTION' in self._Defs \
and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':
self._BuildType = 'UEFI_HII'