[v4,6/9] cmd: efitool: add images command

Message ID 20190115025522.12060-7-takahiro.akashi@linaro.org
State New
Headers show
Series
  • cmd: add efitool for efi environment
Related show

Commit Message

AKASHI Takahiro Jan. 15, 2019, 2:55 a.m.
"images" command prints loaded images-related information.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 cmd/efitool.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Heinrich Schuchardt Jan. 15, 2019, 4:58 a.m. | #1
On 1/15/19 3:55 AM, AKASHI Takahiro wrote:
> "images" command prints loaded images-related information.
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  cmd/efitool.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/cmd/efitool.c b/cmd/efitool.c
> index 4bd6367b4bd9..e77273fc6e1e 100644
> --- a/cmd/efitool.c
> +++ b/cmd/efitool.c
> @@ -533,6 +533,13 @@ static int do_efi_show_handles(int argc, char * const argv[])
>  	return CMD_RET_SUCCESS;
>  }
>  
> +static int do_efi_show_images(int argc, char * const argv[])
> +{
> +	efi_print_image_infos(NULL);
> +
> +	return CMD_RET_SUCCESS;
> +}
> +
>  static int do_efi_boot_add(int argc, char * const argv[])
>  {

Please, use the standard way of adding sub-commands. See
doc/README.commands.

Best regards

Heinrich

>  	int id;
> @@ -946,6 +953,8 @@ static int do_efitool(cmd_tbl_t *cmdtp, int flag,
>  		return do_efi_show_drivers(argc, argv);
>  	else if (!strcmp(command, "dh"))
>  		return do_efi_show_handles(argc, argv);
> +	else if (!strcmp(command, "images"))
> +		return do_efi_show_images(argc, argv);
>  	else
>  		return CMD_RET_USAGE;
>  }
> @@ -976,7 +985,9 @@ static char efitool_help_text[] =
>  	"efitool drivers\n"
>  	"  - show uefi drivers\n"
>  	"efitool dh\n"
> -	"  - show uefi handles\n";
> +	"  - show uefi handles\n"
> +	"efitool images\n"
> +	"  - show loaded images\n";
>  #endif
>  
>  U_BOOT_CMD(
>
AKASHI Takahiro Jan. 17, 2019, 6:02 a.m. | #2
On Tue, Jan 15, 2019 at 05:58:57AM +0100, Heinrich Schuchardt wrote:
> On 1/15/19 3:55 AM, AKASHI Takahiro wrote:
> > "images" command prints loaded images-related information.
> > 
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  cmd/efitool.c | 13 ++++++++++++-
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> > 
> > diff --git a/cmd/efitool.c b/cmd/efitool.c
> > index 4bd6367b4bd9..e77273fc6e1e 100644
> > --- a/cmd/efitool.c
> > +++ b/cmd/efitool.c
> > @@ -533,6 +533,13 @@ static int do_efi_show_handles(int argc, char * const argv[])
> >  	return CMD_RET_SUCCESS;
> >  }
> >  
> > +static int do_efi_show_images(int argc, char * const argv[])
> > +{
> > +	efi_print_image_infos(NULL);
> > +
> > +	return CMD_RET_SUCCESS;
> > +}
> > +
> >  static int do_efi_boot_add(int argc, char * const argv[])
> >  {
> 
> Please, use the standard way of adding sub-commands. See
> doc/README.commands.

OK

-Takahiro Akashi

> Best regards
> 
> Heinrich
> 
> >  	int id;
> > @@ -946,6 +953,8 @@ static int do_efitool(cmd_tbl_t *cmdtp, int flag,
> >  		return do_efi_show_drivers(argc, argv);
> >  	else if (!strcmp(command, "dh"))
> >  		return do_efi_show_handles(argc, argv);
> > +	else if (!strcmp(command, "images"))
> > +		return do_efi_show_images(argc, argv);
> >  	else
> >  		return CMD_RET_USAGE;
> >  }
> > @@ -976,7 +985,9 @@ static char efitool_help_text[] =
> >  	"efitool drivers\n"
> >  	"  - show uefi drivers\n"
> >  	"efitool dh\n"
> > -	"  - show uefi handles\n";
> > +	"  - show uefi handles\n"
> > +	"efitool images\n"
> > +	"  - show loaded images\n";
> >  #endif
> >  
> >  U_BOOT_CMD(
> > 
>

Patch

diff --git a/cmd/efitool.c b/cmd/efitool.c
index 4bd6367b4bd9..e77273fc6e1e 100644
--- a/cmd/efitool.c
+++ b/cmd/efitool.c
@@ -533,6 +533,13 @@  static int do_efi_show_handles(int argc, char * const argv[])
 	return CMD_RET_SUCCESS;
 }
 
+static int do_efi_show_images(int argc, char * const argv[])
+{
+	efi_print_image_infos(NULL);
+
+	return CMD_RET_SUCCESS;
+}
+
 static int do_efi_boot_add(int argc, char * const argv[])
 {
 	int id;
@@ -946,6 +953,8 @@  static int do_efitool(cmd_tbl_t *cmdtp, int flag,
 		return do_efi_show_drivers(argc, argv);
 	else if (!strcmp(command, "dh"))
 		return do_efi_show_handles(argc, argv);
+	else if (!strcmp(command, "images"))
+		return do_efi_show_images(argc, argv);
 	else
 		return CMD_RET_USAGE;
 }
@@ -976,7 +985,9 @@  static char efitool_help_text[] =
 	"efitool drivers\n"
 	"  - show uefi drivers\n"
 	"efitool dh\n"
-	"  - show uefi handles\n";
+	"  - show uefi handles\n"
+	"efitool images\n"
+	"  - show loaded images\n";
 #endif
 
 U_BOOT_CMD(