1

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
Ironwing
  • 121
  • 1
  • 15
  • This question is not currently well suited to stackoverflow, since something like 4 independent answers would be required to resolve it. I would suggest either rewinding to basics and ask about booting an operating system from shell, or moving to some other help forum such as edk2-devel@lists.01.org ([subscription required](https://lists.01.org/mailman/listinfo/edk2-devel)) or #edk2 on freenode (IRC). – unixsmurf Dec 12 '18 at 11:09
  • I really don’t understand your question, but I can tell you one thing that should help: it is possible to boot from the shell, simply by running a boot loader from the shell (or from a shell script, or from startup.nsh). – prl Dec 12 '18 at 11:34
  • @prl I edited the main post, with some more information and what I want to achieve. – Ironwing Dec 12 '18 at 12:04
  • @unixsmurf Thanks for the tips, I also added more info, maybe you could help me somehow. – Ironwing Dec 12 '18 at 12:05
  • @ironwing: no, this question is not salvagable. A stackoverflow question is supposed to ask a specific thing - this is asking several layers down of where your problem starts. If you create a new question asking one thing, what I suggested in my first comment, I will try to answer that. – unixsmurf Dec 12 '18 at 14:49

0 Answers0