Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] efibootmgr and kernel commandline options
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Sun Jul 16, 2017 1:27 pm    Post subject: [SOLVED] efibootmgr and kernel commandline options Reply with quote

How does one pass commandline options to the kernel, when one uses efibootmgr (without rEfind or the such)?

I basically need to workaround this bug
https://github.com/Bumblebee-Project/bbswitch/issues/140
which people do by setting pcie_port_pm=off.
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)


Last edited by Holysword on Sat Aug 05, 2017 9:46 am; edited 1 time in total
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7090
Location: Saint Amant, Acadiana

PostPosted: Sun Jul 16, 2017 1:29 pm    Post subject: Reply with quote

The command line can be built into kernel.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2613

PostPosted: Sun Jul 16, 2017 5:38 pm    Post subject: Re: efibootmgr and kernel commandline options Reply with quote

Holysword wrote:
How does one pass commandline options to the kernel, when one uses efibootmgr (without rEfind or the such)?

You are aware of gentoo wiki?
Back to top
View user's profile Send private message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Mon Jul 24, 2017 1:13 pm    Post subject: Reply with quote

Jaglover wrote:
The command line can be built into kernel.

What I meant was without building it into the kernel (or else I'd have to keep copies of the same kernel with varying commandline).

Is it possible to pass commandline options without hardsetting them?
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2613

PostPosted: Mon Jul 24, 2017 1:35 pm    Post subject: Reply with quote

What is the background this topic?

efibotmgr does nothing but make efi applications (such like grub.efi or refind.efi or bzImage.efi) known to the (u)efi firmware.
(u)efi firmware then loads the selected efi (e.g. bzImage.efi or bootmanager) application.

In case the selected efi application is not an EFI stub kernel and not a bootmanager, how then did you intend to load a kernel??????
Back to top
View user's profile Send private message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Mon Jul 24, 2017 3:32 pm    Post subject: Reply with quote

charles17 wrote:
What is the background this topic?

efibotmgr does nothing but make efi applications (such like grub.efi or refind.efi or bzImage.efi) known to the (u)efi firmware.
(u)efi firmware then loads the selected efi (e.g. bzImage.efi or bootmanager) application.

In case the selected efi application is not an EFI stub kernel and not a bootmanager, how then did you intend to load a kernel??????

The background of this topic is stated at the first post. Workarounding a bug, but without hardsetting options into the kernel.

If it is not possible, an answer such as "Sorry, it is not possible" is much more informative than a rethorical question asking how to achieve the impossible followed by 6 interrogation marks.

Currently I am loading a kernel directly without any efi application. I know that the bios currently does not give me the option to "pass arguments" to the kernel being loaded, what I am wondering is if efibootmgr (or other tools) are able to provide this functionality.
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2613

PostPosted: Mon Jul 24, 2017 4:50 pm    Post subject: Reply with quote

Holysword wrote:
Currently I am loading a kernel directly without any efi application.

AFAIK that is only possible with EFI stub kernel. Is this what you are doing, or am I missing something?

Holysword wrote:
I know that the bios currently does not give me the option to "pass arguments" to the kernel being loaded, what I am wondering is if efibootmgr (or other tools) are able to provide this functionality.

As I understand, efibootmgr is not at all involved in loading / booting. External resources say to add parameters to the efi firmware.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 2512
Location: Canada

PostPosted: Mon Jul 24, 2017 5:01 pm    Post subject: Reply with quote

If you are using EFI stub kernel without bootloader (as I do as well), the only way to pass the parameters is to build them into the kernel.
Back to top
View user's profile Send private message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Mon Jul 24, 2017 6:37 pm    Post subject: Reply with quote

charles17 wrote:
AFAIK that is only possible with EFI stub kernel. Is this what you are doing, or am I missing something?

That's correct. I'm booting directly from EFI stub kernel. No bootloader.

dmpogo wrote:
If you are using EFI stub kernel without bootloader (as I do as well), the only way to pass the parameters is to build them into the kernel.

Thank you, that's what I wanted to know. Quite inconvenient though.
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 2512
Location: Canada

PostPosted: Mon Jul 24, 2017 6:57 pm    Post subject: Reply with quote

Holysword wrote:
charles17 wrote:
AFAIK that is only possible with EFI stub kernel. Is this what you are doing, or am I missing something?

That's correct. I'm booting directly from EFI stub kernel. No bootloader.

dmpogo wrote:
If you are using EFI stub kernel without bootloader (as I do as well), the only way to pass the parameters is to build them into the kernel.

Thank you, that's what I wanted to know. Quite inconvenient though.


well, this is a limitation of direct boot, and (in my opinion, almost the only) reason for additional bootloaders to exist.
Another limitations is that all firmware needed at boot has to be compiled into the kernel as well, or the path to the root device

On the bright side, changing kernel parameters in make menuconfig does not lead to any recompilation, so almost as fast as editing bootloader config :)
(just not forget to copy the bzImage into its place on /boot/EFI)
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2613

