我正在尝试研究 UEFI 和 EDK2。我找到了一些实验室来学习它(https://laurie0131.gitbooks.io/uefi_driver_hii_win_lab_guide/content/)。
在本指南中,我必须将我的项目添加到 Nt32Pkg.dsc 并关闭 Conf/tools_def.txt 中的 -Werror。
首先,我从 https://github.com/tianocore/edk2 克隆的 edk2 源代码中没有提到 Nt32Pkg。所以我在 VS2019 中创建了任务来运行 edk2 模拟器:
{
"version": "0.2.1",
"tasks": [
{
"taskLabel": "build-emulator",
"appliesTo": "/EmulatorPkg",
"type": "launch",
"contextType": "build",
"command": "BuildEmulator.bat",
"args": [
"-b DEBUG"
],
"output": "${workspaceRoot}\\Build\\EmulatorX64\\DEBUG_VS2019\\X64\\WinHost.exe"
},
{
"taskLabel": "clean-emulator",
"appliesTo": "/EmulatorPkg",
"type": "launch",
"contextType": "clean",
"command": "BuildEmulator.bat",
"args": [
"-b DEBUG",
"-b RELEASE",
"clean"
]
},
{
"taskLabel": "build-payload",
"appliesTo": "/UefiPayloadPkg",
"type": "launch",
"contextType": "build",
"command": "BuildPayload.bat",
"args": [
"-b DEBUG"
],
"output": "${workspaceRoot}\\Build\\UefiPayloadPkgX64\\DEBUG_VS2019\\FV\\UEFIPAYLOAD.exe"
},
{
"taskLabel": "release-payload",
"appliesTo": "/UefiPayloadPkg",
"type": "launch",
"contextType": "custom",
"command": "BuildPayload.bat",
"args": [
"-b RELEASE"
]
},
{
"taskLabel": "clean-payload",
"appliesTo": "/UefiPayloadPkg",
"type": "launch",
"contextType": "clean",
"command": "BuildPayload.bat",
"args": [
"-b DEBUG",
"-b RELEASE",
"clean"
]
},
{
"taskLabel": "task-edk2",
"appliesTo": "/",
"type": "launch"
},
{
"taskLabel": "task-edk2",
"appliesTo": "/",
"type": "launch"
},
{
"taskLabel": "task-EmulatorPkg",
"appliesTo": "EmulatorPkg/",
"type": "launch"
},
{
"taskLabel": "task-EmulatorPkg",
"appliesTo": "EmulatorPkg/",
"type": "launch"
},
{
"taskLabel": "task-EmulatorPkg",
"appliesTo": "EmulatorPkg/",
"type": "launch"
}
]
}
我已将我的项目添加到 EmulatorPkg.dsc,例如:
MyWizardDriver/MyPkg/MyWizardDriver/MyWizardDriver.inf{
<LibraryClasses> DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
}
现在我可以用我的项目构建模拟器,但我有一个错误: 错误 12288:CHAR16:意外标记 结构中:
#pragma pack(1)
typedef struct {
UINT16 MyWizardDriverStringData[MYWIZARDDRIVER_STRING_SIZE];
UINT16 MyWizardDriverHexData;
UINT8 MyWizardDriverBaseAddress;
UINT8 MyWizardDriverChooseToEnable;
CHAR16 *MyWizardDriverNvRamAddress; //bug is here
} MYWIZARDDRIVER_CONFIGURATION;
#pragma pack()
我也没有在 Conf/tools_def.txt 中提及 -Werror。
那么,如何在我的构建中禁用 -Werror ?还是我做错了什么?
完整的错误跟踪:
VfrCompile...
C:\edk2\EmulatorPkg\MyWizardDriverNVDataStruc.h(21): error 12288: CHAR16
unexpected token
VfrCompile...
MyWizardDriver.vfr(11): ERROR 12288
undefined
VfrCompile...
C:\edk2\EmulatorPkg\MyWizardDriver.vfr(13): error 12288: MWD_IfrNVData
undefined
VfrCompile...
MyWizardDriver.vfr(11): ERROR 12288
undefined
VfrCompile...
C:\edk2\EmulatorPkg\MyWizardDriver.vfr(23): error 12288: MWD_IfrNVData
undefined
VfrCompile...
C:\edk2\EmulatorPkg\MyWizardDriver.vfr(23): error 12288: MWD_IfrNVData
can not use the efi varstore like this
C:\edk2\EmulatorPkg\VfrCompile : error 0003: Error parsing
compile error in file c:\edk2\Build\EmulatorX64\DEBUG_VS2019\X64\MyWizardDriver\MyPkg\MyWizardDriver\MyWizardDriver\OUTPUT\.\MyWizardDriver.i
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winspool.h
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\prsht.h
C:\edk2\EmulatorPkg\NMAKE : fatal error U1077: C:\edk2\BaseTools\Bin\Win32\VfrCompile.EXE : "0x2"
Stop.
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\pshpack8.h
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\poppack.h
build.py...
C:\edk2\EmulatorPkg\EXEC : error 7000: Failed to execute command
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x86\nmake.exe /nologo tbuild [c:\edk2\Build\EmulatorX64\DEBUG_VS2019\X64\MyWizardDriver\MyPkg\MyWizardDriver\MyWizardDriver]
build.py...
C:\edk2\EmulatorPkg\EXEC : error F002: Failed to build module
c:\edk2\MyWizardDriver\MyPkg\MyWizardDriver\MyWizardDriver.inf [X64, VS2019, DEBUG]
我遇到了和你一样的问题,请问你解决了吗?