Date
1 - 7 of 7
How to link DXE_DRIVER from UEFI_APPLICATION?
joseph@...
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? Kind regards, Joseph |
|
Laszlo Ersek
On 02/05/21 07:59, joseph via groups.io wrote:
Hi,"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 |
|
joseph@...
Hi, Laszlo
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 ========= [LibraryClasses] UefiApplicationEntryPoint UefiLib PcdLib OpensslLib Tpm2DeviceLibTcg2 Tcg2PhysicalPresenceLib ========== DxeTcg2PhysicalPresenceLib.inf ========= [LibraryClasses] MemoryAllocationLib UefiLib UefiBootServicesTableLib UefiDriverEntryPoint UefiRuntimeServicesTableLib BaseMemoryLib DebugLib PrintLib HiiLib HobLib Tpm2CommandLib Tcg2PpVendorLib |
|
Laszlo Ersek
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 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://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: 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. |
|
joseph@...
Hi Laszlo,
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. https://github.com/jc-lab/temp-edk2-tpm2-problem/commit/d9afc8f562d1bda190b27ac8db67df3b0a5bb24a 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. Kind regards, Joseph |
|
joseph@...
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. Thanks. |
|
Laszlo Ersek
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 Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf Tpm2DeviceLibTcg2|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf There is no such library class as "Tpm2DeviceLibTcg2". Please refer to the commit message in the following commit: https://github.com/tianocore/edk2/commit/0c0a50d6b3ff Specifically, please see the part that starts with "Laszlo Ersek explained on the list why Tpm2DeviceLib..." Thanks, Laszlo 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? |
|