diff mbox series

[v2,3/4] mkimage: Move padding commands outside of FIT_SIGNATURE

Message ID 20201208041216.888902-4-joel@jms.id.au
State Accepted
Commit 603e26f76346a36594eda78daa2b7d95ce96b497
Headers show
Series mkimage usability fixes | expand

Commit Message

Joel Stanley Dec. 8, 2020, 4:12 a.m. UTC
These commands were disabled when CONFIG_FIT_SIGNATURE is disabled, but
they do not depend on crypto support so they can be unconditionally
enabled.

Signed-off-by: Joel Stanley <joel@jms.id.au>

--
v2: New patch
---
 tools/mkimage.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

-- 
2.29.2

Comments

Philippe REYNES Dec. 8, 2020, 3:35 p.m. UTC | #1
Hi Joel


Le 08/12/2020 à 05:12, Joel Stanley a écrit :
> These commands were disabled when CONFIG_FIT_SIGNATURE is disabled, but

> they do not depend on crypto support so they can be unconditionally

> enabled.

>

> Signed-off-by: Joel Stanley <joel@jms.id.au>

> --

> v2: New patch

> ---

>   tools/mkimage.c | 11 ++++++-----

>   1 file changed, 6 insertions(+), 5 deletions(-)

>

> diff --git a/tools/mkimage.c b/tools/mkimage.c

> index e78608293e72..68d5206cb4fd 100644

> --- a/tools/mkimage.c

> +++ b/tools/mkimage.c

> @@ -94,18 +94,18 @@ static void usage(const char *msg)

>   		"          -x ==> set XIP (execute in place)\n",

>   		params.cmdname);

>   	fprintf(stderr,

> -		"       %s [-D dtc_options] [-f fit-image.its|-f auto|-F] [-b <dtb> [-b <dtb>]] [-i <ramdisk.cpio.gz>] fit-image\n"

> +		"       %s [-D dtc_options] [-f fit-image.its|-f auto|-F] [-b <dtb> [-b <dtb>]] [-E] [-B size] [-i <ramdisk.cpio.gz>] fit-image\n"

>   		"           <dtb> file is used with -f auto, it may occur multiple times.\n",

>   		params.cmdname);

>   	fprintf(stderr,

>   		"          -D => set all options for device tree compiler\n"

>   		"          -f => input filename for FIT source\n"

> -		"          -i => input filename for ramdisk file\n");

> +		"          -i => input filename for ramdisk file\n"

> +		"          -E => place data outside of the FIT structure\n"

> +		"          -B => align size in hex for FIT structure and header\n");

>   #ifdef CONFIG_FIT_SIGNATURE

>   	fprintf(stderr,

> -		"Signing / verified boot options: [-E] [-B size] [-k keydir] [-K dtb] [ -c <comment>] [-p addr] [-r] [-N engine]\n"

> -		"          -E => place data outside of the FIT structure\n"

> -		"          -B => align size in hex for FIT structure and header\n"

> +		"Signing / verified boot options: [-k keydir] [-K dtb] [ -c <comment>] [-p addr] [-r] [-N engine]\n"

>   		"          -k => set directory containing private keys\n"

>   		"          -K => write public keys to this .dtb file\n"

>   		"          -c => add comment in signature node\n"

Option -p is a generic option, not a signing option. it defines the 
offset of the padding.
So it should be moved above.

Option -k, -K are also used for ciphering. So it signature is disabled 
and ciphering is enabled, the help won't display those options.
I think it could be acceptable to  use #if 
CONFIG_IS_ENABLED(FIT_SIGNATURE) || CONFIG_IS_ENABLED(FIT_CIPHER)
and also change a bit the text "Signing / verified option ..."


> @@ -142,6 +142,7 @@ static int add_content(int type, const char 

> *fname) return 0; } +#define OPT_STRING 

> "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qstT:vVx"


I think that OPT_STRING should be defined in the next patch.

>   static void process_args(int argc, char **argv)

>   {

>   	char *ptr;

Regards,
Philippe
Tom Rini Jan. 23, 2021, 5:46 p.m. UTC | #2
On Tue, Dec 08, 2020 at 02:42:15PM +1030, Joel Stanley wrote:

> These commands were disabled when CONFIG_FIT_SIGNATURE is disabled, but

> they do not depend on crypto support so they can be unconditionally

> enabled.

> 

> Signed-off-by: Joel Stanley <joel@jms.id.au>


Applied to u-boot/master, thanks!

-- 
Tom
diff mbox series

Patch

diff --git a/tools/mkimage.c b/tools/mkimage.c
index e78608293e72..68d5206cb4fd 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -94,18 +94,18 @@  static void usage(const char *msg)
 		"          -x ==> set XIP (execute in place)\n",
 		params.cmdname);
 	fprintf(stderr,
-		"       %s [-D dtc_options] [-f fit-image.its|-f auto|-F] [-b <dtb> [-b <dtb>]] [-i <ramdisk.cpio.gz>] fit-image\n"
+		"       %s [-D dtc_options] [-f fit-image.its|-f auto|-F] [-b <dtb> [-b <dtb>]] [-E] [-B size] [-i <ramdisk.cpio.gz>] fit-image\n"
 		"           <dtb> file is used with -f auto, it may occur multiple times.\n",
 		params.cmdname);
 	fprintf(stderr,
 		"          -D => set all options for device tree compiler\n"
 		"          -f => input filename for FIT source\n"
-		"          -i => input filename for ramdisk file\n");
+		"          -i => input filename for ramdisk file\n"
+		"          -E => place data outside of the FIT structure\n"
+		"          -B => align size in hex for FIT structure and header\n");
 #ifdef CONFIG_FIT_SIGNATURE
 	fprintf(stderr,
-		"Signing / verified boot options: [-E] [-B size] [-k keydir] [-K dtb] [ -c <comment>] [-p addr] [-r] [-N engine]\n"
-		"          -E => place data outside of the FIT structure\n"
-		"          -B => align size in hex for FIT structure and header\n"
+		"Signing / verified boot options: [-k keydir] [-K dtb] [ -c <comment>] [-p addr] [-r] [-N engine]\n"
 		"          -k => set directory containing private keys\n"
 		"          -K => write public keys to this .dtb file\n"
 		"          -c => add comment in signature node\n"
@@ -142,6 +142,7 @@  static int add_content(int type, const char *fname)
 	return 0;
 }
 
+#define OPT_STRING "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qstT:vVx"
 static void process_args(int argc, char **argv)
 {
 	char *ptr;