Reputation: 1
I'm trying to investigate UEFI and EDK2. I have found some labs to learn it (https://laurie0131.gitbooks.io/uefi_driver_hii_win_lab_guide/content/).
In this guide talks that I must add my project to Nt32Pkg.dsc and turn off -Werror in Conf/tools_def.txt.
Firstly, I haven't any mentions of Nt32Pkg in edk2 source code which I have cloned from https://github.com/tianocore/edk2. So I have created task in VS2019 to run edk2 Emulator:
{
"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"
}
]
}
I have added my project to EmulatorPkg.dsc like:
MyWizardDriver/MyPkg/MyWizardDriver/MyWizardDriver.inf{
<LibraryClasses> DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
}
Now I can build Emulator with my project, but I have an error: error 12288: CHAR16 : unexpected token in struct:
#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()
I'm also haven't any mention -Werror in Conf/tools_def.txt.
So, how can I disable -Werror in my build? Or what am I doing wrong?
Full error trace:
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]
Upvotes: 0
Views: 162
Reputation: 1
You can use UINT16 instead of CHAR16,which .vfr does not support, then you will build pass:
typedef struct {
UINT16 MyWizardDriverStringData[MYWIZARDDRIVER_STRING_SIZE];
UINT16 MyWizardDriverHexData;
UINT8 MyWizardDriverBaseAddress;
UINT8 MyWizardDriverChooseToEnable;
UINT16 MyWizardDriverNvRamAddress;
// CHAR16 *MyWizardDriverNvRamAddress
} MYWIZARDDRIVER_CONFIGURATION;
but according to document content, the .efi can't be verified using WinHost.exe, anyway, nice try.
Upvotes: 0