UEFI 01记: 开发环境 在 ubuntu22 中搭建 edk2 开发环境并运行简单示例

https://uefi.org

1,预备环境

$ sudo apt install uuid-dev
$ sudo apt install nasm
$ sudo apt install bison flex
$ sudo apt install build-essential
$ sudo apt-get install x11proto-xext-dev
$ sudo apt-get install libx11-dev
$ sudo apt-get install libxext-dev
$ gcc -version
$ make --version
$ gcc --version


2,下载源代码

$ git clone http://github.com/tianocore/edk2.git
$ git clone http://github.comtianocore/edk2-libc.git
$ git clone http://github.com/tianocore/edk2-libc.git
$ git clone http://github.com/acpica/acpica.git
$ cd edk2
$ git submodule update --init
$ cd -

3,构建edk2

$ make -C edk2/BaseTools
$ python --version

$ uname -a
$ make -C ./acpica/

4,设置环境变量

$ touch setup_env.sh
$ vim setup_env.sh
$ cat setup_env.sh

$ export WORKSPACE=$PWD
$ export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-libc
$ export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-libc
$ export IASL_PREFIX=\$PWD/acpica/generate/unix/bin/
$ export PYTHON_COMMAND=/usr/bin/python3

$ . ./setup_env.sh
$ source edk2/edksetup.sh

5,构建模拟器和uefi

$ build -p edk2/EmulatorPkg/EmulatorPkg.dsc -t GCC5 -a X64


$ build -p edk2-libc/AppPkg/AppPkg.dsc -t GCC5 -a X64

6,运行模拟器和uefi

$ cd ./Build/EmulatorX64/DEBUG_GCC5/X64/
$ ls ./Host
$ ./Host

 Shell:>fs0:

FS0:\>HelloWorld.efi

7,环境和版本信息

过程非常顺利,没有遇到任何问题,做一下信息记录,备查

archer@archer-Z3-Pro-Series-GM5TG0O:~/ex_uefi_dev$ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

archer@archer-Z3-Pro-Series-GM5TG0O:~/ex_uefi_dev$ python --version
Python 3.10.12
archer@archer-Z3-Pro-Series-GM5TG0O:~/ex_uefi_dev$ cd edk2
archer@archer-Z3-Pro-Series-GM5TG0O:~/ex_uefi_dev/edk2$ git log -2
commit b158dad150bf02879668f72ce306445250838201 (HEAD -> master, origin/master, origin/HEAD)
Author: Ashraf Ali <ashraf.ali.s@intel.com>
Date:   Sun Aug 11 21:31:12 2024 +0530

    EmulatorPkg: VS2022 Support on WinHost.
    
    Currently EDK2 is supporting VS2022, with VS2022 EmulatorPkg build is
    failing, this patch is to add the VS2022 support for WinHost
    
    Signed-off-by: Ashraf Ali <ashraf.ali.s@intel.com>

commit b0f43dd3fdec2363e3548ec31eb455dc1c4ac761
Author: Dat Mach <dmach@nvidia.com>
Date:   Tue Jun 25 15:07:38 2024 -0700

    DynamicTablesPkg: Add parser for Tpm2 CM object
    
    Update the CM Object parser to add support for parsing the
    CM_ARM_TPM2_INTERFACE_INFO object.
    
    Signed-off-by: Dat Mach <dmach@nvidia.com>
archer@archer-Z3-Pro-Series-GM5TG0O:~/ex_uefi_dev/edk2$ cd ../edk2-libc/
archer@archer-Z3-Pro-Series-GM5TG0O:~/ex_uefi_dev/edk2-libc$ git log -1
commit 87108465dcfbf888b8044ae86b4dc84b04b19082 (HEAD -> master, origin/master, origin/HEAD)
Author: Jayaprakash, N <n.jayaprakash@intel.com>
Date:   Tue Jul 30 21:47:06 2024 +0530

    edk2-libc: remove gitmodules file added through accidental commit
    
    REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4822
    
    Due to an accidental commit went into edk2-libc while
    experimenting with some inner-source repos lead to the addition
    of gitmodules file and a submodule. This commit is undoing
    this change by removing the gitmodules file and the submodule.
    
    Cc: Rebecca Cran <rebecca@bsdio.com>
    Cc: Michael D Kinney <michael.d.kinney@intel.com>
    Cc: Jayaprakash N <n.jayaprakash@intel.com>
    Signed-off-by: Jayaprakash N <n.jayaprakash@intel.com>
    Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
archer@archer-Z3-Pro-Series-GM5TG0O:~/ex_uefi_dev/edk2-libc$ cd ../acpica/
archer@archer-Z3-Pro-Series-GM5TG0O:~/ex_uefi_dev/acpica$ git log -1
commit c1ac0dcb84b529fa04d0f94d624344584d92e183 (HEAD -> master, origin/master, origin/HEAD)
Merge: 45f86f4bd fad7ed029
Author: Saket Dumbre <saket.dumbre@intel.com>
Date:   Tue Aug 20 16:46:29 2024 -0700

    Merge pull request #966 from Wer-Wolf/phat-fix
    
    PHAT: Various fixes
archer@archer-Z3-Pro-Series-GM5TG0O:~/ex_uefi_dev/acpica$ 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在 Windows 环境下配置 EDK2 开发环境,可以按照以下步骤进行操作: 1. 安装所需的软件和工具: - 下载并安装 Visual Studio(推荐使用 Visual Studio 2019)。 - 下载并安装 Python(推荐使用 Python 3.x 版本)。 - 下载并安装 Git。 2. 克隆 EDK2 代码库: - 打开命令行终端,切换到你希望存放 EDK2 代码的目录。 - 运行以下命令克隆 EDK2 代码库: ``` git clone https://github.com/tianocore/edk2.git ``` 3. 配置环境变量: - 将 Python 安装路径添加到系统环境变量。例如,将 `C:\Python39` 添加到 PATH 变量。 - 将 MSBuild 工具添加到系统环境变量。根据你的 Visual Studio 版本和架构,添加类似以下路径的变量: ``` C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin ``` 4. 构建 BaseTools 工具: - 打开命令行终端,切换到 EDK2 代码库的 `BaseTools` 目录。 - 运行以下命令来构建 BaseTools 工具: ``` python ./Build.py ``` 5. 配置 EDK2 环境: - 打开命令行终端,切换到 EDK2 代码库的根目录。 - 运行以下命令来配置 EDK2 环境: ``` .\edksetup.bat ``` 6. 生成项目文件: - 运行以下命令生成项目文件: ``` build ``` 7. 构建 EDK2: - 运行以下命令来构建 EDK2: ``` build -a [平台架构] -p [平台名称]/[模块名称].dsc ``` 其,`[平台架构]` 可以是 `IA32`、`X64` 或 `ARM`,`[平台名称]` 和 `[模块名称]` 是你要构建的平台和模块的名称。 完成以上步骤后,你就成功配置了 EDK2 开发环境。你可以根据需要进行修改和编译 UEFI 固件和应用程序。注意,以上步骤仅提供了基本的配置过程,具体的配置和构建步骤可能因个人需求和环境而有所不同。建议参考 EDK2 的官方文档和相关资料进行更详细的配置和使用说明。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值