From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=zhijux.fan@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D285B20886FCF for ; Thu, 14 Feb 2019 19:18:06 -0800 (PST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2019 19:18:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,371,1544515200"; d="dat'59?scan'59,208,59";a="126643727" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga003.jf.intel.com with ESMTP; 14 Feb 2019 19:18:05 -0800 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 14 Feb 2019 19:18:05 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 14 Feb 2019 19:18:05 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.109]) with mapi id 14.03.0415.000; Fri, 15 Feb 2019 11:18:03 +0800 From: "Fan, ZhijuX" To: "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Feng, Bob C" Thread-Topic: [PATCH] BaseTools:BaseTools supports to the driver combination. Thread-Index: AdTE3Q4tW6KxWQxnQDi9d2UW44OsvQ== Date: Fri, 15 Feb 2019 03:18:02 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [PATCH] BaseTools:BaseTools supports to the driver combination. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Feb 2019 03:18:07 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1520 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=20 LIBRARY INF has the parameter LIBRARY_CLASS=20 Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/GenC.py | 31 ++++++++++++++++++++++++++---= -- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 9700bf8527..93e8d78375 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1455,10 +1455,24 @@ def CreateLibraryDestructorCode(Info, AutoGenC, Aut= oGenH): def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_= MODULE_SEC]: return + ModuleEntryPointList =3D [] + for Lib in Info.DependentLibraryList: + if len(Lib.ModuleEntryPointList) > 0: + if Lib.ModuleType =3D=3D Info.ModuleType: + ModuleEntryPointList =3D ModuleEntryPointList + Lib.Module= EntryPointList + else: + EdkLogger.error( + "build", + CODE_ERROR, + "%s \nDriver's ModuleType must be consistent" % Lib, + File=3Dstr(Info) + ) + ModuleEntryPointList =3D ModuleEntryPointList + Info.Module.ModuleEntr= yPointList + # # Module Entry Points # - NumEntryPoints =3D len(Info.Module.ModuleEntryPointList) + NumEntryPoints =3D len(ModuleEntryPointList) if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification: PiSpecVersion =3D Info.Module.Specification['PI_SPECIFICATION_VERS= ION'] else: @@ -1468,7 +1482,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGe= nH): else: UefiSpecVersion =3D '0x00000000' Dict =3D { - 'Function' : Info.Module.ModuleEntryPointList, + 'Function' : ModuleEntryPointList, 'PiSpecVersion' : PiSpecVersion + 'U', 'UefiSpecVersion': UefiSpecVersion + 'U' } @@ -1481,7 +1495,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGe= nH): AUTOGEN_ERROR, '%s must have exactly one entry point' % Info.ModuleType= , File=3Dstr(Info), - ExtraData=3D ", ".join(Info.Module.ModuleEntryPointList) + ExtraData=3D ", ".join(ModuleEntryPointList) ) if Info.ModuleType =3D=3D SUP_MODULE_PEI_CORE: AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict)) @@ -1535,11 +1549,18 @@ def CreateModuleEntryPointCode(Info, AutoGenC, Auto= GenH): def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH): if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_= MODULE_SEC]: return + + ModuleUnloadImageList =3D [] + for Lib in Info.DependentLibraryList: + if len(Lib.ModuleUnloadImageList) > 0: + ModuleUnloadImageList =3D ModuleUnloadImageList + Lib.ModuleUn= loadImageList + ModuleUnloadImageList =3D ModuleUnloadImageList + Info.Module.ModuleUn= loadImageList + # # Unload Image Handlers # - NumUnloadImage =3D len(Info.Module.ModuleUnloadImageList) - Dict =3D {'Count':str(NumUnloadImage) + 'U', 'Function':Info.Module.Mo= duleUnloadImageList} + NumUnloadImage =3D len(ModuleUnloadImageList) + Dict =3D {'Count':str(NumUnloadImage) + 'U', 'Function':ModuleUnloadIm= ageList} if NumUnloadImage < 2: AutoGenC.Append(gUefiUnloadImageString[NumUnloadImage].Replace(Dic= t)) else: --=20 2.14.1.windows.1