All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/3] sysboot: add zboot support to boot x86 Linux kernel image
@ 2021-02-02 11:56 Kory Maincent
  2021-02-02 11:56 ` [PATCH v4 2/3] command.h: Clean-up patch, remove extern from the header Kory Maincent
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kory Maincent @ 2021-02-02 11:56 UTC (permalink / raw)
  To: u-boot

Add "zboot" command to the list of supported boot in the label_boot
function.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Change since v1:
 - Modify comment.

Change since v2:
 - Update do_zboot to do_zboot_parent function to follow the patch:
   5588e776b0

Change since v3:
 - Follow review from Simon Glass
 - Add clean-up paches

 cmd/pxe_utils.c   | 4 ++++
 include/command.h | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index 3526a651d7..b788ee9576 100644
--- a/cmd/pxe_utils.c
+++ b/cmd/pxe_utils.c
@@ -657,6 +657,10 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
 	/* Try booting a Image */
 	else
 		do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
+#elif IS_ENABLED(CONFIG_CMD_ZBOOT)
+	/* Try booting an x86_64 Linux kernel image */
+	else
+		do_zboot_parent(cmdtp, 0, bootm_argc, bootm_argv, NULL);
 #endif
 	unmap_sysmem(buf);
 
diff --git a/include/command.h b/include/command.h
index e229bf2825..45d59f92d2 100644
--- a/include/command.h
+++ b/include/command.h
@@ -165,6 +165,9 @@ extern int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc,
 extern int do_booti(struct cmd_tbl *cmdtp, int flag, int argc,
 		    char *const argv[]);
 
+int do_zboot_parent(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[], int *repeatable);
+
 extern int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
 			   char *const argv[]);
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v4 2/3] command.h: Clean-up patch, remove extern from the header
  2021-02-02 11:56 [PATCH v4 1/3] sysboot: add zboot support to boot x86 Linux kernel image Kory Maincent
@ 2021-02-02 11:56 ` Kory Maincent
  2021-02-02 13:21   ` Bin Meng
  2021-02-02 11:56 ` [PATCH v4 3/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED Kory Maincent
  2021-02-02 13:19 ` [PATCH v4 1/3] sysboot: add zboot support to boot x86 Linux kernel image Bin Meng
  2 siblings, 1 reply; 6+ messages in thread
From: Kory Maincent @ 2021-02-02 11:56 UTC (permalink / raw)
  To: u-boot

Remove the extern of the header because they are useless.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 include/command.h | 56 +++++++++++++++++++++++------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/include/command.h b/include/command.h
index 45d59f92d2..747f8f8095 100644
--- a/include/command.h
+++ b/include/command.h
@@ -55,8 +55,8 @@ struct cmd_tbl {
 };
 
 #if defined(CONFIG_CMD_RUN)
-extern int do_run(struct cmd_tbl *cmdtp, int flag, int argc,
-		  char *const argv[]);
+int do_run(struct cmd_tbl *cmdtp, int flag, int argc,
+	   char *const argv[]);
 #endif
 
 /* common/command.c */
@@ -69,7 +69,7 @@ int complete_subcmdv(struct cmd_tbl *cmdtp, int count, int argc,
 		     char *const argv[], char last_char, int maxv,
 		     char *cmdv[]);
 
-extern int cmd_usage(const struct cmd_tbl *cmdtp);
+int cmd_usage(const struct cmd_tbl *cmdtp);
 
 /* Dummy ->cmd and ->cmd_rep wrappers. */
 int cmd_always_repeatable(struct cmd_tbl *cmdtp, int flag, int argc,
@@ -85,10 +85,10 @@ static inline bool cmd_is_repeatable(struct cmd_tbl *cmdtp)
 }
 
 #ifdef CONFIG_AUTO_COMPLETE
-extern int var_complete(int argc, char *const argv[], char last_char, int maxv,
-			char *cmdv[]);
-extern int cmd_auto_complete(const char *const prompt, char *buf, int *np,
-			     int *colp);
+int var_complete(int argc, char *const argv[], char last_char, int maxv,
+		 char *cmdv[]);
+int cmd_auto_complete(const char *const prompt, char *buf, int *np,
+		      int *colp);
 #endif
 
 /**
@@ -145,13 +145,13 @@ int cmd_get_data_size(char *arg, int default_size);
 #endif
 
 #ifdef CONFIG_CMD_BOOTD
-extern int do_bootd(struct cmd_tbl *cmdtp, int flag, int argc,
-		    char *const argv[]);
+int do_bootd(struct cmd_tbl *cmdtp, int flag, int argc,
+	     char *const argv[]);
 #endif
 #ifdef CONFIG_CMD_BOOTM
-extern int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc,
-		    char *const argv[]);
-extern int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd);
+int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc,
+	     char *const argv[]);
+int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd);
 #else
 static inline int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd)
 {
@@ -159,31 +159,31 @@ static inline int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd)
 }
 #endif
 
-extern int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc,
-		    char *const argv[]);
+int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc,
+	     char *const argv[]);
 
-extern int do_booti(struct cmd_tbl *cmdtp, int flag, int argc,
-		    char *const argv[]);
+int do_booti(struct cmd_tbl *cmdtp, int flag, int argc,
+	     char *const argv[]);
 
 int do_zboot_parent(struct cmd_tbl *cmdtp, int flag, int argc,
 		    char *const argv[], int *repeatable);
 
-extern int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
-			   char *const argv[]);
-
-extern int do_reset(struct cmd_tbl *cmdtp, int flag, int argc,
+int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
 		    char *const argv[]);
-extern int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc,
-		       char *const argv[]);
 
-extern unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
-				char *const argv[]);
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc,
+	     char *const argv[]);
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc,
+		char *const argv[]);
+
+unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
+			 char *const argv[]);
 
 #if defined(CONFIG_CMD_NVEDIT_EFI)
-extern int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc,
-			    char *const argv[]);
-extern int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
-			  char *const argv[]);
+int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[]);
+int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[]);
 #endif
 
 /**
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v4 3/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED
  2021-02-02 11:56 [PATCH v4 1/3] sysboot: add zboot support to boot x86 Linux kernel image Kory Maincent
  2021-02-02 11:56 ` [PATCH v4 2/3] command.h: Clean-up patch, remove extern from the header Kory Maincent
@ 2021-02-02 11:56 ` Kory Maincent
  2021-02-02 13:22   ` Bin Meng
  2021-02-02 13:19 ` [PATCH v4 1/3] sysboot: add zboot support to boot x86 Linux kernel image Bin Meng
  2 siblings, 1 reply; 6+ messages in thread
From: Kory Maincent @ 2021-02-02 11:56 UTC (permalink / raw)
  To: u-boot

Replace all the macro ifdef by IS_ENABLED.
All of these configs are set in the defconfig files and not in the
include board headers files.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 cmd/pxe_utils.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index b788ee9576..a6e7d27682 100644
--- a/cmd/pxe_utils.c
+++ b/cmd/pxe_utils.c
@@ -340,7 +340,7 @@ static int label_localboot(struct pxe_label *label)
 /*
  * Loads fdt overlays specified in 'fdtoverlays'.
  */
-#ifdef CONFIG_OF_LIBFDT_OVERLAY
+#if IS_ENABLED(CONFIG_OF_LIBFDT_OVERLAY)
 static void label_boot_fdtoverlay(struct cmd_tbl *cmdtp, struct pxe_label *label)
 {
 	char *fdtoverlay = label->fdtoverlays;
@@ -492,7 +492,7 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
 			env_get("gatewayip"), env_get("netmask"));
 	}
 
-#ifdef CONFIG_CMD_NET
+#if IS_ENABLED(CONFIG_CMD_NET)
 	if (label->ipappend & 0x2) {
 		int err;
 
@@ -626,7 +626,7 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
 				}
 			}
 
-#ifdef CONFIG_OF_LIBFDT_OVERLAY
+#if IS_ENABLED(CONFIG_OF_LIBFDT_OVERLAY)
 			if (label->fdtoverlays)
 				label_boot_fdtoverlay(cmdtp, label);
 #endif
@@ -649,11 +649,11 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
 	/* Try bootm for legacy and FIT format image */
 	if (genimg_get_format(buf) != IMAGE_FORMAT_INVALID)
 		do_bootm(cmdtp, 0, bootm_argc, bootm_argv);
-#ifdef CONFIG_CMD_BOOTI
+#if IS_ENABLED(CONFIG_CMD_BOOTI)
 	/* Try booting an AArch64 Linux kernel image */
 	else
 		do_booti(cmdtp, 0, bootm_argc, bootm_argv);
-#elif defined(CONFIG_CMD_BOOTZ)
+#elif IS_ENABLED(CONFIG_CMD_BOOTZ)
 	/* Try booting a Image */
 	else
 		do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
@@ -1428,7 +1428,7 @@ void handle_pxe_menu(struct cmd_tbl *cmdtp, struct pxe_menu *cfg)
 	struct menu *m;
 	int err;
 
-#ifdef CONFIG_CMD_BMP
+#if IS_ENABLED(CONFIG_CMD_BMP)
 	/* display BMP if available */
 	if (cfg->bmp) {
 		if (get_relfile(cmdtp, cfg->bmp, image_load_addr)) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v4 1/3] sysboot: add zboot support to boot x86 Linux kernel image
  2021-02-02 11:56 [PATCH v4 1/3] sysboot: add zboot support to boot x86 Linux kernel image Kory Maincent
  2021-02-02 11:56 ` [PATCH v4 2/3] command.h: Clean-up patch, remove extern from the header Kory Maincent
  2021-02-02 11:56 ` [PATCH v4 3/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED Kory Maincent
@ 2021-02-02 13:19 ` Bin Meng
  2 siblings, 0 replies; 6+ messages in thread
From: Bin Meng @ 2021-02-02 13:19 UTC (permalink / raw)
  To: u-boot

On Tue, Feb 2, 2021 at 7:56 PM Kory Maincent <kory.maincent@bootlin.com> wrote:
>
> Add "zboot" command to the list of supported boot in the label_boot
> function.
>
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>
> Change since v1:
>  - Modify comment.
>
> Change since v2:
>  - Update do_zboot to do_zboot_parent function to follow the patch:
>    5588e776b0
>
> Change since v3:
>  - Follow review from Simon Glass
>  - Add clean-up paches
>
>  cmd/pxe_utils.c   | 4 ++++
>  include/command.h | 3 +++
>  2 files changed, 7 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

However I think it's better we reorder the patches so that this patch
becomes the last one after the 2 clean-up patches.

Regards,
Bin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4 2/3] command.h: Clean-up patch, remove extern from the header
  2021-02-02 11:56 ` [PATCH v4 2/3] command.h: Clean-up patch, remove extern from the header Kory Maincent
@ 2021-02-02 13:21   ` Bin Meng
  0 siblings, 0 replies; 6+ messages in thread
