第二章 UEFI 开发环境搭建

作者:Maxwell Li
日期:2017/12/05
未经作者允许,禁止转载本文任何内容。如需转载请留言。


最近在学习 UEFI,正好手头有一台阿里云主机,Ubuntu 16.04 系统,就拿来搭建开发环境了。
项目wiki:EDK-II

创建目录并获取源码

$ mkdir ~/src
$ cd ~/src
$ git clone https://github.com/tianocore/edk2

编译基础工具

$ make -C edk2/BaseTools

在编译的时候报错,部分错误如下:

GenSec.c:1354:21: error: pointer targets in passing argument 1 of ‘strcasecmp’ differ in signedness [-Werror=pointer-sign]
         if (stricmp(DummyFileBuffer, InFileBuffer + (InFileSize - DummyFileSize)) == 0){
                     ^
In file included from GenSec.c:17:0:
/usr/include/string.h:529:12: note: expected ‘const char *’ but argument is of type ‘UINT8 * {aka unsigned char *}’
 extern int strcasecmp (const char *__s1, const char *__s2)
            ^
GenSec.c:1354:38: error: pointer targets in passing argument 2 of ‘strcasecmp’ differ in signedness [-Werror=pointer-sign]
         if (stricmp(DummyFileBuffer, InFileBuffer + (InFileSize - DummyFileSize)) == 0){
                                      ^
In file included from GenSec.c:17:0:
/usr/include/string.h:529:12: note: expected ‘const char *’ but argument is of type ‘UINT8 * {aka unsigned char *}’
 extern int strcasecmp (const char *__s1, const char *__s2)
            ^
cc1: all warnings being treated as errors

我没有管他,继续下一步(其实是因为看不懂,有没有大神帮忙解释一下)。

设置基础环境

cd ~/src/edk2
export EDK_TOOLS_PATH=$HOME/src/edk2/BaseTools
. edksetup.sh BaseTools

edksetup.sh 执行完毕后,会在 Conf 目录下产生几个默认配置文件。

修改配置文件

打开 Conf/target.txt 文件,更改以下两行:

ACTIVE_PLATFORM       = Nt32Pkg/Nt32Pkg.dsc
TOOL_CHAIN_TAG        = MYTOOLS

改为

ACTIVE_PLATFORM       = MdeModulePkg/MdeModulePkg.dsc
TOOL_CHAIN_TAG        = GCC5

如果 gcc 版本是4.6,则填 GCC46,如果 gcc 版本是4.5,则填 GCC45。

构建

$ build

你可能感兴趣的:(第二章 UEFI 开发环境搭建)