原先自己编译的EDK2的情况,有点旧,本次更新EDK2使用2019的编译器编译EDK2
需要的工具链如下,自行下载哈:
VS2019:
Python 3.8:Python Release Python 3.8.0 |
ASL:/(MUST Extract to C:\ASL)
NASM:
详细的步骤:
1. 下载最新的EDK2
#github站点
git clone /tianocore/ edk2
#国内同步站点
/mirrors/
2.编辑 .gitmodules 文件,修改对应的下载地址,否则国内会下载不了。
[submodule "CryptoPkg/Library/OpensslLib/openssl"]
path = CryptoPkg/Library/OpensslLib/openssl
url = /ant1423/
[submodule "SoftFloat"]
path = ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3
url = /bbingo/
[submodule "UnitTestFrameworkPkg/Library/CmockaLib/cmocka"]
path = UnitTestFrameworkPkg/Library/CmockaLib/cmocka
url = /m1sstory/
[submodule "MdeModulePkg/Universal/RegularExpressionDxe/oniguruma"]
path = MdeModulePkg/Universal/RegularExpressionDxe/oniguruma
url = /dream-os/
[submodule "MdeModulePkg/Library/BrotliCustomDecompressLib/brotli"]
path = MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
url = /dream-os/
[submodule "BaseTools/Source/C/BrotliCompress/brotli"]
path = BaseTools/Source/C/BrotliCompress/brotli
url = /dream-os/
ignore = untracked
[submodule "RedfishPkg/Library/JsonLib/jansson"]
path = RedfishPkg/Library/JsonLib/jansson
url = /ant1423/
2023/08/29日根据最新的EDK2更新submodule清单;
[submodule "CryptoPkg/Library/OpensslLib/openssl"]
path = CryptoPkg/Library/OpensslLib/openssl
url = /mirrors/
[submodule "SoftFloat"]
path = ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3
url = /yorange1/
[submodule "UnitTestFrameworkPkg/Library/CmockaLib/cmocka"]
path = UnitTestFrameworkPkg/Library/CmockaLib/cmocka
url = /borlwuuu/
[submodule "MdeModulePkg/Universal/RegularExpressionDxe/oniguruma"]
path = MdeModulePkg/Universal/RegularExpressionDxe/oniguruma
url = /borlwuuu/
[submodule "MdeModulePkg/Library/BrotliCustomDecompressLib/brotli"]
path = MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
url = /borlwuuu/
[submodule "BaseTools/Source/C/BrotliCompress/brotli"]
path = BaseTools/Source/C/BrotliCompress/brotli
url = /borlwuuu/
ignore = untracked
[submodule "RedfishPkg/Library/JsonLib/jansson"]
path = RedfishPkg/Library/JsonLib/jansson
url = /borlwuuu/
[submodule "UnitTestFrameworkPkg/Library/GoogleTestLib/googletest"]
path = UnitTestFrameworkPkg/Library/GoogleTestLib/googletest
url = /platformcn/
[submodule "UnitTestFrameworkPkg/Library/SubhookLib/subhook"]
path = UnitTestFrameworkPkg/Library/SubhookLib/subhook
url = /jeady5/
[submodule "MdePkg/Library/BaseFdtLib/libfdt"]
path = MdePkg/Library/BaseFdtLib/libfdt
url = /xpeng1798/
[submodule "MdePkg/Library/MipiSysTLib/mipisyst"]
path = MdePkg/Library/MipiSysTLib/mipisyst
url = /yqrcode/
3. 进入到ed2的文件夹,执行 git submodule update --init 下载对应的模块
4. 每次都要执行相应的环境变量,下载对应的工具,ASL及nasm到官网下载即可
set NASM_PREFIX= E:\code\nasm\
set IASL_PREFIX = C:\asl\
set WORKSPACE = E:\code\edk2\
set PACKAGES_PATH = E:\code\edk2\
set PYTHON_HOME = C:\Program Files\Python38\
5. 编辑edk2的conf目录下的文件,编辑内容如下:
TARGET = RELEASE
TARGET_ARCH = X64
TOOL_CHAIN_TAG = VS2019
ACTIVE_PLATFORM = EmulatorPkg/
6. 执行 构建编译环境, 若编译不通过,则输入如下的指令,编译Basetools
Rebuild
7. 执行 build -D ADD_SHELL_STRING 指令编辑模拟器
8. 执行 build -p OvmfPkg/ 指令编译 支持 uefi 的虚拟机的BIOS
9. 安装qemu的虚拟机,执行如下的指令即可看到BIOS CODE的DEBUG信息(不过需要增加build -p OvmfPkg/ -D DEBUG_ON_SERIAL_PORT)
qemu-system-x86_64.exe -bios "d:\code\edk2\Build\OvmfX64\DEBUG_VS2019\FV\" -serial stdio -net none
备注:的说明如下
:Usage
@echo.
@echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild] [ForceRebuild] [VS2019] [VS2017] [VS2015] [VS2013] [VS2012]"
@echo.
@echo Reconfig Reinstall , tools_def.txt and build_rule.txt.
@echo Rebuild Perform incremental rebuild of BaseTools binaries.
@echo ForceRebuild Force a full rebuild of BaseTools binaries.
@echo VS2012 Set the env for VS2012 build.
@echo VS2013 Set the env for VS2013 build.
@echo VS2015 Set the env for VS2015 build.
@echo VS2017 Set the env for VS2017 build.
@echo VS2019 Set the env for VS2019 build.