From: Bin Meng @ 2021-02-02 13:21 UTC (permalink / raw)
  To: u-boot

On Tue, Feb 2, 2021 at 7:56 PM Kory Maincent <kory.maincent@bootlin.com> wrote:
>
> Remove the extern of the header because they are useless.
>
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> ---
>  include/command.h | 56 +++++++++++++++++++++++------------------------
>  1 file changed, 28 insertions(+), 28 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4 3/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED
  2021-02-02 11:56 ` [PATCH v4 3/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED Kory Maincent
@ 2021-02-02 13:22   ` Bin Meng
  0 siblings, 0 replies; 6+ messages in thread
From: Bin Meng @ 2021-02-02 13:22 UTC (permalink / raw)
  To: u-boot

Hi Kory,

On Tue, Feb 2, 2021 at 7:56 PM Kory Maincent <kory.maincent@bootlin.com> wrote:
>
> Replace all the macro ifdef by IS_ENABLED.
> All of these configs are set in the defconfig files and not in the
> include board headers files.
>
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> ---
>  cmd/pxe_utils.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
> index b788ee9576..a6e7d27682 100644
> --- a/cmd/pxe_utils.c
> +++ b/cmd/pxe_utils.c
> @@ -340,7 +340,7 @@ static int label_localboot(struct pxe_label *label)
>  /*
>   * Loads fdt overlays specified in 'fdtoverlays'.
>   */
> -#ifdef CONFIG_OF_LIBFDT_OVERLAY
> +#if IS_ENABLED(CONFIG_OF_LIBFDT_OVERLAY)
>  static void label_boot_fdtoverlay(struct cmd_tbl *cmdtp, struct pxe_label *label)
>  {
>         char *fdtoverlay = label->fdtoverlays;
> @@ -492,7 +492,7 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
>                         env_get("gatewayip"), env_get("netmask"));
>         }
>
> -#ifdef CONFIG_CMD_NET
> +#if IS_ENABLED(CONFIG_CMD_NET)

