diff mbox series

[v8,05/25] x86: Don't process the kernel command line unless enabled

Message ID 20211229185759.1432518-5-sjg@chromium.org
State Accepted, archived
Commit 440c6645aa501e9dfe96fa314c1db78cbb42f453
Delegated to: Heinrich Schuchardt
Headers show
Series efi: Improvements to U-Boot running on top of UEFI | expand

Commit Message

Simon Glass Dec. 29, 2021, 6:57 p.m. UTC
If the 'bootm' command is not enabled then this code is not available and
this causes a link error. Fix it.

Note that for the EFI app, there is no indication of missing code. It just
hangs!

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 arch/x86/lib/zimage.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Heinrich Schuchardt Dec. 30, 2021, 1:11 p.m. UTC | #1
On 12/29/21 19:57, Simon Glass wrote:
> If the 'bootm' command is not enabled then this code is not available and
> this causes a link error. Fix it.
>
> Note that for the EFI app, there is no indication of missing code. It just
> hangs!
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> (no changes since v1)
>
>   arch/x86/lib/zimage.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
> index 7ce02226ef9..9cc04490307 100644
> --- a/arch/x86/lib/zimage.c
> +++ b/arch/x86/lib/zimage.c
> @@ -365,11 +365,14 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
>   			strcpy(cmd_line, (char *)cmdline_force);
>   		else
>   			build_command_line(cmd_line, auto_boot);
> -		ret = bootm_process_cmdline(cmd_line, max_size, BOOTM_CL_ALL);
> -		if (ret) {
> -			printf("Cmdline setup failed (max_size=%x, bootproto=%x, err=%d)\n",
> -			       max_size, bootproto, ret);
> -			return ret;
> +		if (IS_ENABLED(CONFIG_CMD_BOOTM)) {

boot/Makefile:
obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o
obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o
obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o

Why don't you check for CONFIG_CMD_BOOTZ too (booti is not applicable to
x86)?

if (IS_ENABLED(CONFIG_CMD_BOOTM) || IS_ENABLED(CONFIG_CMD_BOOTZ)) {

Best regards

Heinrich

> +			ret = bootm_process_cmdline(cmd_line, max_size,
> +						    BOOTM_CL_ALL);
> +			if (ret) {
> +				printf("Cmdline setup failed (max_size=%x, bootproto=%x, err=%d)\n",
> +				       max_size, bootproto, ret);
> +				return ret;
> +			}
>   		}
>   		printf("Kernel command line: \"");
>   		puts(cmd_line);
Simon Glass Dec. 30, 2021, 1:33 p.m. UTC | #2
Hi Heinrich,

On Thu, 30 Dec 2021 at 06:16, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 12/29/21 19:57, Simon Glass wrote:
> > If the 'bootm' command is not enabled then this code is not available and
> > this causes a link error. Fix it.
> >
> > Note that for the EFI app, there is no indication of missing code. It just
> > hangs!
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> > (no changes since v1)
> >
> >   arch/x86/lib/zimage.c | 13 ++++++++-----
> >   1 file changed, 8 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
> > index 7ce02226ef9..9cc04490307 100644
> > --- a/arch/x86/lib/zimage.c
> > +++ b/arch/x86/lib/zimage.c
> > @@ -365,11 +365,14 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
> >                       strcpy(cmd_line, (char *)cmdline_force);
> >               else
> >                       build_command_line(cmd_line, auto_boot);
> > -             ret = bootm_process_cmdline(cmd_line, max_size, BOOTM_CL_ALL);
> > -             if (ret) {
> > -                     printf("Cmdline setup failed (max_size=%x, bootproto=%x, err=%d)\n",
> > -                            max_size, bootproto, ret);
> > -                     return ret;
> > +             if (IS_ENABLED(CONFIG_CMD_BOOTM)) {
>
> boot/Makefile:
> obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o
> obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o
> obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
>
> Why don't you check for CONFIG_CMD_BOOTZ too (booti is not applicable to
> x86)?
>
> if (IS_ENABLED(CONFIG_CMD_BOOTM) || IS_ENABLED(CONFIG_CMD_BOOTZ)) {
>

I think the real fix is what Tom suggested, which I can do later.

Regards,
Simon



> Best regards
>
> Heinrich
>
> > +                     ret = bootm_process_cmdline(cmd_line, max_size,
> > +                                                 BOOTM_CL_ALL);
> > +                     if (ret) {
> > +                             printf("Cmdline setup failed (max_size=%x, bootproto=%x, err=%d)\n",
> > +                                    max_size, bootproto, ret);
> > +                             return ret;
> > +                     }
> >               }
> >               printf("Kernel command line: \"");
> >               puts(cmd_line);
>
diff mbox series

Patch

diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 7ce02226ef9..9cc04490307 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -365,11 +365,14 @@  int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
 			strcpy(cmd_line, (char *)cmdline_force);
 		else
 			build_command_line(cmd_line, auto_boot);
-		ret = bootm_process_cmdline(cmd_line, max_size, BOOTM_CL_ALL);
-		if (ret) {
-			printf("Cmdline setup failed (max_size=%x, bootproto=%x, err=%d)\n",
-			       max_size, bootproto, ret);
-			return ret;
+		if (IS_ENABLED(CONFIG_CMD_BOOTM)) {
+			ret = bootm_process_cmdline(cmd_line, max_size,
+						    BOOTM_CL_ALL);
+			if (ret) {
+				printf("Cmdline setup failed (max_size=%x, bootproto=%x, err=%d)\n",
+				       max_size, bootproto, ret);
+				return ret;
+			}
 		}
 		printf("Kernel command line: \"");
 		puts(cmd_line);