[meta-swupdate-boards,RFC,1/1] New board: STM32MP257F-EV1

Message ID 20261114145111.2172544-2-dario.binacchi@amarulasolutions.com
State New
Headers
Series New board: STM32MP257F-EV1 |

Commit Message

Dario Binacchi Nov. 14, 2026, 2:51 p.m. UTC
The STM32MP257F-EV1 is an evaluation board based on the STM32MP25
microprocessor. The boot bank is selected through the Arm FWU
metadata, handled as a libubootenv namespace.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 README.md                                     |   8 +-
 conf/layer.conf                               |   6 +
 .../packagegroup-core-boot.bbappend           |   3 +
 ...t-add-MMC-aliases-on-stm32mp257f-ev1.patch |  20 ++++
 .../linux/linux-stm32mp_%.bbappend            |   7 ++
 .../files/stm32mp25-eval/fw_env.config        |  18 +++
 recipes-extended/images/update-image.bb       |   5 +
 .../update-image/stm32mp25-eval/emmcsetup.lua |  11 ++
 .../stm32mp25-eval/sw-description             |  90 ++++++++++++++
 .../swupdate/stm32mp25-eval/09-swupdate-args  |   8 ++
 .../swupdate/stm32mp25-eval/defconfig         | 111 ++++++++++++++++++
 .../swupdate/stm32mp25-eval/swupdate.cfg      |  41 +++++++
 12 files changed, 326 insertions(+), 2 deletions(-)
 create mode 100644 dynamic-layers/st-openstlinux/recipes-core/packagegroups/packagegroup-core-boot.bbappend
 create mode 100644 dynamic-layers/stm-st-stm32mp/recipes-kernel/linux/files/0001-arm64-dts-st-add-MMC-aliases-on-stm32mp257f-ev1.patch
 create mode 100644 dynamic-layers/stm-st-stm32mp/recipes-kernel/linux/linux-stm32mp_%.bbappend
 create mode 100644 recipes-bsp/libubootenv/files/stm32mp25-eval/fw_env.config
 create mode 100644 recipes-extended/images/update-image/stm32mp25-eval/emmcsetup.lua
 create mode 100644 recipes-extended/images/update-image/stm32mp25-eval/sw-description
 create mode 100644 recipes-support/swupdate/swupdate/stm32mp25-eval/09-swupdate-args
 create mode 100644 recipes-support/swupdate/swupdate/stm32mp25-eval/defconfig
 create mode 100644 recipes-support/swupdate/swupdate/stm32mp25-eval/swupdate.cfg

-- 
2.43.0
  

Patch

diff --git a/README.md b/README.md
index 4348cf05c853..8d4742c8ce10 100644
--- a/README.md
+++ b/README.md
@@ -38,8 +38,8 @@  Usage
 
 The layer contains examples on how to use the SWUpdate project. Examples
 on how to deploy a "dual-copy" update strategy with some common boards
-(Beaglebone Black, Raspberry Pi, Sama5d27-som1-ek-sd and Wandboard) are
-provided.
+(Beaglebone Black, Raspberry Pi, Sama5d27-som1-ek-sd, STM32MP257F-EV1 and
+Wandboard) are provided.
 
 Setup your environment accordingly and update `MACHINE` to desired target.
 
@@ -61,6 +61,10 @@  Above will enable U-boot which Raspberry Pi does not default to, and
 instead boots straight to Linux. U-boot is required to do the "swapping"
 of partitions in the "dual-copy" layout.
 
+For usage with STMicroelectronics STM32MP the boot bank is selected by
+the FWU metadata, written through a `libubootenv` namespace, which
+requires a version of `libubootenv` and SWUpdate supporting it.
+
 Maintainer
 ----------
 
