我正在尝试为UEFI构建应用程序/驱动程序,这将启动UEFI Shell脚本。 我在Visual Studio 2017中使用UDK2018。我已经正确构建了所有工具,可以运行启动UEFI Shell的SecMain,并且已经测试了以下脚本:
在startup.nsh中:
fs0:
echo -off
vol0
vol1
fs1:
vol0
vol1
在vol0中:
vol > base.txt
在第一卷中:
vol > output.txt
comp base.txt output.txt
我的目标是检查是否对UEFI系统进行了任何更改。为什么我更喜欢由应用程序/驱动程序完成此操作?我在文档this屏幕截图中找到了某个地方。也许我错了,但是从Shell我无法启动操作系统。我的意思是自动,因为Uefi应用程序/驱动程序正在UEFI Services中运行,对吗?它将执行,然后将控制权传递给启动OS的启动机制。
我现在有什么:
C:\MyWorkspace
与EDK2文件
C:\MyWorkspace\source
是我使用UEFI驱动程序向导为IA32架构创建了驱动程序
C:\Users\username\source\repos\BootCheck
和Makefile Project,具有以下设置:Debugging和NMake。然后,我加入了BootCheck.c
C:\MyWorkspace\source
我可能需要在MdePkg或Nt32Pkg文件夹的.dec或.dsc文件中添加一些代码行,不知道,我迷路了。感谢您提供逐步指南或任何有用的信息,谢谢。
@@@
很抱歉,不清楚的问题。让我以这个问题为例:
Run a UEFI shell command from inside UEFI application和@Yaniv Levinsky回答。
我想做类似的事情,但是当我尝试包含C:\MyWorkspace\ShellPkg\Include\Library\ShellLib.h
时,会出现如下错误:
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'
如果我尝试第一种方法:
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;
}
我得到..我想链接器错误。我还尝试在属性页中包含一些库,但是我对Makefile项目不是很熟悉,我可能做错了什么。
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