Ubuntu20.04+GCC9.3.0(自帶Python3.8.2)
下載EDKII
git clone https://github.com/tianocore/edk2.git EDKIITest
#https://gitee.com/mirrors/edk2.git
cd EDKIITest
git checkout edk2-stable202005
git submodule update --init
git submodule update
其中#git submodule update --init 命令執行可能會非常慢。
可以考慮編輯.gitmodules 文件如下邊,使url改為gitee上的鏡像倉庫。
我拉的時候oniguruma上卡住,按了一下回車就順利了,也不知道為什么。
[submodule "CryptoPkg/Library/OpensslLib/openssl"]
path = CryptoPkg/Library/OpensslLib/openssl
url = https://gitee.com/mirrors/openssl
# url = https://github.com/openssl/openssl
[submodule "SoftFloat"]
path = ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3
url = https://github.com/ucb-bar/berkeley-softfloat-3.git
[submodule "UnitTestFrameworkPkg/Library/CmockaLib/cmocka"]
path = UnitTestFrameworkPkg/Library/CmockaLib/cmocka
url = https://git.cryptomilk.org/projects/cmocka.git
[submodule "MdeModulePkg/Universal/RegularExpressionDxe/oniguruma"]
path = MdeModulePkg/Universal/RegularExpressionDxe/oniguruma
url = https://github.com/kkos/oniguruma.git
[submodule "MdeModulePkg/Library/BrotliCustomDecompressLib/brotli"]
path = MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
url = https://gitee.com/mirrors/brotli
# url = https://github.com/google/brotli
[submodule "BaseTools/Source/C/BrotliCompress/brotli"]
path = BaseTools/Source/C/BrotliCompress/brotli
# url = https://github.com/google/brotli
url = https://gitee.com/mirrors/brotli
ignore = untracked
配置環境
sudo apt install nasm build-essential uuid-dev iasl libghc-xll-dev gcc-multilib
libghc-x11-dev對應x11的報錯
gcc-multilib 對應一個庫缺失的報錯
make -C BaseTools/
source edksetup.sh
nano ./Conf/target.txt
將里邊的TOOL_CHAIN_TAG值改為GCC5,保存,退出
build
build成功你的環境就是OK的啦
我遇到的報錯
-
與python環境有關的,應該是make階段遇到的,環境里沒有python這個命令,直接建個軟鏈接就好了
sudo ln -s /usr/bin/python3 /usr/bin/python
-
環境沒有相應的庫文件, fatal error: bits/libc-header-start.h: No such file or directory
安裝gcc-multilib -
cannot find -lxxx
尋找對應的庫安裝就好了apt-cache search xxx-dev //然后安裝
-
/usr/bin/ld: skipping incompatible..... 有二進制文件但是不匹配
參考了https://blog.csdn.net/wkq0825/article/details/80401603的文章,懷疑同樣是32或者64位的問題,執行了下(第一次用要安裝)locate libXext.so |egrep ^/usr | xargs file
顯示如下,果然是這個問題
/usr/lib/i386-linux-gnu/libXext.so.6: symbolic link to libXext.so.6.4.0 /usr/lib/i386-linux-gnu/libXext.so.6.4.0: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=72f269fa90172e6a7dfd454f3fe78410ebfc4308, stripped /usr/lib/x86_64-linux-gnu/libXext.so: symbolic link to libXext.so.6.4.0 /usr/lib/x86_64-linux-gnu/libXext.so.6: symbolic link to libXext.so.6.4.0 /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=83a35a5a77775ed2b60b0ceae291841d7bedd28b, stripped
你可以看到libXext.so是指向x86_64的,而默認的build命令參數是IA32,所以新建個同名軟鏈接指向i386就好了
如下ln -s /usr/lib/i386-linux-gnu/libXext.so.6.4.0 /usr/lib/i386-linux-gnu/libXext.so
新學的命令
apt-cache madison nginx //查看倉庫中可用的軟件版本
關於github拉取慢也可采用配置 gitconfig文件的方法,如下
[url "https://gitclone.com/github.com/"]
insteadOf = https://github.com/