]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: fix the bug to build a compressed ROM image via .INF file
authorYonghong Zhu <yonghong.zhu@intel.com>
Fri, 3 Jun 2016 02:01:53 +0000 (10:01 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Sat, 4 Jun 2016 13:22:00 +0000 (21:22 +0800)
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>
BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools/Source/Python/Workspace/WorkspaceDatabase.py

index 4b2902f47330b57d5cbe2f94bd1c1d4a53840c90..be07e46684704b3d1bb6999dfcfc0b9c2ffa59a1 100644 (file)
@@ -488,6 +488,11 @@ cleanlib:
         if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
             self._AutoGenObject.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint\r
 \r
         if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
             self._AutoGenObject.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint\r
 \r
+        PCI_COMPRESS_Flag = False\r
+        for k, v in self._AutoGenObject.Module.Defines.iteritems():\r
+            if 'PCI_COMPRESS' == k and 'TRUE' == v:\r
+                PCI_COMPRESS_Flag = True\r
+\r
         # tools definitions\r
         ToolsDef = []\r
         IncPrefix = self._INC_FLAG_[self._AutoGenObject.ToolChainFamily]\r
         # tools definitions\r
         ToolsDef = []\r
         IncPrefix = self._INC_FLAG_[self._AutoGenObject.ToolChainFamily]\r
@@ -505,6 +510,14 @@ cleanlib:
                     # Remove duplicated include path, if any\r
                     if Attr == "FLAGS":\r
                         Value = RemoveDupOption(Value, IncPrefix, self._AutoGenObject.IncludePathList)\r
                     # Remove duplicated include path, if any\r
                     if Attr == "FLAGS":\r
                         Value = RemoveDupOption(Value, IncPrefix, self._AutoGenObject.IncludePathList)\r
+                        if Tool == "OPTROM" and PCI_COMPRESS_Flag:\r
+                            ValueList = Value.split()\r
+                            if ValueList:\r
+                                for i, v in enumerate(ValueList):\r
+                                    if '-e' == v:\r
+                                        ValueList[i] = '-ec'\r
+                                Value = ' '.join(ValueList)\r
+\r
                     ToolsDef.append("%s_%s = %s" % (Tool, Attr, Value))\r
             ToolsDef.append("")\r
 \r
                     ToolsDef.append("%s_%s = %s" % (Tool, Attr, Value))\r
             ToolsDef.append("")\r
 \r
index 5168e838a8bc08657833607e8dbc76ca612ac9b4..86d8c3256cbddc068c5bbac07f36325b3efcdaa3 100644 (file)
@@ -1930,8 +1930,12 @@ class InfBuildData(ModuleBuildClassObject):
                 if self._ModuleType == SUP_MODULE_SMM_CORE:\r
                     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)\r
             if self._Defs and 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \\r
                 if self._ModuleType == SUP_MODULE_SMM_CORE:\r
                     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)\r
             if self._Defs and 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \\r
-               and 'PCI_CLASS_CODE' in self._Defs:\r
+               and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in self._Defs:\r
                 self._BuildType = 'UEFI_OPTIONROM'\r
                 self._BuildType = 'UEFI_OPTIONROM'\r
+                if 'PCI_COMPRESS' in self._Defs:\r
+                    if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):\r
+                        EdkLogger.error("build", FORMAT_INVALID, "Expected TRUE/FALSE for PCI_COMPRESS: %s" %self.MetaFile)\r
+\r
             elif self._Defs and 'UEFI_HII_RESOURCE_SECTION' in self._Defs \\r
                and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':\r
                 self._BuildType = 'UEFI_HII'\r
             elif self._Defs and 'UEFI_HII_RESOURCE_SECTION' in self._Defs \\r
                and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':\r
                 self._BuildType = 'UEFI_HII'\r