1. 程式人生 > 實用技巧 >EDKII 下載與配置

EDKII 下載與配置

Ubuntu20.04+GCC9.3.0(自帶Python3.8.2)

下載EDKII

    git clone https://github.com/tianocore/edk2.git EDKIITest
    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/
nano ./Conf/target.txt

將裡邊的TOOL_CHAIN_TAG值改為GCC5,儲存,退出

source edksetup.sh
build

build成功你的環境就是OK的啦

我遇到的報錯

  1. 與python環境有關的,應該是make階段遇到的,環境裡沒有python這個命令,直接建個軟連結就好了

     sudo ln -s /usr/bin/python3 /usr/bin/python
    
  2. 環境沒有相應的庫檔案, fatal error: bits/libc-header-start.h: No such file or directory
    安裝gcc-multilib

  3. cannot find -lxxx
    尋找對應的庫安裝就好了

     apt-cache search xxx-dev //然後安裝
    
  4. /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  //檢視倉庫中可用的軟體版本