Skip to contentSkip to conversation

tools: image-host: fix wrong return value

PATCH In review [email protected] 3 participants 3 messages May 31, 2021 – Jul 15, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: image-host: fix wrong return value

From: Ming Liu <[email protected]>

The return value '-ENOSPC' of fit_set_timestamp function does not match the caller fit_image_write_sig's expection which is '-FDT_ERR_NOSPACE'.

Fix it by not calling fit_set_timestamp, but call fdt_setprop instead.

This fixes a following mkimage error:

| Can't write signature for 'signature@1' signature node in
| '[email protected]' conf node: <unknown error>
| mkimage Can't add hashes to FIT blob: -1
---
 tools/image-host.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/image-host.c +3 -1
index 270d36fe45..73095461a7 100644
@@ -132,8 +132,10 @@ static int fit_image_write_sig(void *fit, int noffset, uint8_t *value,
 	if (!ret) {
 		time_t timestamp = imagetool_get_source_date(cmdname,
 							     time(NULL));
+		uint32_t t = cpu_to_uimage(timestamp);
 
-		ret = fit_set_timestamp(fit, noffset, timestamp);
+		ret = fdt_setprop(fit, noffset, FIT_TIMESTAMP_PROP, &t,
+			sizeof(uint32_t));
 	}
 	if (region_prop && !ret) {
 		uint32_t strdata[2];
Signature · 1 line
2.29.0
Tested-by on v1 1/1
#1 lore raw

Hi Ming,

Quoted 35 lines · On Mon, May 31, 2021 at 10:05 AM <[email protected]> wrote:

From: Ming Liu <[email protected]>

The return value '-ENOSPC' of fit_set_timestamp function does not match the caller fit_image_write_sig's expection which is '-FDT_ERR_NOSPACE'.

Fix it by not calling fit_set_timestamp, but call fdt_setprop instead.

This fixes a following mkimage error:

| Can't write signature for 'signature@1' signature node in
| '[email protected]' conf node: <unknown error>
| mkimage Can't add hashes to FIT blob: -1
---
 tools/image-host.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/image-host.c +3 -2
index 270d36fe45..73095461a7 100644
@@ -132,8 +132,10 @@ static int fit_image_write_sig(void *fit, int noffset, uint8_t *value,
        if (!ret) {
                time_t timestamp = imagetool_get_source_date(cmdname,
                                                             time(NULL));
+               uint32_t t = cpu_to_uimage(timestamp);
 
-               ret = fit_set_timestamp(fit, noffset, timestamp);
+               ret = fdt_setprop(fit, noffset, FIT_TIMESTAMP_PROP, &t,
+                       sizeof(uint32_t));
        }
        if (region_prop && !ret) {
                uint32_t strdata[2];
--
Quoted 2 lines

2.29.0

I've hit exactly the same issue on my side today :)

Signature · 7 lines
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk
Embedded Software Engineer
T:  +380 938364067
E: [email protected]
W: www.foundries.io
#2 lore raw
In reply to [email protected]
Quoted 7 lines · On Mon, May 31, 2021 at 09:04:51AM +0200, [email protected] wrote:

From: Ming Liu <[email protected]>

The return value '-ENOSPC' of fit_set_timestamp function does not match the caller fit_image_write_sig's expection which is '-FDT_ERR_NOSPACE'.

Fix it by not calling fit_set_timestamp, but call fdt_setprop instead.

Quoted 7 lines

This fixes a following mkimage error:

| Can't write signature for 'signature@1' signature node in
| '[email protected]' conf node: <unknown error>
| mkimage Can't add hashes to FIT blob: -1

Applied to u-boot/master, thanks!

Signature · 1 line
Tom