EDK2开发环境搭建【详细步骤】

EDK2开发环境搭建【详细步骤】

mssunna 2019-07-16 18:07:01  3692  收藏 7
分类专栏: UEFI\BIOS
版权
参考博客【EDK2 UDK2018的环境搭建】:https://blog.csdn.net/qq_39155263/article/details/82965744
下载EDK2

1.直接从https://github.com/tianocore/edk2/ 网站下载.zip压缩文件
2.运用svn 从http://svn.code.sf.net/p/edk2/code/trunk/edk2edk2下载
   安装Visual Studio2017

3.下载boost_1_70_0,下载地址为:https://www.boost.org/users/history/version_1_70_0.html

在这里插入图片描述


第二步,下载boost_1_70_0,下载地址为:https://www.boost.org/users/history/version_1_70_0.html
下载Widnows版本,下载完成后解压,解压后的目录如下
将整个文件夹放在路径没有中文的目录中。

第二部分,编译
目前网上能找到编译boost库的方法中大都是vs2017、vs2015和vs2013,说多了都是泪。
第一步,根据网上的步骤,在cmd中运行bootstrap.bat,结果出现:cl不是内部命令,也不是外部命令,这个问题网上很多解决办法,直接添加环境变量即可。
需要注意环境变量中路径的选择,本文的路径为:VC\Tools\MSVC\14.21.27702\bin\Hostx64\x64
第二步,运行bootstrap.bat错误,查看bootstrap.log中发现提示缺少ctype.h,解决这个问题,在环境变量中添加C:\Windows\System32,之后重启电脑即可。
第三步,运行bootstrap.bat成功,界面如下:
编译完成后的文件夹目录为:另外,网上还提到用用x64 Native Tools Command Prompt for VS来编译,默认情况下vs2019是没有安装这个功能的,需要在下载器中修改,增加下载项。切换到“单个组件”,然后一直往下找,一直遭到MSVC v142 - VS 2019 C++ x64/x86生成工具(v14.21),勾上,下载安装即可。

扫描二维码关注公众号,回复: 13306919 查看本文章

第三部分,生成
生成x86的脚本代码:
b2.exe install --prefix="F:\Boost\x86" --build-type=complete --toolset=msvc-14.2 threading=multi --build-type=complete address-model=32

生成x64的脚本代码:

b2.exe install --prefix="F:\Boost\x64" --build-type=complete --toolset=msvc-14.2 threading=multi --build-type=complete address-model=64
 

安装其他Tool

1.IASL
从https://www.acpica.org/downloads 下载iasl-win-20190703_0.zip 工具
解压iasl-win-20190703_0.zip到C:\asl 目录下
2.NASM
从http://www.nasm.us/ 下载nasm-2.14.02-win64.zip
解压到C:\nasm
3.Python27
从https://www.python.org/ 下载Python2.7
安装到C:\Python27
下载cx_Freeze-4.3.3.win-amd64-py2.7.exe 并安装,如下图示

4.OPENSSL加密库
下载https://github.com/openssl/openssl/archive/OpenSSL_1_1_0g.zip 并解压到edk2\CryptoPkg\Library\OpensslLib
下载 http://wiki.overbyte.eu/arch/openssl-1.1.0g-win32.zip 解压到C:\Openssl
5.Base tool
下载https://github.com/tianocore/edk2-BaseTools-win32 解压到edk2\BaseTools\Bin\win32


添加环境变量

环境变量PATH中添加C:\NASM和C:\Openssl
新建环境变量PYTHON_HOME,值为C:\Python27

配置edk2

1.以管理员身份运行CMD,cd到edk2所在目录,执行edksetup.bat:
2.找到Conf下的target.txt文件,修改TOOL_CHAIN_TAG = VS2017:

TOOL_CHAIN_TAG        = VS2019

# MAX_CONCURRENT_THREAD_NUMBER  NUMBER  Optional  The number of concurrent threads. If not specified or set
#                                                 to zero, tool automatically detect number of processor
#                                                 threads. Recommend to set this value to one less than the
#                                                 number of your computer cores or CPUs. When value set to 1,
#                                                 means disable multi-thread build, value set to more than 1,
#                                                 means user specify the thread number to build. Not specify
#                                                 the default value in this file.
# MAX_CONCURRENT_THREAD_NUMBER = 1

3.修改Conf下的tools_def.txt文件:

DEFINE VS_HOST            = x86

DEFINE VS2017_BIN         = ENV(VS2017_PREFIX)bin
DEFINE VS2017_BIN_HOST    = DEF(VS2017_BIN)\HostDEF(VS_HOST)\DEF(VS_HOST)
DEFINE VS2017_BIN_IA32    = DEF(VS2017_BIN)\HostDEF(VS_HOST)\x86
DEFINE VS2017_BIN_X64     = DEF(VS2017_BIN)\HostDEF(VS_HOST)\x64
DEFINE VS2017_BIN_ARM     = DEF(VS2017_BIN)\HostDEF(VS_HOST)\arm
DEFINE VS2017_BIN_AARCH64 = DEF(VS2017_BIN)\HostDEF(VS_HOST)\arm64

4.若target.txt文件中ACTIVE_PLATFORM = Nt32Pkg\Nt32Pkg.dsc 则可以直接build,若不是则修改为该值:

ACTIVE_PLATFORM       = EmulatorPkg/EmulatorPkg.dsc

#  TARGET                List       Optional    Zero or more of the following: DEBUG, RELEASE, NOOPT
#                                               UserDefined; separated by a space character.
#                                               If the line is missing or no value is specified, all
#                                               valid targets specified in the platform description file 
#                                               will attempt to be built. The following line will build 
#                                               DEBUG platform target.

5.执行build命令,build完毕之后可以build run进进入UEFI Shell(即UEFI原理与编程上所说的UEFI模拟器):
6.编译其他模块可使用 build –a IA32\X86(选一) –p xxxpkg\xxx.dsc 命:

猜你喜欢

转载自blog.csdn.net/tianpu2320959696/article/details/116422725