Skip to contentSkip to conversation

imx: hab: Allow hab_auth_img_or_fail to be called without ivt_offset

PATCH New Fabio Estevam 2 participants 6 messages Sep 7, 2023 – Sep 23, 2023

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/3 imx: hab: Allow hab_auth_img_or_fail to be called without ivt_offset

From: Eduard Strehlau <[email protected]>

Since commit ea91031b2232 ("imx: hab: extend hab_auth_img to calculate ivt_offset"), it is possible to call the hab_auth_img command without the last ivt_offset argument.

Currently, calling hab_auth_img_or_fail without the last ivt_offset parameter causes a failure and the command usage text is shown.

Fix this problem by adjusting the argc logic to allow calling hab_auth_img_or_fail with only the address and size parameters.

This way, both hab_auth_img and hab_auth_img_or_fail have the same behavior with respect to the allowed number of command parameters.

---
 arch/arm/mach-imx/hab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/hab.c +1 -1
index 439cdaf07a7c..6cacca069d9f 100644
@@ -659,7 +659,7 @@ static int do_authenticate_image_or_failover(struct cmd_tbl *cmdtp, int flag,
 {
 	int ret = CMD_RET_FAILURE;
 
-	if (argc != 4) {
+	if (argc < 3) {
 		ret = CMD_RET_USAGE;
 		goto error;
 	}
Signature · 1 line
2.34.1
author reviewer
#1 lore raw

PATCH 2/3 imx: hab: Improve the hab_auth_img_or_fail usage text

From: Fabio Estevam <[email protected]>

Split the hab_auth_img_or_fail usage text in two sentences to make it clearer.

---
 arch/arm/mach-imx/hab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/hab.c +1 -1
index 6cacca069d9f..ea9c5d3c9fd4 100644
@@ -712,7 +712,7 @@ U_BOOT_CMD(
 U_BOOT_CMD(
 		hab_auth_img_or_fail, 4, 0,
 		do_authenticate_image_or_failover,
-		"authenticate image via HAB on failure drop to USB BootROM mode",
+		"authenticate image via HAB. Switch to USB BootROM mode on failure",
 		"addr length ivt_offset\n"
 		"addr - image hex address\n"
 		"length - image hex length\n"
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/3 imx: hab: Improve the hab_auth_img_or_fail usage text

Quoted 4 lines

From: Fabio Estevam <[email protected]>
Split the hab_auth_img_or_fail usage text in two sentences to make it clearer.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
author reviewer
#3 lore raw

PATCH 3/3 imx: hab: Explain that ivt_offset is optional

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

The ivt_offset parameter is optional for both hab_auth_img_or_fail and hab_auth_img commands.

Document it in their usage texts to make it clearer.

---
 arch/arm/mach-imx/hab.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-imx/hab.c +2 -2
index ea9c5d3c9fd4..41121d575734 100644
@@ -700,7 +700,7 @@ U_BOOT_CMD(
 		"addr length ivt_offset\n"
 		"addr - image hex address\n"
 		"length - image hex length\n"
-		"ivt_offset - hex offset of IVT in the image"
+		"ivt_offset - hex offset of IVT in the image (optional)"
 	  );
 
 U_BOOT_CMD(
@@ -716,7 +716,7 @@ U_BOOT_CMD(
 		"addr length ivt_offset\n"
 		"addr - image hex address\n"
 		"length - image hex length\n"
-		"ivt_offset - hex offset of IVT in the image"
+		"ivt_offset - hex offset of IVT in the image (optional)"
 	  );
 
 U_BOOT_CMD(
Signature · 1 line
2.34.1
#4 lore raw

PATCH 3/3 imx: hab: Explain that ivt_offset is optional

Quoted 5 lines

From: Fabio Estevam <[email protected]>
The ivt_offset parameter is optional for both hab_auth_img_or_fail and hab_auth_img commands.
Document it in their usage texts to make it clearer.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#5 lore raw

PATCH 1/3 imx: hab: Allow hab_auth_img_or_fail to be called without ivt_offset

In reply to Fabio Estevam
Quoted 11 lines

From: Eduard Strehlau <[email protected]>
Since commit ea91031b2232 ("imx: hab: extend hab_auth_img to calculate ivt_offset"), it is possible to call the hab_auth_img command without the last ivt_offset argument.
Currently, calling hab_auth_img_or_fail without the last ivt_offset parameter causes a failure and the command usage text is shown. Fix this problem by adjusting the argc logic to allow
calling hab_auth_img_or_fail with only the address and size parameters. This way, both hab_auth_img and hab_auth_img_or_fail have the same behavior with respect to the allowed number of command parameters.

Quoted 2 lines

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================