Re: How to link DXE_DRIVER from UEFI_APPLICATION?


Laszlo Ersek
 

On 02/05/21 07:59, joseph via groups.io wrote:
Hi,

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:

Package dsc:
[LibraryClasses.common]
Tpm2DeviceLibTcg2|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf

Application inf:
[LibraryClasses]
Tcg2PhysicalPresenceLib
========================================

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?
"SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf" already
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.

Laszlo

Join discuss@edk2.groups.io to automatically receive all group messages.