shell - 使用 EDK2 编译 UEFI 应用程序/驱动程序
问题描述
我正在尝试为 UEFI 构建一个应用程序/驱动程序,它将启动一个 UEFI Shell 脚本。我正在将UDK2018与 Visual Studio 2017 一起使用。我已经正确构建了所有工具,我可以运行启动 UEFI Shell 的 SecMain,并且我已经测试了以下脚本:
在启动.nsh 中:
fs0:
echo -off
vol0
vol1
fs1:
vol0
vol1
在第 0 卷中:
vol > base.txt
在第一卷:
vol > output.txt
comp base.txt output.txt
我的目标是检查是否对 UEFI 系统进行了任何更改。为什么我更喜欢由应用程序/驱动程序来完成?我在文档的某个地方找到了这个截图。也许我错了,但是从 Shell 我无法启动操作系统。我的意思是,自动,因为 UEFI 应用程序/驱动程序在 UEFI 服务中运行,对吗?它将执行,然后将控制权传递给启动操作系统的某些引导机制。
我现在拥有的:
C:\MyWorkspace
使用 EDK2 文件
C:\MyWorkspace\source
我是否使用 UEFI 驱动程序向导为 IA32 架构创建了驱动程序
C:\Users\username\source\repos\BootCheck
使用 Makefile 项目,具有以下设置:Debugging和NMake。然后我包括一个BootCheck.c
来自C:\MyWorkspace\source
我可能需要在 MdePkg 或 Nt32Pkg 文件夹中的 .dec 或 .dsc 文件中添加一些代码行,不知道,我迷路了。我将不胜感激分步指南或任何有用的信息,谢谢。
@@@
对不起,不清楚的问题。让我以这个问题为例:
Run a UEFI shell command from inside UEFI application and @Yaniv Levinsky answer。我想做类似的事情,但是当我尝试包含时,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
解决方案
推荐阅读
- dialogflow-es - 我可以根据问题中的术语位置提取参数吗?
- spring - created_by 在数据库中始终设置为 null 并且 Version 无法正常工作
- python - 有没有办法删除 Pygame Surfaces?或者有什么方法可以将它们从内存中删除以提高性能?
- shopify - 在 Shopify Debut 主题产品上向幻灯片添加箭头
- git - 将更改从克隆推送到 github 中的主分支 gitlab clone vs fork vs branch
- python - 如何计算加权平均值
- python - 最后用 kv 初始化 python3 dict
- reactjs - 在 React 和 Flask 之间上传文件时 POST 400 (BAD REQUEST)
- python - 通过numpy数组的最小总和路由
- twilio - 连接到 Twilio Studio 应用程序的 Twilio 编号失败并出现错误 - 11200