OPTEE-OS-STM32MP: update to v2.0.0 (3.9.0-stm32mp-r1)

Change-Id: I694a30b4d79ec0ff77b6db167c0fbf926c111ac2
This commit is contained in:
Romuald JEANNE 2020-06-17 16:31:07 +02:00
parent 5a288525e2
commit 4b72bbe010
9 changed files with 16034 additions and 29544 deletions

View File

@ -24,7 +24,7 @@ archiver_create_makefile_for_sdk() {
#set default CONFIGURATION with configured OPTEE_CONF #set default CONFIGURATION with configured OPTEE_CONF
if [ -n "${OPTEE_CONF}" ]; then if [ -n "${OPTEE_CONF}" ]; then
echo "PLATFORM ?= ${MACHINE}" >> ${ARCHIVER_OUTDIR}/Makefile.sdk echo "PLATFORM ?= ${MACHINE}" >> ${ARCHIVER_OUTDIR}/Makefile.sdk
echo "CFG_SECURE_DT ?= ${OPTEE_CONF}" >> ${ARCHIVER_OUTDIR}/Makefile.sdk echo "CFG_EMBED_DTB_SOURCE_FILE ?= ${OPTEE_CONF}" >> ${ARCHIVER_OUTDIR}/Makefile.sdk
fi fi
echo -n "EXTRA_OEMAKE=" >> ${ARCHIVER_OUTDIR}/Makefile.sdk echo -n "EXTRA_OEMAKE=" >> ${ARCHIVER_OUTDIR}/Makefile.sdk
@ -32,9 +32,9 @@ archiver_create_makefile_for_sdk() {
echo "" >> ${ARCHIVER_OUTDIR}/Makefile.sdk echo "" >> ${ARCHIVER_OUTDIR}/Makefile.sdk
echo "all:" >> ${ARCHIVER_OUTDIR}/Makefile.sdk echo "all:" >> ${ARCHIVER_OUTDIR}/Makefile.sdk
echo " if test -n \"\$(CFG_SECURE_DT)\" ; then \\" >> ${ARCHIVER_OUTDIR}/Makefile.sdk echo " if test -n \"\$(CFG_EMBED_DTB_SOURCE_FILE)\" ; then \\" >> ${ARCHIVER_OUTDIR}/Makefile.sdk
echo " for dt in \$(CFG_SECURE_DT) ; do \\" >> ${ARCHIVER_OUTDIR}/Makefile.sdk echo " for dt in \$(CFG_EMBED_DTB_SOURCE_FILE) ; do \\" >> ${ARCHIVER_OUTDIR}/Makefile.sdk
echo " \$(MAKE) \$(EXTRA_OEMAKE) -C \$(LOCAL_PATH) PREFIX=\$(SDKTARGETSYSROOT) O=\$(LOCAL_PATH)/../build/\$\$dt CFG_SECURE_DT=\$\$dt ; \\" >> ${ARCHIVER_OUTDIR}/Makefile.sdk echo " \$(MAKE) \$(EXTRA_OEMAKE) -C \$(LOCAL_PATH) PREFIX=\$(SDKTARGETSYSROOT) O=\$(LOCAL_PATH)/../build/\$\$dt CFG_EMBED_DTB_SOURCE_FILE=\$\$dt.dts ; \\" >> ${ARCHIVER_OUTDIR}/Makefile.sdk
# Copy binary files with explicit name # Copy binary files with explicit name
echo " cp ../build/\$\$dt/core/${OPTEE_HEADER}.${OPTEE_SUFFIX} ../build/${OPTEE_HEADER}-\$\$dt-${OPTEE_BOOTCHAIN}.${OPTEE_SUFFIX} ; \\" >> ${ARCHIVER_OUTDIR}/Makefile.sdk echo " cp ../build/\$\$dt/core/${OPTEE_HEADER}.${OPTEE_SUFFIX} ../build/${OPTEE_HEADER}-\$\$dt-${OPTEE_BOOTCHAIN}.${OPTEE_SUFFIX} ; \\" >> ${ARCHIVER_OUTDIR}/Makefile.sdk
echo " cp ../build/\$\$dt/core/${OPTEE_PAGER}.${OPTEE_SUFFIX} ../build/${OPTEE_PAGER}-\$\$dt-${OPTEE_BOOTCHAIN}.${OPTEE_SUFFIX} ; \\" >> ${ARCHIVER_OUTDIR}/Makefile.sdk echo " cp ../build/\$\$dt/core/${OPTEE_PAGER}.${OPTEE_SUFFIX} ../build/${OPTEE_PAGER}-\$\$dt-${OPTEE_BOOTCHAIN}.${OPTEE_SUFFIX} ; \\" >> ${ARCHIVER_OUTDIR}/Makefile.sdk

View File

@ -2,13 +2,16 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/optee-os:"
PACKAGE_ARCH = "${MACHINE_ARCH}" PACKAGE_ARCH = "${MACHINE_ARCH}"
PROVIDES += "virtual/optee-os"
RPROVIDES_${PN} += "virtual/optee-os virtual/systemd-bootconf"
B = "${WORKDIR}/build" B = "${WORKDIR}/build"
# Configure build dir for externalsrc class usage through devtool # Configure build dir for externalsrc class usage through devtool
EXTERNALSRC_BUILD_pn-${PN} = "${WORKDIR}/build" EXTERNALSRC_BUILD_pn-${PN} = "${WORKDIR}/build"
DEPENDS += "dtc-native python-pycrypto-native" DEPENDS += "dtc-native python3-pycryptodomex-native python3-pycrypto-native python3-pyelftools-native"
inherit deploy pythonnative inherit deploy python3native
OPTEEMACHINE ?= "${MACHINE}" OPTEEMACHINE ?= "${MACHINE}"
OPTEEOUTPUTMACHINE ?= "${MACHINE}" OPTEEOUTPUTMACHINE ?= "${MACHINE}"
@ -38,7 +41,7 @@ do_compile() {
unset -v CFLAGS CPPFLAGS LDFLAGS LDADD unset -v CFLAGS CPPFLAGS LDFLAGS LDADD
if [ -n "${OPTEE_CONF}" ]; then if [ -n "${OPTEE_CONF}" ]; then
for conf in ${OPTEE_CONF}; do for conf in ${OPTEE_CONF}; do
oe_runmake -C ${S} O=${B}/${conf} CFG_SECURE_DT=${conf} oe_runmake -C ${S} O=${B}/${conf} CFG_EMBED_DTB_SOURCE_FILE=${conf}.dts
done done
else else
oe_runmake -C ${S} O=${B}/out oe_runmake -C ${S} O=${B}/out
@ -69,6 +72,7 @@ ELF_DEBUG_ENABLE ?= ""
OPTEE_ELF = "tee" OPTEE_ELF = "tee"
OPTEE_ELF_SUFFIX = "elf" OPTEE_ELF_SUFFIX = "elf"
do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}/optee"
do_deploy() { do_deploy() {
install -d ${DEPLOYDIR} install -d ${DEPLOYDIR}
if [ -n "${OPTEE_CONF}" ]; then if [ -n "${OPTEE_CONF}" ]; then

View File

@ -1,49 +0,0 @@
SUMMARY = "OPTEE TA development kit for stm32mp"
LICENSE = "BSD-2-Clause & BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=69663ab153298557a59c67a60a743e5b"
SRC_URI = "https://github.com/OP-TEE/optee_os/archive/${PV}.tar.gz"
SRC_URI[md5sum] = "7cb56c333066fd576460358fc97da85f"
SRC_URI[sha256sum] = "7b62e9fe650e197473eb2f4dc35c09d1e6395eb48dc1c16cc139d401b359ac6f"
SRC_URI += " \
file://0001-st-updates-r1.patch \
file://0002-st-updates-r2.patch \
file://0003-st-updates-r3.patch \
"
OPTEE_VERSION = "3.3.0"
PV = "${OPTEE_VERSION}"
S = "${WORKDIR}/optee_os-${PV}"
COMPATIBLE_MACHINE = "(stm32mpcommon)"
PROVIDES += "optee-os"
# The package is empty but must be generated to avoid apt-get installation issue
ALLOW_EMPTY_${PN} = "1"
require optee-os-stm32mp-common.inc
# ---------------------------------
# Configure archiver use
# ---------------------------------
include ${@oe.utils.ifelse(d.getVar('ST_ARCHIVER_ENABLE') == '1', 'optee-os-stm32mp-archiver.inc','')}
# ---------------------------------
# Configure devupstream class usage
# ---------------------------------
BBCLASSEXTEND = "devupstream:target"
SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/optee_os.git;protocol=https;name=opteeos;branch=3.3.0-stm32mp"
SRCREV_class-devupstream = "273094317924bd18d2b7e7ed1d98e5118ed9c1fa"
SRCREV_FORMAT_class-devupstream = "opteeos"
PV_class-devupstream = "${OPTEE_VERSION}+github+${SRCPV}"
# ---------------------------------
# Configure default preference to manage dynamic selection between tarball and github
# ---------------------------------
STM32MP_SOURCE_SELECTION ?= "tarball"
DEFAULT_PREFERENCE = "${@bb.utils.contains('STM32MP_SOURCE_SELECTION', 'github', '-1', '1', d)}"

View File

@ -0,0 +1,51 @@
SUMMARY = "OPTEE TA development kit for stm32mp"
LICENSE = "BSD-2-Clause & BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
SRC_URI = "git://github.com/OP-TEE/optee_os.git;protocol=https;name=os"
SRCREV = "af141c61fe7a2430f3b4bb89661d8414117013b3"
SRC_URI += " \
file://0001-3.9.0-stm32mp-r1.patch \
"
OPTEE_VERSION = "3.9.0"
PV = "${OPTEE_VERSION}.r1"
S = "${WORKDIR}/git"
COMPATIBLE_MACHINE = "(stm32mpcommon)"
OPTEEMACHINE ?= "stm32mp1"
OPTEEMACHINE_stm32mp1common = "stm32mp1"
OPTEEOUTPUTMACHINE ?= "stm32mp1"
OPTEEOUTPUTMACHINE_stm32mp1common = "stm32mp1"
# The package is empty but must be generated to avoid apt-get installation issue
ALLOW_EMPTY_${PN} = "1"
require optee-os-stm32mp-common.inc
# ---------------------------------
# Configure archiver use
# ---------------------------------
include ${@oe.utils.ifelse(d.getVar('ST_ARCHIVER_ENABLE') == '1', 'optee-os-stm32mp-archiver.inc','')}
# ---------------------------------
# Configure devupstream class usage
# ---------------------------------
#BBCLASSEXTEND = "devupstream:target"
#SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/optee_os.git;protocol=https;name=opteeos;branch=3.3.0-stm32mp"
#SRCREV_class-devupstream = "5f5cc70dfd04419be2ba66b87f41584b6136118c"
#SRCREV_FORMAT_class-devupstream = "opteeos"
#PV_class-devupstream = "${OPTEE_VERSION}+github+${SRCPV}"
# ---------------------------------
# Configure default preference to manage dynamic selection between tarball and github
# ---------------------------------
#STM32MP_SOURCE_SELECTION ?= "tarball"
#DEFAULT_PREFERENCE = "${@bb.utils.contains('STM32MP_SOURCE_SELECTION', 'github', '-1', '1', d)}"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,17 +19,17 @@ For optee-os build you need to install:
Fedora: sudo yum install git Fedora: sudo yum install git
If you have never configured you git configuration: If you have never configured you git configuration:
$> git config --global user.name "your_name" $ git config --global user.name "your_name"
$> git config --global user.email "your_email@example.com" $ git config --global user.email "your_email@example.com"
2. Initialise cross-compilation via SDK: 2. Initialise cross-compilation via SDK:
--------------------------------------- ---------------------------------------
Source SDK environment: Source SDK environment:
$> source <path to SDK>/environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi $ source <path to SDK>/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
To verify if your cross-compilation environment have put in place: To verify if your cross-compilation environment have put in place:
$> set | grep CROSS $ set | grep CROSS
CROSS_COMPILE=arm-openstlinux_weston-linux-gnueabi- CROSS_COMPILE=arm-ostl-linux-gnueabi-
Warning: the environment are valid only on the shell session where you have Warning: the environment are valid only on the shell session where you have
sourced the sdk environment. sourced the sdk environment.
@ -38,55 +38,52 @@ Warning: the environment are valid only on the shell session where you have
------------------------ ------------------------
If you have the tarball and the list of patch then you must extract the If you have the tarball and the list of patch then you must extract the
tarball and apply the patch. tarball and apply the patch.
$> tar xfz <optee-os source>.tar.gz $> tar xfz ##BP##-##PR##.tar.gz
or
$> tar xfj <optee-os source>.tar.bz2
or
$> tar xfJ <optee-os source>.tar.xz
A new directory containing optee standard source code will be created, go into it: A new directory containing optee standard source code will be created, go into it:
$> cd <directory to optee-os source code> $> cd ##BP##
NB: if there is no git management on source code and you would like to have a git management NB: if there is no git management on source code and you would like to have a git management
on the code see section 4 [Management of optee-os source code] on the code see section 4 [Management of optee-os source code]
if there is some patch, please apply it on source code if there is some patch, please apply it on source code
$> for p in `ls -1 <path to patch>/*.patch`; do patch -p1 < $p; done $> for p in `ls -1 ../*.patch`; do patch -p1 < $p; done
4. Management of optee-os source code: 4. Management of optee-os source code:
----------------------------------- -----------------------------------
If you like to have a better management of change made on optee-os source, you If you like to have a better management of change made on optee-os source, you
can use git: can use git:
$> cd <optee-os source> $ cd <optee-os source>
$> test -d .git || git init . && git add . && git commit -m "optee-ossource code" && git gc $ test -d .git || git init . && git add . && git commit -m "optee-ossource code" && git gc
$> git checkout -b WORKING $ git checkout -b WORKING
$> for p in `ls -1 <path to patch>/*.patch`; do git am $p; done $ for p in `ls -1 <path to patch>/*.patch`; do git am $p; done
MANDATORY: You must update sources MANDATORY: You must update sources
$> cd <directory to optee-os source code> $ cd <directory to optee-os source code>
$> chmod 755 scripts/bin_to_c.py $ chmod 755 scripts/bin_to_c.py
NB: you can use directly the source from the community: NB: you can use directly the source from the community:
URL: git://github.com/OP-TEE/optee_os.git URL: git://github.com/OP-TEE/optee_os.git
Branch: ##GIT_BRANCH## Branch: ##GIT_BRANCH##
Revision: ##GIT_SRCREV## Revision: ##GIT_SRCREV##
$> git clone git://github.com/OP-TEE/optee_os.git $ git clone git://github.com/OP-TEE/optee_os.git
$> cd <optee-os source> $ cd <optee-os source>
$> git checkout -b WORKING ##GIT_SRCREV## $ git checkout -b WORKING ##GIT_SRCREV##
$> for p in `ls -1 <path to patch>/*.patch`; do git am $p; done $ for p in `ls -1 <path to patch>/*.patch`; do git am $p; done
MANDATORY: You must update sources MANDATORY: You must update sources
$> cd <directory to optee-os source code> $ cd <directory to optee-os source code>
$> chmod 755 scripts/bin_to_c.py $ chmod 755 scripts/bin_to_c.py
5. Build optee-os source code: 5. Build optee-os source code:
-------------------------------- --------------------------------
To compile optee-os source code To compile optee-os source code
$> cd <directory to optee-os source code>
$> make -f $PWD/../Makefile.sdk $> make -f $PWD/../Makefile.sdk
or for a specific config : or for a specific config :
$> make -f $PWD/../Makefile.sdk CFG_SECURE_DT=stm32mp157c-ev1 $ make -f $PWD/../Makefile.sdk CFG_EMBED_DTB_SOURCE_FILE=stm32mp157c-ev1
Binaries generated are as follow:
##> PWD/../build/tee-*-optee.stm32
By default, binaries are located in $PWD/../build
6. Update software on board: 6. Update software on board:
---------------------------- ----------------------------
@ -107,7 +104,7 @@ the OP-TEE partitions are the partitions 4/5/6:
- SDCARD via USB reader: /dev/sdX4 /dev/sdX5 /dev/sdX6 - SDCARD via USB reader: /dev/sdX4 /dev/sdX5 /dev/sdX6
(where X is the instance identifier) (where X is the instance identifier)
So, for each binary: So, for each binary:
$> dd if=<op-tee binary> of=/dev/<device partition> bs=1M conv=fdatasync $ dd if=<op-tee binary> of=/dev/<device partition> bs=1M conv=fdatasync
6.3. Update via USB mass storage on U-boot: 6.3. Update via USB mass storage on U-boot:
------------------------------------------- -------------------------------------------
@ -135,7 +132,7 @@ To find the partition associated to a specific label, connect the
SDCARD to your PC or run on target U-boot 'ums' command SDCARD to your PC or run on target U-boot 'ums' command
and list /dev/disk/by-partlabel/ content, i.e: and list /dev/disk/by-partlabel/ content, i.e:
$> ls -l /dev/disk/by-partlabel/ $ ls -l /dev/disk/by-partlabel/
total 0 total 0
lrwxrwxrwx 1 root root 15 Jan 23 19:11 bootfs -> ../../mmcblk0p7 lrwxrwxrwx 1 root root 15 Jan 23 19:11 bootfs -> ../../mmcblk0p7
lrwxrwxrwx 1 root root 15 Jan 23 19:11 fsbl1 -> ../../mmcblk0p1 # FSBL (TF-A) lrwxrwxrwx 1 root root 15 Jan 23 19:11 fsbl1 -> ../../mmcblk0p1 # FSBL (TF-A)
@ -146,4 +143,4 @@ and list /dev/disk/by-partlabel/ content, i.e:
lrwxrwxrwx 1 root root 15 Jan 23 19:11 teeh -> ../../mmcblk0p4 # TEEH (OP-TEE tee-header) lrwxrwxrwx 1 root root 15 Jan 23 19:11 teeh -> ../../mmcblk0p4 # TEEH (OP-TEE tee-header)
lrwxrwxrwx 1 root root 15 Jan 23 19:11 teex -> ../../mmcblk0p6 # TEEX (OP-TEE tee-pager) lrwxrwxrwx 1 root root 15 Jan 23 19:11 teex -> ../../mmcblk0p6 # TEEX (OP-TEE tee-pager)
lrwxrwxrwx 1 root root 16 Jan 23 19:11 userfs -> ../../mmcblk0p10 lrwxrwxrwx 1 root root 16 Jan 23 19:11 userfs -> ../../mmcblk0p10
lrwxrwxrwx 1 root root 15 Jan 23 19:11 vendorfs -> ../../mmcblk0p8 lrwxrwxrwx 1 root root 15 Jan 23 19:11 vendorfs -> ../../mmcblk0p8