command.h: Clean-up patch, remove extern from the header
PATCH v5 1/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,28 +159,28 @@ 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[]); -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 v5 2/3 pxe_utils: clean-up, replace ifdef by IS_ENABLED
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.
---
Change since v4:
- Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible
cmd/pxe_utils.c | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 27 deletions(-)
cmd/pxe_utils.c +25 -27
@@ -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,16 +492,16 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) env_get("gatewayip"), env_get("netmask")); } -#ifdef CONFIG_CMD_NET -if (label->ipappend &0x2 ) { -int err; +if (IS_ENABLED (CONFIG_CMD_NET )) { +if (label->ipappend &0x2 ) { +int err; -strcpy (mac_str," BOOTIF=" ); - err =format_mac_pxe (mac_str +8 ,sizeof (mac_str) -8 ); -if (err <0 ) - mac_str[0 ] ='\0' ; +strcpy (mac_str," BOOTIF=" ); + err =format_mac_pxe (mac_str +8 ,sizeof (mac_str) -8 ); +if (err <0 ) + mac_str[0 ] ='\0' ; + } } -#endif if ((label->ipappend &0x3 ) || label->append) {char bootargs[CONFIG_SYS_CBSIZE ] ="" ;
@@ -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,15 +649,13 @@ 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 /* Try booting an AArch64 Linux kernel image */ - else +else if (IS_ENABLED (CONFIG_CMD_BOOTI ))do_booti (cmdtp,0 , bootm_argc, bootm_argv); -#elif defined(CONFIG_CMD_BOOTZ )/* Try booting a Image */ - else +else if (IS_ENABLED (CONFIG_CMD_BOOTZ ))do_bootz (cmdtp,0 , bootm_argc, bootm_argv); -#endif +unmap_sysmem (buf); cleanup:
@@ -1424,20 +1422,20 @@ void handle_pxe_menu(struct cmd_tbl *cmdtp, struct pxe_menu *cfg)struct menu *m;int err; -#ifdef CONFIG_CMD_BMP -/* display BMP if available */ -if (cfg->bmp) { -if (get_relfile (cmdtp, cfg->bmp, image_load_addr)) { -if (CONFIG_IS_ENABLED (CMD_CLS )) -run_command ("cls" ,0 ); -bmp_display (image_load_addr, -BMP_ALIGN_CENTER ,BMP_ALIGN_CENTER ); - }else { -printf ("Skipping background bmp %s for failure\n" , - cfg->bmp); +if (IS_ENABLED (CONFIG_CMD_BMP )) { +/* display BMP if available */ +if (cfg->bmp) { +if (get_relfile (cmdtp, cfg->bmp, image_load_addr)) { +if (CONFIG_IS_ENABLED (CMD_CLS )) +run_command ("cls" ,0 ); +bmp_display (image_load_addr, +BMP_ALIGN_CENTER ,BMP_ALIGN_CENTER ); + }else { +printf ("Skipping background bmp %s for failure\n" , + cfg->bmp); + } } } -#endif m =pxe_menu_to_menu (cfg);if (!m)
Signature · 1 line
2.17.1
PATCH v5 2/3 pxe_utils: clean-up, replace ifdef by IS_ENABLED
Quoted 5 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.
Quoted 9 lines
Signed-off-by Kory Maincent <[email protected]>---
Change since v4:
- Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possiblecmd/pxe_utils.c | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 27 deletions(-)
applied to u-boot-x86, thanks!
PATCH v5 2/3 pxe_utils: clean-up, replace ifdef by IS_ENABLED
In reply to Kory MaincentHi Kory,
Quoted 53 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]>---
Change since v4:
- Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possiblecmd/pxe_utils.c | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 27 deletions(-)cmd/pxe_utils.c +9
-9@@ -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,16 +492,16 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) env_get("gatewayip"), env_get("netmask")); } -#ifdef CONFIG_CMD_NET -if (label->ipappend &0x2 ) { -int err; +if (IS_ENABLED (CONFIG_CMD_NET )) { +if (label->ipappend &0x2 ) { +int err; -strcpy (mac_str," BOOTIF=" ); - err =format_mac_pxe (mac_str +8 ,sizeof (mac_str) -8 ); -if (err <0 ) - mac_str[0 ] ='\0' ; +strcpy (mac_str," BOOTIF=" ); + err =format_mac_pxe (mac_str +8 ,sizeof (mac_str) -8 ); +if (err <0 ) + mac_str[0 ] ='\0' ; + } } -#endif if ((label->ipappend &0x3 ) || label->append) {char bootargs[CONFIG_SYS_CBSIZE ] ="" ;
cmd/pxe_utils.c static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) · line 629
Quoted 5 lines
cmd/pxe_utils.c +1
-1@@ -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 )
There is actually no point in doing that...just leave it as it is. IS_ENABLED() is useful when we can move things to the compiler instead of the preprocessor.
Quoted 56 lines
cmd/pxe_utils.c +15
-18if (label->fdtoverlays)label_boot_fdtoverlay (cmdtp, label);#endif @@ -649,15 +649,13 @@ 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 /* Try booting an AArch64 Linux kernel image */ - else +else if (IS_ENABLED (CONFIG_CMD_BOOTI ))do_booti (cmdtp,0 , bootm_argc, bootm_argv); -#elif defined(CONFIG_CMD_BOOTZ )/* Try booting a Image */ - else +else if (IS_ENABLED (CONFIG_CMD_BOOTZ ))do_bootz (cmdtp,0 , bootm_argc, bootm_argv); -#endif +unmap_sysmem (buf); cleanup:@@ -1424,20 +1422,20 @@ void handle_pxe_menu(struct cmd_tbl *cmdtp, struct pxe_menu *cfg)struct menu *m;int err; -#ifdef CONFIG_CMD_BMP -/* display BMP if available */ -if (cfg->bmp) { -if (get_relfile (cmdtp, cfg->bmp, image_load_addr)) { -if (CONFIG_IS_ENABLED (CMD_CLS )) -run_command ("cls" ,0 ); -bmp_display (image_load_addr, -BMP_ALIGN_CENTER ,BMP_ALIGN_CENTER ); - }else { -printf ("Skipping background bmp %s for failure\n" , - cfg->bmp); +if (IS_ENABLED (CONFIG_CMD_BMP )) { +/* display BMP if available */ +if (cfg->bmp) { +if (get_relfile (cmdtp, cfg->bmp, image_load_addr)) { +if (CONFIG_IS_ENABLED (CMD_CLS )) +run_command ("cls" ,0 ); +bmp_display (image_load_addr, +BMP_ALIGN_CENTER ,BMP_ALIGN_CENTER ); + }else { +printf ("Skipping background bmp %s for failure\n" , + cfg->bmp); + } } } -#endif m =pxe_menu_to_menu (cfg);if (!m) --
Quoted 2 lines
2.17.1
Regards,
Simon
PATCH v5 2/3 pxe_utils: clean-up, replace ifdef by IS_ENABLED
Quoted 60 lines · Simon Glass
Hi Kory,
Quoted 56 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]>---
Change since v4:
- Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possiblecmd/pxe_utils.c | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 27 deletions(-)cmd/pxe_utils.c +9
-9@@ -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,16 +492,16 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) env_get("gatewayip"), env_get("netmask")); } -#ifdef CONFIG_CMD_NET -if (label->ipappend &0x2 ) { -int err; +if (IS_ENABLED (CONFIG_CMD_NET )) { +if (label->ipappend &0x2 ) { +int err; -strcpy (mac_str," BOOTIF=" ); - err =format_mac_pxe (mac_str +8 ,sizeof (mac_str) -8 ); -if (err <0 ) - mac_str[0 ] ='\0' ; +strcpy (mac_str," BOOTIF=" ); + err =format_mac_pxe (mac_str +8 ,sizeof (mac_str) -8 ); +if (err <0 ) + mac_str[0 ] ='\0' ; + } } -#endif if ((label->ipappend &0x3 ) || label->append) {char bootargs[CONFIG_SYS_CBSIZE ] ="" ;@@ -626,7 +626,7 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) } }
Quoted 7 lines
cmd/pxe_utils.c static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) · line 629
Quoted 2 lines
cmd/pxe_utils.c +1
-1-#ifdef CONFIG_OF_LIBFDT_OVERLAY +#if IS_ENABLED (CONFIG_OF_LIBFDT_OVERLAY )There is actually no point in doing that...just leave it as it is.
IS_ENABLED()is useful when we can move things to the compiler instead of the preprocessor.
I will fix this up in the tree. Thanks!
Regards,
Bin
PATCH v5 3/3 sysboot: add zboot support to boot x86 Linux kernel image
In reply to Kory MaincentAdd "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
Change since v4:
- Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef'
cmd/pxe_utils.c | 3 +++ include/command.h | 3 +++ 2 files changed, 6 insertions(+)
cmd/pxe_utils.c +3 -0
@@ -655,6 +655,9 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)/* Try booting a Image */ else if (IS_ENABLED(CONFIG_CMD_BOOTZ)) do_bootz(cmdtp, 0, bootm_argc, bootm_argv); +/* Try booting an x86_64 Linux kernel image */ + else if (IS_ENABLED(CONFIG_CMD_ZBOOT)) + do_zboot_parent(cmdtp, 0, bootm_argc, bootm_argv, NULL);unmap_sysmem (buf );
include/command.h +3 -0
@@ -165,6 +165,9 @@ int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc,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); +int common_diskboot (struct cmd_tbl *cmdtp,const char *intf,int argc,char *const argv[]);
Signature · 1 line
2.17.1
PATCH v5 3/3 sysboot: add zboot support to boot x86 Linux kernel image
Quoted 20 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]>Reviewed-by Bin Meng <[email protected]>---
Change since v1:
- Modify comment.Change since v2:
- Updatedo_zboottodo_zboot_parentfunction to follow the patch:5588e776b0Change since v3:
- Follow review from Simon Glass
- Add clean-up paches
Quoted 7 lines
Change since v4:
- Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef'cmd/pxe_utils.c | 3 +++ include/command.h | 3 +++ 2 files changed, 6 insertions(+)
applied to u-boot-x86, thanks!
PATCH v5 1/3 command.h: Clean-up patch, remove extern from the header
In reply to Kory MaincentQuoted 9 lines · Kory Maincent
Remove the extern of the header because they are useless.
Signed-off-by Kory Maincent <[email protected]>Reviewed-by Bin Meng <[email protected]>--- include/command.h | 56 +++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-)
applied to u-boot-x86, thanks!
PATCH v5 1/3 command.h: Clean-up patch, remove extern from the header
In reply to Kory MaincentQuoted 8 lines · Kory Maincent
Remove the extern of the header because they are useless.
Signed-off-by Kory Maincent <[email protected]>Reviewed-by Bin Meng <[email protected]>--- include/command.h | 56 +++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-)