summaryrefslogtreecommitdiff
path: root/br-ext
diff options
context:
space:
mode:
authorEtienne Carriere <etienne.carriere@linaro.org>2020-05-16 13:42:36 +0200
committerJérôme Forissier <jerome@forissier.org>2020-06-05 10:35:05 +0200
commitbba5972e98e2bf007125d409d4f9c626e688f1bf (patch)
tree69607b5839ec38c51a9977fca30a5c27e3b6fc4b /br-ext
parent8adab8471d514414df13372a875c18f1f1284073 (diff)
stm32mp1: initial support
Build OP-TEE for STM32MP1 based platforms. Currently supports platforms STM32MP157A-DK1, STM32MP157C-DK2 and STM32MP157C-EV1 using a SDcard as boot media. Default build targets board STM32MP157C-DK2: # make One can specify a target board with PLATFORM configuration switch: # make PLATFORM=stm32mp1-157A_DK1 # make PLATFORM=stm32mp1-157C_DK2 # make PLATFORM=stm32mp1-157C_EV1 Refer to br-ext/board/stmicroelectronics/stm32mp1-tz/readme.txt for mode information. TF-A, OP-TEE OS, U-Boot and Linux kernel are built outside Builrdoot. All other embedded components are built through Buildroot. Buildroot generates the final SDcard binary image file to be loaded raw in the target SD card. The image includes a GPT partition table. See br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-*.cfg for more details. Note on U-Boot defconfig: from v2019.10 up to v2020.07-rc2, one shall use stm32mp15_optee_defconfig. From v2020-rc3 onward, one shall use stm32mp15_trusted_defconfig. For flexibility, stm32mp1.mk supports both. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Diffstat (limited to 'br-ext')
-rw-r--r--br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157A-DK1.cfg48
-rw-r--r--br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157C-DK2.cfg48
-rw-r--r--br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157C-EV1.cfg48
-rw-r--r--br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157A-DK1/boot/extlinux/extlinux.conf6
-rw-r--r--br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157C-DK2/boot/extlinux/extlinux.conf6
-rw-r--r--br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157C-EV1/boot/extlinux/extlinux.conf6
-rwxr-xr-xbr-ext/board/stmicroelectronics/stm32mp1-tz/post-image.sh45
-rw-r--r--br-ext/board/stmicroelectronics/stm32mp1-tz/readme.txt46
8 files changed, 253 insertions, 0 deletions
diff --git a/br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157A-DK1.cfg b/br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157A-DK1.cfg
new file mode 100644
index 0000000..d076c83
--- /dev/null
+++ b/br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157A-DK1.cfg
@@ -0,0 +1,48 @@
+image sdcard.img {
+ hdimage {
+ gpt = "true"
+ }
+
+ partition fsbl1 {
+ image = "tf-a-stm32mp157a-dk1.stm32"
+ size = 256K
+ }
+
+ partition fsbl2 {
+ image = "tf-a-stm32mp157a-dk1.stm32"
+ size = 256K
+ }
+
+ partition ssbl {
+ image = "u-boot.stm32"
+ size = 2M
+ }
+
+ partition teeh {
+ image = "tee-header_v2.stm32"
+ size = 32K
+ }
+
+ partition teed {
+ image = "tee-pageable_v2.stm32"
+ size = 512K
+ }
+
+ partition teex {
+ image = "tee-pager_v2.stm32"
+ size = 128K
+ }
+
+ partition bootfs {
+ image = "bootfs.ext2"
+ partition-type = 0x83
+ size = 32M
+ bootable = "yes"
+ }
+
+ partition rootfs {
+ image = "rootfs.ext2"
+ partition-type = 0x83
+ size = 128M
+ }
+}
diff --git a/br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157C-DK2.cfg b/br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157C-DK2.cfg
new file mode 100644
index 0000000..f929d70
--- /dev/null
+++ b/br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157C-DK2.cfg
@@ -0,0 +1,48 @@
+image sdcard.img {
+ hdimage {
+ gpt = "true"
+ }
+
+ partition fsbl1 {
+ image = "tf-a-stm32mp157c-dk2.stm32"
+ size = 256K
+ }
+
+ partition fsbl2 {
+ image = "tf-a-stm32mp157c-dk2.stm32"
+ size = 256K
+ }
+
+ partition ssbl {
+ image = "u-boot.stm32"
+ size = 2M
+ }
+
+ partition teeh {
+ image = "tee-header_v2.stm32"
+ size = 32K
+ }
+
+ partition teed {
+ image = "tee-pageable_v2.stm32"
+ size = 512K
+ }
+
+ partition teex {
+ image = "tee-pager_v2.stm32"
+ size = 128K
+ }
+
+ partition bootfs {
+ image = "bootfs.ext2"
+ partition-type = 0x83
+ size = 32M
+ bootable = "yes"
+ }
+
+ partition rootfs {
+ image = "rootfs.ext2"
+ partition-type = 0x83
+ size = 128M
+ }
+}
diff --git a/br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157C-EV1.cfg b/br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157C-EV1.cfg
new file mode 100644
index 0000000..d38142f
--- /dev/null
+++ b/br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157C-EV1.cfg
@@ -0,0 +1,48 @@
+image sdcard.img {
+ hdimage {
+ gpt = "true"
+ }
+
+ partition fsbl1 {
+ image = "tf-a-stm32mp157c-ev1.stm32"
+ size = 256K
+ }
+
+ partition fsbl2 {
+ image = "tf-a-stm32mp157c-ev1.stm32"
+ size = 256K
+ }
+
+ partition ssbl {
+ image = "u-boot.stm32"
+ size = 2M
+ }
+
+ partition teeh {
+ image = "tee-header_v2.stm32"
+ size = 32K
+ }
+
+ partition teed {
+ image = "tee-pageable_v2.stm32"
+ size = 512K
+ }
+
+ partition teex {
+ image = "tee-pager_v2.stm32"
+ size = 128K
+ }
+
+ partition bootfs {
+ image = "rootfs.ext2"
+ partition-type = 0x83
+ size = 32M
+ bootable = "yes"
+ }
+
+ partition rootfs {
+ image = "rootfs.ext2"
+ partition-type = 0x83
+ size = 100M
+ }
+}
diff --git a/br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157A-DK1/boot/extlinux/extlinux.conf b/br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157A-DK1/boot/extlinux/extlinux.conf
new file mode 100644
index 0000000..78ef578
--- /dev/null
+++ b/br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157A-DK1/boot/extlinux/extlinux.conf
@@ -0,0 +1,6 @@
+TIMEOUT 20
+DEFAULT stm32mp15-buildroot
+LABEL stm32mp15-buildroot
+ kernel /boot/uImage
+ devicetree /boot/stm32mp157a-dk1.dtb
+ append root=/dev/mmcblk0p8 rootwait rw console=ttySTM0,115200
diff --git a/br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157C-DK2/boot/extlinux/extlinux.conf b/br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157C-DK2/boot/extlinux/extlinux.conf
new file mode 100644
index 0000000..fea3150
--- /dev/null
+++ b/br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157C-DK2/boot/extlinux/extlinux.conf
@@ -0,0 +1,6 @@
+TIMEOUT 20
+DEFAULT stm32mp15-buildroot
+LABEL stm32mp15-buildroot
+ kernel /boot/uImage
+ devicetree /boot/stm32mp157c-dk2.dtb
+ append root=/dev/mmcblk0p8 rootwait rw console=ttySTM0,115200
diff --git a/br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157C-EV1/boot/extlinux/extlinux.conf b/br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157C-EV1/boot/extlinux/extlinux.conf
new file mode 100644
index 0000000..2c7f84f
--- /dev/null
+++ b/br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157C-EV1/boot/extlinux/extlinux.conf
@@ -0,0 +1,6 @@
+TIMEOUT 20
+DEFAULT stm32mp15-buildroot
+LABEL stm32mp15-buildroot
+ kernel /boot/uImage
+ devicetree /boot/stm32mp157c-ev1.dtb
+ append root=/dev/mmcblk0p8 rootwait rw console=ttySTM0,115200
diff --git a/br-ext/board/stmicroelectronics/stm32mp1-tz/post-image.sh b/br-ext/board/stmicroelectronics/stm32mp1-tz/post-image.sh
new file mode 100755
index 0000000..d72bca1
--- /dev/null
+++ b/br-ext/board/stmicroelectronics/stm32mp1-tz/post-image.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+die() {
+ cat <<EOF >&2
+Error: $@
+
+Usage: ${0} IMG_DIR GENIMAGE_CFG EXT_BIN_DIR [BOOTFS_OVERLAY]
+EOF
+ exit 1
+}
+
+echo "Creating bootfs image"
+echo "- image directory path: ${1}" # Generic argument set by Buildroot
+echo "- genimage config file: ${2}"
+echo "- external bins path: ${3}"
+echo "- bootfs overlay path: ${4}"
+
+[ ! -z "${2}" -a -e ${2} ] || die "Error: missing argument genimage config file"
+[ ! -z "${3}" -a -d ${3} ] || die "Error: missing argument external binaries dir"
+[ -z "${4}" -o -d ${4} ] || die "Error: invalid bootfs overlay directory path"
+
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+# Create target bootfs filesystem
+# - Copy uImage and DTBs from path provided in arg $3 into boot/
+# - Copy bootfs overlay filetree from path provided in optional arg $4
+
+BOOTFS_DIR=${BASE_DIR}/target-bootfs
+rm -f ${BINARIES_DIR}/bootfs.ext2 || exit 1
+rm -rf ${BOOTFS_DIR} && mkdir -p ${BOOTFS_DIR}/boot || exit 1
+cp ${3}/uImage ${BOOTFS_DIR}/boot || exit 1
+cp ${3}/*.dtb ${BOOTFS_DIR}/boot || exit 1
+[ -z "${4}" ] || { cp -ar ${4}/* ${BOOTFS_DIR} || exit 1; }
+
+mkfs.ext2 -L bootfs -d ${BOOTFS_DIR} ${BINARIES_DIR}/bootfs.ext2 32M || exit 1
+
+# Generate image from generated partition images and genimage config file
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage --rootpath "${ROOTPATH_TMP}" \
+ --tmppath "${GENIMAGE_TMP}" \
+ --inputpath "${BINARIES_DIR}" \
+ --outputpath "${BINARIES_DIR}" \
+ --config ${2}
diff --git a/br-ext/board/stmicroelectronics/stm32mp1-tz/readme.txt b/br-ext/board/stmicroelectronics/stm32mp1-tz/readme.txt
new file mode 100644
index 0000000..62cbb48
--- /dev/null
+++ b/br-ext/board/stmicroelectronics/stm32mp1-tz/readme.txt
@@ -0,0 +1,46 @@
+STM32MP1 Based platforms
+
+Intro
+=====
+
+This directory provides support for few STM32MP1 based development boards.
+
+ https://www.st.com/en/evaluation-tools/stm32mp157a-dk1.html
+ https://www.st.com/en/evaluation-tools/stm32mp157c-dk2.html
+ https://www.st.com/en/evaluation-tools/stm32mp157c-ev1.html
+
+How to build
+============
+
+From OP-TEE build repository:
+
+ $ make PLATFORM=stm32mp1-157A_DK1 all
+or
+ $ make PLATFORM=stm32mp1-157C_DK2 all
+or
+ $ make PLATFORM=stm32mp1-157C_EV1 all
+
+How to write the microSD card
+=============================
+
+Once the build process is finished you will have an image called
+"sdcard.img" in directory ../out-br/images/ (relative to build
+repository root path).
+
+Copy the bootable "sdcard.img" onto an microSD card with "dd":
+
+ $ sudo dd if=../out-br/images/sdcard.img of=/dev/sdX \
+ conv=fdatasync status=progress
+
+Boot the board
+==============
+
+ (1) Insert the microSD card in connector CN15
+
+ (2) Plug a micro-USB cable in connector CN11 and run your serial
+ communication program on /dev/ttyACM0.
+
+ (3) Plug a USB-C cable in CN6 to power-up the board.
+
+ (4) The system will start, with the console on UART. Both secure
+ and non-secure console consoles are on the same UART bus.