PostPosted: Tue Jul 25, 2017 6:46 am    Post subject: Reply with quote

dmpogo wrote:
On the bright side, changing kernel parameters in make menuconfig does not lead to any recompilation, so almost as fast as editing bootloader config :)

Are you saying changes done in make menuconfig were going directly into bzImage without recompilation?
Back to top
View user's profile Send private message
grumblebear
Tux's lil' helper
Tux's lil' helper


Joined: 26 Feb 2008
Posts: 141

PostPosted: Tue Jul 25, 2017 7:44 am    Post subject: Reply with quote

This thread is going to be a little confusing. With efibootmgr you pass the kernel command line parameters with the -u option when creating a new boot entry (-c).
Only when booting the standard UEFI OS, that is the kernel you put under bootx64.efi, you have to compile the parameters into the kernel.
Back to top
View user's profile Send private message
s4e8
Guru
Guru


Joined: 29 Jul 2006
Posts: 309

PostPosted: Tue Jul 25, 2017 7:54 am    Post subject: Reply with quote

"efibootmgr -u" would add load option/kernel parameters to firmware.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2613

PostPosted: Tue Jul 25, 2017 8:25 am    Post subject: Reply with quote

grumblebear wrote:
Only when booting the standard UEFI OS, that is the kernel you put under bootx64.efi, you have to compile the parameters into the kernel.

aka EFI stub kernel
Back to top
View user's profile Send private message
grumblebear
Tux's lil' helper
Tux's lil' helper


Joined: 26 Feb 2008
Posts: 141

PostPosted: Tue Jul 25, 2017 9:38 am    Post subject: Reply with quote

Yes of course. Since the first entry in this thread we all know, that Holysword is using an EFI stub kernel. And yes, the -u option is storing the command line parameters in the EFI firmware. But from my understanding, this is what Holysword wants. If you want to pass different parameters on every single boot, you have to use the EFI shell.
Back to top
View user's profile Send private message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Sat Aug 05, 2017 8:28 am    Post subject: Reply with quote

s4e8 wrote:
"efibootmgr -u" would add load option/kernel parameters to firmware.

@s4e8 and @grumblebear

I'm sorry, I am indeed a bit confused:
Code:
   -u | --unicode | --UCS-2
              Handle extra command line arguments as UCS-2 (default is ASCII)


That seems to only change the encoding of the arguments, but not to take the arguments themselves. Am I misunderstanding something?
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
grumblebear
Tux's lil' helper
Tux's lil' helper


Joined: 26 Feb 2008
Posts: 141

PostPosted: Sat Aug 05, 2017 9:33 am    Post subject: Reply with quote

Quote:
I'm sorry, I am indeed a bit confused:
Code:

   -u | --unicode | --UCS-2
              Handle extra command line arguments as UCS-2 (default is ASCII)


That seems to only change the encoding of the arguments, but not to take the arguments themselves. Am I misunderstanding something?


Admitted, that description is not very clear. It simply means the command line string does not have to be pure ASCII. So just put your arguments behind the -u.
For example:
Code:
efibootmgr -c -L MyGentoo -l '\EFI\BOOT\MyKernel.efi' -u "root=/dev/sda2 ro quiet"
Back to top
View user's profile Send private message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Sat Aug 05, 2017 9:46 am    Post subject: Reply with quote

grumblebear wrote:
Quote:
I'm sorry, I am indeed a bit confused:
Code:

   -u | --unicode | --UCS-2
              Handle extra command line arguments as UCS-2 (default is ASCII)


That seems to only change the encoding of the arguments, but not to take the arguments themselves. Am I misunderstanding something?


Admitted, that description is not very clear. It simply means the command line string does not have to be pure ASCII. So just put your arguments behind the -u.
For example:
Code:
efibootmgr -c -L MyGentoo -l '\EFI\BOOT\MyKernel.efi' -u "root=/dev/sda2 ro quiet"


Indeed! Works like a charm, thanks!
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum