I'm trying to build an application/driver for UEFI, which will start an UEFI Shell script. I'm using UDK2018 with Visual Studio 2017. I have build all tools properly, I can run SecMain which launches UEFI Shell and I have already tested following scripts:
In startup.nsh:
fs0:
echo -off
vol0
vol1
fs1:
vol0
vol1
In vol0:
vol > base.txt
In vol1:
vol > output.txt
comp base.txt output.txt
My goal is to check if there were made any changes to UEFI system. Why I prefer this to be done by application/driver? I found somewhere in documentation this screenshot. Maybe I'm wrong, but from Shell I can't boot operating system. I mean, automatically, because Uefi app/driver is running in UEFI Services, right? It will execute, and then pass control to some boot mechanism which launches OS.
What I have at this moment:
C:\MyWorkspace
with EDK2 files
C:\MyWorkspace\source
were I created a driver for IA32 architecture using UEFI Driver Wizard
C:\Users\username\source\repos\BootCheck
with Makefile Project, with following settings: Debugging and NMake. Then I include a BootCheck.c
from C:\MyWorkspace\source
I probably need to add some lines of code into .dec or .dsc files in folders MdePkg or Nt32Pkg, don't know, I'm lost. I would appreciate a step by step guide or any useful information, thank you.
@@@
Sorry for unclear question. Let me use this question as example:
Run a UEFI shell command from inside UEFI application and @Yaniv Levinsky answer.
I want to do similar thing, but when I'm trying to include C:\MyWorkspace\ShellPkg\Include\Library\ShellLib.h
i get errors like this:
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 the first 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 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