Re: UEFI Driver/Application


Rafael Machado
 

Hi Ivan

You need to add the declaration of ShellLib at the Nt32Pkg dsc file.
Other .dsc files maybe usefull to check how to do that. Maybe you will need
to add other packages after adding the ShellLib. So other errors may arise
until you add all the required packages.

Rafael Machado

Em seg, 17 de dez de 2018 04:19, Ivan Novgorodtsev via edk2-devel <
edk2-devel@...> escreveu:

Hi,


I want to develop a small security check
for UEFI partition. I want it to be run each time when system starts. My
idea was to
create UEFI driver or application (I'm not quite sure what will fit
better), because
if I'm not wrong, they run at UEFI Services
level, according to the documentation:https://imgur.com/a/yep2IwB It
will execute,
and the pass control to Boot Manager which launches OS, right? I'm open to
suggestions, if there's more suitable solution. The scripts I want to run
in Shell
via
application:

vol > base.txt
vol > output.txt
comp base.txt output.txt

Right now I have also problem with compilation of project. I want to use
similar
piece of code like this:

#include <Library/ShellLib.h>

...

EFI_STATUS
EFIAPI UefiMain(IN EFI_HANDLE
ImageHandle,IN EFI_SYSTEM_TABLE *SystemTable)
{
EFI_STATUS Status;
ShellExecute(&ImageHandle,L"echo Hello World!",FALSE,NULL,&Status);
returnStatus;
}

...
My .INF file:
## @file
# TODO: Brief Description of UEFI Driver BootCheck
#
# TODO: Detailed Description of UEFI Driver BootCheck
#
# TODO: Copyright for UEFI Driver BootCheck
#
# TODO: License for UEFI Driver BootCheck
#
##

[Defines]
INF_VERSION = 0x00010005
BASE_NAME = BootCheck
FILE_GUID = 7a81cdc0-fde7-11e8-b163-3c970edcfd41
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
ENTRY_POINT = BootCheckDriverEntryPoint

[Packages]
MdePkg/MdePkg.dec
ShellPkg/ShellPkg.dec

[Sources]
BootCheck.h
BootCheck.c
ComponentName.c
ComponentName.h

[LibraryClasses]
UefiDriverEntryPoint
UefiBootServicesTableLib
MemoryAllocationLib
BaseMemoryLib
BaseLib
UefiLib
DevicePathLib
DebugLib
ShellLib

[Protocols]
gEfiDriverBindingProtocolGuid
gEfiPciIoProtocolGuid
gEfiComponentName2ProtocolGuid
gEfiComponentNameProtocolGuid
gEfiShellProtocolGuid

[Guids]

I get the following output erros:

Active Platform = c:\myworkspace\Nt32Pkg\Nt32Pkg.dsc
1>Flash Image Definition = c:\myworkspace\Nt32Pkg\Nt32Pkg.fdf
1>
1>
1>
1>build.py...
1>c:\myworkspace\Nt32Pkg\Nt32Pkg.dsc(...) : error 4000: Instance of
library class [ShellLib] is not found
1> in [c:\myworkspace\source\BootCheck.inf] [IA32]
1> consumed by module [c:\myworkspace\source\BootCheck.inf]

I really appreciate your time and your help with this.
Kind regards, Ivan

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

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