dmesg | grep ttyUSB
screen /dev/ttyUSB0 115200
在基于K3架构的设备上,ROM只支持通过R5引导。这意味着引导加载程序必须在R5核心上运行。Linux引导体系结构如下图所示。这种引导体系结构考虑了安全性,同时还允许更快的引导时间。
+------------------------------------------------------------------------+
| DMSC(M3) | R5 | ARM64(A53) |
+------------------------------------------------------------------------+
| +---------+ | | |
| | Reset | | | |
| +---------+ | | |
| : | | |
| +---------+ | +------------+ | |
| | *ROM* |---------|-->| Reset rls | | |
| +---------+ | +------------+ | |
| | | | : | |
| | ROM | | : | |
| |services | | : | |
| | | | +-------------+ | |
| | | | | *R5 ROM* | | |
| | | | +-------------+ | |
| | |<--------|---| Load & auth | | |
| | | | | tiboot3.bin | | |
| | | | | (R5 SPL + | | |
| | Start | | | SYSFW image)| | |
| | SYSFW | | +-------------+ | |
| +--------+ | : | |
| : | : | |
| +---------+ | : | |
| | *SYSFW* | | +-------------+ | |
| | | | | *R5 SPL* | | |
| | | | +-------------+ | |
| | | | | DDR | | |
| | | | | Config | | |
| | | | +-------------+ | |
| | |<--------|---| Start A53 | | |
| | | | | and Reset | | |
| | | | +-------------+ | |
| | | | | +-----------+ |
| | |---------|-----------------------|---->| Reset rls | |
| | | | | +-----------+ |
| | DMSC | | | : |
| |Services | | | +-----------+ |
| | |<--------|-----------------------|---->|*ATF/OPTEE*| |
| | | | | +-----------+ |
| | | | | : |
| | | | | +-----------+ |
| | |<--------|-----------------------|---->| *A53 SPL* | |
| | | | | +-----------+ |
| | | | | | Load | |
| | | | | | u-boot.img| |
| | | | | +-----------+ |
| | | | | : |
| | | | | +-----------+ |
| | |<--------|-----------------------|---->| *U-Boot* | |
| | | | | +-----------+ |
| | | | | | prompt | |
| | | | | +-----------+ |
| | | | | | Load | |
| | | | | |Kernel/DTB | |
| | | | | +-----------+ |
| | | | | : |
| | | | | +-----------+ |
| | |<--------|-----------------------|---->| *Linux* | |
| | | | | +-----------+ |
| +---------+ | | |
| | | |
+------------------------------------------------------------------------+
DMSC充当主服务器并提供所有关键服务。R5和ARM64请求DMSC获得这些服务,如上图所示。
需要重新编译的情况:
tip:需要先sudo su,提升权限。否则在sudo make时系统变量失效,导致arm-none-linux-gnueabihf-gcc can’t found错误。
$ git clone https://git.ti.com/git/security-development-tools/core-secdev-k3.git -b master
$ export TI_SECURE_DEV_PKG=`pwd`/core-secdev-k3
export SDK_INSTALL_DIR=/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04
export PATH=$PATH:$SDK_INSTALL_DIR/linux-devkit/sysroots/x86_64-arago-linux/usr/bin
export UBOOT_DIR=/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/u-boot-2021.01+gitAUTOINC+2dd2e1d366-g2dd2e1d366
e2e
cc error
$ cd $UBOOT_DIR
$ export ARCH=arm
$ export CROSS_COMPILE=arm-none-linux-gnueabihf-
$ make am64x_evm_r5_defconfig O=build/r5
$ make O=build/r5
$ cd ../k3-image-gen-<version>/
$ make SOC=am64x SBL=$UBOOT_DIR/build/r5/spl/u-boot-spl.bin SYSFW_PATH=../prebuilt-images/<TI-SYSFW.bin>
root@ideapad:/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/u-boot-2021.01+gitAUTOINC+2dd2e1d366-g2dd2e1d366# make ATF=$(pwd)/../prebuilt-images/bl31.bin TEE=$(pwd)/../prebuilt-images/bl32.bin O=build/arm64
make[1]: Entering directory '/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/u-boot-2021.01+gitAUTOINC+2dd2e1d366-g2dd2e1d366/build/arm64'
Using /opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/u-boot-2021.01+gitAUTOINC+2dd2e1d366-g2dd2e1d366 as source for U-Boot
GEN ./Makefile
UPD include/generated/timestamp_autogenerated.h
rm -f scripts/dtc/pylibfdt/_libfdt*.so
PYMOD scripts/dtc/pylibfdt/_libfdt.so
cc: error: unrecognized command line option ‘-fmacro-prefix-map=/nativesdk-python3/3.8.13-r0=/usr/src/debug/nativesdk-python3/3.8.13-r0’
cc: error: unrecognized command line option ‘-fmacro-prefix-map=/nativesdk-python3/3.8.13-r0=/usr/src/debug/nativesdk-python3/3.8.13-r0’
error: command 'cc' failed with exit status 1
/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/u-boot-2021.01+gitAUTOINC+2dd2e1d366-g2dd2e1d366/scripts/dtc/pylibfdt/Makefile:27: recipe for target 'scripts/dtc/pylibfdt/_libfdt.so' failed
make[4]: *** [scripts/dtc/pylibfdt/_libfdt.so] Error 1
/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/u-boot-2021.01+gitAUTOINC+2dd2e1d366-g2dd2e1d366/scripts/Makefile.build:419: recipe for target 'scripts/dtc/pylibfdt' failed
make[3]: *** [scripts/dtc/pylibfdt] Error 2
/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/u-boot-2021.01+gitAUTOINC+2dd2e1d366-g2dd2e1d366/scripts/Makefile.build:419: recipe for target 'scripts/dtc' failed
make[2]: *** [scripts/dtc] Error 2
maybe gcc version low 7.5.0
tip:如果是GP版本,则不需要SYSFW_PATH,忽略即可。
$ make SOC=am64x SBL=<UBOOT_DIR>/build/r5/spl/u-boot-spl.bin
$ cd $UBOOT_DIR
$ export ARCH=arm
$ export CROSS_COMPILE=aarch64-none-linux-gnu-
$ make am64x_evm_a53_defconfig O=build/arm64
$ make ATF=$(pwd)/../prebuilt-images/bl31.bin TEE=$(pwd)/../prebuilt-images/bl32.bin O=build/arm64
unable to execute ‘swig’: No such file or directory
error: command ‘swig’ failed with exit status 1
sudo apt install swig
tip:pay attention to python version
scripts/dtc/pylibfdt/libfdt_wrap.c:149:11: fatal error: Python.h: No such file or directory
sudo apt-get install python-dev
sudo apt-get install python3.6-dev #attention,match your python3 version ,my version is 3.6.9
error
$ git clone https://git.ti.com/git/security-development-tools/core-secdev-k3.git -b master
$ export TI_SECURE_DEV_PKG=`pwd`/core-secdev-k3
We strongly recommend using the toolchain that came with the Linux Core release that corresponds to this U-Boot release. For e.g:
export PATH=$HOME/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf/bin:$PATH
export PATH=$HOME/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin:$PATH
#
export SDK_INSTALL_DIR=/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04
export PATH=$PATH:$SDK_INSTALL_DIR/linux-devkit/sysroots/x86_64-arago-linux/usr/bin
git clone https://git.ti.com/git/processor-firmware/ti-linux-firmware.git/ -b master
cd ti-linux-firmware
git checkout ti-linux-firmware
ti-arm-trusted-firmware.openE2E
ti-optee-os.build
OP-TEE is a Trusted Execution Environment (TEE) designed as companion to a non-secure Linux kernel running on Arm; Cortex-A cores using the TrustZone technology. OP-TEE implements TEE Internal Core API v1.1.x which is the API exposed to Trusted Applications and the TEE Client API v1.0, which is the API describing how to communicate with a TEE. Those APIs are defined in the GlobalPlatform API specifications.
export TI_SECURE_DEV_PKG=`pwd`/core-secdev-k3
export PATH=$PATH:/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin
export PATH=/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin:$PATH
on GP
make CROSS_COMPILE64=aarch64-none-linux-gnu- CROSS_COMPILE32=arm-none-linux-gnueabihf- PLATFORM=k3-am65x CFG_ARM64_core=y
ModuleNotFoundError: No module named ‘cryptography’ always error
pip3 install -U pip setuptools #No module named 'setuptools_rust'
sudo apt install python-pip
pip install --upgrade cryptography
pip install cryptography
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
$ export UBOOT_DIR=/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/u-boot-2021.01+gitAUTOINC+2dd2e1d366-g2dd2e1d366
$ export K3IG_DIR=/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/k3-image-gen-2022.01
$ export SYSFW_DIR=/home/wzx/ti-linux-firmware/ti-sysfw
$ export TFA_DIR=/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/trusted-firmware-a-2.6
$ export OPTEE_DIR=/home/wzx/ti-optee-os
Makefile:185: recipe for target ‘/home/wzx/ti-linux-firmware/ti-sysfw/ti-sci-firmware-am64x-gp.bin’ failedE2E
unable to execute ‘swig’: No such file or directory
error: command ‘swig’ failed with exit status 1
sudo apt install swig
scripts/dtc/pylibfdt/libfdt_wrap.c:149:11: fatal error: Python.h: No such file or directory
sudo apt-get install python-dev
sudo apt-get install python3-dev
WARNING: TI_SECURE_DEV_PKG environment variable must be defined for TI secure devices. arch/arm/dts/k3-am642-evm-nand.dtbo was NOT secured!
cd /opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/k3-image-gen-2022.01
export TI_SECURE_DEV_PKG=`pwd`/core-secdev-k3
binman: [Errno 2] No such file or directory: ‘/opt/ti-processor-sdk-linux-am64xx-evm-08.04.01.04/board-support/trusted-firmware-a-2.6/build/k3/lite/release/bl31.bin’
下面的说明假设所有二进制文件都是手动构建的。有关构建bl31.bin的说明,请访问:OP-TEE。关于构建bl32.bin/tee-pager_v2.bin的说明,请访问:ARM Trusted Firmware-A。要使用现有的映像,请转到/board-support/prebuilt-images获取预构建sdk中的预构建二进制文件。
on GP
R5
To build u-boot-spl.bin for tiboot3.bin. Saved in $UBOOT_DIR/out/r5.
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- am64x_evm_r5_defconfig O=$UBOOT_DIR/out/r5
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=$UBOOT_DIR/out/r5
To build tiboot3-am64x-gp-evm.bin. Saved in $K3IG_DIR. Requires u-boot-spl.bin and ti-sci-firmware-am64x-gp.bin.
$ cd $K3IG_DIR
$ make CROSS_COMPILE=arm-none-linux-gnueabihf- SOC=am64x SOC_TYPE=gp SBL=$UBOOT_DIR/out/r5/spl/u-boot-spl.bin SYSFW_DIR=$SYSFW_DIR
A53
To build tispl.bin_unsigned and u-boot.img_unsigned. Saved in $UBOOT_DIR/out/a53. Requires bl31.bin and tee-pager_v2.bin.
$ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am64x_evm_a53_defconfig O=$UBOOT_DIR/out/a53
$ make CROSS_COMPILE=aarch64-none-linux-gnu- ATF=$TFA_DIR/build/k3/lite/release/bl31.bin TEE=$OPTEE_DIR/out/arm-plat-k3/core/tee-pager_v2.bin O=$UBOOT_DIR/out/a53
如果不使用TI SDK,而是从主线构建U-Boot,那么k3-image-gen(用于生成tiboot3.bin)项目位于这里
Linux固件(设备特定的ti-dm和ti-sysfw二进制文件)项目位于这里。映像在ti-dm和ti-sysfw文件夹下