Skip to contentSkip to conversation

rockchip: make it possible to sign the u-boot.itb

PATCH Superseded Heiko Stuebner 4 participants 14 messages May 26, 2020 – Jun 26, 2020

Subsystems (5)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

v3 cover rockchip: make it possible to sign the u-boot.itb

From: Heiko Stuebner <[email protected]>

This series makes it possible to sign a generated u-boot.itb automatically even if the its-source got created by a generator script.

To let the SPL know about the key, the -K option for mkimage points to the dts/dt-spl.dtb which can then get included into the spl binary.

Tested on Rockchip PX30 with a TPL -> SPL -> U-Boot.itb bootchain.

I've split out the the rsa/crypto fixes into a separate series starting at [0].

[0] https://patchwork.ozlabs.org/project/uboot/patch/20200522141937.3523692-1-heiko at sntech.de/

changes in v3:
- add patch to fix imx make_fit_atf.sh error handling
- split out rsa fixes into separate series
changes in v2.1:
- depend on $(CONFIG_SPL_FIT_SIGNATURE)$(U_BOOT_ITS) instead of only $(CONFIG_SPL_FIT_GENERATOR)
changes in v2:
- add received reviews
- fix commit message typo
- add doc snippet explaining CONFIG_SPL_FIT_GENERATOR_KEY_HINT

Heiko Stuebner (5):
imx: mkimage_fit_atf: Fix FIT image if BL31.bin missing
mkimage: fit_image: handle multiple errors when writing signatures
spl: fit: enable signing a generated u-boot.itb
spl: fit: add Kconfig option to specify key-hint for fit_generator
rockchip: make_fit_atf: add signature handling

 Kconfig                                | 16 ++++++++
 Makefile                               | 11 +++++-
 arch/arm/mach-imx/mkimage_fit_atf.sh   |  4 +-
 arch/arm/mach-rockchip/make_fit_atf.py | 51 +++++++++++++++++++++++++-
 doc/uImage.FIT/howto.txt               | 13 +++++++
 tools/image-host.c                     |  2 +-
 6 files changed, 92 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH v3 1/5 imx: mkimage_fit_atf: Fix FIT image if BL31.bin missing

From: Heiko Stuebner <[email protected]>

Right now if its bl31.bin is missing, the imx make_fit_atf.sh does return "sucessful" without generating an .its source file, which makes autobuilders unhappy.

So this change is similar to Tom Rini's
commit 4c78028737c3 ("mksunxi_fit_atf.sh: Allow for this to complete when bl31.bin is missing") in that it changes the behaviour to a warning and still lets the script
generate a usable u-boot.its and thus also lets the u-boot.itb get build successfully

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc uboot-imx at nxp.com

---
changes in v3:
- new patch

 arch/arm/mach-imx/mkimage_fit_atf.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-imx/mkimage_fit_atf.sh +2 -2
index dd1ca5ad3f..2224d85281 100755
@@ -12,8 +12,8 @@
 [ -z "$BL33_LOAD_ADDR" ] && BL33_LOAD_ADDR="0x40200000"
 
 if [ ! -f $BL31 ]; then
-	echo "ERROR: BL31 file $BL31 NOT found" >&2
-	exit 0
+	echo "WARNING: BL31 file $BL31 NOT found, resulting binary is not-functional" >&2
+	BL31=/dev/null
 else
 	echo "$BL31 size: " >&2
 	ls -lct $BL31 | awk '{print $5}' >&2
Signature · 1 line
2.25.1
#2 lore raw

PATCH v3 1/5 imx: mkimage_fit_atf: Fix FIT image if BL31.bin missing

Quoted 39 lines

Subject: [PATCH v3 1/5] imx: mkimage_fit_atf: Fix FIT image if BL31.bin missing

From: Heiko Stuebner <[email protected]>

Right now if its bl31.bin is missing, the imx make_fit_atf.sh does return "sucessful" without generating an .its source file, which makes autobuilders unhappy.

