[EXTERNAL] Re: [edk2-discuss] How to link DXE_DRIVER from UEFI_APPLICATION?


Bret Barkelew
 

Yeah, DxeTcg2PhysicalPresence could use some TLC. It’s a weird catch-all of stuff which should be refactored.
I’ve had it on my backlog forever.

- Bret

From: Laszlo Ersek via groups.io<mailto:lersek=redhat.com@groups.io>
Sent: Friday, February 5, 2021 7:47 AM
To: joseph@zeronsoftn.com<mailto:joseph@zeronsoftn.com>; discuss@edk2.groups.io<mailto:discuss@edk2.groups.io>
Subject: [EXTERNAL] Re: [edk2-discuss] How to link DXE_DRIVER from UEFI_APPLICATION?

On 02/05/21 15:44, joseph via [] wrote:
Hi, Laszlo

Thank you for reply.

My app does not use UefiDriverEntryPoint.
UefiDriverEntryPoint exists in DxeTcg2PhysicalPresenceLib.inf.
Ouch. That's a bug in "DxeTcg2PhysicalPresenceLib.inf", no doubt.

Let's see if there are some other library INF files that have a similar issue:

$ git grep -l -w UefiDriverEntryPoint -- '*inf' \
| xargs grep -l -w LIBRARY_CLASS

MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.inf
SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.inf

OK, so the bugged library INF files are:
- CustomizedDisplayLib.inf
- DxeTcg2PhysicalPresenceLib.inf
- DxeTcgPhysicalPresenceLib.inf

Can you please file a bugzilla ticket at <https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2F&;data=04%7C01%7Cbret.barkelew%40microsoft.com%7Ca5ed4a8cc1d74674a28708d8c9ed6450%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637481368714208086%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=cUIKRsSv9HUywTgoybjzT%2FnavUVC4JLdCleHnpxjtg4%3D&amp;reserved=0>, about this? Those library instances should not depend on the UefiDriverEntryPoint class.


If forcibly delete UefiDriverEntryPoint from DxeTcg2PhysicalPresenceLib.inf, Another error occurs.
Instance of library class [Tcg2PpVendorLib] is not found
Wait, that's a different case.

When you delete UefiDriverEntryPoint from DxeTcg2PhysicalPresenceLib.inf, you actually fix a bug. And therefore the build process advances a bit further, before it runs into *another* problem.

This particular (new) problem is that your platform DSC file does not resolve the Tcg2PpVendorLib class to a library instance. DxeTcg2PhysicalPresenceLib depends on Tcg2PpVendorLib, but the build process doesn't know what instance of Tcg2PpVendorLib to use. Edk2 offers a Null instance of this library:

SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf

So in your DSC file, you could use:

[LibraryClasses]
Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf

Hope this helps,
Laszlo

Adding the Tcg2PpVendorLib again gives me the "error 1001" error.

========== MyApp.inf =========
[LibraryClasses]
UefiApplicationEntryPoint
UefiLib
PcdLib
OpensslLib
Tpm2DeviceLibTcg2
Tcg2PhysicalPresenceLib

========== DxeTcg2PhysicalPresenceLib.inf =========
[LibraryClasses]
MemoryAllocationLib
UefiLib
UefiBootServicesTableLib
UefiDriverEntryPoint
UefiRuntimeServicesTableLib
BaseMemoryLib
DebugLib
PrintLib
HiiLib
HobLib
Tpm2CommandLib
Tcg2PpVendorLib