I followed below procedure to build OPTEE OS
git clone https://source.codeaurora.org/external/imx/imx-optee-os.git
git clone -b lf-5.4.y origin/lf-5.4.y
cd /imx-optee-os
$ CFG_NXPCRYPT=y CFG_GEN_DEK_BLOB=y source ./scripts/nxp_build.sh mx8mmevk
Then I got error message:
GEN ./build.mx8mmevk/core/ta_pub_key.c
Traceback (most recent call last):
File "scripts/pem_to_pub_c.py", line 57, in <module>
main()
File "scripts/pem_to_pub_c.py", line 23, in main
from Crypto.PublicKey import RSA
ImportError: No module named Crypto.PublicKey
make: *** [mk/subdir.mk:160: build.mx8mmevk/core/ta_pub_key.c] Error 1What wrong with me? Thanks...
已解决! 转到解答。
Thank your advise.
I managed to successfully to build imx-optee-os version of lf-5.10.y_1.0.0 and imx_5.4.70_2.3.0.
To solve the issue: I found that I need to switch default python to python3.
I download the linaro toolchains of 8.2-2019.01. I got another problem below
no module named 'Cryptodome'
solution: pip install pycryptodomex
Thank your advise.
I managed to successfully to build imx-optee-os version of lf-5.10.y_1.0.0 and imx_5.4.70_2.3.0.
To solve the issue: I found that I need to switch default python to python3.
I download the linaro toolchains of 8.2-2019.01. I got another problem below
no module named 'Cryptodome'
solution: pip install pycryptodomex
you can use linaro toolchain to build optee.
If you use toolchain from yocto, you will find lots of problems.
https://optee.readthedocs.io/en/latest/building/prerequisites.html
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 libc6:i386 libcap-dev \
libfdt-dev libftdi-dev libglib2.0-dev libhidapi-dev libncurses5-dev \
libpixman-1-dev libssl-dev libstdc++6:i386 libtool libz1:i386 make \
mtools netcat python-crypto python3-crypto python-pyelftools \
python3-pycryptodome python3-pyelftools python-serial python3-serial \
rsync unzip uuid-dev xdg-utils xterm xz-utils zlib1g-dev
If you use linaro toolchain, it will be no any problem facing.
Yocto meta toolchain:
Please source toolchain environment first.
working with atf build-optee
make -j 8 PLAT=imx8mm BUILD_BASE=build-optee SPD=opteed bl31
imx-optee-os:
https://source.codeaurora.org/external/imx/imx-optee-os
aarch64:
ARCH=arm CROSS_COMPILE64=${CROSS_COMPILE} CFLAGS="--sysroot=${SDKTARGETSYSROOT}" LDFLAGS= ./scripts/imx_build.sh mx8mmevk
rel_imx_5.4.24_2.1.0:
ARCH=arm CROSS_COMPILE64=${CROSS_COMPILE} CFLAGS="--sysroot=${SDKTARGETSYSROOT}" LDFLAGS= ./scripts/nxp_build.sh mx8mmevk
CFLAGS="--sysroot=${SDKTARGETSYSROOT}": xxk yocto
build.mx8mmevk/tee.bin
arm:
CROSS_COMPILE64=${CROSS_COMPILE} CFLAGS="--sysroot=${SDKTARGETSYSROOT}" LDFLAGS= ./scripts/imx_build.sh mx6qsabresd
rel_imx_5.4.24_2.1.0:
CROSS_COMPILE64=${CROSS_COMPILE} CFLAGS="--sysroot=${SDKTARGETSYSROOT}" LDFLAGS= ./scripts/nxp_build.sh mx6qsabresd
uTee.mx6qsabresd
build.mx6qsabresd/uTee.mx6qsabres
imx-optee-client:
https://source.codeaurora.org/external/imx/imx-optee-client
make
out/export/bin/tee-supplicant --> target board /usr/bin
out/export/lib/libteec.so.1 --> target board /usr/lib
imx-optee-test:
https://source.codeaurora.org/external/imx/imx-optee-test
aarch64:
make TA_DEV_KIT_DIR=~/imx-optee-os/build.mx8mmevk/export-ta_arm64/ OPTEE_CLIENT_EXPORT=~/imx-optee-client/out/export/ CROSS_COMPILE_HOST=${CROSS_COMPILE} CROSS_COMPILE_TA=${CROSS_COMPILE}
make clean TA_DEV_KIT_DIR=~/imx-optee-os/build.mx8mmevk/export-ta_arm64/ OPTEE_CLIENT_EXPORT=~/imx-optee-client/out/export/ CROSS_COMPILE_HOST=${CROSS_COMPILE} CROSS_COMPILE_TA=${CROSS_COMPILE}
rel_imx_5.4.24_2.1.0:
make TA_DEV_KIT_DIR=~/imx-optee-os/build.mx8mmevk/export-ta_arm64/ OPTEE_CLIENT_EXPORT=~/imx-optee-client/out/export/usr CROSS_COMPILE_HOST=${CROSS_COMPILE} CROSS_COMPILE_TA=${CROSS_COMPILE}
make clean TA_DEV_KIT_DIR=~/imx-optee-os/build.mx8mmevk/export-ta_arm64/ OPTEE_CLIENT_EXPORT=~/imx-optee-client/out/export/usr CROSS_COMPILE_HOST=${CROSS_COMPILE} CROSS_COMPILE_TA=${CROSS_COMPILE}
5.4-zeus yocto meta toolchain(xxk yocto toolchain has python3.7 and no site-package Crypto, what is a definition of a toolchain!!! xxk again):
from Crypto.Signature import PKCS1_v1_5
ModuleNotFoundError: No module named 'Crypto'
because using python3 in the /opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin
workaround:
sudo mv /opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/python3 /opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/python3.bak
or
remove the /opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin in the PATH, which from source enviroment
arm:
make TA_DEV_KIT_DIR=~/imx-optee-os/build.mx6qsabresd/export-ta_arm32/ OPTEE_CLIENT_EXPORT=~/imx-optee-client/out/export/ CROSS_COMPILE_HOST=${CROSS_COMPILE} CROSS_COMPILE_TA=${CROSS_COMPILE}
out/xtest/xtest --> target board /usr/bin
tree --charset . -P *.ta -L 2 out/ta/
out/ta/ --> target board /lib/optee_armtz/
|-- aes_perf
| `-- e626662e-c0e2-485c-b8c8-09fbce6edf3d.ta
|-- concurrent
| `-- e13010e0-2ae1-11e5-896a-0002a5d5c51b.ta
|-- concurrent_large
| `-- 5ce0c432-0ab0-40e5-a056-782ca0e6aba2.ta
|-- create_fail_test
| `-- c3f6e2c0-3548-11e1-b86c-0800200c9a66.ta
|-- crypt
| `-- cb3e5ba0-adf1-11e0-998b-0002a5d5c51b.ta
|-- crypto_perf
| `-- 690d2100-dbe5-11e6-bf26-cec0c932ce01.ta
|-- os_test
| `-- 5b9e0e40-2636-11e1-ad9e-0002a5d5c51b.ta
|-- os_test_lib
| `-- ffd2bded-ab7d-4988-95ee-e4962fff7154.ta
|-- rpc_test
| `-- d17f73a0-36ef-11e1-984a-0002a5d5c51b.ta
|-- sha_perf
| `-- 614789f2-39c0-4ebf-b235-92b32ac107ed.ta
|-- sims
| `-- e6a33ed4-562b-463a-bb7e-ff5e15a493c8.ta
|-- socket
| `-- 873bcd08-c2c3-11e6-a937-d0bf9c45c61c.ta
|-- storage
| `-- b689f2a7-8adf-477a-9f99-32e90c0ad0a2.ta
|-- storage2
| `-- 731e279e-aafb-4575-a771-38caa6f0cca6.ta
`-- storage_benchmark
`-- f157cda0-550c-11e5-a6fa-0002a5d5c51b.ta
find out/ta/ -name \*.ta -exec cp -f {} ~/optee_armtz/ \;
~/optee_armtz/ --> target board /lib/optee_armtz/
Hi Hong
one can try to follow sect.5.6.10 OP-TEE enablement i.MX Yocto Project User’s Guide
Best regards
igor