So this change is similar to Tom Rini's
commit 4c78028737c3 ("mksunxi_fit_atf.sh: Allow for this to complete when bl31.bin is missing") in that it changes the behaviour to a warning and still lets the script generate a usable u-boot.its and thus also lets the u-boot.itb get build successfully

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc uboot-imx at nxp.com

---
changes in v3:
- new patch

 arch/arm/mach-imx/mkimage_fit_atf.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-imx/mkimage_fit_atf.sh +1 -2
index dd1ca5ad3f..2224d85281 100755
@@ -12,8 +12,8 @@
 [ -z "$BL33_LOAD_ADDR" ] && BL33_LOAD_ADDR="0x40200000"
 
 if [ ! -f $BL31 ]; then
-	echo "ERROR: BL31 file $BL31 NOT found" >&2
-	exit 0
+	echo "WARNING: BL31 file $BL31 NOT found, resulting binary is

not-functional" >&2

arch/arm/mach-imx/mkimage_fit_atf.sh line 19

Quoted 4 lines
arch/arm/mach-imx/mkimage_fit_atf.sh +1 -0
+	BL31=/dev/null
 else
 	echo "$BL31 size: " >&2
 	ls -lct $BL31 | awk '{print $5}' >&2
author maintainer
#3 lore raw

PATCH v3 2/5 mkimage: fit_image: handle multiple errors when writing signatures

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

fit_image_write_sig() contains mostly functions from libfdt that return FDT_ERR_foo errors but also a call to fit_set_timestamp() which returns a regular error.

When handling the size increase via multiple iterations, check for both -FDT_ERR_NOSPACE but also for -ENOSPC.

There is no real conflict, as FDT_ERR_NOSPACE = 3 = ESRCH (No such process) and ENOSPC = 28 which is above any FDT_ERR_*.

---
 tools/image-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/image-host.c +1 -1
