OPTEE-OS-STM32MP: update archiver to manage dt config

When provided device tree is not one of the embedded one in official source
code, we need to set the right configuration switch:
CFG_STM32MP13=1 or CFG_STM32MP15=y
And also we need to manage the DRAM size to configure.

Change-Id: I7d3dc67b89ce2ff1c6330d3ce1b07a5e4344eb61
Signed-off-by: Romuald JEANNE <romuald.jeanne@st.com>
This commit is contained in:
Romuald JEANNE 2022-06-15 17:25:54 +02:00 committed by bernard PUEL
parent 919572b847
commit 48713aae88
2 changed files with 72 additions and 7 deletions

View File

@ -20,6 +20,9 @@ DEPLOYDIR ?= \$(SRC_PATH)/../deploy
# Set default optee-os config
CFG_EMBED_DTB_SOURCE_FILE ?= ${OPTEE_CONF}
OPTEE_DRAMSIZE ?=
OPTEE_DRAMSIZE_EV ?= 0x40000000
OPTEE_DRAMSIZE_DK ?= 0x20000000
# Remove default variables
LDFLAGS =
@ -28,6 +31,26 @@ CPPFLAGS =
# Define default make options
EXTRA_OEMAKE = $(echo "${EXTRA_OEMAKE}" | sed "s|LIBGCC_LOCATE_CFLAGS=[^ ]* |LIBGCC_LOCATE_CFLAGS=\$(KCFLAGS) |")
# Check that provided devicetree file follow the default naming rules:
# devicetree name should contains the original stm32mp devicetree name to allow proper auto-configuration
check_dt:= \$(shell \\
for dt in \$(CFG_EMBED_DTB_SOURCE_FILE); do \\
match_naming="\$\$dt" ; \\
for stdt in ${STM32MP_DEVICETREE} ; do \\
if [ "\$\$(echo \$\$dt | grep -cE "\$\$stdt\$\$|\$\$stdt-")" -eq 1 ]; then \\
match_naming="" ; \\
break ; \\
fi ; \\
done ; \\
echo \$\$match_naming ; \\
done)
ifneq (\$(check_dt),)
ifeq (\$(OPTEE_DRAMSIZE),)
\$(error Devicetree name "\$(check_dt)" is not compatible with optee-os-stm32mp auto configuration switch: you should configure OPTEE_DRAMSIZE by yourself)
endif
endif
# Set dependencies list for building all
DEPS = optee
DEPS += fip
@ -36,6 +59,21 @@ help:
@echo
@echo "OPTEE-OS configuration:"
@echo " CFG_EMBED_DTB_SOURCE_FILE = \$(CFG_EMBED_DTB_SOURCE_FILE)"
@echo " DRAM size setting:"
@for dt in \$(CFG_EMBED_DTB_SOURCE_FILE); do \\
if [ -n "\$(OPTEE_DRAMSIZE)" ]; then \
dramsize_config="OPTEE_DRAMSIZE = \$(OPTEE_DRAMSIZE)" ; \
else \
dramsize_config="OPTEE_DRAMSIZE_EV = \$(OPTEE_DRAMSIZE_EV)" ; \\
for dk in ${STM32MP_DT_FILES_DK} ; do \\
if [ "\$\$(echo \$\$dt | grep -cE "\$\$dk\$\$|\$\$dk-")" -eq 1 ]; then \\
dramsize_config="OPTEE_DRAMSIZE_DK = \$(OPTEE_DRAMSIZE_DK)" ; \\
break ; \\
fi ; \\
done ; \\
fi ; \\
echo " \$\$dt : \$\$dramsize_config" ; \\
done
@echo
@echo "OPTEE-OS folder configuration:"
@echo " SRC_PATH = \$(SRC_PATH)"
@ -46,7 +84,9 @@ help:
@echo " Do not forget to set FIP deploydir folders (such as FIP_DEPLOYDIR_ROOT) to provide path to needed binaries"
@echo
@echo "Available targets:"
@echo " all : build OPTEE-OS binaries for defined config(s)"
@echo " all : default target to build all binaries for defined config(s)"
@echo " fip : build FIP binaries for defined config(s)"
@echo " optee : build OPTEE-OS binaries for defined config(s)"
@echo " clean : clean build directories from generated files"
@echo
@ -55,9 +95,29 @@ all: \$(DEPS)
optee:
@mkdir -p \$(DEPLOYDIR)
@mkdir -p \$(DEPLOYDIR)/debug
@if test -n "\$(CFG_EMBED_DTB_SOURCE_FILE)" ; then \\
@if [ -n "\$(CFG_EMBED_DTB_SOURCE_FILE)" ]; then \\
for dt in \$(CFG_EMBED_DTB_SOURCE_FILE); do \\
\$(MAKE) \$(EXTRA_OEMAKE) -C \$(SRC_PATH) PREFIX=\$(SDKTARGETSYSROOT) O=\$(BLD_PATH)/\$\$dt CFG_EMBED_DTB_SOURCE_FILE=\$\$dt.dts ; \\
# Configure SOC switch \\
soc_extra="" ; \\
for soc in ${STM32MP_SOC_NAME} ; do \\
if [ "\$\$(echo \$\$dt | grep -c \$\$soc)" -eq 1 ]; then \\
soc_extra="\$\$(echo CFG_\$\$soc | tr a-z A-Z)=y" ; \\
break ; \\
fi ; \\
done ; \\
# Configure DRAM_SIZE switch \\
if [ -n "\$(OPTEE_DRAMSIZE)" ]; then \\
dramsize="\$(OPTEE_DRAMSIZE)" ; \\
else \\
dramsize="\$(OPTEE_DRAMSIZE_EV)" ; \\
for dk in ${STM32MP_DT_FILES_DK} ; do \\
if [ "\$\$(echo \$\$dt | grep -cE "\$\$dk\$\$|\$\$dk-")" -eq 1 ]; then \\
dramsize="\$(OPTEE_DRAMSIZE_DK)" ; \\
break ; \\
fi ; \\
done ; \\
fi ; \\
\$(MAKE) \$(EXTRA_OEMAKE) -C \$(SRC_PATH) PREFIX=\$(SDKTARGETSYSROOT) O=\$(BLD_PATH)/\$\$dt CFG_EMBED_DTB_SOURCE_FILE=\$\$dt.dts CFG_DRAM_SIZE=\$\$dramsize \$\$soc_extra ; \\
# Copy binary files with explicit name \\
cp \$(BLD_PATH)/\$\$dt/core/${OPTEE_HEADER}.${OPTEE_SUFFIX} \$(DEPLOYDIR)/${OPTEE_HEADER}-\$\$dt.${OPTEE_SUFFIX} ; \\
cp \$(BLD_PATH)/\$\$dt/core/${OPTEE_PAGER}.${OPTEE_SUFFIX} \$(DEPLOYDIR)/${OPTEE_PAGER}-\$\$dt.${OPTEE_SUFFIX} ; \\

