上个月edk2 202308 正式发布在:
https://github.com/tianocore/edk2/releases/tag/edk2-stable202308
从 History 来看,改动并不大:
- CryptoPkg: consume OpenSSL 3.0
- Replace the OVMF-specific SataControllerDxe with the generic one in MdeModulePkg
- Remove the duplicated definitions from BaseTools
- Arm GIC Library and Driver improvements
- Use restricted memory mappings in PEI
- Add SmmCpuFeaturesLib implementation for AMD Processor family
- Add USB Network RNDIS Drivers
- Support Standalone MM based variable services in PEI on ARM systems
- Add RISC-V MMU support
- Add RISC-V support to CLANGDWARF toolchain
和之前类似,这里放上一个完整版,补全了所有的三方库,大小是107MB 左右。
https://pan.baidu.com/s/1rQf19nHbpxDdwB5DJkVi0w?pwd=LABZ
提取码: LABZ
此外,为了方便初学者,这里提供一个配置好的 Win10+VS2019 EDK2 环境,导入即可上手:
https://pan.baidu.com/s/1B9aFEcRur8xY4g1X6Fdgcg?pwd=labz
提取码: labz
请问博主有没有出现编译OvmfPkg失败的问题,我自己搭建的环境Windows + VS2019编译OvmfPkg过不了,试过MdePkg和EmulatorPkg都是可以编译的
具体什么错误?
Python版本:3.11.5 Nasm版本:2.16.01,branch切到的stable-202308的tag,挂了梯子,submodule完备,ShellPkg和EmulatorPkg都能编过,就是OvmfPkg编译有问题
1.执行build -t VS2019 -a IA32 -a X64 -p OvmfPkg\OvmfPkgIa32X64.dsc出现
build.py…
: 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 [d:\code\edk2-stable202308\Build\Ovmf3264\DEBUG_VS2019\IA32\OvmfPkg\Library\BaseMemEncryptSevLib\SecMemEncryptSevLib]
build.py…
: 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 [d:\code\edk2-stable202308\Build\Ovmf3264\DEBUG_VS2019\IA32\OvmfPkg\Library\BaseMemEncryptSevLib\PeiMemEncryptSevLib]
build.py…
: error F002: Failed to build module
d:\code\edk2-stable202308\OvmfPkg\Library\BaseMemEncryptSevLib\SecMemEncryptSevLib.inf [IA32, VS2019, DEBUG]
– Failed –
2.执行build -t VS2019 -a IA32 -p OvmfPkg\OvmfPkgIa32.dsc出现
build.py…
: 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 [d:\code\edk2-stable202308\Build\OvmfIa32\DEBUG_VS2019\IA32\UefiCpuPkg\Library\MicrocodeLib\MicrocodeLib]
build.py…
: 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 [d:\code\edk2-stable202308\Build\OvmfIa32\DEBUG_VS2019\IA32\UefiCpuPkg\Library\MtrrLib\MtrrLib]
build.py…
: 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 [d:\code\edk2-stable202308\Build\OvmfIa32\DEBUG_VS2019\IA32\UefiCpuPkg\Library\BaseXApicX2ApicLib\BaseXApicX2ApicLib]
build.py…
: 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 [d:\code\edk2-stable202308\Build\OvmfIa32\DEBUG_VS2019\IA32\UefiCpuPkg\Library\MpInitLib\DxeMpInitLib]
build.py…
: error F002: Failed to build module
d:\code\edk2-stable202308\UefiCpuPkg\Library\MicrocodeLib\MicrocodeLib.inf [IA32, VS2019, DEBUG]
– Failed –
3.执行build -t VS2019 -a X64 -p OvmfPkg\OvmfPkgX64.dsc 出现
build.py…
: 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 [d:\code\edk2-stable202308\Build\OvmfX64\DEBUG_VS2019\X64\OvmfPkg\Library\BaseMemEncryptSevLib\SecMemEncryptSevLib]
build.py…
: 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 [d:\code\edk2-stable202308\Build\OvmfX64\DEBUG_VS2019\X64\OvmfPkg\Library\CcExitLib\SecCcExitLib]
我试验了一下你的编译命令,我这边可以正常编译。
你看一下 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x86\nmake.exe
这个是否存在?
这个是存在的,cmd打开显示是Microsoft (R) 程序维护实用工具 14.29.30151.0 版,我补充说明的EmulatorPkg和ShellPkg能编译pass也是想说明我本地编译环境ok这一点,按理说edk2 release有CICD去跑GCC和VS2019工具链,我也没往OvmfPkg上想,但没找出来本地环境哪里有问题,就是编译不了Ovmf
想想办法,能否再细化一下,到底是什么命令出错的?
同一个问题,请问解决了吗?
Python 3.11.4
Nasm 2.16.01
VS2022 + MSVC v142
我查了一下 tools_def.txt 里面目前还不支持 VS2022,请使用 2019
刚试了,2019一样的编译不过,毕竟MSVC 142就是2019的编译工具嘛。
版主有兴趣的话可以试试2022里加MSVC 142组件,设置下面的临时变量玩玩,至少我除了OVMF跟楼上一个问题外,别的都能编译。
set VS2019_PREFIX=..\VS2022路径\VC\Tools\MSVC\14.29.30133\
我刚确认了一下 build -t VS2019 -a IA32 -a X64 -p OvmfPkg\OvmfPkgIa32X64.dsc 可以正常 Build 通过。我这边看不到 fail的现象。
回头我下载一个 vs2022 试试看。
Generate Region at Offset 0x20000
Region Size = 0xE0000
Region Name = FV
Generate Region at Offset 0x100000
Region Size = 0xD00000
Region Name = FV
GUID cross reference file can be found at c:\buildbs\edk202308\Build\Ovmf3264\DEBUG_VS2019\FV\Guid.xref
FV Space Information
SECFV [16%Full] 212992 (0x34000) total, 34192 (0x8590) used, 178800 (0x2ba70) free
PEIFV [24%Full] 917504 (0xe0000) total, 220392 (0x35ce8) used, 697112 (0xaa318) free
DXEFV [34%Full] 13631488 (0xd00000) total, 4731808 (0x4833a0) used, 8899680 (0x87cc60) free
FVMAIN_COMPACT [36%Full] 3440640 (0x348000) total, 1257504 (0x133020) used, 2183136 (0x214fe0) free
– Done –
Build end time: 09:03:14, Dec.13 2023
Build total time: 00:05:15
我下载了一个 VS2022 编译 OVMF 的时候,确实会遇到一个错误 HiiDatabase 中的memcpy无法找到 Link。这个问题是对 \MdeModulePkg\Universal\HiiDatabaseDxe\Image.c
OffsetY1 = Image->Width * Ypos; 这个语句使用 memcpy 优化导致的。可以通过/Od 关闭这里的优化,然后就可以编译通过了。
感谢尝试,我找到我失败的原因了,ArchitecturalMsr.h这个文件在我这个系统里100%会有编译器 C4819警告,重新以Unicode – Codepage 65001编码进行保存可以解决