optee3.14.0 qemu_v8的环境搭建篇(ubuntu20.10)--终极篇

青春须早为,岂能长少年。这篇文章主要讲述optee3.14.0 qemu_v8的环境搭建篇(ubuntu20.10)--终极篇相关的知识,希望能为你提供帮助。

文章目录

        • 环境准备
        • 1、安装编译optee的工具
        • 2、更新optee代码
        • 3、更新工具链
        • 4、编译和运行
        • 问题解决

环境准备(1)、安装ubuntu
先安装一下virtualbox + ubuntu20.10环境,可参考如下:[HOW TO]-图解virtualbox下安装ubuntu20.04虚拟机
(2)、安装基础工具
(3)、进行一些配置
(4)、修改终端标题栏文字
(5)、安装http服务
(6)、安装pulse-secure
(7)、安装repo
(8)、配置git
1、安装编译optee的工具
sudo apt-get install android-tools-adb android-tools-fastboot autoconf \\ automake bc bison build-essential ccache cscope curl device-tree-compiler \\ expect flex ftp-upload gdisk iasl libattr1-dev libcap-dev \\ libfdt-dev libftdi-dev libglib2.0-dev libgmp-dev libhidapi-dev \\ libmpc-dev libncurses5-dev libpixman-1-dev libssl-dev libtool make \\ mtools netcat ninja-buildpython3-crypto\\ python3-pycryptodome python3-pyelftoolspython3-serial \\ rsync unzip uuid-dev xdg-utils xterm xz-utils zlib1g-dev

2、更新optee代码(1)、repo init
repo init -u git://github.com/OP-TEE/manifest.git -m qemu_v8.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -b 3.14.0

repo init后,由于在国内访问https://github.com有限制,为了能够更快的拉取代码,我们需要对repositories做一些修改:
(2)、修改manifest
注意一是将https改成git,二是注释掉两个repository,因为这两个仓库clone不下来,需单独敲命令clone
test@test:~/workspace/code/optee_3.14$ cd .repo/manifests test@test:~/workspace/code/optee_3.14/.repo/manifests$ git diff . diff --git a/qemu_v8.xml b/qemu_v8.xml index b99e2db..03ead23 100644 --- a/qemu_v8.xml +++ b/qemu_v8.xml @@ -1,6 +1,6 @@ < ?xml version="1.0" encoding="UTF-8"?> < manifest> -< remote name="github"fetch="https://github.com" /> +< remote name="github"fetch="git://github.com" /> < remote name="tfo"fetch="https://git.trustedfirmware.org" /> < remote name="u-boot"fetch="https://source.denx.de/u-boot" /> < remote name="xen-git"fetch="https://xenbits.xen.org/git-http" /> @@ -22,10 +22,10 @@ < !-- Misc gits --> < project path="buildroot"name="buildroot/buildroot.git"revision="refs/tags/2021.02" clone-depth="1" /> -< project path="edk2"name="tianocore/edk2.git"revision="refs/tags/edk2-stable202102" sync-s="true" /> +< !-- < project path="edk2"name="tianocore/edk2.git"revision="refs/tags/edk2-stable202102" sync-s="true" /> --> < project path="mbedtls"name="ARMmbed/mbedtls.git"revision="refs/tags/mbedtls-2.16.0" clone-depth="1" /> < project path="qemu"name="qemu/qemu.git"revision="refs/tags/v6.0.0" clone-depth="1" /> -< project path="trusted-firmware-a"name="TF-A/trusted-firmware-a.git"revision="refs/tags/v2.5" clone-depth="1" remote="tfo" /> +< !-- < project path="trusted-firmware-a"name="TF-A/trusted-firmware-a.git"revision="refs/tags/v2.5" clone-depth="1" remote="tfo" /> --> < project path="u-boot"name="u-boot.git"revision="refs/tags/v2021.04" remote="u-boot" clone-depth="1" /> < project path="xen"name="xen.git"revision="refs/tags/RELEASE-4.14.1" remote="xen-git" clone-depth="1" /> < /manifest> test@test:~/workspace/code/optee_3.14/.repo/manifests$

optee3.14.0 qemu_v8的环境搭建篇(ubuntu20.10)--终极篇

