Reviewed-by: Liming Gao <[email protected]>

> -----Original Message-----
> From: Zhu, Yonghong
> Sent: Friday, June 03, 2016 10:16 AM
> To: [email protected]
> Cc: Gao, Liming <[email protected]>
> Subject: [Patch V2] 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 <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu <[email protected]>
> ---
>  BaseTools/Source/Python/AutoGen/GenMake.py             | 13
> +++++++++++++
>  BaseTools/Source/Python/Workspace/WorkspaceDatabase.py |  6 +++++-
>  2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py
> b/BaseTools/Source/Python/AutoGen/GenMake.py
> index 4b2902f..be07e46 100644
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -486,10 +486,15 @@ cleanlib:
>          if 'ARCH_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():
>              self._AutoGenObject.Macros['ARCH_ENTRY_POINT'] = ArchEntryPoint
>          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]
>          for Tool in self._AutoGenObject.BuildOption:
>              for Attr in self._AutoGenObject.BuildOption[Tool]:
> @@ -503,10 +508,18 @@ cleanlib:
>                      if Tool == "MAKE":
>                          continue
>                      # 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("")
> 
>          # generate the Response file and Response flag
>          RespDict = self.CommandExceedLimit()
> diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
> b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
> index 5168e83..86d8c32 100644
> --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
> +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
> @@ -1928,12 +1928,16 @@ class InfBuildData(ModuleBuildClassObject):
>                                  File=self.MetaFile, Line=LineNo)
>              if (self._Specification == None) or (not 
> 'PI_SPECIFICATION_VERSION'
> in self._Specification) or
> (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
>                  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'
>              else:
>                  self._BuildType = self._ModuleType.upper()
> --
> 2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to