public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* UEFI Driver/Application
@ 2018-12-17  7:11 Ivan Novgorodtsev
  2018-12-17 10:14 ` Rafael Machado
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Novgorodtsev @ 2018-12-17  7:11 UTC (permalink / raw)
  To: edk2-devel

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: UEFI Driver/Application
  2018-12-17  7:11 UEFI Driver/Application Ivan Novgorodtsev
@ 2018-12-17 10:14 ` Rafael Machado
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael Machado @ 2018-12-17 10:14 UTC (permalink / raw)
  To: Ivan Novgorodtsev; +Cc: edk2-devel

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@lists.01.org> 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@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-17  9:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-17  7:11 UEFI Driver/Application Ivan Novgorodtsev
2018-12-17 10:14 ` Rafael Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox