Skip to contentSkip to conversation

mkimage: Add support for bundling TEE in mkimage -f auto

PATCH In review Marek Vasut 2 participants 7 messages Nov 18, 2025 – Nov 25, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mkimage: Add support for bundling TEE in mkimage -f auto

Introduce two new parameters to be used with mkimage -f auto to bundle TEE image into fitImage, using auto-generated fitImage. Add -z to specify TEE file name and -Z to specify TEE load and entry point address. This is meant to be used with systems which boot all of TEE, Linux and its DT from a single fitImage, all booted by U-Boot.

Example invocation:
"

$ mkimage -E -A arm -C none -e 0xc0008000 -a 0xc0008000 -f auto \
          -d arch/arm/boot/zImage \
          -b arch/arm/boot/dts/st/stm32mp135f-dhcor-dhsbc.dtb \
          -z ../optee_os/out/arm-plat-stm32mp1/core/tee-raw.bin \
	  -Z 0xde000000 \
          /path/to/output/fitImage
"

Documentation update and test are also included, the test validates both positive and negative test cases, where fitImage does not include TEE and does include TEE blobs.

---
Cc: "Carlos López" <[email protected]>
Cc: Aristo Chen <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Julien Masson <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Mayuresh Chitale <[email protected]>
Cc: Paul HENRYS <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Wolfgang Wallner <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 doc/mkimage.1                         |  12 +++
 include/image.h                       |   1 +
 test/py/tests/test_fit_auto_signed.py | 110 +++++++++++++++++++++++---
 tools/fit_image.c                     |  55 ++++++++++++-
 tools/imagetool.h                     |   2 +
 tools/mkimage.c                       |  17 +++-
 6 files changed, 185 insertions(+), 12 deletions(-)
doc/mkimage.1 +12 -0
index c705218d345..c87003a6c0a 100644
@@ -251,6 +251,18 @@ Append TFA BL31 file to the image.
 .B \-\-tfa-bl31-addr
 Set TFA BL31 file load and entry point address.
 .
+.TP
+.B \-z
+.TQ
+.B \-\-optee-file
+Append OPTEE file to the image.
+.
+.TP
+.B \-Z
+.TQ
+.B \-\-optee-addr
+Set OPTEE file load and entry point address.
+.
 .SS Options for creating FIT images
 .
 .TP
include/image.h +1 -0
index 9a1c828416d..d543c6cf254 100644
@@ -1105,6 +1105,7 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
 #define FIT_SCRIPT_PROP		"script"
 #define FIT_PHASE_PROP		"phase"
 #define FIT_TFA_BL31_PROP	"tfa-bl31"
+#define FIT_TEE_PROP		"tee"
 
 #define FIT_MAX_HASH_LEN	HASH_MAX_DIGEST_SIZE
 
test/py/tests/test_fit_auto_signed.py +101 -9

175 lines not on this page · raw message

tools/fit_image.c +53 -2

85 lines not on this page · raw message

tools/imagetool.h +2 -0
index 866b8834fd7..d0e7d6d56e3 100644
@@ -101,6 +101,8 @@ struct image_tool_params {
 	struct image_summary summary;	/* results of signing process */
 	char *fit_tfa_bl31;	/* TFA BL31 file to include */
 	unsigned int fit_tfa_bl31_addr;	/* TFA BL31 load and entry point address */
+	char *fit_tee;		/* TEE file to include */
+	unsigned int fit_tee_addr;	/* TEE load and entry point address */
 };
 
 /*
tools/mkimage.c +16 -1
index a800f9507bf..139d1bece2c 100644
@@ -103,6 +103,8 @@ static void usage(const char *msg)
 		"          -s ==> create an image with no data\n"
 		"          -y ==> append TFA BL31 file to the image\n"
 		"          -Y ==> set TFA BL31 file load and entry point address\n"
+		"          -z ==> append TEE file to the image\n"
+		"          -Z ==> set TEE file load and entry point address\n"
 		"          -v ==> verbose\n",
 		params.cmdname);
 	fprintf(stderr,
@@ -162,7 +164,7 @@ static int add_content(int type, const char *fname)
 }
 
 static const char optstring[] =
-	"a:A:b:B:c:C:d:D:e:Ef:Fg:G:i:k:K:ln:N:o:O:p:qrR:stT:vVxy:Y:";
+	"a:A:b:B:c:C:d:D:e:Ef:Fg:G:i:k:K:ln:N:o:O:p:qrR:stT:vVxy:Y:z:Z:";
 
 static const struct option longopts[] = {
 	{ "load-address", required_argument, NULL, 'a' },
@@ -200,6 +202,8 @@ static const struct option longopts[] = {
 	{ "xip", no_argument, NULL, 'x' },
 	{ "tfa-bl31-file", no_argument, NULL, 'y' },
 	{ "tfa-bl31-addr", no_argument, NULL, 'Y' },
+	{ "tee-file", no_argument, NULL, 'z' },
+	{ "tee-addr", no_argument, NULL, 'Z' },
 	{ /* sentinel */ },
 };
 
@@ -382,6 +386,17 @@ static void process_args(int argc, char **argv)
 				exit(EXIT_FAILURE);
 			}
 			break;
+		case 'z':
+			params.fit_tee = optarg;
+			break;
+		case 'Z':
+			params.fit_tee_addr = strtoull(optarg, &ptr, 16);
+			if (*ptr) {
+				fprintf(stderr, "%s: invalid TEE address %s\n",
+					params.cmdname, optarg);
+				exit(EXIT_FAILURE);
+			}
+			break;
 		default:
 			usage("Invalid option");
 		}
Signature · 1 line
2.51.0
#1 lore raw

Hi Marek,

Quoted 55 lines · Marek Vasut

Introduce two new parameters to be used with mkimage -f auto to bundle TEE image into fitImage, using auto-generated fitImage. Add -z to specify TEE file name and -Z to specify TEE load and entry point address. This is meant to be used with systems which boot all of TEE, Linux and its DT from a single fitImage, all booted by U-Boot.

Example invocation:
"

$ mkimage -E -A arm -C none -e 0xc0008000 -a 0xc0008000 -f auto \
           -d arch/arm/boot/zImage \
           -b arch/arm/boot/dts/st/stm32mp135f-dhcor-dhsbc.dtb \
           -z ../optee_os/out/arm-plat-stm32mp1/core/tee-raw.bin \
	  -Z 0xde000000 \
           /path/to/output/fitImage
"

Documentation update and test are also included, the test validates both positive and negative test cases, where fitImage does not include TEE and does include TEE blobs.

---
Cc: "Carlos López" <[email protected]>
Cc: Aristo Chen <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Julien Masson <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Mayuresh Chitale <[email protected]>
Cc: Paul HENRYS <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Wolfgang Wallner <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
  doc/mkimage.1                         |  12 +++
  include/image.h                       |   1 +
  test/py/tests/test_fit_auto_signed.py | 110 +++++++++++++++++++++++---
  tools/fit_image.c                     |  55 ++++++++++++-
  tools/imagetool.h                     |   2 +
  tools/mkimage.c                       |  17 +++-
  6 files changed, 185 insertions(+), 12 deletions(-)
doc/mkimage.1 +2 -0
index c705218d345..c87003a6c0a 100644
@@ -251,6 +251,18 @@ Append TFA BL31 file to the image.
  .B \-\-tfa-bl31-addr
  Set TFA BL31 file load and entry point address.
  .
+.TP
+.B \-z

doc/mkimage.1 Append TFA BL31 file to the image. · line 265

Quoted 10 lines
doc/mkimage.1 +10 -0
+.TQ
+.B \-\-optee-file
+Append OPTEE file to the image.
+.
+.TP
+.B \-Z
+.TQ
+.B \-\-optee-addr
+Set OPTEE file load and entry point address.
+.

I believe we use tee-file and tee-addr according to the last diff in this patch?

Please specify this is parsed as hex.

Which formats are supported for the --tee-file parameter? OP-TEE OS itself has multiple versions for the binary header (v1 and v2?) and we can pass either a binary (tee.bin) or an ELF (tee.elf) in binman, c.f. tools/binman/etype/tee_os.py

Quoted 20 lines
doc/mkimage.1 +0 -0
  .SS Options for creating FIT images
  .
  .TP
include/image.h +1 -0
index 9a1c828416d..d543c6cf254 100644
@@ -1105,6 +1105,7 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
  #define FIT_SCRIPT_PROP		"script"
  #define FIT_PHASE_PROP		"phase"
  #define FIT_TFA_BL31_PROP	"tfa-bl31"
+#define FIT_TEE_PROP		"tee"
 
  #define FIT_MAX_HASH_LEN	HASH_MAX_DIGEST_SIZE
 
test/py/tests/test_fit_auto_signed.py +0 -0
index 0b5dbd5401c..cb8bd519fd9 100644

test/py/tests/test_fit_auto_signed.py class SignedFitHelper(object): · line 124

Quoted 9 lines
test/py/tests/test_fit_auto_signed.py +1 -1
@@ -117,23 +117,31 @@ class SignedFitHelper(object):
              algo = self.__fdt_get_string(f'{node}/signature', 'algo')
              assert algo == sign_algo + "\n", "Missing expected signature algo!"
 
-    def check_fit_loadables(self, present):
+    def check_fit_loadables(self, bl31present, teepresent):
          """Test that loadables contains both kernel and TFA BL31 entries.
 
          Each configuration must have a loadables property which lists both
          kernel-1 and tfa-bl31-1 strings in the string list.

Missing update to the method docstring.

Quoted 22 lines
test/py/tests/test_fit_auto_signed.py +10 -2
          """
-        if present:
+        if bl31present:
              assert "/images/tfa-bl31-1" in self.images_nodes
          else:
              assert "/images/tfa-bl31-1" not in self.images_nodes
+        if teepresent:
+            assert "/images/tee-1" in self.images_nodes
+        else:
+            assert "/images/tee-1" not in self.images_nodes
          for node in self.confgs_nodes:
              loadables = self.__fdt_get_string(f'{node}', 'loadables')
              assert "kernel-1" in loadables
-            if present:
+            if bl31present:
                  assert "tfa-bl31-1" in loadables
              else:
                  assert "tfa-bl31-1" not in loadables
+            if teepresent:
+                assert "tee-1" in loadables
+            else:
+                assert "tee-1" not in loadables

[...]

Quoted 33 lines
test/py/tests/test_fit_auto_signed.py +33 -0
+    # Run the same tests as 1/2/3 above, but this time with TEE
+    # options -z tee.bin -Z 0x56780000 to cover both mkimage with
+    # and without TEE use cases.
+    b_args = " -d" + kernel_file + " -b" + dt1_file + " -b" + dt2_file + " -z" + tee_file + " -Z 0x56780000"
+
+    # 4 - Create auto FIT with images crc32 checksum, and verify it
+    utils.run_and_log(ubman, mkimage + ' -fauto' + b_args + " " + fit_file)
+
+    fit = SignedFitHelper(ubman, fit_file)
+    if fit.build_nodes_sets() == 0:
+        raise ValueError('FIT-7 has no "/image" nor "/configuration" nodes')
+
+    fit.check_fit_crc32_images()
+
+    fit.check_fit_loadables(bl31present=False, teepresent=True)
+
+    # 5 - Create auto FIT with signed images, and verify it
+    utils.run_and_log(ubman, mkimage + ' -fauto' + b_args + s_args + " " +
+                      fit_file)
+
+    fit = SignedFitHelper(ubman, fit_file)
+    if fit.build_nodes_sets() == 0:
+        raise ValueError('FIT-8 has no "/image" nor "/configuration" nodes')
+
+    fit.check_fit_signed_images(key_name, sign_algo, verifier)
+
+    fit.check_fit_loadables(bl31present=False, teepresent=True)
+
+    # 6 - Create auto FIT with signed configs and hashed images, and verify it
+    utils.run_and_log(ubman, mkimage + ' -fauto-conf' + b_args + s_args + " " +
+                      fit_file)
+
+    fit = SignedFitHelper(ubman, fit_file)

test/py/tests/test_fit_auto_signed.py def test_fit_auto_signed(ubman): · line 317

Quoted 10 lines
test/py/tests/test_fit_auto_signed.py +10 -0
+    if fit.build_nodes_sets() == 0:
+        raise ValueError('FIT-9 has no "/image" nor "/configuration" nodes')
+
+    fit.check_fit_signed_confgs(key_name, sign_algo)
+
+    fit.check_fit_loadables(bl31present=False, teepresent=True)
+
+    # Run the same tests as 1/2/3 above, but this time with TEE
+    # options -z tee.bin -Z 0x56780000 to cover both mkimage with
+    # and without TEE use cases.

And with TFA BL31...

[...]

Quoted 36 lines
tools/fit_image.c +21 -0
index 0306333141e..6388b04e340 100644
@@ -180,6 +180,13 @@ static int fit_calc_size(struct image_tool_params *params)
  		total_size += size;
  	}
 
+	if (params->fit_tee) {
+		size = imagetool_get_filesize(params, params->fit_tee);
+		if (size < 0)
+			return -1;
+		total_size += size;
+	}
+
  	for (cont = params->content_head; cont; cont = cont->next) {
  		size = imagetool_get_filesize(params, cont->fname);
  		if (size < 0)
@@ -433,6 +440,30 @@ static int fit_write_images(struct image_tool_params *params, char *fdt)
  		fdt_end_node(fdt);
  	}
 
+	/* And a TEE file if available */
+	if (params->fit_tee) {
+		fdt_begin_node(fdt, FIT_TEE_PROP "-1");
+
+		fdt_property_string(fdt, FIT_TYPE_PROP, FIT_TEE_PROP);
+		fdt_property_string(fdt, FIT_OS_PROP,
+				    genimg_get_os_short_name(params->os));
+		fdt_property_string(fdt, FIT_ARCH_PROP,
+				    genimg_get_arch_short_name(params->arch));
+		get_basename(str, sizeof(str), params->fit_tee);
+		fdt_property_string(fdt, FIT_DESC_PROP, str);
+
+		ret = fdt_property_file(params, fdt, FIT_DATA_PROP,
+					params->fit_tee);

tools/fit_image.c static int fit_write_images(struct image_tool_params *params, char *fdt) · line 466

Quoted 10 lines
tools/fit_image.c +10 -0
+		if (ret)
+			return ret;
+		fdt_property_u32(fdt, FIT_LOAD_PROP, params->fit_tee_addr);
+		fdt_property_u32(fdt, FIT_ENTRY_PROP, params->fit_tee_addr);
+		fit_add_hash_or_sign(params, fdt, true);
+		if (ret)
+			return ret;
+		fdt_end_node(fdt);
+	}
+

OK so... On Rockchip we have TF-A and OP-TEE OS split in multiple entries with different load addresses (see @atf-seq and @tee-seq in arch/arm/dts/rockchip-u-boot.dtsi). I guess this means we wouldn't be able to use this auto FIT?

Quoted 35 lines
tools/fit_image.c +16 -2
  	fdt_end_node(fdt);
 
  	return 0;
@@ -473,10 +504,20 @@ static void fit_write_configs(struct image_tool_params *params, char *fdt)
  		len = strlen(str);
  		fdt_property_string(fdt, typename, str);
 
-		if (params->fit_tfa_bl31) {
+		if (params->fit_tfa_bl31 && params->fit_tee) {
+			snprintf(str, sizeof(str), "%s-1." FIT_TFA_BL31_PROP "-1." FIT_TEE_PROP "-1", typename);
+			str[len] = 0;
+			len += strlen(FIT_TFA_BL31_PROP "-1") + 1;
+			str[len] = 0;
+			len += strlen(FIT_TEE_PROP "-1") + 1;
+		} else if (params->fit_tfa_bl31) {
  			snprintf(str, sizeof(str), "%s-1." FIT_TFA_BL31_PROP "-1", typename);
  			str[len] = 0;
  			len += strlen(FIT_TFA_BL31_PROP "-1") + 1;
+		} else if (params->fit_tee) {
+			snprintf(str, sizeof(str), "%s-1." FIT_TEE_PROP "-1", typename);
+			str[len] = 0;
+			len += strlen(FIT_TEE_PROP "-1") + 1;
  		}
 
  		fdt_property(fdt, FIT_LOADABLE_PROP, str, len + 1);
@@ -498,10 +539,20 @@ static void fit_write_configs(struct image_tool_params *params, char *fdt)
  		len = strlen(str);
  		fdt_property_string(fdt, typename, str);
 
-		if (params->fit_tfa_bl31) {
+		if (params->fit_tfa_bl31 && params->fit_tee) {
+			snprintf(str, sizeof(str), "%s-1." FIT_TFA_BL31_PROP "-1." FIT_TEE_PROP "-1", typename);
+			str[len] = 0;
+			len += strlen(FIT_TFA_BL31_PROP "-1") + 1;
+			str[len] = 0;

tools/fit_image.c static void fit_write_configs(struct image_tool_params *params, char *fdt) · line 556

Quoted 10 lines
tools/fit_image.c +6 -0
+			len += strlen(FIT_TEE_PROP "-1") + 1;
+		} else if (params->fit_tfa_bl31) {
  			snprintf(str, sizeof(str), "%s-1." FIT_TFA_BL31_PROP "-1", typename);
  			str[len] = 0;
  			len += strlen(FIT_TFA_BL31_PROP "-1") + 1;
+		} else if (params->fit_tee) {
+			snprintf(str, sizeof(str), "%s-1." FIT_TEE_PROP "-1", typename);
+			str[len] = 0;
+			len += strlen(FIT_TEE_PROP "-1") + 1;
  		}

The coded here seems to be shared with one diff above, maybe it'd make sense to make this into a reusable function? What do you think?

Cheers,
Quentin

#2 lore raw

On 11/24/25 4:05 PM, Quentin Schulz wrote:

Hello Quentin,

Quoted 9 lines
Quoted 9 lines

Example invocation:
"

$ mkimage -E -A arm -C none -e 0xc0008000 -a 0xc0008000 -f auto \
           -d arch/arm/boot/zImage \
           -b arch/arm/boot/dts/st/stm32mp135f-dhcor-dhsbc.dtb \
           -z ../optee_os/out/arm-plat-stm32mp1/core/tee-raw.bin \
      -Z 0xde000000 \
           /path/to/output/fitImage
"

...

Quoted 1 line

Which formats are supported for the --tee-file parameter? OP-TEE OS itself has multiple versions for the binary header (v1 and v2?) and we can pass either a binary (tee.bin) or an ELF (tee.elf) in binman, c.f. tools/binman/etype/tee_os.py

The raw binary only, see the example invocation above.

[...]

Quoted 1 line

OK so... On Rockchip we have TF-A and OP-TEE OS split in multiple entries with different load addresses (see @atf-seq and @tee-seq in arch/arm/dts/rockchip-u-boot.dtsi). I guess this means we wouldn't be able to use this auto FIT?

Are those multiple "versions" of these binaries or are those really separate parts of a single binary ? The later seems a bit odd. Do you have an example of such configuration?

Note that you could include multiple TFA BL31/TEE binaries in fitImage, but to support that from command line would probably be overloading mkimage -f auto already.

...

The rest, I hope, is addressed in V2.

#3 lore raw

Hi Marek,

Quoted 14 lines · Marek Vasut

On 11/24/25 4:05 PM, Quentin Schulz wrote:

Hello Quentin,

Quoted 9 lines
Quoted 9 lines

Example invocation:
"

$ mkimage -E -A arm -C none -e 0xc0008000 -a 0xc0008000 -f auto \
           -d arch/arm/boot/zImage \
           -b arch/arm/boot/dts/st/stm32mp135f-dhcor-dhsbc.dtb \
           -z ../optee_os/out/arm-plat-stm32mp1/core/tee-raw.bin \
      -Z 0xde000000 \
           /path/to/output/fitImage
"
Quoted 6 lines

...

Quoted 1 line

Which formats are supported for the --tee-file parameter? OP-TEE OS itself has multiple versions for the binary header (v1 and v2?) and we can pass either a binary (tee.bin) or an ELF (tee.elf) in binman, c.f. tools/binman/etype/tee_os.py

The raw binary only, see the example invocation above.

Must be documented then please.

Quoted 6 lines

[...]

Quoted 1 line

OK so... On Rockchip we have TF-A and OP-TEE OS split in multiple entries with different load addresses (see @atf-seq and @tee-seq in arch/arm/dts/rockchip-u-boot.dtsi). I guess this means we wouldn't be able to use this auto FIT?

Are those multiple "versions" of these binaries or are those really separate parts of a single binary ? The later seems a bit odd. Do you have an example of such configuration?

Same binary split.

Rk3399, PX30 and RK3588 (the three Rockchip SoCs we use on our product line) have this.

- For PX30:

Checkout trusted-firmware-a repo and build with

make CROSS_COMPILE=aarch64-linux-gnu- PLAT=px30 -jnproc

Compile U-Boot:

export BL31=/path/to/trusted-firmware-a/build/px30/release/bl31/bl31.elf

make CROSS_COMPILE=aarch64-linux-gnu- O=build/ringneck ringneck-px30_defconfig -jnproc

- For RK3399:

Checkout trusted-firmware-a repo and build with

make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 -jnproc

Compile U-Boot:

export BL31=/path/to/trusted-firmware-a/build/rk3399/release/bl31/bl31.elf

make CROSS_COMPILE=aarch64-linux-gnu- O=build/puma puma-rk3399_defconfig -jnproc

For PX30:

$ mkimage -l build/ringneck/u-boot.itb
FIT description: FIT image for U-Boot with bl31 (TF-A)
Created:         Tue Nov 25 10:52:42 2025
 Image 0 (u-boot)
  Description:  U-Boot
  Created:      Tue Nov 25 10:52:42 2025
  Type:         Standalone Program
  Compression:  uncompressed
  Data Size:    659944 Bytes = 644.48 KiB = 0.63 MiB
  Architecture: AArch64
  Load Address: 0x00200000
  Entry Point:  0x00200000
  Hash algo:    sha256
  Hash value: 
2f6a1658befcd8330843ed5d61ee5b539000f3dca5f2b35311be064596fc94f7
 Image 1 (atf-1)
  Description:  ARM Trusted Firmware
  Created:      Tue Nov 25 10:52:42 2025
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    106496 Bytes = 104.00 KiB = 0.10 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0x00040000
  Hash algo:    sha256
  Hash value: 
e6d48a0c4a47d8132d8185b58a1f5e44c025eed6eb9c4328a40feec85446281e
 Image 2 (atf-2)
  Description:  ARM Trusted Firmware
  Created:      Tue Nov 25 10:52:42 2025
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    129 Bytes = 0.13 KiB = 0.00 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0x0005a000
  Hash algo:    sha256
  Hash value: 
3125317584ab4860216e817612321962a0a904f14c830fd64961eaf12c15215a
 Image 3 (atf-3)
  Description:  ARM Trusted Firmware
  Created:      Tue Nov 25 10:52:42 2025
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    112 Bytes = 0.11 KiB = 0.00 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0xff020000
  Hash algo:    sha256
  Hash value: 
d856721b954d3b7d74bca14ae49a3ce52b17acde932bb2218f927af73c422b9b
 Image 4 (fdt-1)
  Description:  fdt-rockchip/px30-ringneck-haikou
  Created:      Tue Nov 25 10:52:42 2025
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    72912 Bytes = 71.20 KiB = 0.07 MiB
  Architecture: Unknown Architecture
  Hash algo:    sha256
  Hash value: 
0d8d2d650a311a7085ccb883409e680daec58df83a27b76724de60465342777e
 Default Configuration: 'config-1'
 Configuration 0 (config-1)
  Description:  rockchip/px30-ringneck-haikou.dtb
  Kernel:       unavailable
  Firmware:     atf-1
  FDT:          fdt-1
  Loadables:    u-boot
                atf-2
                atf-3

According to datasheet:

0x00040000 = DRAM
0x0005a000 = DRAM
0xff020000 = PMU_MEM (SRAM?)

$ mkimage -l build/puma/u-boot.itb
FIT description: FIT image for U-Boot with bl31 (TF-A)
Created:         Tue Nov 25 10:53:47 2025
 Image 0 (u-boot)
  Description:  U-Boot
  Created:      Tue Nov 25 10:53:47 2025
  Type:         Standalone Program
  Compression:  uncompressed
  Data Size:    897112 Bytes = 876.09 KiB = 0.86 MiB
  Architecture: AArch64
  Load Address: 0x00200000
  Entry Point:  0x00200000
  Hash algo:    sha256
  Hash value: 
5da93c500366e99d5fe3acb84b32b5757a90d8ef32fe73052bc20f6ca17f0b89
 Image 1 (atf-1)
  Description:  ARM Trusted Firmware
  Created:      Tue Nov 25 10:53:47 2025
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    143360 Bytes = 140.00 KiB = 0.14 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0x00040000
  Hash algo:    sha256
  Hash value: 
30e187d1b9c029657b1a9e029e5f7ad34fbfd5f9ca4a44cb1cb48750a92cf09b
 Image 2 (atf-2)
  Description:  ARM Trusted Firmware
  Created:      Tue Nov 25 10:53:47 2025
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    81 Bytes = 0.08 KiB = 0.00 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0x00063000
  Hash algo:    sha256
  Hash value: 
7380684a38dedb22d648d835934ef573c3e32a15e4b81cbc4ec158d17cb707ea
 Image 3 (atf-3)
  Description:  ARM Trusted Firmware
  Created:      Tue Nov 25 10:53:47 2025
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    8024 Bytes = 7.84 KiB = 0.01 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0xff3b0000
  Hash algo:    sha256
  Hash value: 
a887bbaec347403739e27430cc512922178b694ebe001e22c2cb4774254d67e6
 Image 4 (atf-4)
  Description:  ARM Trusted Firmware
  Created:      Tue Nov 25 10:53:47 2025
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    8192 Bytes = 8.00 KiB = 0.01 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0xff8c0000
  Hash algo:    sha256
  Hash value: 
67bf4dd100c6c99dbbf76c0b19072e6e9756383925795d94ced000c2a7cf3b9e
 Image 5 (atf-5)
  Description:  ARM Trusted Firmware
  Created:      Tue Nov 25 10:53:47 2025
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    0 Bytes = 0.00 KiB = 0.00 MiB
  Architecture: AArch64
  OS:           ARM Trusted Firmware
  Load Address: 0xff8c2000
  Hash algo:    sha256
  Hash value: 
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
 Image 6 (fdt-1)
  Description:  fdt-rockchip/rk3399-puma-haikou
  Created:      Tue Nov 25 10:53:47 2025
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    97832 Bytes = 95.54 KiB = 0.09 MiB
  Architecture: Unknown Architecture
  Hash algo:    sha256
  Hash value: 
5439f6f77ab01fa191a6a69a8691165669497fe74fc909f13a6d448b1004d629
 Default Configuration: 'config-1'
 Configuration 0 (config-1)
  Description:  rockchip/rk3399-puma-haikou.dtb
  Kernel:       unavailable
  Firmware:     atf-1
  FDT:          fdt-1
  Loadables:    u-boot
                atf-2
                atf-3
                atf-4
                atf-5

According to the datasheet:

0x00040000 = RAM
0x00063000 = RAM
0xff3b0000 = INTMEM1 (SRAM)
0xff8c0000 = INTMEM0 (SRAM)
0xff8c2000 = INTMEM0 (SRAM)

RK3399 is a special case because TF-A is running both on A and M cores.

Cheers,
Quentin

#4 lore raw

On 11/25/25 11:07 AM, Quentin Schulz wrote:

Hello Quentin,

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines

Example invocation:
"

$ mkimage -E -A arm -C none -e 0xc0008000 -a 0xc0008000 -f auto \
           -d arch/arm/boot/zImage \
           -b arch/arm/boot/dts/st/stm32mp135f-dhcor-dhsbc.dtb \
           -z ../optee_os/out/arm-plat-stm32mp1/core/tee-raw.bin \
      -Z 0xde000000 \
           /path/to/output/fitImage
"
Quoted 8 lines
Quoted 6 lines

...

Quoted 1 line

Which formats are supported for the --tee-file parameter? OP-TEE OS itself has multiple versions for the binary header (v1 and v2?) and we can pass either a binary (tee.bin) or an ELF (tee.elf) in binman, c.f. tools/binman/etype/tee_os.py

The raw binary only, see the example invocation above.

Must be documented then please.

Where would you document this ? In the manpage ? Elsewhere ?

Quoted 214 lines
Quoted 6 lines

[...]

Quoted 1 line

OK so... On Rockchip we have TF-A and OP-TEE OS split in multiple entries with different load addresses (see @atf-seq and @tee-seq in arch/arm/dts/rockchip-u-boot.dtsi). I guess this means we wouldn't be able to use this auto FIT?

Are those multiple "versions" of these binaries or are those really separate parts of a single binary ? The later seems a bit odd. Do you have an example of such configuration?

Same binary split.

Rk3399, PX30 and RK3588 (the three Rockchip SoCs we use on our product line) have this.

- For PX30:

Checkout trusted-firmware-a repo and build with

make CROSS_COMPILE=aarch64-linux-gnu- PLAT=px30 -jnproc

Compile U-Boot:

export BL31=/path/to/trusted-firmware-a/build/px30/release/bl31/bl31.elf

make CROSS_COMPILE=aarch64-linux-gnu- O=build/ringneck ringneck- px30_defconfig -jnproc

- For RK3399:

Checkout trusted-firmware-a repo and build with

make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 -jnproc

Compile U-Boot:

export BL31=/path/to/trusted-firmware-a/build/rk3399/release/bl31/bl31.elf

make CROSS_COMPILE=aarch64-linux-gnu- O=build/puma puma-rk3399_defconfig -jnproc

For PX30:

$ mkimage -l build/ringneck/u-boot.itb
FIT description: FIT image for U-Boot with bl31 (TF-A)
Created:         Tue Nov 25 10:52:42 2025
  Image 0 (u-boot)
   Description:  U-Boot
   Created:      Tue Nov 25 10:52:42 2025
   Type:         Standalone Program
   Compression:  uncompressed
   Data Size:    659944 Bytes = 644.48 KiB = 0.63 MiB
   Architecture: AArch64
   Load Address: 0x00200000
   Entry Point:  0x00200000
   Hash algo:    sha256
   Hash value: 
2f6a1658befcd8330843ed5d61ee5b539000f3dca5f2b35311be064596fc94f7
  Image 1 (atf-1)
   Description:  ARM Trusted Firmware
   Created:      Tue Nov 25 10:52:42 2025
   Type:         Firmware
   Compression:  uncompressed
   Data Size:    106496 Bytes = 104.00 KiB = 0.10 MiB
   Architecture: AArch64
   OS:           ARM Trusted Firmware
   Load Address: 0x00040000
   Hash algo:    sha256
   Hash value: 
e6d48a0c4a47d8132d8185b58a1f5e44c025eed6eb9c4328a40feec85446281e
  Image 2 (atf-2)
   Description:  ARM Trusted Firmware
   Created:      Tue Nov 25 10:52:42 2025
   Type:         Firmware
   Compression:  uncompressed
   Data Size:    129 Bytes = 0.13 KiB = 0.00 MiB
   Architecture: AArch64
   OS:           ARM Trusted Firmware
   Load Address: 0x0005a000
   Hash algo:    sha256
   Hash value: 
3125317584ab4860216e817612321962a0a904f14c830fd64961eaf12c15215a
  Image 3 (atf-3)
   Description:  ARM Trusted Firmware
   Created:      Tue Nov 25 10:52:42 2025
   Type:         Firmware
   Compression:  uncompressed
   Data Size:    112 Bytes = 0.11 KiB = 0.00 MiB
   Architecture: AArch64
   OS:           ARM Trusted Firmware
   Load Address: 0xff020000
   Hash algo:    sha256
   Hash value: 
d856721b954d3b7d74bca14ae49a3ce52b17acde932bb2218f927af73c422b9b
  Image 4 (fdt-1)
   Description:  fdt-rockchip/px30-ringneck-haikou
   Created:      Tue Nov 25 10:52:42 2025
   Type:         Flat Device Tree
   Compression:  uncompressed
   Data Size:    72912 Bytes = 71.20 KiB = 0.07 MiB
   Architecture: Unknown Architecture
   Hash algo:    sha256
   Hash value: 
0d8d2d650a311a7085ccb883409e680daec58df83a27b76724de60465342777e
  Default Configuration: 'config-1'
  Configuration 0 (config-1)
   Description:  rockchip/px30-ringneck-haikou.dtb
   Kernel:       unavailable
   Firmware:     atf-1
   FDT:          fdt-1
   Loadables:    u-boot
                 atf-2
                 atf-3

According to datasheet:

0x00040000 = DRAM
0x0005a000 = DRAM
0xff020000 = PMU_MEM (SRAM?)

$ mkimage -l build/puma/u-boot.itb
FIT description: FIT image for U-Boot with bl31 (TF-A)
Created:         Tue Nov 25 10:53:47 2025
  Image 0 (u-boot)
   Description:  U-Boot
   Created:      Tue Nov 25 10:53:47 2025
   Type:         Standalone Program
   Compression:  uncompressed
   Data Size:    897112 Bytes = 876.09 KiB = 0.86 MiB
   Architecture: AArch64
   Load Address: 0x00200000
   Entry Point:  0x00200000
   Hash algo:    sha256
   Hash value: 
5da93c500366e99d5fe3acb84b32b5757a90d8ef32fe73052bc20f6ca17f0b89
  Image 1 (atf-1)
   Description:  ARM Trusted Firmware
   Created:      Tue Nov 25 10:53:47 2025
   Type:         Firmware
   Compression:  uncompressed
   Data Size:    143360 Bytes = 140.00 KiB = 0.14 MiB
   Architecture: AArch64
   OS:           ARM Trusted Firmware
   Load Address: 0x00040000
   Hash algo:    sha256
   Hash value: 
30e187d1b9c029657b1a9e029e5f7ad34fbfd5f9ca4a44cb1cb48750a92cf09b
  Image 2 (atf-2)
   Description:  ARM Trusted Firmware
   Created:      Tue Nov 25 10:53:47 2025
   Type:         Firmware
   Compression:  uncompressed
   Data Size:    81 Bytes = 0.08 KiB = 0.00 MiB
   Architecture: AArch64
   OS:           ARM Trusted Firmware
   Load Address: 0x00063000
   Hash algo:    sha256
   Hash value: 
7380684a38dedb22d648d835934ef573c3e32a15e4b81cbc4ec158d17cb707ea
  Image 3 (atf-3)
   Description:  ARM Trusted Firmware
   Created:      Tue Nov 25 10:53:47 2025
   Type:         Firmware
   Compression:  uncompressed
   Data Size:    8024 Bytes = 7.84 KiB = 0.01 MiB
   Architecture: AArch64
   OS:           ARM Trusted Firmware
   Load Address: 0xff3b0000
   Hash algo:    sha256
   Hash value: 
a887bbaec347403739e27430cc512922178b694ebe001e22c2cb4774254d67e6
  Image 4 (atf-4)
   Description:  ARM Trusted Firmware
   Created:      Tue Nov 25 10:53:47 2025
   Type:         Firmware
   Compression:  uncompressed
   Data Size:    8192 Bytes = 8.00 KiB = 0.01 MiB
   Architecture: AArch64
   OS:           ARM Trusted Firmware
   Load Address: 0xff8c0000
   Hash algo:    sha256
   Hash value: 
67bf4dd100c6c99dbbf76c0b19072e6e9756383925795d94ced000c2a7cf3b9e
  Image 5 (atf-5)
   Description:  ARM Trusted Firmware
   Created:      Tue Nov 25 10:53:47 2025
   Type:         Firmware
   Compression:  uncompressed
   Data Size:    0 Bytes = 0.00 KiB = 0.00 MiB
   Architecture: AArch64
   OS:           ARM Trusted Firmware
   Load Address: 0xff8c2000
   Hash algo:    sha256
   Hash value: 
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
  Image 6 (fdt-1)
   Description:  fdt-rockchip/rk3399-puma-haikou
   Created:      Tue Nov 25 10:53:47 2025
   Type:         Flat Device Tree
   Compression:  uncompressed
   Data Size:    97832 Bytes = 95.54 KiB = 0.09 MiB
   Architecture: Unknown Architecture
   Hash algo:    sha256
   Hash value: 
5439f6f77ab01fa191a6a69a8691165669497fe74fc909f13a6d448b1004d629
  Default Configuration: 'config-1'
  Configuration 0 (config-1)
   Description:  rockchip/rk3399-puma-haikou.dtb
   Kernel:       unavailable
   Firmware:     atf-1
   FDT:          fdt-1
   Loadables:    u-boot
                 atf-2
                 atf-3
                 atf-4
                 atf-5

According to the datasheet:

Quoted 7 lines

0x00040000 = RAM
0x00063000 = RAM
0xff3b0000 = INTMEM1 (SRAM)
0xff8c0000 = INTMEM0 (SRAM)
0xff8c2000 = INTMEM0 (SRAM)

RK3399 is a special case because TF-A is running both on A and M cores.

Neither of the binaries listed above is TEE ?

I can imagine you can have tee header and something else bundled in the fitImage, but for such more complex case, better use .its file to describe it.

#5 lore raw

Hi Marek,

Quoted 16 lines · Marek Vasut

On 11/25/25 11:07 AM, Quentin Schulz wrote:

Hello Quentin,

Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
Quoted 9 lines

Example invocation:
"

$ mkimage -E -A arm -C none -e 0xc0008000 -a 0xc0008000 -f auto \
           -d arch/arm/boot/zImage \
           -b arch/arm/boot/dts/st/stm32mp135f-dhcor-dhsbc.dtb \
           -z ../optee_os/out/arm-plat-stm32mp1/core/tee-raw.bin \
      -Z 0xde000000 \
           /path/to/output/fitImage
"

...

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Which formats are supported for the --tee-file parameter? OP-TEE OS itself has multiple versions for the binary header (v1 and v2?) and we can pass either a binary (tee.bin) or an ELF (tee.elf) in binman, c.f. tools/binman/etype/tee_os.py

The raw binary only, see the example invocation above.

Must be documented then please.

Where would you document this ? In the manpage ? Elsewhere ?

Wherever the user can see it when using the tool. The manpage for sure yes. Maybe in the mkimage usage help string but I'm worried it'll make it harder to read.

Also, turns out that one really is supposed to use the raw binary format for OP-TEE OS (since 3.8.0). I had missed that part so it kinda makes sense to only support that, after all 3.8.0 is already 6 years old! Blobs from Rockchip do have a .bin extension so I assume they are raw binaries.

Quoted 9 lines
Quoted 9 lines
Quoted 6 lines

[...]

Quoted 1 line

OK so... On Rockchip we have TF-A and OP-TEE OS split in multiple entries with different load addresses (see @atf-seq and @tee-seq in arch/arm/dts/rockchip-u-boot.dtsi). I guess this means we wouldn't be able to use this auto FIT?

Are those multiple "versions" of these binaries or are those really separate parts of a single binary ? The later seems a bit odd. Do you have an example of such configuration?

Same binary split.

[...]

Quoted 3 lines

Neither of the binaries listed above is TEE ?

Oopsies. Got distracted by reviewing both tf-a (already merged) and tee support in mkimage -f auto. So this applies to TF-A part only, where we (Rockchip) use the ELF file (for Rockchip blobs; maybe upstream TF-A is loadable in raw binary form as well?) and that is split by binman. Since one is supposed to use the raw bin for OP-TEE OS and that binman doesn't actually split this into multiple entries, this doesn't apply, sorry for the noise.

Quoted 1 line

I can imagine you can have tee header and something else bundled in the fitImage, but for such more complex case, better use .its file to describe it.

Fair.

Quentin

#6 lore raw

On 11/25/25 4:18 PM, Quentin Schulz wrote:

Hello Quentin,

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 9 lines
Quoted 9 lines

Example invocation:
"

$ mkimage -E -A arm -C none -e 0xc0008000 -a 0xc0008000 -f auto \
           -d arch/arm/boot/zImage \
           -b arch/arm/boot/dts/st/stm32mp135f-dhcor-dhsbc.dtb \
           -z ../optee_os/out/arm-plat-stm32mp1/core/tee-raw.bin \
      -Z 0xde000000 \
           /path/to/output/fitImage
"

...

Quoted 1 line

Which formats are supported for the --tee-file parameter? OP-TEE OS itself has multiple versions for the binary header (v1 and v2?) and we can pass either a binary (tee.bin) or an ELF (tee.elf) in binman, c.f. tools/binman/etype/tee_os.py

The raw binary only, see the example invocation above.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Must be documented then please.

Where would you document this ? In the manpage ? Elsewhere ?

Wherever the user can see it when using the tool. The manpage for sure yes. Maybe in the mkimage usage help string but I'm worried it'll make it harder to read.

Done in V3

Quoted 1 line

Also, turns out that one really is supposed to use the raw binary format for OP-TEE OS (since 3.8.0). I had missed that part so it kinda makes sense to only support that, after all 3.8.0 is already 6 years old! Blobs from Rockchip do have a .bin extension so I assume they are raw binaries.

[...]

Quoted 4 lines
Quoted 2 lines

Neither of the binaries listed above is TEE ?

Oopsies. Got distracted by reviewing both tf-a (already merged) and tee support in mkimage -f auto. So this applies to TF-A part only, where we (Rockchip) use the ELF file (for Rockchip blobs; maybe upstream TF-A is loadable in raw binary form as well?) and that is split by binman. Since one is supposed to use the raw bin for OP-TEE OS and that binman doesn't actually split this into multiple entries, this doesn't apply, sorry for the noise.

No worries, thank you for checking !