View File

@ -104,10 +104,15 @@ Since OpenSTLinux activates FIP by default, FIP_artifacts directory path must be
- In case of using SOURCES-xxxx.tar.gz of Developer package the FIP_DEPLOYDIR_ROOT must be set as below:
$> export FIP_DEPLOYDIR_ROOT=$PWD/../../FIP_artifacts
To compile optee-os source code
To compile optee-os source code with default embedded config:
$> make -f $PWD/../Makefile.sdk all
or for a specific config :
$ make -f $PWD/../Makefile.sdk CFG_EMBED_DTB_SOURCE_FILE=stm32mp157c-ev1 all
You can check the configuration throught 'help' target:
$ make -f $PWD/../Makefile.sdk help
To compile only one of the provided devicetree:
$ make -f $PWD/../Makefile.sdk CFG_EMBED_DTB_SOURCE_FILE=stm32mp157f-ev1 all
For a specific devicetree file you need to force not only the devicetree but also the DRAM size settings:
$ make -f $PWD/../Makefile.sdk CFG_EMBED_DTB_SOURCE_FILE=<your_devicetree> OPTEE_DRAMSIZE=<dram_size_value_in_hexadecimal> all
By default, the build results for this component are available in $PWD/../deploy directory.
If needed, this deploy directory can be specified by added "DEPLOYDIR=<your_deploy_dir_path>" compilation option to the build command line above.