How to link DXE_DRIVER from UEFI_APPLICATION?
I want to include Tcg2PhysicalPresenceLib in my UEFI Application.
Tcg2PhysicalPresenceLib is located in SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf in EDK2.
This is what I tried:
If you do the above, you will get this error.
.../edk2/MyPkg/MyPkg.dsc(...): error 1001: Module type [UEFI_APPLICATION] is not supported by library instance [.../edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf]
consumed by [.../edk2/MyPkg/MyApp/MyApp.inf]
How do I use Tcg2PhysicalPresenceLib in Application?
On 02/05/21 07:59, joseph via groups.io wrote:
permits UEFI_APPLICATION, so that's not the problem.
The issue is that you're trying to link UefiDriverEntryPoint into your
application -- that's wrong. UEFI_APPLICATION modules have different
entry points / depend on different entry point lib classes, namely one
of the following:
- "UefiApplicationEntryPoint" if the application is stand-alone (for
example, bootable as a UEFI boot option)
- "ShellCEntryLib" if the application is a shell application (= it can,
and needs to, be started from the UEFI shell only)
- "LibC" if the application consumes the edk2-libc project for a
standard C library implementation, and starts with a main() function.
Thank you for reply.
My app does not use UefiDriverEntryPoint.
UefiDriverEntryPoint exists in DxeTcg2PhysicalPresenceLib.inf.
If forcibly delete UefiDriverEntryPoint from DxeTcg2PhysicalPresenceLib.inf, Another error occurs.
Instance of library class [Tcg2PpVendorLib] is not foundAdding the Tcg2PpVendorLib again gives me the "error 1001" error.
========== MyApp.inf =========
========== DxeTcg2PhysicalPresenceLib.inf =========
On 02/05/21 15:44, joseph via  wrote:
Hi, LaszloOuch. 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
OK, so the bugged library INF files are:
Can you please file a bugzilla ticket at <https://bugzilla.tianocore.org/>, about this? Those library instances should not depend on the UefiDriverEntryPoint class.
If forcibly delete UefiDriverEntryPoint from DxeTcg2PhysicalPresenceLib.inf, Another error occurs.Wait, that's a different case.Instance of library class [Tcg2PpVendorLib] is not found
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:
So in your DSC file, you could use:
Hope this helps,
Adding the Tcg2PpVendorLib again gives me the "error 1001" error.
Thank you. But the problem is still not solved.
.../edk2/MyPkg/MyPkg.dsc(...): error 1001: Module type [UEFI_APPLICATION] is not supported byAfter modifying several more steps through the method you suggested, the build was completed.
But I get the error like below.
/usr/bin/ld: Tpm2DeviceLibTcg2.obj (symbol from plugin): in function `mTcg2Protocol':Can you help me a little more?
I will also create a Bugzilla ticket soon.
Oh, this was my mistake.
The above error was because the Tpm2DeviceLib and Tpm2DeviceLibTcg2 libraries were linked both.
Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.infThis discussion seems to be resolved.
I need to go to Bugzilla.
On 02/06/21 05:49, joseph via  wrote:
Hi Laszlo,This is the bug (or, at least "one" bug) in your platform DSC file:
# TPM 2
There is no such library class as "Tpm2DeviceLibTcg2".
Please refer to the commit message in the following commit:
Specifically, please see the part that starts with "Laszlo Ersek explained on the list why Tpm2DeviceLib..."
But I get the error like below./usr/bin/ld: Tpm2DeviceLibTcg2.obj (symbol from plugin): in function `mTcg2Protocol':Can you help me a little more?