[edk2] UEFI Driver Libraries problem

Jarlstrom, Laurie laurie.jarlstrom at intel.com
Wed Dec 12 09:09:27 PST 2018


Hi Ivan,

It seems that probably you might be getting the error because of your .inf File. Do you want your UEFI module to be a UEFI_DRIVER or UEFI_APPLICATION? I am assuming UEFI_DRIVER.
Is there a reason why you need to access the UEFI Shell protocol from your driver?
Typically it is not best practices to have a dependency on the UEFI Shell within a driver since the UEFI Driver is called from the UEFI Dispatcher and not from the Shell.
Some good examples of a UEFI Driver are in https://github.com/tianocore/edk2/tree/master/MdeModulePkg of which the SCSI driver is a good single example: https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Bus/Scsi/ScsiDiskDxe 

Here is an example of a UEFI Application:  
https://github.com/tianocore/edk2/tree/master/MdeModulePkg/Application/HelloWorld

Here is an example of a super simple UEFI Application: https://github.com/tianocore/tianocore.github.io/wiki/Getting-Started-Writing-Simple-Application 

Thanks,
Laurie

Laurie.jarlstrom at intel.com, 
Firmware Integration & Dev (FED-SSG)
(503) 712 9395


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces at lists.01.org] On Behalf Of Jarlstrom, Laurie
Sent: Wednesday, December 12, 2018 8:46 AM
To: inovgorodtsev at itti.com.pl; edk2-devel at lists.01.org
Subject: [edk2] FW: UEFI Driver Libraries problem


Hi Ivan,

I am forwarding your question to the email list for EDK II, edk2-devel at lists.01.org and will answer there.

To join this email list see: https://github.com/tianocore/tianocore.github.io/wiki/edk2-devel and then join the https://lists.01.org/mailman/listinfo/edk2-devel email list for edk2-devel


Thanks,
Laurie

Laurie.jarlstrom at intel.com, 

-----Original Message-----
From: edk2-devel [mailto:mailman-bounces at lists.01.org] On Behalf Of inovgorodtsev at itti.com.pl
Sent: Wednesday, December 12, 2018 5:14 AM
To: edk2-devel-owner at lists.01.org
Subject: UEFI Driver Libraries problem

Hello,
at the beggining I wanted to say, that maybe here on this page it will be easier to understand my problem, there are some pictures explaining and nice code formatting:

https://stackoverflow.com/questions/53741304/compile-uefi-application-driver-using-edk2 

I'm trying to build UEFI Application/Driver, but I get errors when I'm trying to include library:
#include "C:\MyWorkspace\ShellPkg\Include\Library\ShellLib.h"
Errors:
1>Building ...
c:\myworkspace\MdeModulePkg\Library\CustomizedDisplayLib\CustomizedDisplayLib.inf
[IA32]
1>C:\MyWorkspace\ShellPkg\Include\Library\ShellLib.h(22): fatal error
C1083: Cannot open include file: 'Protocol/EfiShellInterface.h': No such file or directory
1>NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\cl.exe"'
: return code '0x2'

If I try another method:

EFI_STATUS
EFIAPI
BootCheckDriverEntryPoint (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE  *SystemTable
  )
{
    EFI_SHELL_PROTOCOL    *EfiShellProtocol;
    EFI_STATUS            Status;

    Status = gBS->LocateProtocol(&gEfiShellProtocolGuid,NULL,(VOID
**)&EfiShellProtocol);

  //
  // Install UEFI Driver Model protocol(s).
  //

  Status = EfiLibInstallDriverBindingComponentName2 (
             ImageHandle,
             SystemTable,
             &gBootCheckDriverBinding,
             ImageHandle,
             &gBootCheckComponentName,
             &gBootCheckComponentName2
             );
  ASSERT_EFI_ERROR (Status);

  return Status;
}

I get.. linker errors I suppose. I also tried to include some libraries in property pages, but I'm not very familiar with Visual Makefile project, I could have done something wrong.

1>Building ...
c:\myworkspace\MdeModulePkg\Library\FileExplorerLib\FileExplorerLib.inf
[IA32]
1>c:\myworkspace\source\BootCheck.c(111): error C2065:
'EFI_SHELL_PROTOCOL': undeclared identifier
1>c:\myworkspace\source\BootCheck.c(111): error C2065: 'EfiShellProtocol':
undeclared identifier
1>c:\myworkspace\source\BootCheck.c(111): warning C4552: '*': result of
expression not used
1>c:\myworkspace\source\BootCheck.c(114): error C2065: 'EfiShellProtocol':
undeclared identifier


I would appreciate any useful information, thank you.
Ivan Novgorodtsev


_______________________________________________
edk2-devel mailing list
edk2-devel at lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


More information about the edk2-devel mailing list