index 9a83b7f675..baf9590f3b 100644
@@ -241,7 +241,7 @@ static int fit_image_process_sig(const char *keydir, void *keydest,
 	ret = fit_image_write_sig(fit, noffset, value, value_len, comment,
 			NULL, 0, cmdname);
 	if (ret) {
-		if (ret == -FDT_ERR_NOSPACE)
+		if (ret == -FDT_ERR_NOSPACE || ret == -ENOSPC)
 			return -ENOSPC;
 		printf("Can't write signature for '%s' signature node in '%s' conf node: %s\n",
 		       node_name, image_name, fdt_strerror(ret));
Signature · 1 line
2.25.1
#4 lore raw

PATCH v3 2/5 mkimage: fit_image: handle multiple errors when writing signatures

Hi Heiko,

Quoted 13 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

fit_image_write_sig() contains mostly functions from libfdt that return FDT_ERR_foo errors but also a call to fit_set_timestamp() which returns a regular error.

When handling the size increase via multiple iterations, check for both -FDT_ERR_NOSPACE but also for -ENOSPC.

There is no real conflict, as FDT_ERR_NOSPACE = 3 = ESRCH (No such process) and ENOSPC = 28 which is above any FDT_ERR_*.

Quoted 6 lines
---
 tools/image-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Changing my mind on this - I wonder if we can change fit_image_write_sig() to always return an errno code, never an FDT code? Could be a follow-on patch.

Quoted 15 lines
tools/image-host.c +1 -2
index 9a83b7f675..baf9590f3b 100644
@@ -241,7 +241,7 @@ static int fit_image_process_sig(const char *keydir, void *keydest,
        ret = fit_image_write_sig(fit, noffset, value, value_len, comment,
                        NULL, 0, cmdname);
        if (ret) {
-               if (ret == -FDT_ERR_NOSPACE)
+               if (ret == -FDT_ERR_NOSPACE || ret == -ENOSPC)
                        return -ENOSPC;
                printf("Can't write signature for '%s' signature node in '%s' conf node: %s\n",
                       node_name, image_name, fdt_strerror(ret));
--
Quoted 2 lines

2.25.1

Regards,
Simon

author maintainer
#5 lore raw

PATCH v3 2/5 mkimage: fit_image: handle multiple errors when writing signatures

Am Sonntag, 31. Mai 2020, 16:07:56 CEST schrieb Simon Glass:

Quoted 23 lines

Hi Heiko,

Quoted 13 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

fit_image_write_sig() contains mostly functions from libfdt that return FDT_ERR_foo errors but also a call to fit_set_timestamp() which returns a regular error.

When handling the size increase via multiple iterations, check for both -FDT_ERR_NOSPACE but also for -ENOSPC.

There is no real conflict, as FDT_ERR_NOSPACE = 3 = ESRCH (No such process) and ENOSPC = 28 which is above any FDT_ERR_*.

Quoted 6 lines
---
 tools/image-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 3 lines

Changing my mind on this - I wonder if we can change fit_image_write_sig() to always return an errno code, never an FDT code? Could be a follow-on patch.

I'll take that suggestion and do a followup with this suggestion, simply because this may open up additional discussion.

Heiko

Quoted 20 lines
Quoted 14 lines
tools/image-host.c +1 -2
index 9a83b7f675..baf9590f3b 100644
@@ -241,7 +241,7 @@ static int fit_image_process_sig(const char *keydir, void *keydest,
        ret = fit_image_write_sig(fit, noffset, value, value_len, comment,
                        NULL, 0, cmdname);
        if (ret) {
-               if (ret == -FDT_ERR_NOSPACE)
+               if (ret == -FDT_ERR_NOSPACE || ret == -ENOSPC)
                        return -ENOSPC;
                printf("Can't write signature for '%s' signature node in '%s' conf node: %s\n",
                       node_name, image_name, fdt_strerror(ret));
--
Quoted 2 lines

2.25.1

Regards,
Simon

author maintainer
#6 lore raw

PATCH v3 3/5 spl: fit: enable signing a generated u-boot.itb

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

With SPL_FIT_SIGNATURE enabled we will likely want a generated u-boot.itb to be signed and the key stores so that the spl can reach it.

So add a SPL_FIT_SIGNATURE_KEY_DIR option and suitable hooks into the Makefile to have mkimage sign the .itb and store the used key into the spl dtb file.

The added dependencies should make sure that the u-boot.itb gets generated before the spl-binary gets build, so that there is the necessary space for the key to get included.

---
changes in v2.1:
- depend on $(CONFIG_SPL_FIT_SIGNATURE)$(U_BOOT_ITS) instead of only $(CONFIG_SPL_FIT_GENERATOR)

 Kconfig  |  8 ++++++++
 Makefile | 11 ++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
Kconfig +8 -0
index 0c184f7f06..bab7c4f3ee 100644
@@ -465,6 +465,14 @@ config SPL_FIT_SIGNATURE
 	select SPL_RSA_VERIFY
 	select SPL_IMAGE_SIGN_INFO
 
+config SPL_FIT_SIGNATURE_KEY_DIR
+	string "key directory for signing U-Boot FIT image"
+	depends on SPL_FIT_SIGNATURE
+	default "keys"
+	help
+	  The directory to give to mkimage to retrieve keys from when
+	  generating a signed U-Boot FIT image.
+
 config SPL_LOAD_FIT
 	bool "Enable SPL loading U-Boot as a FIT (basic fitImage features)"
 	select SPL_FIT
Makefile +10 -1
index 463fa72e3f..b8f7536940 100644
@@ -1407,6 +1407,14 @@ MKIMAGEFLAGS_u-boot.itb =
 else
 MKIMAGEFLAGS_u-boot.itb = -E
 endif
+ifdef CONFIG_SPL_FIT_SIGNATURE
+ifdef CONFIG_SPL_OF_CONTROL
+MKIMAGEFLAGS_u-boot.itb += -K dts/dt-spl.dtb -r
+ifneq ($(CONFIG_SPL_FIT_SIGNATURE_KEY_DIR),"")
+MKIMAGEFLAGS_u-boot.itb += -k $(CONFIG_SPL_FIT_SIGNATURE_KEY_DIR)
+endif
+endif
+endif
 
 u-boot.itb: u-boot-nodtb.bin \
 		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_OF_HOSTFILE),dts/dt.dtb) \
@@ -1929,7 +1937,8 @@ spl/u-boot-spl.bin: spl/u-boot-spl
 
 spl/u-boot-spl: tools prepare \
 		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \
-		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb)
+		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb) \
+		$(if $(CONFIG_SPL_FIT_SIGNATURE)$(U_BOOT_ITS),u-boot.itb FORCE)
 	$(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl all
 
 spl/sunxi-spl.bin: spl/u-boot-spl
Signature · 1 line
2.25.1
#7 lore raw

PATCH v3 3/5 spl: fit: enable signing a generated u-boot.itb

Quoted 17 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

With SPL_FIT_SIGNATURE enabled we will likely want a generated u-boot.itb to be signed and the key stores so that the spl can reach it.

So add a SPL_FIT_SIGNATURE_KEY_DIR option and suitable hooks into the Makefile to have mkimage sign the .itb and store the used key into the spl dtb file.

The added dependencies should make sure that the u-boot.itb gets generated before the spl-binary gets build, so that there is the necessary space for the key to get included.

Quoted 9 lines

---
changes in v2.1:
- depend on $(CONFIG_SPL_FIT_SIGNATURE)$(U_BOOT_ITS) instead of only $(CONFIG_SPL_FIT_GENERATOR)

 Kconfig  |  8 ++++++++
 Makefile | 11 ++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
author maintainer
#8 lore raw

PATCH v3 4/5 spl: fit: add Kconfig option to specify key-hint for fit_generator

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

The u-boot.itb can be generated either from a static .its that can simply include the needed signature nodes with key-hints or from a fit-generator script referenced in CONFIG_SPL_FIT_GENERATOR.

In the script-case it will need to know what key to include for the key-hint and specified algorithm, so add an option for that key-name.

---
changes in v2:
- add doc snippet explaining the option

 Kconfig                  |  8 ++++++++
 doc/uImage.FIT/howto.txt | 13 +++++++++++++
 2 files changed, 21 insertions(+)
Kconfig +8 -0
index bab7c4f3ee..6a9bf8d865 100644
@@ -548,6 +548,14 @@ config SPL_FIT_GENERATOR
 	  passed a list of supported device tree file stub names to
 	  include in the generated image.
 
+config SPL_FIT_GENERATOR_KEY_HINT
+	string "key hint for signing U-Boot FIT image"
+	depends on SPL_FIT_SIGNATURE
+	default "dev"
+	help
+	  The key hint to store in both the generated .its file as well as
+	  u-boot-key.dtb generated separately and embedded into the SPL.
+
 endif # SPL
 
 endif # FIT
doc/uImage.FIT/howto.txt +13 -0
index 8592719685..f409b3770e 100644
@@ -66,6 +66,19 @@ can point to a script which generates this image source file during
 the build process. It gets passed a list of device tree files (taken from the
 CONFIG_OF_LIST symbol).
 
+Signing u-boot.itb with SPL_FIT_GENERATOR
+-----------------------------------------
+
+u-boot.itb can be signed to verify the integrity of its components.
+When CONFIG_SPL_FIT_SIGNATURE is enabled the CONFIG_SPL_FIT_SIGNATURE_KEY_DIR
+option can be used to specifiy the key directory - either a relative or
+absolute path.
+
+See signature.txt for general signature handling, but when
+CONFIG_SPL_FIT_GENERATOR is used the option CONFIG_SPL_FIT_GENERATOR_KEY_HINT
+can be used to specify the key-hint that should be included into the
+created u-boot.its by the generator.
+
 Example 1 -- old-style (non-FDT) kernel booting
 -----------------------------------------------
 
Signature · 1 line
2.25.1
author maintainer
#9 lore raw

PATCH v3 5/5 rockchip: make_fit_atf: add signature handling

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

If the newly added fit-generator key-options are found, append needed signature nodes to all generated image blocks, so that they can get signed when mkimage later compiles the .itb from the generated .its.

---
 arch/arm/mach-rockchip/make_fit_atf.py | 51 +++++++++++++++++++++++++-
 1 file changed, 50 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/make_fit_atf.py +50 -1
index d15c32b303..5b353f9d0a 100755
@@ -14,6 +14,8 @@ import sys
 import getopt
 import logging
 import struct
+import Crypto
+from Crypto.PublicKey import RSA
 
 DT_HEADER = """
 /*
@@ -37,7 +39,9 @@ DT_UBOOT = """
 			arch = "arm64";
 			compression = "none";
 			load = <0x%08x>;
-		};
+"""
+
+DT_UBOOT_NODE_END = """		};
 
 """
 
@@ -47,6 +51,46 @@ DT_IMAGES_NODE_END = """	};
 
 DT_END = "};"
 
