多种网站模板网络服务投诉
视频:在全新的Ubuntu上从零搭建UEFI的EDK2开发环境
开始:git clone https://github.com/tianocore/edk2.git

开始编译BaseTools前先更新一下子模块:git submodule update --init ,然后:make -C BaseTools/
问题1:BrotliCompress.c:20:10: fatal error: ./brotli/c/common/constants.h: 没有那个文件或目录 #include "./brotli/c/common/constants.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.

解决方法:把确实的文件下载好,放到相应的目录下
来源:edk2编译报错 BrotliCompress.c:20:10: fatal error: ./brotli/c/common/constants.h: No such file or directo
问题2:gcc 找不到 -luuid

解决方法:
sudo apt-get install uuid-dev
来源:解决/usr/bin/ld: cannot find -luuid编译错误
问题3:FAIL: test_FMMT_FMMT (CheckPythonSyntax.Tests)

解决方法:原因是 python 版本不对 ,应该使用python3,但使用设备里 python 指向了python2,重定向软连接到 python3,然后工程根目录执行 source ./edksetup.sh 将正确的python版本设置到工作环境变量

来源:edkII 环境配置
到这里,Basetools 编译成功了。。。。。。。。。。

问题4:EDK2构建发生错误 File/directory not found in workspace
解决方法:可能是之前的子模块没有弄好,重新更新一下
问题5:build 不成功

解决方法:将编译链可以改为GCC

问题6:/bin/sh: 1: nasm: not found

解决方法:sudo apt install nasm

问题7: /home/feng/edk2/Build/EmulatorIA32/DEBUG_GCC/IA32/MdePkg/Library/BaseLib/BaseLib/OUTPUT/Ia32/LongJump.iii:42: error: parser: instruction expected /home/feng/edk2/Build/EmulatorIA32/DEBUG_GCC/IA32/MdePkg/Library/BaseLib/BaseLib/OUTPUT/Ia32/LongJump.iii:47: error: parser: instruction expected

解决方法:nasm 版本太低,下载最新版本

等到 configure 后,进行 make && sudo make install
问题8:/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: 没有那个文件或目录

解决方法:这个头文件在 gcc-multlib 里,安装一下:sudo apt install gcc-multilib
问题9:/home/feng/edk2/EmulatorPkg/Unix/Host/X11GraphicsWindow.c:15:10: fatal error: X11/Xlib.h: 没有那个文件或目录
解决方法:这个头文件在 libx11-dev 里,安装一下:sudo apt install libx11-dev
问题10:/home/feng/edk2/EmulatorPkg/Unix/Host/X11GraphicsWindow.c:18:10: fatal error: X11/extensions/XShm.h: 没有那个文件或目录
解决方法:这个头文件在 libx11-dev 里,安装一下:sudo apt install libxext-dev
问题11:编译不兼容

解决方法:架构IA32不匹配,要改一下,改为 X64,vim Conf/target.txt

成功了!!!


编译 Ovmf
build -a X64 -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc (GCC5及以上都写为GCC5)
问题:/bin/sh: 1: iasl: not found
解决方法:sudo apt install iasl

然后切换到编译好的目录:cd Build/OvmfX64/DEBUG_GCC5/FV,运行qemu-system-x86_64 -bios OVMF.fd
