Skip to contentSkip to conversation

efi_loader: LoadOptions (bootargs)

U-Boot AKASHI Takahiro 2 participants 6 messages Aug 22, 2019 – Sep 12, 2019

lore
Share & tools
lore
#0 lore raw

Heinrich,

I'm now wondering whether LoadedImage's LoadOptions, which comes from "bootargs" variable, should contain a command(application) name as a first argument or not.

When I tried some efi application (efitools), I found that it expected so. For example, efitools' UpdateVars.efi takes

    Usage: UpdateVars.efi: [-g guid] [-a] [-e] [-b] var file

and I had to passed arguments by specifying "foo db DB.auth" for "bootargs" where foo makes no sense.

What do you think about this issue?

Thanks,
-Takahiro Akashi

#1 lore raw
Quoted 6 lines · AKASHI Takahiro

Heinrich,

I'm now wondering whether LoadedImage's LoadOptions, which comes from "bootargs" variable, should contain a command(application) name as a first argument or not.

Quoted 8 lines

When I tried some efi application (efitools), I found that it expected so. For example, efitools' UpdateVars.efi takes

     Usage: UpdateVars.efi: [-g guid] [-a] [-e] [-b] var file

and I had to passed arguments by specifying "foo db DB.auth" for "bootargs" where foo makes no sense.

What do you think about this issue?

Do you relate to
https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git?

This style of parsing LoadOptions is defined by the EFI shell. See function ParseCommandLineToArgs() in ShellPkg/Application/Shell/ShellParametersProtocol.c.

If UpdateVars.efi would work differently it could not be launched via the shell.

Best regards

Heinrich

#2 lore raw
Quoted 11 lines · Heinrich Schuchardt
Quoted 10 lines · AKASHI Takahiro

Heinrich,

I'm now wondering whether LoadedImage's LoadOptions, which comes from "bootargs" variable, should contain a command(application) name as a first argument or not.

When I tried some efi application (efitools), I found that it expected so. For example, efitools' UpdateVars.efi takes

    Usage: UpdateVars.efi: [-g guid] [-a] [-e] [-b] var file
Quoted 7 lines
Quoted 4 lines

and I had to passed arguments by specifying "foo db DB.auth" for "bootargs" where foo makes no sense.

What do you think about this issue?

Do you relate to
https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git?

Yes.

Quoted 3 lines

This style of parsing LoadOptions is defined by the EFI shell. See function ParseCommandLineToArgs() in ShellPkg/Application/Shell/ShellParametersProtocol.c.

So do you mean that Shell.efi is responsible for adding a command name to LoadOptions (or bootargs) as a first parameter or that LoadOptions is solely for Shell environment?

If so, should we do the same thing at bootefi?

Quoted 2 lines

If UpdateVars.efi would work differently it could not be launched via the shell.

Well, I'm trying to run UpdateVars.efi in a standalone way by invoking it directly from bootefi/bootmgr and it obviously fails due to this issue.

Thanks,
-Takashiro Akashi

Quoted 3 lines

Best regards

Heinrich

#3 lore raw

Heinrich,

Quoted 26 lines · AKASHI Takahiro
Quoted 11 lines · Heinrich Schuchardt
Quoted 10 lines · AKASHI Takahiro

Heinrich,

I'm now wondering whether LoadedImage's LoadOptions, which comes from "bootargs" variable, should contain a command(application) name as a first argument or not.

When I tried some efi application (efitools), I found that it expected so. For example, efitools' UpdateVars.efi takes

    Usage: UpdateVars.efi: [-g guid] [-a] [-e] [-b] var file
Quoted 7 lines
Quoted 4 lines

and I had to passed arguments by specifying "foo db DB.auth" for "bootargs" where foo makes no sense.

What do you think about this issue?

Do you relate to
https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git?

Yes.

Quoted 3 lines

This style of parsing LoadOptions is defined by the EFI shell. See function ParseCommandLineToArgs() in ShellPkg/Application/Shell/ShellParametersProtocol.c.

Quoted 5 lines

So do you mean that Shell.efi is responsible for adding a command name to LoadOptions (or bootargs) as a first parameter or that LoadOptions is solely for Shell environment?

If so, should we do the same thing at bootefi?

Any comment?

-Takahiro Akashi

Quoted 14 lines
Quoted 2 lines

If UpdateVars.efi would work differently it could not be launched via the shell.

Well, I'm trying to run UpdateVars.efi in a standalone way by invoking it directly from bootefi/bootmgr and it obviously fails due to this issue.

Thanks,
-Takashiro Akashi

Quoted 3 lines

Best regards

Heinrich