+def append_signature(file):
+    if not os.path.exists("u-boot.cfg"):
+        return
+
+    config = {}
+    with open("u-boot.cfg") as fd:
+        for line in fd:
+            line = line.strip()
+            values = line[8:].split(' ', 1)
+            if len(values) > 1:
+                key, value = values
+                value = value.strip('"')
+            else:
+                key = values[0]
+                value = '1'
+            if not key.startswith('CONFIG_'):
+                continue
+            config[key] = value
+
+    try:
+        keyhint = config["CONFIG_SPL_FIT_GENERATOR_KEY_HINT"]
+    except KeyError:
+        return
+
+    try:
+        keyfile = os.path.join(config["CONFIG_SPL_FIT_SIGNATURE_KEY_DIR"], keyhint)
+    except KeyError:
+        keyfile = keyhint
+
+    if not os.path.exists('%s.key' % keyfile):
+        return
+
+    f = open('%s.key' % keyfile,'r')
+    key = RSA.importKey(f.read())
+
+    file.write('\t\t\tsignature {\n')
+    file.write('\t\t\t\talgo = "sha256,rsa%s";\n' % key.n.bit_length())
+    file.write('\t\t\t\tkey-name-hint = "%s";\n' % keyhint)
+    file.write('\t\t\t};\n')
+
 def append_bl31_node(file, atf_index, phy_addr, elf_entry):
     # Append BL31 DT node to input FIT dts file.
     data = 'bl31_0x%08x.bin' % phy_addr
@@ -60,6 +104,7 @@ def append_bl31_node(file, atf_index, phy_addr, elf_entry):
     file.write('\t\t\tload = <0x%08x>;\n' % phy_addr)
     if atf_index == 1:
         file.write('\t\t\tentry = <0x%08x>;\n' % elf_entry)
+    append_signature(file);
     file.write('\t\t};\n')
     file.write('\n')
 
@@ -75,6 +120,7 @@ def append_tee_node(file, atf_index, phy_addr, elf_entry):
     file.write('\t\t\tcompression = "none";\n')
     file.write('\t\t\tload = <0x%08x>;\n' % phy_addr)
     file.write('\t\t\tentry = <0x%08x>;\n' % elf_entry)
+    append_signature(file);
     file.write('\t\t};\n')
     file.write('\n')
 
@@ -88,6 +134,7 @@ def append_fdt_node(file, dtbs):
         file.write('\t\t\tdata = /incbin/("%s");\n' % dtb)
         file.write('\t\t\ttype = "flat_dt";\n')
         file.write('\t\t\tcompression = "none";\n')
+        append_signature(file);
         file.write('\t\t};\n')
         file.write('\n')
         cnt = cnt + 1
@@ -129,6 +176,8 @@ def generate_atf_fit_dts_uboot(fit_file, uboot_file_name):
         raise ValueError("Invalid u-boot ELF image '%s'" % uboot_file_name)
     index, entry, p_paddr, data = segments[0]
     fit_file.write(DT_UBOOT % p_paddr)
