大家好,欢迎来到IT知识分享网。
有问题请留言或mail至nosilver@protonmail.com
一、注意事项
由于此文档为配置完成后编写,可能在下载包的描述有所遗漏,届时根据自身报错去下载对应包文件
需联网
编译报错一般为git clone没下全
缺省时去下载对应包
笔者遇到的所有的编译问题均为git clone下载的包不全或版本不对
一些指令
解压tar文件 tar -xvf filename 解压zip文件 unzip filename 提权 sudo su 可用Tab建补全一些指令或文件夹 cp -r 拷贝
二、EDK2环境搭建过程
1.换源
更换源文件
有需求的话可以先 sudo apt install vim vi(下载了vim可以使用vim) /etc/apt/sources/list 替换下列源文件 源文件(选取一个即可
,多选一般也没事)
| #阿里源
| deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
| deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
| deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
| deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
| deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
| deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
| deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
| deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
| deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
| deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
| #网易源
| deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
| deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
| deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
| deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
| deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
| deb-src http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
| deb-src http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
| deb-src http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
| deb-src http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
| deb-src http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
| #中科大源
| deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
| deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
| deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports ma
更新完之后依次执行下面两条命令
1.apt-get update
2.apt-get upgrade
如果执行之后出现源不能更新的问题,到/etc/apt/sources.list.d 下删除对应的源重新更新即可解决
2.搭建EDK2环境
配置软件环境
安装gcc,python
apt install gcc
apt install python
安装qemu
apt install qemu
安装NASM
sudo apt install nasm
安装asl code
sudo apt install iasl
安装uuid库
sudo apt install uuid-dev
构建必备软件包的信息列表
sudo apt install build-essential
安装make与git
sudo apt install make
sudo apt install git
下载edk2源码https://github.com/tianocore/edk2/
确保网络连接正常接入github.com
git clone https://github.com/tianocore/edk2.git
cd edk2
git submodule update --init(确保这项成功)
3. 编译运行
编译(这里失败大概率是apt install有东西没下,按报错去下载就行了)
source edksetup.sh BaseTools
make -C BaseTools
图为成功编译
编译Ovmf
build -a X64 -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc (GCC5及以上都写为GCC5)
图为编译成功
运行
cd /finaledk2/edk2-master/Build/OvmfX64/DEBUG_GCC5/FV
切换的目录名为自己对应的编译文件夹名字
qemu-system-x86_64 -bios OVMF.fd
图为运行成功(需等待一小段时间)
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/22467.html