public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: "Fan, ZhijuX" <zhijux.fan@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH V3] BaseTools:BaseTools supports to the driver combination.
Date: Tue, 19 Feb 2019 14:55:18 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3E1A78@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <FAD0D7E0AE0FA54D987F6E72435CAFD50AF244A7@SHSMSX101.ccr.corp.intel.com>

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Fan, ZhijuX
> Sent: Tuesday, February 19, 2019 6:47 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [edk2][PATCH V3] BaseTools:BaseTools supports to the driver combination.
> 
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1520
> 
> To save the image size without the compression, more than
> one drivers can be combined into single one. When more than
> one drivers are combined, their depex will be AND together.
> Below is the example to combine BootManagerPolicyDxe into
> DriverHealthManagerDxe.
> 
> Besides this patch, BaseTools also needs to check the module
> type and make sure all module type are same. Otherwise,
> BaseTools will report the error.
> DRIVER INF has the parameter ENTRY_POINT
> LIBRARY INF has the parameter LIBRARY_CLASS
> 
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
> ---
>  BaseTools/Source/Python/AutoGen/GenC.py            | 32 ++++++++++++++++++----
>  .../Source/Python/Workspace/WorkspaceCommon.py     |  8 ++++++
>  2 files changed, 35 insertions(+), 5 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
> index 9700bf8527..e6fc5cda3c 100644
> --- a/BaseTools/Source/Python/AutoGen/GenC.py
> +++ b/BaseTools/Source/Python/AutoGen/GenC.py
> @@ -1455,10 +1455,25 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
>  def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
>      if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]:
>          return
> +    ModuleEntryPointList = []
> +    for Lib in Info.DependentLibraryList:
> +        if len(Lib.ModuleEntryPointList) > 0:
> +            if Lib.ModuleType == Info.ModuleType:
> +                ModuleEntryPointList = ModuleEntryPointList + Lib.ModuleEntryPointList
> +            else:
> +                EdkLogger.error(
> +                    "build",
> +                    PREBUILD_ERROR,
> +                    "Driver's ModuleType must be consistent [%s]"%(str(Lib)),
> +                    File=str(Info.PlatformInfo),
> +                    ExtraData="consumed by [%s]" % str(Info.MetaFile)
> +                )
> +    ModuleEntryPointList = ModuleEntryPointList + Info.Module.ModuleEntryPointList
> +
>      #
>      # Module Entry Points
>      #
> -    NumEntryPoints = len(Info.Module.ModuleEntryPointList)
> +    NumEntryPoints = len(ModuleEntryPointList)
>      if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification:
>          PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION']
>      else:
> @@ -1468,7 +1483,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
>      else:
>          UefiSpecVersion = '0x00000000'
>      Dict = {
> -        'Function'       :   Info.Module.ModuleEntryPointList,
> +        'Function'       :   ModuleEntryPointList,
>          'PiSpecVersion'  :   PiSpecVersion + 'U',
>          'UefiSpecVersion':   UefiSpecVersion + 'U'
>      }
> @@ -1481,7 +1496,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
>                    AUTOGEN_ERROR,
>                    '%s must have exactly one entry point' % Info.ModuleType,
>                    File=str(Info),
> -                  ExtraData= ", ".join(Info.Module.ModuleEntryPointList)
> +                  ExtraData= ", ".join(ModuleEntryPointList)
>                    )
>      if Info.ModuleType == SUP_MODULE_PEI_CORE:
>          AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict))
> @@ -1535,11 +1550,18 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
>  def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
>      if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]:
>          return
> +
> +    ModuleUnloadImageList = []
> +    for Lib in Info.DependentLibraryList:
> +        if len(Lib.ModuleUnloadImageList) > 0:
> +            ModuleUnloadImageList = ModuleUnloadImageList + Lib.ModuleUnloadImageList
> +    ModuleUnloadImageList = ModuleUnloadImageList + Info.Module.ModuleUnloadImageList
> +
>      #
>      # Unload Image Handlers
>      #
> -    NumUnloadImage = len(Info.Module.ModuleUnloadImageList)
> -    Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':Info.Module.ModuleUnloadImageList}
> +    NumUnloadImage = len(ModuleUnloadImageList)
> +    Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':ModuleUnloadImageList}
>      if NumUnloadImage < 2:
>          AutoGenC.Append(gUefiUnloadImageString[NumUnloadImage].Replace(Dict))
>      else:
> diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> index b79280bc2e..22abda8743 100644
> --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> @@ -20,6 +20,8 @@ from Workspace.BuildClassObject import StructurePcd
>  from Common.BuildToolError import RESOURCE_NOT_AVAILABLE
>  from Common.BuildToolError import OPTION_MISSING
>  from Common.BuildToolError import BUILD_ERROR
> +from Common.BuildToolError import PREBUILD_ERROR
> +import Common.EdkLogger as EdkLogError
> 
>  class OrderedListDict(OrderedDict):
>      def __init__(self, *args, **kwargs):
> @@ -138,6 +140,12 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
>                              return []
> 
>                  LibraryModule = BuildDatabase[LibraryPath, Arch, Target, Toolchain]
> +                if LibraryModule.ModuleEntryPointList and LibraryModule.ModuleType != Module.ModuleType:
> +                    EdkLogError.error(
> +                        "build", PREBUILD_ERROR,
> +                        "Driver's ModuleType must be consistent [%s]" % (str(Module)),
> +                        File=str(FileName),
> +                        ExtraData="consumed by [%s]" % str(LibraryModule))
>                  # for those forced library instance (NULL library), add a fake library class
>                  if LibraryClassName.startswith("NULL"):
>                      LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
> --
> 2.14.1.windows.1



      reply	other threads:[~2019-02-19 14:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 10:46 [PATCH V3] BaseTools:BaseTools supports to the driver combination Fan, ZhijuX
2019-02-19 14:55 ` Gao, Liming [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14E3E1A78@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox