$ git clone https://github.com/linux4sam/at91bootstrap.git Cloning into 'at91bootstrap'... remote: Enumerating objects: 17621, done. remote: Counting objects: 100% (3324/3324), done. remote: Compressing objects: 100% (1029/1029), done. remote: Total 17621 (delta 2465), reused 3102 (delta 2285), pack-reused 14297 Receiving objects: 100% (17621/17621), 5.65 MiB | 4.65 MiB/s, done. Resolving deltas: 100% (13459/13459), done. $ cd at91bootstrap/
configs
folder which contains several default configuration files only one file contains the correct configuration for OP-TEE:
sama5d27_som1_ek-opteesd_uboot_defconfigYou can configure AT91Bootstrap by doing:
$ make mrproper $ make sama5d27_som1_ek-opteesd_uboot_defconfigIf the configuring process is successful, the .config file can be found at AT91Bootstrap root directory.
$ makeIf the building process is successful, the final .bin image is build/binaries/at91bootstrap.bin.
$ git clone https://github.com/OP-TEE/optee_os.git Cloning into 'optee_os'... remote: Enumerating objects: 72568, done. remote: Counting objects: 100% (14031/14031), done. remote: Compressing objects: 100% (1909/1909), done. remote: Total 72568 (delta 12442), reused 12192 (delta 12121), pack-reused 58537 Receiving objects: 100% (72568/72568), 26.90 MiB | 2.82 MiB/s, done. Resolving deltas: 100% (53100/53100), done. $ cd optee_os/After cloning the default branch is
master
which pointing to the latest version of optee_os. Checkout to the latest tag 4.0.0.
$ git checkout 4.0.0
$ sudo apt install python3-pyelftoolsTo build OP-TEE binary
$ make CROSS_COMPILE=arm-linux-gnueabi- PLATFORM=sam PLATFORM_FLAVOR=sama5d27_som1_ek -j12A
tee.bin
file will be created in out/arm-plat-sam/core
and should be copied on a SDCard to allow at91bootstrap booting it.
Note: By default OP-TEE will not display anything, only some messages in case of errors. To enable a more verbose debug, compile it with the following options:
$ make CROSS_COMPILE=arm-linux-gnueabi- PLATFORM=sam PLATFORM_FLAVOR=sama5d27_som1_ek DEBUG=1 CFG_TEE_CORE_LOG_LEVEL=4 CFG_TEE_CORE_DEBUG=y -j12
CFG_RPMB_FS=y CFG_RPMB_WRITE_KEY=y CFG_RPMB_TESTKEY=y CFG_REE_FS=y
The xtest
program will verify the secure storage when it runs its regression test. To call a specific secure storage memory test run xtest _6
, and xtest -t benchmark -l 15
.
configs/
$ make sama5d27_som1_ek_mmc_optee_defconfig $ makeOnce built, a u-boot.bin file will be available in the build directory. This file should be copied on the SDCard.
arch/arm/configs/
$make ARCH=arm sama5_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/confdata.o HOSTCC scripts/kconfig/expr.o LEX scripts/kconfig/lexer.lex.c YACC scripts/kconfig/parser.tab.[ch] HOSTCC scripts/kconfig/lexer.lex.o HOSTCC scripts/kconfig/menu.o HOSTCC scripts/kconfig/parser.tab.o HOSTCC scripts/kconfig/preprocess.o HOSTCC scripts/kconfig/symbol.o HOSTCC scripts/kconfig/util.o HOSTLD scripts/kconfig/conf # # configuration written to .config #TO add the OP-TEE support configurations to the .config file need to be changed to match what is shown below:
CONFIG_OPTEE=y CONFIG_ARM_PSCI=y CONFIG_ARM_PSCI_FW=y CONFIG_HAVE_ARM_SMCCC=y CONFIG_HAVE_ARM_SMCCC_DISCOVERY=y CONFIG_ARM_SMCCC_SOC_ID=y CONFIG_REGMAP_SMCCC=y CONFIG_ARM_SCMI_PROTOCOL=y CONFIG_COMMON_CLK_SCMI=y CONFIG_CPU_IDLE=y CONFIG_ARM_PSCI_CPUIDLE=y # CONFIG_ARM_PSCI_CPUIDLE_DOMAIN is not set # CONFIG_ARM_AT91_CPUIDLE is not set # CONFIG_ATMEL_PM is not set CONFIG_ATMEL_SECURE_PM=yNow to build the Linux kernel image, before you build you need to set up the cross compile toochain here(link).
$ARCH=arm makeNow you have a usable compressed kernel image
zImage
.
configs/sama5d27_som1_ek_optee_graphics_defconfig configs/sama5d27_som1_ek_optee_headless_defconfigThen to load the OP-TEE config you'll have to do:
$ BR2_EXTERNAL=../buildroot-external-microchip/ make sama5d27_som1_ek_optee_graphics_defconfigThen you can build the image:
$ make
BR2_EXTERNAL=../buildroot-external-microchip/ make menuconfigand go into
Bootloaders
menu to find the highlighted portion:
Simply add any additional build variables that you might need as if you are building OP-TEE stand alone.
Linux4SAM 2022.10
release, the meta-atmel
layer supports OP-TEE for the following boards
sama5d27-som1-ek-optee-sdThe Build commands are as follows
1/ To build the microchip image with no graphics support: [MACHINE=] bitbake microchip-headless-image Example for sama5d27-som1-ek-optee-sd SD card image: MACHINE=sama5d27-som1-ek-optee-sd bitbake microchip-headless-image 2/ To build the microchip image with graphics support (EGT): [MACHINE= ] bitbake microchip-graphics-image Example for sama5d27-som1-ek-optee-sd SD card image: MACHINE=sama5d27-som1-ek-optee-sd bitbake microchip-graphics-image
host
folder, shown below:
ta_my_program.h
Note: For clarity the UUID that was generated for this instance is cd9a3290-457b-4e49-99ff-32145fbde7cb
and TA_MY_PROGRAM_CMD_INC_VALUE
is a parameter passed into the main program from the host program.
ta
folder.
An Example:
global-incdirs-y +=include srcs-y += my_program_ta.cThis adds the include folder globally and adds the trusted application main.c file to the list of source files.
host
folder the cross compiler needs to be set and the tee client export needs to be set as well.
If using the Buildroot OP-TEE build:
$ make CROSS_COMPILE=<buildroot-at91>/output/host/bin/arm-buildroot-gnueabihf- TEEC_EXPORT=<buildroot-at91>/output/build/optee-client-3.15.0/out/export/usr --no-builtin-variablesThis will output the program as a binary in the host folder, where the build was done. To compile the trusted application first navigate to the
ta
folder. The cross compiler needs to be set just like the above step as well as the location of the ta_dev_kit, which is made when the optee_os is built.
An example using buildroot:
$ make CROSS_COMPILE=<buildroot-at91>/output/host/bin/arm-buildroot-gnueabihf- PLATFORM=sam TA_DEV_KIT_DIR=<buildroot-at91>/output/build/<optee-os>/out/export-ta_arm32/
.ta
into <buildroot-at91>/output/target/lib/optee_armtz/
folder If this folder is not there double check the environment was configured correctly for OP-TEE and finished building.
<buildroot-at91>/output/target/usr/bin/
This location is different due to how OP-TEE separates the secure world and the non secure world.
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.
Microchip and others, are registered trademarks or trademarks of Microchip Technology Inc. and its subsidiaries.
Arm® and others are registered trademarks or trademarks of Arm Limited (or its affiliates). Other terms and product names may be trademarks of others.
Ideas, requests, contributions ? Connect to LinksToCommunities page.