sysboot: add zboot support to boot x86 Linux kernel image
PATCH v4 1/3 sysboot: add zboot support to boot x86 Linux kernel image
Add "zboot" command to the list of supported boot in the label_boot function.
---
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(+)
cmd/pxe_utils.c +4 -0
@@ -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);
include/command.h +3 -0
@@ -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[]);
Signature · 1 line
2.17.1
PATCH v4 2/3 command.h: Clean-up patch, remove extern from the header
Remove the extern of the header because they are useless.
--- include/command.h | 56 +++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-)
include/command.h +28 -28
@@ -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 /**
Signature · 1 line
2.17.1
PATCH v4 2/3 command.h: Clean-up patch, remove extern from the header
Quoted 8 lines · Kory Maincent
Remove the extern of the header because they are useless.
Signed-off-by Kory Maincent <[email protected]>--- include/command.h | 56 +++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-)
PATCH v4 3/3 pxe_utils: clean-up, replace ifdef by IS_ENABLED
In reply to Kory MaincentReplace 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.
--- cmd/pxe_utils.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
cmd/pxe_utils.c +6 -6
@@ -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)) {
Signature · 1 line
2.17.1
PATCH v4 3/3 pxe_utils: clean-up, replace ifdef by IS_ENABLED
Hi Kory,
Quoted 24 lines · Kory Maincent
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 <[email protected]>--- cmd/pxe_utils.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)cmd/pxe_utils.c +1
-1@@ -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;
cmd/pxe_utils.c static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) · line 495
Quoted 5 lines
cmd/pxe_utils.c +1
-1@@ -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.
Quoted 27 lines
cmd/pxe_utils.c +3
-3if (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);
cmd/pxe_utils.c void handle_pxe_menu(struct cmd_tbl *cmdtp, struct pxe_menu *cfg)
Quoted 9 lines
cmd/pxe_utils.c +1
-2@@ -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
PATCH v4 1/3 sysboot: add zboot support to boot x86 Linux kernel image
In reply to Kory MaincentQuoted 15 lines · Kory Maincent
Add "zboot" command to the list of supported boot in the
label_bootfunction.Signed-off-by Kory Maincent <[email protected]>Reviewed-by Simon Glass <[email protected]>---
Change since v1:
- Modify comment.Change since v2:
- Updatedo_zboottodo_zboot_parentfunction to follow the patch:5588e776b0
Quoted 8 lines
Change since v3:
- Follow review from Simon Glass
- Add clean-up pachescmd/pxe_utils.c | 4 ++++ include/command.h | 3 +++ 2 files changed, 7 insertions(+)
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