+    append_signature(fit_file)
+    fit_file.write(DT_UBOOT_NODE_END)
 
 def generate_atf_fit_dts_bl31(fit_file, bl31_file_name, tee_file_name, dtbs_file_name):
     segments = unpack_elf(bl31_file_name)
Signature · 1 line
2.25.1
#10 lore raw

PATCH v3 5/5 rockchip: make_fit_atf: add signature handling

Quoted 7 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

If the newly added fit-generator key-options are found, append needed signature nodes to all generated image blocks, so that they can get signed when mkimage later compiles the .itb from the generated .its.

Quoted 6 lines
---
 arch/arm/mach-rockchip/make_fit_atf.py | 51 +++++++++++++++++++++++++-
 1 file changed, 50 insertions(+), 1 deletion(-)

Maybe I am repeating myself, but this really should move to binman I think. I'll send a few patches that might help.

- Simon

#11 lore raw

v3 cover rockchip: make it possible to sign the u-boot.itb

In reply to Heiko Stuebner

Hi Heiko,

??? This patch set make rk3288 series board build fail. Could you help
to check again?

Thanks,

- Kever

Quoted 42 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

This series makes it possible to sign a generated u-boot.itb automatically even if the its-source got created by a generator script.

To let the SPL know about the key, the -K option for mkimage points to the dts/dt-spl.dtb which can then get included into the spl binary.

Tested on Rockchip PX30 with a TPL -> SPL -> U-Boot.itb bootchain.

I've split out the the rsa/crypto fixes into a separate series starting at [0].

[0] https://patchwork.ozlabs.org/project/uboot/patch/20200522141937.3523692-1-heiko at sntech.de/

changes in v3:
- add patch to fix imx make_fit_atf.sh error handling
- split out rsa fixes into separate series
changes in v2.1:
- depend on $(CONFIG_SPL_FIT_SIGNATURE)$(U_BOOT_ITS) instead of only $(CONFIG_SPL_FIT_GENERATOR)
changes in v2:
- add received reviews
- fix commit message typo
- add doc snippet explaining CONFIG_SPL_FIT_GENERATOR_KEY_HINT

Heiko Stuebner (5):
imx: mkimage_fit_atf: Fix FIT image if BL31.bin missing
mkimage: fit_image: handle multiple errors when writing signatures
spl: fit: enable signing a generated u-boot.itb
spl: fit: add Kconfig option to specify key-hint for fit_generator
rockchip: make_fit_atf: add signature handling

  Kconfig                                | 16 ++++++++
  Makefile                               | 11 +++++-
  arch/arm/mach-imx/mkimage_fit_atf.sh   |  4 +-
  arch/arm/mach-rockchip/make_fit_atf.py | 51 +++++++++++++++++++++++++-
  doc/uImage.FIT/howto.txt               | 13 +++++++
  tools/image-host.c                     |  2 +-
  6 files changed, 92 insertions(+), 5 deletions(-)
author maintainer
#12 lore raw

v3 cover rockchip: make it possible to sign the u-boot.itb

Hi Kever,

Am Sonntag, 31. Mai 2020, 10:28:45 CEST schrieb Kever Yang:

Quoted 2 lines

This patch set make rk3288 series board build fail. Could you help
to check again?

the additional patch in v4 adding the ifdef CONFIG_SPL_FIT clamp, should hopefully fix this

Heiko

Quoted 46 lines · Heiko Stuebner
Quoted 42 lines

From: Heiko Stuebner <[email protected]>

This series makes it possible to sign a generated u-boot.itb automatically even if the its-source got created by a generator script.

To let the SPL know about the key, the -K option for mkimage points to the dts/dt-spl.dtb which can then get included into the spl binary.

Tested on Rockchip PX30 with a TPL -> SPL -> U-Boot.itb bootchain.

I've split out the the rsa/crypto fixes into a separate series starting at [0].

[0] https://patchwork.ozlabs.org/project/uboot/patch/20200522141937.3523692-1-heiko at sntech.de/

changes in v3:
- add patch to fix imx make_fit_atf.sh error handling
- split out rsa fixes into separate series
changes in v2.1:
- depend on $(CONFIG_SPL_FIT_SIGNATURE)$(U_BOOT_ITS) instead of only $(CONFIG_SPL_FIT_GENERATOR)
changes in v2:
- add received reviews
- fix commit message typo
- add doc snippet explaining CONFIG_SPL_FIT_GENERATOR_KEY_HINT

Heiko Stuebner (5):
imx: mkimage_fit_atf: Fix FIT image if BL31.bin missing
mkimage: fit_image: handle multiple errors when writing signatures
spl: fit: enable signing a generated u-boot.itb
spl: fit: add Kconfig option to specify key-hint for fit_generator
rockchip: make_fit_atf: add signature handling

  Kconfig                                | 16 ++++++++
  Makefile                               | 11 +++++-
  arch/arm/mach-imx/mkimage_fit_atf.sh   |  4 +-
  arch/arm/mach-rockchip/make_fit_atf.py | 51 +++++++++++++++++++++++++-
  doc/uImage.FIT/howto.txt               | 13 +++++++
  tools/image-host.c                     |  2 +-
  6 files changed, 92 insertions(+), 5 deletions(-)
#13 lore raw

v3 cover rockchip: make it possible to sign the u-boot.itb

Hi,

Quoted 54 lines · Heiko Stuebner

Hi Kever,

Am Sonntag, 31. Mai 2020, 10:28:45 CEST schrieb Kever Yang:

Quoted 2 lines

This patch set make rk3288 series board build fail. Could you help
to check again?

the additional patch in v4 adding the ifdef CONFIG_SPL_FIT clamp, should hopefully fix this

Heiko

Quoted 42 lines · Heiko Stuebner
Quoted 41 lines

From: Heiko Stuebner <[email protected]>

This series makes it possible to sign a generated u-boot.itb automatically even if the its-source got created by a generator script.

To let the SPL know about the key, the -K option for mkimage points to the dts/dt-spl.dtb which can then get included into the spl binary.

Tested on Rockchip PX30 with a TPL -> SPL -> U-Boot.itb bootchain.

I've split out the the rsa/crypto fixes into a separate series starting at [0].

[0] https://patchwork.ozlabs.org/project/uboot/patch/20200522141937.3523692-1-heiko at sntech.de/

changes in v3:
- add patch to fix imx make_fit_atf.sh error handling
- split out rsa fixes into separate series
changes in v2.1:
- depend on $(CONFIG_SPL_FIT_SIGNATURE)$(U_BOOT_ITS) instead of only $(CONFIG_SPL_FIT_GENERATOR)
changes in v2:
- add received reviews
- fix commit message typo
- add doc snippet explaining CONFIG_SPL_FIT_GENERATOR_KEY_HINT

Heiko Stuebner (5):
imx: mkimage_fit_atf: Fix FIT image if BL31.bin missing
mkimage: fit_image: handle multiple errors when writing signatures
spl: fit: enable signing a generated u-boot.itb
spl: fit: add Kconfig option to specify key-hint for fit_generator
rockchip: make_fit_atf: add signature handling

  Kconfig                                | 16 ++++++++
  Makefile                               | 11 +++++-
  arch/arm/mach-imx/mkimage_fit_atf.sh   |  4 +-
  arch/arm/mach-rockchip/make_fit_atf.py | 51 +++++++++++++++++++++++++-
  doc/uImage.FIT/howto.txt               | 13 +++++++
  tools/image-host.c                     |  2 +-
  6 files changed, 92 insertions(+), 5 deletions(-)

Please no more adding to this script. It should be removed and use binman to make images.

Regards,
Simon