OPTEE 3.15运行在QEMU ARMv8上

📅 2026/8/23 10:22:46
OPTEE 3.15运行在QEMU ARMv8上
系统信息uname -a Linux rtos 5.11.0-37-generic #41-Ubuntu SMP Mon Sep 20 16:39:20 UTC 2021 x86_64 x86_64 x86_64 GNU/LinuxGit配置~/.bashrc中开启git的调试模式export GIT_TRACE_PACKET1 export GIT_TRACE1 export GIT_CURL_VERBOSE1 git config --global user.email yourmailxx.com git config --global user.name yourname编译依赖sudo apt install automake bc bison build-essential cscope curl device-tree-compiler expect flex autoconf ftp-upload gdisk acpica-tools libattr1-dev libc6:i386 libcap-dev libfdt-dev libftdi-dev libglib2.0-dev libhidapi-dev libncurses5-dev libpixman-1-dev libssl-dev libstdc6:i386 libtool ninja-build zlib1g:i386 make mtools netcat unzip uuid-dev xdg-utils xterm xz-utils zlib1g-dev adb fastboot meson libgnutls28-dev autoconf -f sudo apt install -y python3-pyelftools sudo apt install -y python3-pip sudo apt install -y python3-pwntools python3-pycryptodome python3 -m pip install --user --break-system-packages \ pwntools pycryptodome pycryptodomex下载代码mkdir tee3.15 cd tee3.15 repo init -u https://github.com/OP-TEE/manifest.git --depth 1 -m qemu_v8.xml --repo-urlhttps://mirrors.tuna.tsinghua.edu.cn/git/git-repo -b 3.15.0 repo sync -j4 --no-clone-bundle如果没有意外下载成功截图如下获取交叉编译工具cd build/ make -f toolchain.mk toolchains -j4编译OP-TEEcd build/ make -f qemu_v8.mk -j4需要做的就是耐心等待编译完成如图所示给虚拟机分配了4颗CPU编译过程可以看到CPU占用率比较高。还可以运行make check测试编译是否成功会运行xtest用例。运行观察soc_term.py源码可以看到支持端口入参。可以开启两个shell命令行分别使用python3 soc_term.py 54320和python3 sco_term.py 54321分别监听Normal World和Secure World两个世界的端口。然后进入到build目录运行make run-only即可进入到交互状态然后按照提示输入c字母,回车确认接着Normal World以root用户登录并运行xtest进行测试如果顺利你将会看到参考资料OP-TEE Documentation — OP-TEE documentation documentation (optee.readthedocs.io)FAQRPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was receivedsudo apt-get purge git sudo apt-get install gitModuleNotFoundError: No module named Cryptodome#pycrypto、pycrytodome和crypto是一个东西crypto在python上面的名字是pycryptopip3 uninstall pycryptodome pip3 install pycryptodomeedk2相关错误编译edk2 提示莫名奇怪错误可能是编译过程中没能正常下载相关依赖导致。进edk2 执行下载相即可。git submodule update --init --recursiveedk2 boringssl下载失败tianocore/edk2.git/CryptoPkg/Library/OpensslLib/openssl/boringssl: fatal: unable to access https://hub.fastgit.org/google/boringssl.git/: gnutls_handshake() failed: Error in the pull function. error: Cannot fetch tianocore/edk2.git/CryptoPkg/Library/OpensslLib/openssl/boringssl from https://boringssl.googlesource.com/boringssl Fetching: 100% (1/1), done in 4.610s 解决思路是使用git config --global url.A.insteadOf B 命令将boringssl.googlesource.com替换为谷歌的github镜像库 https://github.com/google/boringssl.git方法如下 git config --global url.https://github.com/google/boringssl.git.insteadOf https://boringssl.googlesource.com/boringssl