[PATCH v2 1/3] spl: Kconfig: Fix SPL_OPTEE_IMAGE dependency

fdt_addr will build as part of SPL_LOAD_FIT or SPL_LOAD_FIT_FULL which is indeed required to build optee image support in SPL.
common/spl/spl.c: In function ‘jump_to_image_optee’: common/spl/spl.c:220:46: error: ‘struct spl_image_info’ has no member named ‘fdt_addr’ 220 | spl_optee_entry(NULL, NULL, spl_image->fdt_addr,
Fix the dependency support.
Signed-off-by: Jagan Teki jagan@edgeble.ai --- Changes for v2: - none
common/spl/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/common/spl/Kconfig b/common/spl/Kconfig index b738c749ff..95a4b8e855 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -1479,6 +1479,7 @@ config SPL_AM33XX_ENABLE_RTC32K_OSC config SPL_OPTEE_IMAGE bool "Support OP-TEE Trusted OS image in SPL" depends on ARM + depends on SPL_LOAD_FIT || SPL_LOAD_FIT_FULL help OP-TEE is an open source Trusted OS which is loaded by SPL. More detail at: https://github.com/OP-TEE/optee_os

rockchip-u-boot.dtsi has the FIT image for the final stage of binman image creation.
If the actual binman node is part of this dtsi then there are build issues to use optee as input to this final stage binman image since optee is built via another binman image creation unlike ATF built via tools like make_fit_atf.py.
binman: Filename 'u-boot.itb' not found in input path
Fix this by separating binman FIT image in rockchip-binman.dtsi
rockchip-u-boot.dtsi: binman node rockchip-binman.dtsi: binman FIT image node
The inclusion of rockchip-binman.dtsi is always to be last in included files as it has a FIT image node for final image creation.
Sample example of optee used rk3288 looks like b/arch/arm/dts/rk3288-u-boot.dtsi #include "rockchip-u-boot.dtsi" #include "rockchip-optee.dtsi" #include "rockchip-binman.dtsi"
Signed-off-by: Jagan Teki jagan@edgeble.ai --- Changes for v2: - excluded rv1126
arch/arm/dts/px30-u-boot.dtsi | 1 + arch/arm/dts/rk3036-u-boot.dtsi | 1 + arch/arm/dts/rk3066a-u-boot.dtsi | 1 + arch/arm/dts/rk3188-u-boot.dtsi | 1 + arch/arm/dts/rk322x-u-boot.dtsi | 1 + arch/arm/dts/rk3288-u-boot.dtsi | 1 + arch/arm/dts/rk3308-u-boot.dtsi | 1 + arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi | 1 + arch/arm/dts/rk3328-u-boot.dtsi | 1 + arch/arm/dts/rk3368-u-boot.dtsi | 1 + arch/arm/dts/rk3399-u-boot.dtsi | 1 + arch/arm/dts/rk356x-u-boot.dtsi | 1 + arch/arm/dts/rockchip-binman.dtsi | 67 ++++++++++++++++++++++ arch/arm/dts/rockchip-u-boot.dtsi | 61 -------------------- arch/arm/dts/rv1108-u-boot.dtsi | 1 + 15 files changed, 80 insertions(+), 61 deletions(-) create mode 100644 arch/arm/dts/rockchip-binman.dtsi
diff --git a/arch/arm/dts/px30-u-boot.dtsi b/arch/arm/dts/px30-u-boot.dtsi index 462eaf68f8..7cea48181c 100644 --- a/arch/arm/dts/px30-u-boot.dtsi +++ b/arch/arm/dts/px30-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { aliases { diff --git a/arch/arm/dts/rk3036-u-boot.dtsi b/arch/arm/dts/rk3036-u-boot.dtsi index 41ac054b81..a49526c63a 100644 --- a/arch/arm/dts/rk3036-u-boot.dtsi +++ b/arch/arm/dts/rk3036-u-boot.dtsi @@ -4,3 +4,4 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi" diff --git a/arch/arm/dts/rk3066a-u-boot.dtsi b/arch/arm/dts/rk3066a-u-boot.dtsi index bc6e609d02..a85f752477 100644 --- a/arch/arm/dts/rk3066a-u-boot.dtsi +++ b/arch/arm/dts/rk3066a-u-boot.dtsi @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0+
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi" #include "rk3xxx-u-boot.dtsi" diff --git a/arch/arm/dts/rk3188-u-boot.dtsi b/arch/arm/dts/rk3188-u-boot.dtsi index 735776c16b..bc028a8c1b 100644 --- a/arch/arm/dts/rk3188-u-boot.dtsi +++ b/arch/arm/dts/rk3188-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi" #include "rk3xxx-u-boot.dtsi"
&global_timer { diff --git a/arch/arm/dts/rk322x-u-boot.dtsi b/arch/arm/dts/rk322x-u-boot.dtsi index 79c41e481b..bd31c3bdc4 100644 --- a/arch/arm/dts/rk322x-u-boot.dtsi +++ b/arch/arm/dts/rk322x-u-boot.dtsi @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { bus_intmem@10080000 { diff --git a/arch/arm/dts/rk3288-u-boot.dtsi b/arch/arm/dts/rk3288-u-boot.dtsi index e411445ed6..a24d590e20 100644 --- a/arch/arm/dts/rk3288-u-boot.dtsi +++ b/arch/arm/dts/rk3288-u-boot.dtsi @@ -5,6 +5,7 @@
#include "rockchip-u-boot.dtsi" #include "rockchip-optee.dtsi" +#include "rockchip-binman.dtsi"
/ { aliases { diff --git a/arch/arm/dts/rk3308-u-boot.dtsi b/arch/arm/dts/rk3308-u-boot.dtsi index ab5bfc2ce9..665582ddd3 100644 --- a/arch/arm/dts/rk3308-u-boot.dtsi +++ b/arch/arm/dts/rk3308-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { aliases { diff --git a/arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi b/arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi index 16c33735eb..cd5d43b3c4 100644 --- a/arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi +++ b/arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { chosen { diff --git a/arch/arm/dts/rk3328-u-boot.dtsi b/arch/arm/dts/rk3328-u-boot.dtsi index d4a7540a92..407286b176 100644 --- a/arch/arm/dts/rk3328-u-boot.dtsi +++ b/arch/arm/dts/rk3328-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { aliases { diff --git a/arch/arm/dts/rk3368-u-boot.dtsi b/arch/arm/dts/rk3368-u-boot.dtsi index 811d59ac34..c33604266a 100644 --- a/arch/arm/dts/rk3368-u-boot.dtsi +++ b/arch/arm/dts/rk3368-u-boot.dtsi @@ -5,6 +5,7 @@
#include <dt-bindings/memory/rk3368-dmc.h> #include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { dmc: dmc@ff610000 { diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi index 3c1a15fe51..03a328b295 100644 --- a/arch/arm/dts/rk3399-u-boot.dtsi +++ b/arch/arm/dts/rk3399-u-boot.dtsi @@ -5,6 +5,7 @@ #define USB_CLASS_HUB 9
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { aliases { diff --git a/arch/arm/dts/rk356x-u-boot.dtsi b/arch/arm/dts/rk356x-u-boot.dtsi index ccb8db0001..8265e1a0bd 100644 --- a/arch/arm/dts/rk356x-u-boot.dtsi +++ b/arch/arm/dts/rk356x-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { aliases { diff --git a/arch/arm/dts/rockchip-binman.dtsi b/arch/arm/dts/rockchip-binman.dtsi new file mode 100644 index 0000000000..8f7b3ee53b --- /dev/null +++ b/arch/arm/dts/rockchip-binman.dtsi @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com + */ + +#include <config.h> + +#ifdef CONFIG_SPL +&binman { + simple-bin { + filename = "u-boot-rockchip.bin"; + pad-byte = <0xff>; + + mkimage { + filename = "idbloader.img"; + args = "-n", CONFIG_SYS_SOC, "-T", "rksd"; +#ifdef CONFIG_TPL + multiple-data-files; + + u-boot-tpl { + }; +#endif + u-boot-spl { + }; + }; + +#ifdef CONFIG_ARM64 + blob { + filename = "u-boot.itb"; +#else + u-boot-img { +#endif + offset = <CONFIG_SPL_PAD_TO>; + }; + }; + +#ifdef CONFIG_ROCKCHIP_SPI_IMAGE + simple-bin-spi { + filename = "u-boot-rockchip-spi.bin"; + pad-byte = <0xff>; + + mkimage { + filename = "idbloader-spi.img"; + args = "-n", CONFIG_SYS_SOC, "-T", "rkspi"; +#ifdef CONFIG_TPL + multiple-data-files; + + u-boot-tpl { + }; +#endif + u-boot-spl { + }; + }; + +#ifdef CONFIG_ARM64 + blob { + filename = "u-boot.itb"; +#else + u-boot-img { +#endif + /* Sync with u-boot,spl-payload-offset if present */ + offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>; + }; + }; +#endif +}; +#endif diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi index 584f21eb5b..3d55553e44 100644 --- a/arch/arm/dts/rockchip-u-boot.dtsi +++ b/arch/arm/dts/rockchip-u-boot.dtsi @@ -10,64 +10,3 @@ multiple-images; }; }; - -#ifdef CONFIG_SPL -&binman { - simple-bin { - filename = "u-boot-rockchip.bin"; - pad-byte = <0xff>; - - mkimage { - filename = "idbloader.img"; - args = "-n", CONFIG_SYS_SOC, "-T", "rksd"; -#ifdef CONFIG_TPL - multiple-data-files; - - u-boot-tpl { - }; -#endif - u-boot-spl { - }; - }; - -#ifdef CONFIG_ARM64 - blob { - filename = "u-boot.itb"; -#else - u-boot-img { -#endif - offset = <CONFIG_SPL_PAD_TO>; - }; - }; - -#ifdef CONFIG_ROCKCHIP_SPI_IMAGE - simple-bin-spi { - filename = "u-boot-rockchip-spi.bin"; - pad-byte = <0xff>; - - mkimage { - filename = "idbloader-spi.img"; - args = "-n", CONFIG_SYS_SOC, "-T", "rkspi"; -#ifdef CONFIG_TPL - multiple-data-files; - - u-boot-tpl { - }; -#endif - u-boot-spl { - }; - }; - -#ifdef CONFIG_ARM64 - blob { - filename = "u-boot.itb"; -#else - u-boot-img { -#endif - /* Sync with u-boot,spl-payload-offset if present */ - offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>; - }; - }; -#endif -}; -#endif diff --git a/arch/arm/dts/rv1108-u-boot.dtsi b/arch/arm/dts/rv1108-u-boot.dtsi index 6a2098b8d4..e6cb7b2f24 100644 --- a/arch/arm/dts/rv1108-u-boot.dtsi +++ b/arch/arm/dts/rv1108-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
&grf { u-boot,dm-pre-reloc;

Hi Jagan,
On 11/3/22 07:19, Jagan Teki wrote:
rockchip-u-boot.dtsi has the FIT image for the final stage of binman image creation.
If the actual binman node is part of this dtsi then there are build issues to use optee as input to this final stage binman image since optee is built via another binman image creation unlike ATF built via tools like make_fit_atf.py.
binman: Filename 'u-boot.itb' not found in input path
Fix this by separating binman FIT image in rockchip-binman.dtsi
My understanding is that this is a work-around for something that should be implemented in binman instead (e.g. dependency between images). If i'm not mistaken, what you're suggesting is to not build u-boot-rockchip.bin for some platforms? IIRC the plan for this binary was that it would apply to all Rockchip platforms, and this patch makes this "promise" go away.
rockchip-u-boot.dtsi: binman node rockchip-binman.dtsi: binman FIT image node
The inclusion of rockchip-binman.dtsi is always to be last in included files as it has a FIT image node for final image creation.
You are not respecting this in your patch. Please update or remove this section if not required. (I assume you have this limitation because you use a binman phandle, meaning the node needs to be defined before).
Also, rockchip-u-boot.dtsi content is now literally: / { binman: binman { multiple-images; }; };
which is pretty much useless.
Since you want to work around your build issue, why just not include rockchip-u-boot.dtsi instead of moving part of it to another file without any added benefit (at least at first glance, I may be missing some context).
BTW, we were discussing some months ago on moving away from make_fit_atf.py to binman for all Rockchip platforms, c.f. the long discussion here: https://lore.kernel.org/u-boot/20220725172953.GD2029@begut/ So maybe we should just do this and that might fix the problem you're trying to work-around?
In any case, can you provide a bit more context on the failing platform(s)?
Cheers, Quentin
Sample example of optee used rk3288 looks like b/arch/arm/dts/rk3288-u-boot.dtsi #include "rockchip-u-boot.dtsi" #include "rockchip-optee.dtsi" #include "rockchip-binman.dtsi"
Signed-off-by: Jagan Teki jagan@edgeble.ai
Changes for v2:
excluded rv1126
arch/arm/dts/px30-u-boot.dtsi | 1 + arch/arm/dts/rk3036-u-boot.dtsi | 1 + arch/arm/dts/rk3066a-u-boot.dtsi | 1 + arch/arm/dts/rk3188-u-boot.dtsi | 1 + arch/arm/dts/rk322x-u-boot.dtsi | 1 + arch/arm/dts/rk3288-u-boot.dtsi | 1 + arch/arm/dts/rk3308-u-boot.dtsi | 1 + arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi | 1 + arch/arm/dts/rk3328-u-boot.dtsi | 1 + arch/arm/dts/rk3368-u-boot.dtsi | 1 + arch/arm/dts/rk3399-u-boot.dtsi | 1 + arch/arm/dts/rk356x-u-boot.dtsi | 1 + arch/arm/dts/rockchip-binman.dtsi | 67 ++++++++++++++++++++++ arch/arm/dts/rockchip-u-boot.dtsi | 61 -------------------- arch/arm/dts/rv1108-u-boot.dtsi | 1 + 15 files changed, 80 insertions(+), 61 deletions(-) create mode 100644 arch/arm/dts/rockchip-binman.dtsi
diff --git a/arch/arm/dts/px30-u-boot.dtsi b/arch/arm/dts/px30-u-boot.dtsi index 462eaf68f8..7cea48181c 100644 --- a/arch/arm/dts/px30-u-boot.dtsi +++ b/arch/arm/dts/px30-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { aliases { diff --git a/arch/arm/dts/rk3036-u-boot.dtsi b/arch/arm/dts/rk3036-u-boot.dtsi index 41ac054b81..a49526c63a 100644 --- a/arch/arm/dts/rk3036-u-boot.dtsi +++ b/arch/arm/dts/rk3036-u-boot.dtsi @@ -4,3 +4,4 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi" diff --git a/arch/arm/dts/rk3066a-u-boot.dtsi b/arch/arm/dts/rk3066a-u-boot.dtsi index bc6e609d02..a85f752477 100644 --- a/arch/arm/dts/rk3066a-u-boot.dtsi +++ b/arch/arm/dts/rk3066a-u-boot.dtsi @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0+
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi" #include "rk3xxx-u-boot.dtsi" diff --git a/arch/arm/dts/rk3188-u-boot.dtsi b/arch/arm/dts/rk3188-u-boot.dtsi index 735776c16b..bc028a8c1b 100644 --- a/arch/arm/dts/rk3188-u-boot.dtsi +++ b/arch/arm/dts/rk3188-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi" #include "rk3xxx-u-boot.dtsi"
&global_timer { diff --git a/arch/arm/dts/rk322x-u-boot.dtsi b/arch/arm/dts/rk322x-u-boot.dtsi index 79c41e481b..bd31c3bdc4 100644 --- a/arch/arm/dts/rk322x-u-boot.dtsi +++ b/arch/arm/dts/rk322x-u-boot.dtsi @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { bus_intmem@10080000 { diff --git a/arch/arm/dts/rk3288-u-boot.dtsi b/arch/arm/dts/rk3288-u-boot.dtsi index e411445ed6..a24d590e20 100644 --- a/arch/arm/dts/rk3288-u-boot.dtsi +++ b/arch/arm/dts/rk3288-u-boot.dtsi @@ -5,6 +5,7 @@
#include "rockchip-u-boot.dtsi" #include "rockchip-optee.dtsi" +#include "rockchip-binman.dtsi"
/ { aliases { diff --git a/arch/arm/dts/rk3308-u-boot.dtsi b/arch/arm/dts/rk3308-u-boot.dtsi index ab5bfc2ce9..665582ddd3 100644 --- a/arch/arm/dts/rk3308-u-boot.dtsi +++ b/arch/arm/dts/rk3308-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { aliases { diff --git a/arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi b/arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi index 16c33735eb..cd5d43b3c4 100644 --- a/arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi +++ b/arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { chosen { diff --git a/arch/arm/dts/rk3328-u-boot.dtsi b/arch/arm/dts/rk3328-u-boot.dtsi index d4a7540a92..407286b176 100644 --- a/arch/arm/dts/rk3328-u-boot.dtsi +++ b/arch/arm/dts/rk3328-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { aliases { diff --git a/arch/arm/dts/rk3368-u-boot.dtsi b/arch/arm/dts/rk3368-u-boot.dtsi index 811d59ac34..c33604266a 100644 --- a/arch/arm/dts/rk3368-u-boot.dtsi +++ b/arch/arm/dts/rk3368-u-boot.dtsi @@ -5,6 +5,7 @@
#include <dt-bindings/memory/rk3368-dmc.h> #include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { dmc: dmc@ff610000 { diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi index 3c1a15fe51..03a328b295 100644 --- a/arch/arm/dts/rk3399-u-boot.dtsi +++ b/arch/arm/dts/rk3399-u-boot.dtsi @@ -5,6 +5,7 @@ #define USB_CLASS_HUB 9
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { aliases { diff --git a/arch/arm/dts/rk356x-u-boot.dtsi b/arch/arm/dts/rk356x-u-boot.dtsi index ccb8db0001..8265e1a0bd 100644 --- a/arch/arm/dts/rk356x-u-boot.dtsi +++ b/arch/arm/dts/rk356x-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
/ { aliases { diff --git a/arch/arm/dts/rockchip-binman.dtsi b/arch/arm/dts/rockchip-binman.dtsi new file mode 100644 index 0000000000..8f7b3ee53b --- /dev/null +++ b/arch/arm/dts/rockchip-binman.dtsi @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0+ +/*
- Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com
- */
+#include <config.h>
+#ifdef CONFIG_SPL +&binman {
- simple-bin {
filename = "u-boot-rockchip.bin";
pad-byte = <0xff>;
mkimage {
filename = "idbloader.img";
args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+#ifdef CONFIG_TPL
multiple-data-files;
u-boot-tpl {
};
+#endif
u-boot-spl {
};
};
+#ifdef CONFIG_ARM64
blob {
filename = "u-boot.itb";
+#else
u-boot-img {
+#endif
offset = <CONFIG_SPL_PAD_TO>;
};
- };
+#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
- simple-bin-spi {
filename = "u-boot-rockchip-spi.bin";
pad-byte = <0xff>;
mkimage {
filename = "idbloader-spi.img";
args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
+#ifdef CONFIG_TPL
multiple-data-files;
u-boot-tpl {
};
+#endif
u-boot-spl {
};
};
+#ifdef CONFIG_ARM64
blob {
filename = "u-boot.itb";
+#else
u-boot-img {
+#endif
/* Sync with u-boot,spl-payload-offset if present */
offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>;
};
- };
+#endif +}; +#endif diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi index 584f21eb5b..3d55553e44 100644 --- a/arch/arm/dts/rockchip-u-boot.dtsi +++ b/arch/arm/dts/rockchip-u-boot.dtsi @@ -10,64 +10,3 @@ multiple-images; }; };
-#ifdef CONFIG_SPL -&binman {
- simple-bin {
filename = "u-boot-rockchip.bin";
pad-byte = <0xff>;
mkimage {
filename = "idbloader.img";
args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
-#ifdef CONFIG_TPL
multiple-data-files;
u-boot-tpl {
};
-#endif
u-boot-spl {
};
};
-#ifdef CONFIG_ARM64
blob {
filename = "u-boot.itb";
-#else
u-boot-img {
-#endif
offset = <CONFIG_SPL_PAD_TO>;
};
- };
-#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
- simple-bin-spi {
filename = "u-boot-rockchip-spi.bin";
pad-byte = <0xff>;
mkimage {
filename = "idbloader-spi.img";
args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
-#ifdef CONFIG_TPL
multiple-data-files;
u-boot-tpl {
};
-#endif
u-boot-spl {
};
};
-#ifdef CONFIG_ARM64
blob {
filename = "u-boot.itb";
-#else
u-boot-img {
-#endif
/* Sync with u-boot,spl-payload-offset if present */
offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>;
};
- };
-#endif -}; -#endif diff --git a/arch/arm/dts/rv1108-u-boot.dtsi b/arch/arm/dts/rv1108-u-boot.dtsi index 6a2098b8d4..e6cb7b2f24 100644 --- a/arch/arm/dts/rv1108-u-boot.dtsi +++ b/arch/arm/dts/rv1108-u-boot.dtsi @@ -4,6 +4,7 @@ */
#include "rockchip-u-boot.dtsi" +#include "rockchip-binman.dtsi"
&grf { u-boot,dm-pre-reloc;

On Thu, 3 Nov 2022 at 15:32, Quentin Schulz quentin.schulz@theobroma-systems.com wrote:
Hi Jagan,
On 11/3/22 07:19, Jagan Teki wrote:
rockchip-u-boot.dtsi has the FIT image for the final stage of binman image creation.
If the actual binman node is part of this dtsi then there are build issues to use optee as input to this final stage binman image since optee is built via another binman image creation unlike ATF built via tools like make_fit_atf.py.
binman: Filename 'u-boot.itb' not found in input path
Fix this by separating binman FIT image in rockchip-binman.dtsi
My understanding is that this is a work-around for something that should be implemented in binman instead (e.g. dependency between images). If i'm not mistaken, what you're suggesting is to not build u-boot-rockchip.bin for some platforms? IIRC the plan for this binary was that it would apply to all Rockchip platforms, and this patch makes this "promise" go away.
Not really, no functionality is changed. It is just that we cannot create the final binman image for optee. It is not possible to implement in binman alone however if you want to add optee binman prior to the final binman can be solvable but it makes unnecessary ifdefs and maintaining many binman node definitions in one file seems confusing and difficult to maintain.
rockchip-u-boot.dtsi: binman node rockchip-binman.dtsi: binman FIT image node
The inclusion of rockchip-binman.dtsi is always to be last in included files as it has a FIT image node for final image creation.
You are not respecting this in your patch. Please update or remove this section if not required. (I assume you have this limitation because you use a binman phandle, meaning the node needs to be defined before).
Also, rockchip-u-boot.dtsi content is now literally: / { binman: binman { multiple-images; }; };
which is pretty much useless.
Since you want to work around your build issue, why just not include rockchip-u-boot.dtsi instead of moving part of it to another file without any added benefit (at least at first glance, I may be missing some context).
BTW, we were discussing some months ago on moving away from make_fit_atf.py to binman for all Rockchip platforms, c.f. the long discussion here: https://lore.kernel.org/u-boot/20220725172953.GD2029@begut/ So maybe we should just do this and that might fix the problem you're trying to work-around?
In any case, can you provide a bit more context on the failing platform(s)?
As I explained above, the functionality remains unchanged. Even if you build atf via binam dts files the final binman node has to be in the order of last since input files like bl31 and tee.bin have depended. Adding all the binman image creations and the final binman image creation in one file make it difficult to read and maintain and unnecessary ifdef.
Thanks, Jagan.

Hi Jagan,
On 11/3/22 13:37, Jagan Teki wrote:
On Thu, 3 Nov 2022 at 15:32, Quentin Schulz quentin.schulz@theobroma-systems.com wrote:
Hi Jagan,
On 11/3/22 07:19, Jagan Teki wrote:
rockchip-u-boot.dtsi has the FIT image for the final stage of binman image creation.
If the actual binman node is part of this dtsi then there are build issues to use optee as input to this final stage binman image since optee is built via another binman image creation unlike ATF built via tools like make_fit_atf.py.
binman: Filename 'u-boot.itb' not found in input path
Fix this by separating binman FIT image in rockchip-binman.dtsi
My understanding is that this is a work-around for something that should be implemented in binman instead (e.g. dependency between images). If i'm not mistaken, what you're suggesting is to not build u-boot-rockchip.bin for some platforms? IIRC the plan for this binary was that it would apply to all Rockchip platforms, and this patch makes this "promise" go away.
Not really, no functionality is changed. It is just that we cannot create the final binman image for optee. It is not possible to implement in binman alone however if you want to add optee binman prior to the final binman can be solvable but it makes unnecessary ifdefs and maintaining many binman node definitions in one file seems confusing and difficult to maintain.
The project does not want us to use a separate script for building the SPL fit image, c.f. the message printed when you build (https://source.denx.de/u-boot/u-boot/-/blob/master/Makefile#L1134-L1140) so we'll need to migrate to binman eventually.
Patches or suggestions on how to make the binman nodes easier to maintain welcome obviously. That's a different topic though.
rockchip-u-boot.dtsi: binman node rockchip-binman.dtsi: binman FIT image node
The inclusion of rockchip-binman.dtsi is always to be last in included files as it has a FIT image node for final image creation.
You are not respecting this in your patch. Please update or remove this section if not required. (I assume you have this limitation because you use a binman phandle, meaning the node needs to be defined before).
Also, rockchip-u-boot.dtsi content is now literally: / { binman: binman { multiple-images; }; };
which is pretty much useless.
Since you want to work around your build issue, why just not include rockchip-u-boot.dtsi instead of moving part of it to another file without any added benefit (at least at first glance, I may be missing some context).
BTW, we were discussing some months ago on moving away from make_fit_atf.py to binman for all Rockchip platforms, c.f. the long discussion here: https://urldefense.com/v3/__https://lore.kernel.org/u-boot/20220725172953.GD... So maybe we should just do this and that might fix the problem you're trying to work-around?
In any case, can you provide a bit more context on the failing platform(s)?
As I explained above, the functionality remains unchanged. Even if you build atf via binam dts files the final binman node has to be in the order of last since input files like bl31 and tee.bin have depended.
Yes, that's something we discussed on the linked topic. Binman would need to gain the ability to express dependencies between nodes. Otherwise, one could also force binman to build images sequentially in which case (AFAIK) the images are created top to bottom in the binman node. It makes the image creation slower but you should get what you want.
AFAIK, binman is what we're supposed to use to create U-Boot binaries and binman uses FDT for how to generate them. If there's a better way to configure the FDT without ifdef, feel free to suggest something.
Adding all the binman image creations and the final binman image creation in one file make it difficult to read and maintain and unnecessary ifdef.
We'll eventually have to make this migration anyways.
Back to the patch.
Applying your patch, rockchip-u-boot.dtsi only contains: / { binman: binman { multiple-images; }; }; This makes very little sense since it is useless and meaningless on its own.
You would need to move this node to the newly added rockchip-binman.dtsi which would make this patch just about a file rename. All of this because of a build issue for one platform/SoC (as per my understanding). If you don't want to work on improving binman to support your use case right now, just don't include rockchip-u-boot.dtsi for your platform until what you want is supported?
Cheers, Quentin

Hi Quentin,
On Thu, 3 Nov 2022 at 18:51, Quentin Schulz quentin.schulz@theobroma-systems.com wrote:
Hi Jagan,
On 11/3/22 13:37, Jagan Teki wrote:
On Thu, 3 Nov 2022 at 15:32, Quentin Schulz quentin.schulz@theobroma-systems.com wrote:
Hi Jagan,
On 11/3/22 07:19, Jagan Teki wrote:
rockchip-u-boot.dtsi has the FIT image for the final stage of binman image creation.
If the actual binman node is part of this dtsi then there are build issues to use optee as input to this final stage binman image since optee is built via another binman image creation unlike ATF built via tools like make_fit_atf.py.
binman: Filename 'u-boot.itb' not found in input path
Fix this by separating binman FIT image in rockchip-binman.dtsi
My understanding is that this is a work-around for something that should be implemented in binman instead (e.g. dependency between images). If i'm not mistaken, what you're suggesting is to not build u-boot-rockchip.bin for some platforms? IIRC the plan for this binary was that it would apply to all Rockchip platforms, and this patch makes this "promise" go away.
Not really, no functionality is changed. It is just that we cannot create the final binman image for optee. It is not possible to implement in binman alone however if you want to add optee binman prior to the final binman can be solvable but it makes unnecessary ifdefs and maintaining many binman node definitions in one file seems confusing and difficult to maintain.
The project does not want us to use a separate script for building the SPL fit image, c.f. the message printed when you build (https://source.denx.de/u-boot/u-boot/-/blob/master/Makefile#L1134-L1140) so we'll need to migrate to binman eventually.
Patches or suggestions on how to make the binman nodes easier to maintain welcome obviously. That's a different topic though.
rockchip-u-boot.dtsi: binman node rockchip-binman.dtsi: binman FIT image node
The inclusion of rockchip-binman.dtsi is always to be last in included files as it has a FIT image node for final image creation.
You are not respecting this in your patch. Please update or remove this section if not required. (I assume you have this limitation because you use a binman phandle, meaning the node needs to be defined before).
Also, rockchip-u-boot.dtsi content is now literally: / { binman: binman { multiple-images; }; };
which is pretty much useless.
Since you want to work around your build issue, why just not include rockchip-u-boot.dtsi instead of moving part of it to another file without any added benefit (at least at first glance, I may be missing some context).
BTW, we were discussing some months ago on moving away from make_fit_atf.py to binman for all Rockchip platforms, c.f. the long discussion here: https://urldefense.com/v3/__https://lore.kernel.org/u-boot/20220725172953.GD... So maybe we should just do this and that might fix the problem you're trying to work-around?
In any case, can you provide a bit more context on the failing platform(s)?
As I explained above, the functionality remains unchanged. Even if you build atf via binam dts files the final binman node has to be in the order of last since input files like bl31 and tee.bin have depended.
Yes, that's something we discussed on the linked topic. Binman would need to gain the ability to express dependencies between nodes. Otherwise, one could also force binman to build images sequentially in which case (AFAIK) the images are created top to bottom in the binman node. It makes the image creation slower but you should get what you want.
AFAIK, binman is what we're supposed to use to create U-Boot binaries and binman uses FDT for how to generate them. If there's a better way to configure the FDT without ifdef, feel free to suggest something.
Adding all the binman image creations and the final binman image creation in one file make it difficult to read and maintain and unnecessary ifdef.
We'll eventually have to make this migration anyways.
Back to the patch.
Applying your patch, rockchip-u-boot.dtsi only contains: / { binman: binman { multiple-images; }; }; This makes very little sense since it is useless and meaningless on its own.
You would need to move this node to the newly added rockchip-binman.dtsi which would make this patch just about a file rename. All of this because of a build issue for one platform/SoC (as per my understanding). If you don't want to work on improving binman to support your use case right now, just don't include rockchip-u-boot.dtsi for your platform until what you want is supported?
< answering all together here>
As I said this is not about building issue on a specific platform.
Let's consider the situation w/o this patch and assume u-boot.itb creation for tf-a was done via binam.
The optee image creation is already part of binman in rockchip-optee.dtsi assumes it is optee-binman The tf-a image creation can be part of binman in rockchip-tf-a.dtsi assumes it is tf-a-binam and final image u-boot-rockchip.bin creation is part of rockchip-binman.dtsi assumes it is final-binman.
In order to build final-binman both the optee-binman and tf-a-binman have to be built prior.
Solutions: 1 - Keep maintaining individual binam in respective files. - Add binman node in rockchip-u-boot.dtsi (This is needed as the binman node is updating and used in later files or we can add this on individual binman image creation files - assume we do a later step) - Include the rockchip-binman.dtsi at last in the list as it is the final image creation.
For example, a platform with tf-a #include "rockchip-tf-a.dtsi" #include "rockcihp-binman.dtsi"
For examples, a platform with spl-optee #include "rockchip-optee.dtsi" #include "rockcihp-binman.dtsi"
Solution:2 Add all binman-related files in one file and add proper ifdef to control.
There are pros and cons to each solution but solution 1 seems to be maintainable at this point in time and this patches doing that. I understand more matureness to binman can simplify things but that can be a separate discussion as of now.
Hope you understand.
Thanks, Jagan.

Hi Jagan,
On 11/4/22 05:17, Jagan Teki wrote:
Hi Quentin,
On Thu, 3 Nov 2022 at 18:51, Quentin Schulz quentin.schulz@theobroma-systems.com wrote:
Hi Jagan,
On 11/3/22 13:37, Jagan Teki wrote:
On Thu, 3 Nov 2022 at 15:32, Quentin Schulz quentin.schulz@theobroma-systems.com wrote:
Hi Jagan,
On 11/3/22 07:19, Jagan Teki wrote:
rockchip-u-boot.dtsi has the FIT image for the final stage of binman image creation.
If the actual binman node is part of this dtsi then there are build issues to use optee as input to this final stage binman image since optee is built via another binman image creation unlike ATF built via tools like make_fit_atf.py.
binman: Filename 'u-boot.itb' not found in input path
Fix this by separating binman FIT image in rockchip-binman.dtsi
My understanding is that this is a work-around for something that should be implemented in binman instead (e.g. dependency between images). If i'm not mistaken, what you're suggesting is to not build u-boot-rockchip.bin for some platforms? IIRC the plan for this binary was that it would apply to all Rockchip platforms, and this patch makes this "promise" go away.
Not really, no functionality is changed. It is just that we cannot create the final binman image for optee. It is not possible to implement in binman alone however if you want to add optee binman prior to the final binman can be solvable but it makes unnecessary ifdefs and maintaining many binman node definitions in one file seems confusing and difficult to maintain.
The project does not want us to use a separate script for building the SPL fit image, c.f. the message printed when you build (https://urldefense.com/v3/__https://source.denx.de/u-boot/u-boot/-/blob/mast... ) so we'll need to migrate to binman eventually.
Patches or suggestions on how to make the binman nodes easier to maintain welcome obviously. That's a different topic though.
rockchip-u-boot.dtsi: binman node rockchip-binman.dtsi: binman FIT image node
The inclusion of rockchip-binman.dtsi is always to be last in included files as it has a FIT image node for final image creation.
You are not respecting this in your patch. Please update or remove this section if not required. (I assume you have this limitation because you use a binman phandle, meaning the node needs to be defined before).
Also, rockchip-u-boot.dtsi content is now literally: / { binman: binman { multiple-images; }; };
which is pretty much useless.
Since you want to work around your build issue, why just not include rockchip-u-boot.dtsi instead of moving part of it to another file without any added benefit (at least at first glance, I may be missing some context).
BTW, we were discussing some months ago on moving away from make_fit_atf.py to binman for all Rockchip platforms, c.f. the long discussion here: https://urldefense.com/v3/__https://lore.kernel.org/u-boot/20220725172953.GD... So maybe we should just do this and that might fix the problem you're trying to work-around?
In any case, can you provide a bit more context on the failing platform(s)?
As I explained above, the functionality remains unchanged. Even if you build atf via binam dts files the final binman node has to be in the order of last since input files like bl31 and tee.bin have depended.
Yes, that's something we discussed on the linked topic. Binman would need to gain the ability to express dependencies between nodes. Otherwise, one could also force binman to build images sequentially in which case (AFAIK) the images are created top to bottom in the binman node. It makes the image creation slower but you should get what you want.
AFAIK, binman is what we're supposed to use to create U-Boot binaries and binman uses FDT for how to generate them. If there's a better way to configure the FDT without ifdef, feel free to suggest something.
Adding all the binman image creations and the final binman image creation in one file make it difficult to read and maintain and unnecessary ifdef.
We'll eventually have to make this migration anyways.
Back to the patch.
Applying your patch, rockchip-u-boot.dtsi only contains: / { binman: binman { multiple-images; }; }; This makes very little sense since it is useless and meaningless on its own.
You would need to move this node to the newly added rockchip-binman.dtsi which would make this patch just about a file rename. All of this because of a build issue for one platform/SoC (as per my understanding). If you don't want to work on improving binman to support your use case right now, just don't include rockchip-u-boot.dtsi for your platform until what you want is supported?
< answering all together here>
As I said this is not about building issue on a specific platform.
Let's consider the situation w/o this patch and assume u-boot.itb creation for tf-a was done via binam.
The optee image creation is already part of binman in rockchip-optee.dtsi assumes it is optee-binman
It is not "the optee image" it is a fitImage which happens to contain OP-TEE OS in it, but it is not *only* OP-TEE (you have u-boot-nodtb.bin and u-boot fdt too). However, I concede that the name is confusing.
The tf-a image creation can be part of binman in rockchip-tf-a.dtsi assumes it is tf-a-binam and final image u-boot-rockchip.bin creation is part of rockchip-binman.dtsi assumes it is final-binman.
In order to build final-binman both the optee-binman and tf-a-binman have to be built prior.
1) This is not possible currently since binman compiles all images in parallel and there's no inter-image dependency. 2) This also does not make much sense since U-Boot does not build OP-TEE OS nor TF-A, it merely injects them into a fitImage loaded by the SPL. I don't think we want a binman dtsi per possible combination of loadables (one for tf-a, one for tf-a+op-tee, one for no tf-a (Aarch32) but op-tee, one with none of them (Aarch32)).
Considering point 2), there seems to be a misunderstanding somewhere. What am I missing?
Solutions: 1
- Keep maintaining individual binam in respective files.
- Add binman node in rockchip-u-boot.dtsi (This is needed as the
binman node is updating and used in later files or we can add this on individual binman image creation files - assume we do a later step)
- Include the rockchip-binman.dtsi at last in the list as it is the
final image creation.
For example, a platform with tf-a #include "rockchip-tf-a.dtsi" #include "rockcihp-binman.dtsi"
For examples, a platform with spl-optee #include "rockchip-optee.dtsi" #include "rockcihp-binman.dtsi"
Solution:2 Add all binman-related files in one file and add proper ifdef to control.
You can have a separate file per binman image if you want and include it only when needed. That would be e.g. one binman dtsi for u-boot-rockchip.bin and one for u-boot-rockchip-spi.bin.
FWIW, rockchip-optee.dtsi seems like a mistake to me and should be merged with rockchip-u-boot.dtsi.
I agree that ifdefs don't make the dtsi easy to read and error-prone when doing changes to it. The issue is that there's usually a lot in common between dtsis when you split things to avoid ifdefs (and to have some generic support, I guess the ifdef will just be added to the SoC include list to know which binman dtsi to include?).
I feel like I don't understand what you're suggesting to fix and how.
Finally, if this patch series is to be continued, I believe you should just not have a rockchip-u-boot.dtsi and have in rockchip-binman.dtsi:
/ { binman: binman { multiple-images;
whatever is in &binman currently }; };
same for rockchip-optee.dtsi:
/ { binman: binman { multiple-images;
whatever is in &binman currently }; };
The point being that the dtsi for just setting multiple-images and have the node label is a bit silly. Also because it could be possible to include rockchip-optee.dtsi without rockchip-u-boot.dtsi by just adding a binman: binman {} node, which is incorrect since we need this multiple-images property.
Cheers, Quentin

Like ARM64 the u-boot.itb is also built when SPL_OPTEE_IMAGE is defined.
So, add SPL_OPTEE_IMAGE check for u-boot.itb blob so-that OPTEE is part of u-boot-rockchip.bin.
Signed-off-by: Jagan Teki jagan@edgeble.ai --- Changes for v2: - none
arch/arm/dts/rockchip-binman.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/dts/rockchip-binman.dtsi b/arch/arm/dts/rockchip-binman.dtsi index 8f7b3ee53b..48c6e2de4c 100644 --- a/arch/arm/dts/rockchip-binman.dtsi +++ b/arch/arm/dts/rockchip-binman.dtsi @@ -24,7 +24,7 @@ }; };
-#ifdef CONFIG_ARM64 +#if defined(CONFIG_ARM64) || defined(CONFIG_SPL_OPTEE_IMAGE) blob { filename = "u-boot.itb"; #else

On Thu, 3 Nov 2022 at 11:50, Jagan Teki jagan@edgeble.ai wrote:
fdt_addr will build as part of SPL_LOAD_FIT or SPL_LOAD_FIT_FULL which is indeed required to build optee image support in SPL.
common/spl/spl.c: In function ‘jump_to_image_optee’: common/spl/spl.c:220:46: error: ‘struct spl_image_info’ has no member named ‘fdt_addr’ 220 | spl_optee_entry(NULL, NULL, spl_image->fdt_addr,
Fix the dependency support.
Signed-off-by: Jagan Teki jagan@edgeble.ai
Tom, please apply this fix.
Jagan.

On Thu, Nov 03, 2022 at 11:49:47AM +0530, Jagan Teki wrote:
fdt_addr will build as part of SPL_LOAD_FIT or SPL_LOAD_FIT_FULL which is indeed required to build optee image support in SPL.
common/spl/spl.c: In function ‘jump_to_image_optee’: common/spl/spl.c:220:46: error: ‘struct spl_image_info’ has no member named ‘fdt_addr’ 220 | spl_optee_entry(NULL, NULL, spl_image->fdt_addr,
Fix the dependency support.
Signed-off-by: Jagan Teki jagan@edgeble.ai
Applied to u-boot/master, thanks!
participants (3)
-
Jagan Teki
-
Quentin Schulz
-
Tom Rini