文章图片

(3)、然后就可以拖取代码了
(4)、克隆atf代码
git clone--branch v2.5 https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git

(4)、克隆edk2代码
git clone--branch edk2-stable202102 git://github.com/tianocore/edk2.git

修改edk2/.gitmodules
(vim .gitmodules)
[submodule "CryptoPkg/Library/OpensslLib/openssl"] path = CryptoPkg/Library/OpensslLib/openssl url = git://github.com/openssl/openssl [submodule "SoftFloat"] path = ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 url = git://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 = git://github.com/kkos/oniguruma [submodule "MdeModulePkg/Library/BrotliCustomDecompressLib/brotli"] path = MdeModulePkg/Library/BrotliCustomDecompressLib/brotli url = git://github.com/google/brotli [submodule "BaseTools/Source/C/BrotliCompress/brotli"] path = BaseTools/Source/C/BrotliCompress/brotli url = git://github.com/google/brotli ignore = untracked [submodule "RedfishPkg/Library/JsonLib/jansson"] path = RedfishPkg/Library/JsonLib/jansson url = git://github.com/akheron/jansson

optee3.14.0 qemu_v8的环境搭建篇(ubuntu20.10)--终极篇

文章图片

cd edk2/
git submodule sync
git submodule update --init
3、更新工具链下载gcc-arm-10.2-2020.11-aarch64-arm-none-linux-gnueabihf.tar.xz和 gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu.tar.xz 并拷贝到toolchains目录下
gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf.tar.xz
gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu.tar.xz
4、编译和运行make -f qemu_v8.mk all -j8
make -f qemu_v8.mk run-only
optee3.14.0 qemu_v8的环境搭建篇(ubuntu20.10)--终极篇

文章图片

问题解决1、fatal error: ./brotli/c/common/constants.h: No such file or directory
optee3.14.0 qemu_v8的环境搭建篇(ubuntu20.10)--终极篇

文章图片

cd edk2/
git submodule sync
git submodule update --init
2、arm-linux-gnueabihf-gcc failed: Exec format error
ccache: error: execv of /home/test/workspace/code/optee_3.14/build/…/toolchains/aarch32/bin/arm-linux-gnueabihf-gcc failed: Exec format error
optee3.14.0 qemu_v8的环境搭建篇(ubuntu20.10)--终极篇

文章图片

sudo apt install binfmt-support qemu qemu-user-static
3、/lib/ld-linux-aarch64.so.1: No such file or directory
/lib/ld-linux-aarch64.so.1: No such file or directory
make[1]: *** [mk/compile.mk:159: out/arm/ta_arm32-lib/libdl/dlfcn.o] Error 255
make[1]: *** Waiting for unfinished jobs…
optee3.14.0 qemu_v8的环境搭建篇(ubuntu20.10)--终极篇

文章图片

test@test:~/workspace/code/optee_3.14/toolchains$ find ./ -name ld-linux-aarch64.so.1
./aarch64/aarch64-none-linux-gnu/libc/lib/ld-linux-aarch64.so.1
test@test:~/workspace/code/optee_3.14/toolchains$ sudo cp ./aarch64/aarch64-none-linux-gnu/libc/lib/ld-linux-aarch64.so.1 /lib
optee3.14.0 qemu_v8的环境搭建篇(ubuntu20.10)--终极篇

文章图片

4、arm-linux-gnueabihf-gcc: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
test_Ecc_CParser4_CListener (CheckPythonSyntax.Tests) … ok
test_Ecc_CParser4_CParser (CheckPythonSyntax.Tests) … /home/test/workspace/code/optee_3.14/build/…/toolchains/aarch32/bin/arm-linux-gnueabihf-gcc: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
make[1]: *** [mk/compile.mk:159: out/arm/ta_arm32-lib/libdl/dlfcn.o] Error 127
make[1]: *** Waiting for unfinished jobs…
ok
optee3.14.0 qemu_v8的环境搭建篇(ubuntu20.10)--终极篇

文章图片

请仔细对比工具链,工具链没选对
【optee3.14.0 qemu_v8的环境搭建篇(ubuntu20.10)--终极篇】

    推荐阅读