binman can omit packaging an optional blob when it is missing.
This allows us to not bother with config options.
The core challenge is the interaction between tf-a and OP-TEE where
U-Boot/binman does not know whether tf-a was built with SPD=opteed or
without. This is important because tf-a might jump into the void when no
optee_os is present, leading to boot failure. Thus by marking it
optional, user is prompted to recheck (due to the warning message)
whether they really have the right combination of tf-a and optee.

Due to a bug in binman, we had to guard binman tee.bin with OPTEE config
as builds would error when tee.bin was not present in path; Even though
optee_os was marked as optional in the binman tree. Since the bug has
been resolved in
commit d4f61eae2ab7 ("Merge patch series "Fix handling of optional blobs in 
binman"")
we can mark it optional again without getting build errors.

Note that after this commit a warning will be printed when optee is not
present for a binman build.

Image 'image' is missing optional external blobs but is still functional: tee-os

/binman/section/fit/images/tee/tee-os (tee.bin):
   See the documentation for your board. You may need to build Open Portable
   Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin

Signed-off-by: Yannic Moog <y.m...@phytec.de>
---
Changes in v2:
- add cover letter paragraph to commit message for more context
- remove RFC tag
- Link to v1: 
https://lore.kernel.org/r/20250731-imx8m-optional-optee-v1-1-5b5ea1434...@phytec.de
---
 arch/arm/dts/imx8mm-u-boot.dtsi | 7 +------
 arch/arm/dts/imx8mn-u-boot.dtsi | 7 +------
 arch/arm/dts/imx8mp-u-boot.dtsi | 7 +------
 arch/arm/dts/imx8mq-u-boot.dtsi | 7 +------
 4 files changed, 4 insertions(+), 24 deletions(-)

diff --git a/arch/arm/dts/imx8mm-u-boot.dtsi b/arch/arm/dts/imx8mm-u-boot.dtsi
index 
59453dc36d3155b8076ac726da074caa0b568051..eb5b95a1fda7c37f8911bf1732d20ee9ede4c198
 100644
--- a/arch/arm/dts/imx8mm-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-u-boot.dtsi
@@ -164,7 +164,6 @@
                                        };
 #endif
 
-#ifdef CONFIG_OPTEE
                                        tee: tee {
                                                description = "OP-TEE";
                                                type = "tee";
@@ -176,9 +175,9 @@
 
                                                tee-os {
                                                        filename = "tee.bin";
+                                                       optional;
                                                };
                                        };
-#endif
 
                                        binman_fip: fip {
                                                arch = "arm64";
@@ -208,11 +207,7 @@
                                                fdt = "fdt-SEQ";
                                                firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
-#ifdef CONFIG_OPTEE
                                                loadables = "atf", "tee";
-#else
-                                               loadables = "atf";
-#endif
 #endif
                                        };
                                };
diff --git a/arch/arm/dts/imx8mn-u-boot.dtsi b/arch/arm/dts/imx8mn-u-boot.dtsi
index 
96a6df94c6cfdc9fde9dbea59fa2bb8a97243741..4a4498b36b012eb7aa22a3feeb043013068e961f
 100644
--- a/arch/arm/dts/imx8mn-u-boot.dtsi
+++ b/arch/arm/dts/imx8mn-u-boot.dtsi
@@ -240,7 +240,6 @@
                                        };
 #endif
 
-#ifdef CONFIG_OPTEE
                                        tee: tee {
                                                description = "OP-TEE";
                                                type = "tee";
@@ -252,9 +251,9 @@
 
                                                tee-os {
                                                        filename = "tee.bin";
+                                                       optional;
                                                };
                                        };
-#endif
 
                                        binman_fip: fip {
                                                arch = "arm64";
@@ -284,11 +283,7 @@
                                                fdt = "fdt-SEQ";
                                                firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
-#ifdef CONFIG_OPTEE
                                                loadables = "atf", "tee";
-#else
-                                               loadables = "atf";
-#endif
 #endif
                                        };
                                };
diff --git a/arch/arm/dts/imx8mp-u-boot.dtsi b/arch/arm/dts/imx8mp-u-boot.dtsi
index 
6de9ab5d37cf151471707fdb8677754970bae0dd..9ede98a11e42f6279d654443bbb2d7059ad53d81
 100644
--- a/arch/arm/dts/imx8mp-u-boot.dtsi
+++ b/arch/arm/dts/imx8mp-u-boot.dtsi
@@ -185,7 +185,6 @@
                                        };
 #endif
 
-#ifdef CONFIG_OPTEE
                                        tee: tee {
                                                description = "OP-TEE";
                                                type = "tee";
@@ -197,9 +196,9 @@
 
                                                tee-os {
                                                        filename = "tee.bin";
+                                                       optional;
                                                };
                                        };
-#endif
 
                                        @fdt-SEQ {
                                                description = "NAME";
@@ -220,11 +219,7 @@
                                                fdt = "fdt-SEQ";
                                                firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
-#ifdef CONFIG_OPTEE
                                                loadables = "atf", "tee";
-#else
-                                               loadables = "atf";
-#endif
 #endif
                                        };
                                };
diff --git a/arch/arm/dts/imx8mq-u-boot.dtsi b/arch/arm/dts/imx8mq-u-boot.dtsi
index 
8a536b16e8f524b6bfea68991f0ec90d7d626246..93e2ef27f7ced9b3a471e1dc41be4b1861ed0b81
 100644
--- a/arch/arm/dts/imx8mq-u-boot.dtsi
+++ b/arch/arm/dts/imx8mq-u-boot.dtsi
@@ -144,7 +144,6 @@
                                        };
 #endif
 
-#ifdef CONFIG_OPTEE
                                        tee: tee {
                                                description = "OP-TEE";
                                                type = "tee";
@@ -156,9 +155,9 @@
 
                                                tee-os {
                                                        filename = "tee.bin";
+                                                       optional;
                                                };
                                        };
-#endif
 
                                        fdt {
                                                compression = "none";
@@ -180,11 +179,7 @@
                                                fdt = "fdt";
                                                firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
-#ifdef CONFIG_OPTEE
                                                loadables = "atf", "tee";
-#else
-                                               loadables = "atf";
-#endif
 #endif
                                        };
                                };

---
base-commit: b40c9b0c22773c23322423e6206f049d8f82c25d
change-id: 20250731-imx8m-optional-optee-ef12df51b3ef

Best regards,
-- 
Yannic Moog <y.m...@phytec.de>

Reply via email to