#4 lore raw
Quoted 32 lines · AKASHI Takahiro

Heinrich,

Quoted 29 lines · AKASHI Takahiro
Quoted 11 lines · Heinrich Schuchardt
Quoted 10 lines · AKASHI Takahiro

Heinrich,

I'm now wondering whether LoadedImage's LoadOptions, which comes from "bootargs" variable, should contain a command(application) name as a first argument or not.

When I tried some efi application (efitools), I found that it expected so. For example, efitools' UpdateVars.efi takes

     Usage: UpdateVars.efi: [-g guid] [-a] [-e] [-b] var file
Quoted 7 lines
Quoted 4 lines

and I had to passed arguments by specifying "foo db DB.auth" for "bootargs" where foo makes no sense.

What do you think about this issue?

Do you relate to
https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git?

Yes.

Quoted 3 lines

This style of parsing LoadOptions is defined by the EFI shell. See function ParseCommandLineToArgs() in ShellPkg/Application/Shell/ShellParametersProtocol.c.

So do you mean that Shell.efi is responsible for adding a command name to LoadOptions (or bootargs) as a first parameter or that LoadOptions is solely for Shell environment?

LoadOptions are used to communicate with any EFI binary including the Linux kernels. Inside the EFI shell Shell.efi takes care of passing the executable name as a first parameter.

If a user chooses to call an EFI binary which expects its own name as first parameter via bootefi, the user should simply add it to LoadOptions via 'setenv bootargs'.

I would not change anything in bootefi. Otherwise you start passing 'vmlinux' or 'grubaa64.efi' as command line arguments to Linux.

Best regards

Heinrich

Quoted 23 lines
Quoted 2 lines

If so, should we do the same thing at bootefi?

Any comment?

-Takahiro Akashi

Quoted 14 lines
Quoted 2 lines

If UpdateVars.efi would work differently it could not be launched via the shell.

Well, I'm trying to run UpdateVars.efi in a standalone way by invoking it directly from bootefi/bootmgr and it obviously fails due to this issue.

Thanks,
-Takashiro Akashi

Quoted 3 lines

Best regards

Heinrich

#5 lore raw
Quoted 34 lines · Heinrich Schuchardt
Quoted 32 lines · AKASHI Takahiro

Heinrich,

Quoted 29 lines · AKASHI Takahiro
Quoted 11 lines · Heinrich Schuchardt
Quoted 10 lines · AKASHI Takahiro

Heinrich,

I'm now wondering whether LoadedImage's LoadOptions, which comes from "bootargs" variable, should contain a command(application) name as a first argument or not.

When I tried some efi application (efitools), I found that it expected so. For example, efitools' UpdateVars.efi takes

    Usage: UpdateVars.efi: [-g guid] [-a] [-e] [-b] var file
Quoted 7 lines
Quoted 4 lines

and I had to passed arguments by specifying "foo db DB.auth" for "bootargs" where foo makes no sense.

What do you think about this issue?

Do you relate to
https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git?

Yes.

Quoted 3 lines

This style of parsing LoadOptions is defined by the EFI shell. See function ParseCommandLineToArgs() in ShellPkg/Application/Shell/ShellParametersProtocol.c.

So do you mean that Shell.efi is responsible for adding a command name to LoadOptions (or bootargs) as a first parameter or that LoadOptions is solely for Shell environment?

Quoted 7 lines

LoadOptions are used to communicate with any EFI binary including the Linux kernels. Inside the EFI shell Shell.efi takes care of passing the executable name as a first parameter.

If a user chooses to call an EFI binary which expects its own name as first parameter via bootefi, the user should simply add it to LoadOptions via 'setenv bootargs'.

Right, but
my concern is that a user normally doesn't care/know if an application expects that it would be invoked from Shell or with Shell-style arguments.

Quoted 2 lines

I would not change anything in bootefi. Otherwise you start passing 'vmlinux' or 'grubaa64.efi' as command line arguments to Linux.

How can users distinguish vmlinux or whatever else from other apps that would expect Shell-style arguments in general?

-Takahiro Akashi

Quoted 28 lines

Best regards

Heinrich

Quoted 23 lines
Quoted 2 lines

If so, should we do the same thing at bootefi?

Any comment?

-Takahiro Akashi

Quoted 14 lines
Quoted 2 lines

If UpdateVars.efi would work differently it could not be launched via the shell.

Well, I'm trying to run UpdateVars.efi in a standalone way by invoking it directly from bootefi/bootmgr and it obviously fails due to this issue.

Thanks,
-Takashiro Akashi

Quoted 3 lines

Best regards

Heinrich