This should use: if (IS_ENABLED(CONFIG_CMD_NET)) to increase build coverage.

>         if (label->ipappend & 0x2) {
>                 int err;
>
> @@ -626,7 +626,7 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
>                                 }
>                         }
>
> -#ifdef CONFIG_OF_LIBFDT_OVERLAY
> +#if IS_ENABLED(CONFIG_OF_LIBFDT_OVERLAY)
>                         if (label->fdtoverlays)
>                                 label_boot_fdtoverlay(cmdtp, label);
>  #endif
> @@ -649,11 +649,11 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
>         /* Try bootm for legacy and FIT format image */
>         if (genimg_get_format(buf) != IMAGE_FORMAT_INVALID)
>                 do_bootm(cmdtp, 0, bootm_argc, bootm_argv);
> -#ifdef CONFIG_CMD_BOOTI
> +#if IS_ENABLED(CONFIG_CMD_BOOTI)
>         /* Try booting an AArch64 Linux kernel image */
>         else
>                 do_booti(cmdtp, 0, bootm_argc, bootm_argv);
> -#elif defined(CONFIG_CMD_BOOTZ)
> +#elif IS_ENABLED(CONFIG_CMD_BOOTZ)
>         /* Try booting a Image */
>         else
>                 do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
> @@ -1428,7 +1428,7 @@ void handle_pxe_menu(struct cmd_tbl *cmdtp, struct pxe_menu *cfg)
>         struct menu *m;
>         int err;
>
> -#ifdef CONFIG_CMD_BMP
> +#if IS_ENABLED(CONFIG_CMD_BMP)
>         /* display BMP if available */
>         if (cfg->bmp) {
>                 if (get_relfile(cmdtp, cfg->bmp, image_load_addr)) {
> --

Regards,
Bin

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-02 13:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 11:56 [PATCH v4 1/3] sysboot: add zboot support to boot x86 Linux kernel image Kory Maincent
2021-02-02 11:56 ` [PATCH v4 2/3] command.h: Clean-up patch, remove extern from the header Kory Maincent
2021-02-02 13:21   ` Bin Meng
2021-02-02 11:56 ` [PATCH v4 3/3] pxe_utils: clean-up, replace ifdef by IS_ENABLED Kory Maincent
2021-02-02 13:22   ` Bin Meng
2021-02-02 13:19 ` [PATCH v4 1/3] sysboot: add zboot support to boot x86 Linux kernel image Bin Meng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.