diff --git a/conf/layer.conf b/conf/layer.conf
index c239335526be..2f624bda5b4f 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -19,4 +19,10 @@  BBFILES_DYNAMIC += " \
     \
     raspberrypi:${LAYERDIR}/dynamic-layers/raspberrypi/*/*/*.bb \
     raspberrypi:${LAYERDIR}/dynamic-layers/raspberrypi/*/*/*.bbappend \
+    \
+    st-openstlinux:${LAYERDIR}/dynamic-layers/st-openstlinux/*/*/*.bb \
+    st-openstlinux:${LAYERDIR}/dynamic-layers/st-openstlinux/*/*/*.bbappend \
+    \
+    stm-st-stm32mp:${LAYERDIR}/dynamic-layers/stm-st-stm32mp/*/*/*.bb \
+    stm-st-stm32mp:${LAYERDIR}/dynamic-layers/stm-st-stm32mp/*/*/*.bbappend \
 "
diff --git a/dynamic-layers/st-openstlinux/recipes-core/packagegroups/packagegroup-core-boot.bbappend b/dynamic-layers/st-openstlinux/recipes-core/packagegroups/packagegroup-core-boot.bbappend
new file mode 100644
index 000000000000..ec099f69e200
--- /dev/null
+++ b/dynamic-layers/st-openstlinux/recipes-core/packagegroups/packagegroup-core-boot.bbappend
@@ -0,0 +1,3 @@ 
+RDEPENDS:${PN}:append:stm32mp25-eval = " \
+    ${@bb.utils.contains('COMBINED_FEATURES', 'initrd', '${INITRD_PACKAGE}', '', d)} \
+"
diff --git a/dynamic-layers/stm-st-stm32mp/recipes-kernel/linux/files/0001-arm64-dts-st-add-MMC-aliases-on-stm32mp257f-ev1.patch b/dynamic-layers/stm-st-stm32mp/recipes-kernel/linux/files/0001-arm64-dts-st-add-MMC-aliases-on-stm32mp257f-ev1.patch
new file mode 100644
index 000000000000..e73f3530bdb0
--- /dev/null
+++ b/dynamic-layers/stm-st-stm32mp/recipes-kernel/linux/files/0001-arm64-dts-st-add-MMC-aliases-on-stm32mp257f-ev1.patch
@@ -0,0 +1,20 @@ 
+From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
+Subject: [PATCH] arm64: dts: st: add MMC aliases on stm32mp257f-ev1
+
+Add MMC aliases to ensure that the /dev/mmcblk IDs won't change depending
+on the probe order of the MMC drivers.
+
+Upstream-Status: Pending
+Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
+---
+--- a/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
++++ b/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
+@@ -24,6 +24,8 @@
+ 	aliases {
+ 		ethernet0 = &ethernet2;
+ 		ethernet1 = &ethernet1;
++		mmc0 = &sdmmc1;
++		mmc1 = &sdmmc2;
+ 		serial0 = &usart2;
+ 		serial1 = &usart6;
+ 		serial2 = &lpuart1;
diff --git a/dynamic-layers/stm-st-stm32mp/recipes-kernel/linux/linux-stm32mp_%.bbappend b/dynamic-layers/stm-st-stm32mp/recipes-kernel/linux/linux-stm32mp_%.bbappend
new file mode 100644
index 000000000000..5de8bce0e839
--- /dev/null
+++ b/dynamic-layers/stm-st-stm32mp/recipes-kernel/linux/linux-stm32mp_%.bbappend
@@ -0,0 +1,7 @@ 
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+SRC_URI:append:stm32mp25-eval = " file://0001-arm64-dts-st-add-MMC-aliases-on-stm32mp257f-ev1.patch"
+
+KERNEL_CONFIG_FRAGMENTS:append:stm32mp25-eval = " \
+    ${@bb.utils.contains_any('MACHINE_FEATURES', 'gpu nogpu', '', '${UNPACKDIR}/features/optional-fragment-08-disable-etnaviv.config', d)} \
+"
diff --git a/recipes-bsp/libubootenv/files/stm32mp25-eval/fw_env.config b/recipes-bsp/libubootenv/files/stm32mp25-eval/fw_env.config
new file mode 100644
index 000000000000..bb84377c75d5
--- /dev/null
+++ b/recipes-bsp/libubootenv/files/stm32mp25-eval/fw_env.config
@@ -0,0 +1,18 @@ 
+# The U-Boot environment is the first namespace, so it is the default one.
+# The FWU metadata has its own namespace.
+uboot:
+  size : 0x2000
+  lockfile : /run/fw_printenv.lock
+  devices:
+    - path : /dev/mmcblk0p7
+      offset : -0x2000
+    - path : /dev/mmcblk0p7
+      offset : -0x4000
+
+fwu:
+  format : fwu-mdata
+  size : 0x118
+  lockfile : /run/fwu-mdata.lock
+  devices:
+    - path : /dev/mmcblk0p3
+    - path : /dev/mmcblk0p4
diff --git a/recipes-extended/images/update-image.bb b/recipes-extended/images/update-image.bb
index a6c9f1ea87b1..4abd3f249ecd 100644
--- a/recipes-extended/images/update-image.bb
+++ b/recipes-extended/images/update-image.bb
@@ -15,5 +15,10 @@  IMAGE_DEPENDS = "core-image-full-cmdline"
 
 # images and files that will be included in the .swu image
 SWUPDATE_IMAGES = "core-image-full-cmdline"
+SWUPDATE_IMAGES:stm32mp25-eval = " \
+    fip/fip-stm32mp257f-ev1-optee-sdcard.bin \
+    core-image-full-cmdline-${DISTRO}-${MACHINE}.splitted-bootfs.ext4 \
+    core-image-full-cmdline-${DISTRO}-${MACHINE}.rootfs.ext4.gz \
+"
 
 SWUPDATE_IMAGES_FSTYPES[core-image-full-cmdline] = ".rootfs.ext4.gz"
diff --git a/recipes-extended/images/update-image/stm32mp25-eval/emmcsetup.lua b/recipes-extended/images/update-image/stm32mp25-eval/emmcsetup.lua
new file mode 100644
index 000000000000..a619596ee5d4
--- /dev/null
+++ b/recipes-extended/images/update-image/stm32mp25-eval/emmcsetup.lua
@@ -0,0 +1,11 @@ 
+function preinst()
+	local out = "Pre installed script called"
+
+	return true, out
+end
+
+function postinst()
+	local out = "Post installed script called"
+
+	return true, out
+end
diff --git a/recipes-extended/images/update-image/stm32mp25-eval/sw-description b/recipes-extended/images/update-image/stm32mp25-eval/sw-description
new file mode 100644
index 000000000000..84f4f8e10168
--- /dev/null
+++ b/recipes-extended/images/update-image/stm32mp25-eval/sw-description
@@ -0,0 +1,90 @@ 
+software =
+{
+	version = "0.1.0";
+
+	@@MACHINE@@ = {
+		hardware-compatibility: [ "1.0" ];
+		stable: {
+			copy1: {
+				images: (
+					{
+						filename = "fip-stm32mp257f-ev1-optee-sdcard.bin";
+						sha256 = "$swupdate_get_sha256(fip-stm32mp257f-ev1-optee-sdcard.bin)";
+						type = "raw";
+						device = "/dev/mmcblk0p5";
+					},
+					{
+						filename = "core-image-full-cmdline-@@DISTRO@@-@@MACHINE@@.splitted-bootfs.ext4";
+						sha256 = "$swupdate_get_sha256(core-image-full-cmdline-@@DISTRO@@-@@MACHINE@@.splitted-bootfs.ext4)";
+						type = "raw";
+						device = "/dev/mmcblk0p8";
+					},
+					{
+						filename = "core-image-full-cmdline-@@DISTRO@@-@@MACHINE@@.rootfs.ext4.gz";
+						sha256 = "$swupdate_get_sha256(core-image-full-cmdline-@@DISTRO@@-@@MACHINE@@.rootfs.ext4.gz)";
+						compressed = "zlib";
+						type = "raw";
+						device = "/dev/mmcblk0p12";
+					}
+				);
+				bootenv: (
+					{
+						name = "active_index";
+						value = "0";
+						namespace = "fwu";
+					},
+					{
+						name = "previous_active_index";
+						value = "1";
+						namespace = "fwu";
+					},
+					{
+						name = "bank0_state";
+						value = "valid";
+						namespace = "fwu";
+					}
+				);
+			};
+			copy2: {
+				images: (
+					{
+						filename = "fip-stm32mp257f-ev1-optee-sdcard.bin";
+						sha256 = "$swupdate_get_sha256(fip-stm32mp257f-ev1-optee-sdcard.bin)";
+						type = "raw";
+						device = "/dev/mmcblk0p6";
+					},
+					{
+						filename = "core-image-full-cmdline-@@DISTRO@@-@@MACHINE@@.splitted-bootfs.ext4";
+						sha256 = "$swupdate_get_sha256(core-image-full-cmdline-@@DISTRO@@-@@MACHINE@@.splitted-bootfs.ext4)";
+						type = "raw";
+						device = "/dev/mmcblk0p9";
+					},
+					{
+						filename = "core-image-full-cmdline-@@DISTRO@@-@@MACHINE@@.rootfs.ext4.gz";
+						sha256 = "$swupdate_get_sha256(core-image-full-cmdline-@@DISTRO@@-@@MACHINE@@.rootfs.ext4.gz)";
+						compressed = "zlib";
+						type = "raw";
+						device = "/dev/mmcblk0p13";
+					}
+				);
+				bootenv: (
+					{
+						name = "active_index";
+						value = "1";
+						namespace = "fwu";
+					},
+					{
+						name = "previous_active_index";
+						value = "0";
+						namespace = "fwu";
+					},
+					{
+						name = "bank1_state";
+						value = "valid";
+						namespace = "fwu";
+					}
+				);
+			};
+		};
+	};
+};
diff --git a/recipes-support/swupdate/swupdate/stm32mp25-eval/09-swupdate-args b/recipes-support/swupdate/swupdate/stm32mp25-eval/09-swupdate-args
new file mode 100644
index 000000000000..470b21f8d621
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/stm32mp25-eval/09-swupdate-args
@@ -0,0 +1,8 @@ 
+# The FWU metadata selects the bank to boot, update the other one
+if [ "$(fw_printenv -n -m fwu active_index)" = "0" ]; then
+	selection="-e stable,copy2"
+else
+	selection="-e stable,copy1"
+fi
+
+SWUPDATE_ARGS="-v -H @MACHINE@:1.0 ${selection} -f /etc/swupdate.cfg"
diff --git a/recipes-support/swupdate/swupdate/stm32mp25-eval/defconfig b/recipes-support/swupdate/swupdate/stm32mp25-eval/defconfig
new file mode 100644
index 000000000000..c8fa67ce900d
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/stm32mp25-eval/defconfig
@@ -0,0 +1,111 @@ 
+#
+# Automatically generated file; DO NOT EDIT.
+# Swupdate Configuration
+#
+
+#
+# Swupdate Settings
+#
+
+#
+# General Configuration
+#
+CONFIG_SYSTEMD=y
+CONFIG_DEFAULT_CONFIG_FILE="/etc/swupdate.cfg"
+CONFIG_SCRIPTS=y
+CONFIG_HW_COMPATIBILITY=y
+CONFIG_HW_COMPATIBILITY_FILE="/etc/hwrevision"
+CONFIG_SW_VERSIONS_FILE="/etc/sw-versions"
+
+#
+# Socket Paths
+#
+CONFIG_SOCKET_CTRL_PATH=""
+CONFIG_SOCKET_PROGRESS_PATH=""
+CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY="/tmp/"
+# CONFIG_MTD is not set
+CONFIG_LUA=y
+CONFIG_LUAPKG="lua"
+# CONFIG_FEATURE_SYSLOG is not set
+
+#
+# Build Options
+#
+CONFIG_CROSS_COMPILE=""
+CONFIG_SYSROOT=""
+CONFIG_EXTRA_LDLIBS=""
+
+#
+# Debugging Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_WERROR is not set
+# CONFIG_NOCLEANUP is not set
+# CONFIG_BOOTLOADER_EBG is not set
+CONFIG_UBOOT=y
+CONFIG_UBOOT_FWENV="/etc/fw_env.config"
+CONFIG_UBOOT_DEFAULTENV="/etc/u-boot-initial-env"
+# CONFIG_BOOTLOADER_GRUB is not set
+# CONFIG_BOOTLOADER_CBOOT is not set
+CONFIG_DOWNLOAD=y
+CONFIG_HASH_VERIFY=y
+# CONFIG_SIGNED_IMAGES is not set
+CONFIG_ENCRYPTED_IMAGES=y
+CONFIG_SURICATTA=y
+
+#
+# Suricatta
+#
+
+#
+# Features
+#
+CONFIG_SURICATTA_SSL=y
+
+
+#
+# Server
+#
+CONFIG_SURICATTA_HAWKBIT=y
+# CONFIG_SURICATTA_SERVER_NONE is not set
+CONFIG_WEBSERVER=y
+
+#
+# Webserver Features
+#
+CONFIG_MONGOOSE=y
+
+#
+# Mongoose Feature
+#
+CONFIG_MONGOOSELUA=y
+# CONFIG_MONGOOSEIPV6 is not set
+CONFIG_MONGOOSESSL=y
+
+#
+# Compressors (zlib always on)
+#
+CONFIG_GUNZIP=y
+# CONFIG_XZ is not set
+# CONFIG_ZSTD is not set
+
+# Parser Features
+#
+CONFIG_LIBCONFIG=y
+CONFIG_PARSERROOT=""
+CONFIG_JSON=y
+# CONFIG_LUAEXTERNAL is not set
+# CONFIG_SETSWDESCRIPTION is not set
+
+#
+# Image Handlers
+#
+CONFIG_RAW=y
+CONFIG_LUASCRIPTHANDLER=y
+CONFIG_SHELLSCRIPTHANDLER=y
+# CONFIG_HANDLER_IN_LUA is not set
+CONFIG_RDIFFHANDLER=y
+CONFIG_HANDLER_IN_LUA=y
+# CONFIG_EMBEDDED_LUA_HANDLER is not set
+CONFIG_ARCHIVE=y
+# CONFIG_REMOTE_HANDLER is not set
diff --git a/recipes-support/swupdate/swupdate/stm32mp25-eval/swupdate.cfg b/recipes-support/swupdate/swupdate/stm32mp25-eval/swupdate.cfg
new file mode 100644
index 000000000000..c5a473de861a
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/stm32mp25-eval/swupdate.cfg
@@ -0,0 +1,41 @@ 
+globals :
+{
+	verbose = true;
+	loglevel = 5;
+	syslog = true;
+	postupdatecmd = "(sleep 2 && reboot)&";
+};
+
+download :
+{
+	retries = 3;
+	timeout = 1800;
+};
+
+identify : (
+	{ name = "board"; value = "stm32mp25-eval"; }
+);
+
+suricatta :
+{
+
+	tenant		= "default";
+	id		= "stm32mp25-eval";
+	confirm 	= 0;
+	url 		= "http://papero:8080";
+	polldelay	= 360;
+	nocheckcert	= true;
+	retry		= 4;
+	retrywait	= 200;
+	loglevel	= 10;
+	userid		= 0;
+	groupid		= 0;
+	max_artifacts	= 1;
+};
+
+webserver :
+{
+	document_root = "/www";
+	userid		= 0;
+	groupid		= 0;
+};