Skip to contentSkip to conversation

passing options to grub in xen,openfirmware and efi

DISCUSSION Olaf Hering 5 participants 39 messages Apr 23, 2015 – May 11, 2015

lore
Share & tools
lore
#0 lore raw

Is there a way to pass options to grub in a Xen PV domU, in openfirmware and in EFI environment?

In a PV domU arguments can be passed to the specified kernel="/path/file" with the extra="what ever" option. In openfirmware the arguments may come from the /boot/chosen node. In EFI it may be possible as well, not my area of expertise. In the wellknown dumb i386 BIOS no such way exist.

In case grub has code to evalute these things, how can such arguements be used within grub.cfg? Where is that documented?

Thanks,

Olaf

#1 lore raw
Quoted 4 lines · Olaf Hering

Is there a way to pass options to grub in a Xen PV domU, in openfirmware and in EFI environment?

Quoted 9 lines

In a PV domU arguments can be passed to the specified kernel="/path/file" with the extra="what ever" option. In openfirmware the arguments may come from the /boot/chosen node. In EFI it may be possible as well, not my area of expertise. In the wellknown dumb i386 BIOS no such way exist.

In case grub has code to evalute these things, how can such arguements be used within grub.cfg? Where is that documented?

I believe the question briefly came up already but without any followup. IIRC it was in relation to how to pass real kernel name to grub in Xen.

For OFW grub will parse bootargs property, interpret it as series of variable assignments separated by ";" and set these variables. There is nothing similar for Xen or EFI cases currently. For EFI we could fetch arguments using Loaded Image Protocol (LoadOptions). Another option (in addition, not either/or) is to define GUID for grub and set them in NVRAM.

What I do not like is the possibility to blindly set any internal variable (consider overriding of $prefix). I'd prefer to set variables in separate namespace, like grub.arg.XXX=YYY for XXX=YYY argument and let user figure out what to do with them.

As long as variables are defined you of course can do whatever you like with them, including referencing them in grub.cfg. How you can use them in grub.cfg is limited only by your imagination then :)

I do not think it is documented anywhere mostly because feature does not really exist; I suppose OFW was added mostly as prerequisite for something else. git blame may answer it.

And of course patches are welcome :)

#2 lore raw
Quoted 4 lines · Andrei Borzenkov

What I do not like is the possibility to blindly set any internal variable (consider overriding of $prefix). I'd prefer to set variables in separate namespace, like grub.arg.XXX=YYY for XXX=YYY argument and let user figure out what to do with them.

You mean if booted with 'boot hd:,grub foo=bar' a 'grub.arg.foo=bar' should be available? That sounds like a plan.

Olaf

#3 lore raw
Quoted 9 lines · Olaf Hering
Quoted 4 lines · Andrei Borzenkov

What I do not like is the possibility to blindly set any internal variable (consider overriding of $prefix). I'd prefer to set variables in separate namespace, like grub.arg.XXX=YYY for XXX=YYY argument and let user figure out what to do with them.

You mean if booted with 'boot hd:,grub foo=bar' a 'grub.arg.foo=bar' should be available?

yes.

#4 lore raw
Quoted 8 lines · Andrei Borzenkov
Quoted 7 lines · Olaf Hering
Quoted 4 lines · Andrei Borzenkov

What I do not like is the possibility to blindly set any internal variable (consider overriding of $prefix). I'd prefer to set variables in separate namespace, like grub.arg.XXX=YYY for XXX=YYY argument and let user figure out what to do with them.

Quoted 4 lines
Quoted 2 lines

You mean if booted with 'boot hd:,grub foo=bar' a 'grub.arg.foo=bar' should be available?

yes.

Current grub_parse_cmdline seems to set foo=bar instead.

Olaf

#5 lore raw
Quoted 10 lines · Olaf Hering
Quoted 8 lines · Andrei Borzenkov
Quoted 7 lines · Olaf Hering
Quoted 4 lines · Andrei Borzenkov

What I do not like is the possibility to blindly set any internal variable (consider overriding of $prefix). I'd prefer to set variables in separate namespace, like grub.arg.XXX=YYY for XXX=YYY argument and let user figure out what to do with them.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

You mean if booted with 'boot hd:,grub foo=bar' a 'grub.arg.foo=bar' should be available?

yes.

Current grub_parse_cmdline seems to set foo=bar instead.

I know. as I said, IIRC it was added to support specific requirement, not as part of generic framework. Of course, now that it is there nobody knows who depends on it.

#6 lore raw
Quoted 3 lines · Andrei Borzenkov

I know. as I said, IIRC it was added to support specific requirement, not as part of generic framework. Of course, now that it is there nobody knows who depends on it.

What is wrong with it anyway? Both grub and the optional commands passed to it are one unit.

Looks like your concern is that the defaults used during mkimage time can be changed at runtime. Thats common practice I think.

Olaf

#38 lore raw
In reply to Olaf Hering

Hello,

This is a very interesting topic.

Quoted 8 lines · Olaf Hering

Is there a way to pass options to grub in a Xen PV domU, in openfirmware and in EFI environment?

In a PV domU arguments can be passed to the specified kernel="/path/file" with the extra="what ever" option. In openfirmware the arguments may come from the /boot/chosen node. In EFI it may be possible as well, not my area of expertise.

I am particularly curious about the EFI part of Olaf's question.

Is there anyway to pass arguments to GRUB via EFI variables or other bits of data in the Boot#### load option variable?

Cheers,
Curt

#7 lore raw
In reply to Andrei Borzenkov
Quoted 26 lines · Andrei Borzenkov
Quoted 4 lines · Olaf Hering

Is there a way to pass options to grub in a Xen PV domU, in openfirmware and in EFI environment?

Quoted 9 lines

In a PV domU arguments can be passed to the specified kernel="/path/file" with the extra="what ever" option. In openfirmware the arguments may come from the /boot/chosen node. In EFI it may be possible as well, not my area of expertise. In the wellknown dumb i386 BIOS no such way exist.

In case grub has code to evalute these things, how can such arguements be used within grub.cfg? Where is that documented?

I believe the question briefly came up already but without any followup. IIRC it was in relation to how to pass real kernel name to grub in Xen.

For OFW grub will parse bootargs property, interpret it as series of variable assignments separated by ";" and set these variables. There is nothing similar for Xen or EFI cases currently. For EFI we could fetch arguments using Loaded Image Protocol (LoadOptions). Another option (in addition, not either/or) is to define GUID for grub and set them in NVRAM.

Quoted 4 lines

What I do not like is the possibility to blindly set any internal variable (consider overriding of $prefix). I'd prefer to set variables in separate namespace, like grub.arg.XXX=YYY for XXX=YYY argument and let user figure out what to do with them.

I'm aware of the problem and I fully agree with you. Automatic install doesn't use those and I think the reason for it was to specify root in early days of porting. I don't think it's used for anything nowadays.

Also unless there is a good usecase for having command line parsing, I'm all for killing existing ieee1275 parsing altogether and not introducing any parsing in the future.

Quoted 16 lines

As long as variables are defined you of course can do whatever you like with them, including referencing them in grub.cfg. How you can use them in grub.cfg is limited only by your imagination then :)

I do not think it is documented anywhere mostly because feature does not really exist; I suppose OFW was added mostly as prerequisite for something else. git blame may answer it.

And of course patches are welcome :)

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#8 lore raw
Quoted 3 lines · Vladimir 'φ-coder/phcoder' Serbinenko

I'm aware of the problem and I fully agree with you. Automatic install doesn't use those and I think the reason for it was to specify root in early days of porting. I don't think it's used for anything nowadays.

For PV guests the use case is simple: provide a generic grub binary, which recognizes optional knobs from the domU.cfg. This will be used to select one of the configured devices as root.
I can imagine that this can be used for OF or EFI as well.

Quoted 3 lines

Also unless there is a good usecase for having command line parsing, I'm all for killing existing ieee1275 parsing altogether and not introducing any parsing in the future.

So you want to dumb it down to the 80s PC level, even if some firmware implementations can set knobs?!

Olaf

#9 lore raw
Quoted 10 lines · Olaf Hering
Quoted 3 lines · Vladimir 'φ-coder/phcoder' Serbinenko

I'm aware of the problem and I fully agree with you. Automatic install doesn't use those and I think the reason for it was to specify root in early days of porting. I don't think it's used for anything nowadays.

For PV guests the use case is simple: provide a generic grub binary, which recognizes optional knobs from the domU.cfg. This will be used to select one of the configured devices as root.

More details on this one please. Both command line and grub binary are on host. How is managing changing one is different from the other?

Quoted 9 lines

I can imagine that this can be used for OF or EFI as well.

Quoted 3 lines

Also unless there is a good usecase for having command line parsing, I'm all for killing existing ieee1275 parsing altogether and not introducing any parsing in the future.

So you want to dumb it down to the 80s PC level, even if some firmware implementations can set knobs?!

"It's shiny and new" or "this is from 80s" are fallacies and not arguments.

Quoted 6 lines

Olaf

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#10 lore raw
Quoted 9 lines · Vladimir 'phcoder' Serbinenko
Quoted 7 lines · Olaf Hering
Quoted 3 lines · Vladimir 'φ-coder/phcoder' Serbinenko

I'm aware of the problem and I fully agree with you. Automatic install doesn't use those and I think the reason for it was to specify root in early days of porting. I don't think it's used for anything nowadays.

Quoted 5 lines
Quoted 3 lines

For PV guests the use case is simple: provide a generic grub binary, which recognizes optional knobs from the domU.cfg. This will be used to select one of the configured devices as root.

More details on this one please. Both command line and grub binary are on host. How is managing changing one is different from the other?

Not sure what you are asking, but:
The distro provides a static binary, which has a certain level of features. And some of the features can be controlled from the outside by some knobs. The feature is to select a certain drive without user interaction, and the knob is a string in the cmdline in the PV domU case.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Also unless there is a good usecase for having command line parsing, I'm all for killing existing ieee1275 parsing altogether and not introducing any parsing in the future.

So you want to dumb it down to the 80s PC level, even if some firmware implementations can set knobs?!

"It's shiny and new" or "this is from 80s" are fallacies and not arguments.

Its not new that a firmware provides an interface to query its properties AND that a firmware provides an interface the adjust properties. OF does that. EFI maybe, no idea. And in some sense a PV guest via its cmdline does that as well. I have however not looked how the cmdline is passed to the PV kernel and how its retrieved in the PV kernel.

My laptop with its BIOS provides nothing like that because the concept is based on the PC from the 80s. Or whatever.

Olaf

#11 lore raw
Quoted 9 lines · Olaf Hering
Quoted 6 lines · Vladimir 'phcoder' Serbinenko
Quoted 4 lines · Olaf Hering
Quoted 1 line · Vladimir 'φ-coder/phcoder' Serbinenko

I'm aware of the problem and I fully agree with you. Automatic

install

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

doesn't use those and I think the reason for it was to specify root

in

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

early days of porting. I don't think it's used for anything

nowadays.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

For PV guests the use case is simple: provide a generic grub binary, which recognizes optional knobs from the domU.cfg. This will be used

to

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

select one of the configured devices as root.

More details on this one please. Both command line and grub binary are

on host.

Quoted 7 lines
Quoted 1 line

How is managing changing one is different from the other?

Not sure what you are asking, but:
The distro provides a static binary, which has a certain level of features. And some of the features can be controlled from the outside by some knobs. The feature is to select a certain drive without user interaction,

This info is already in grub.cfg. Why does grub.cfg need help to find disk with distro if it already contains a refence to it?

Quoted 4 lines

and the knob is a string in the cmdline in the PV domU case.

Quoted 1 line
Quoted 1 line
Quoted 1 line

Also unless there is a good usecase for having command line

parsing, I'm

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

all for killing existing ieee1275 parsing altogether and not

introducing

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

any parsing in the future.

So you want to dumb it down to the 80s PC level, even if some firmware implementations can set knobs?!

"It's shiny and new" or "this is from 80s" are fallacies and not

arguments.

Quoted 8 lines

Its not new that a firmware provides an interface to query its properties AND that a firmware provides an interface the adjust properties. OF does that. EFI maybe, no idea. And in some sense a PV guest via its cmdline does that as well. I have however not looked how the cmdline is passed to the PV kernel and how its retrieved in the PV kernel.

And your point is? Just that something is available doesn't mean it's useful

Quoted 9 lines

My laptop with its BIOS provides nothing like that because the concept is based on the PC from the 80s. Or whatever.

Olaf

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#12 lore raw
Quoted 2 lines · Vladimir 'phcoder' Serbinenko

This info is already in grub.cfg. Why does grub.cfg need help to find disk with distro if it already contains a refence to it?

How does the info which disk inside the guest to use initially get into grub.cfg? The distro can certainly not know that in advance. This is like setting the boot-device, which is up to the host admin, not grub or the distro.

Olaf

#13 lore raw

There is a standard where to put it. See xen docs

Quoted 18 lines · Olaf Hering
Quoted 1 line · Vladimir 'phcoder' Serbinenko

This info is already in grub.cfg. Why does grub.cfg need help to find

disk with

Quoted 1 line

distro if it already contains a refence to it?

How does the info which disk inside the guest to use initially get into grub.cfg? The distro can certainly not know that in advance. This is like setting the boot-device, which is up to the host admin, not grub or the distro.

Olaf

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#14 lore raw
Quoted 1 line · Vladimir 'phcoder' Serbinenko

There is a standard where to put it. See xen docs

Yes, its like that:
kernel="/usr/whatever/distro/grub.xen"
extra="opt1=val opt2=val"

And grub2 does not grab the cmdline provided via extra=. I think that providing root=xen/xvdb is the right way to control grub inside the domU.
In anycase, what the OF does today in its init code is valid and should stay. Once I find the time I will do the very same for PV grub.

Olaf

#15 lore raw
Quoted 9 lines · Olaf Hering
Quoted 1 line · Vladimir 'phcoder' Serbinenko

There is a standard where to put it. See xen docs

Yes, its like that:
kernel="/usr/whatever/distro/grub.xen"
extra="opt1=val opt2=val"

That's not what I meant. There is a standard on where to find files inside the domU.

Quoted 5 lines

And grub2 does not grab the cmdline provided via extra=. I think that providing root=xen/xvdb is the right way to control grub inside the domU.
In anycase, what the OF does today in its init code is valid and should stay.

Mixing up namespaces is certainly not valid. This will lead to both intended misuses like changing variables that shouldn't be and unintentional when e.g. root=/dev/xvda2 meant for Linux will sneak into grub breaking stuff

Quoted 8 lines

Once I find the time I will do the very same for PV grub.

Olaf

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#16 lore raw
Quoted 5 lines · Vladimir 'phcoder' Serbinenko
Quoted 3 lines · Olaf Hering

On Wed, Apr 29, Vladimir 'phcoder' Serbinenko wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

There is a standard where to put it. See xen docs

Yes, its like that:
kernel="/usr/whatever/distro/grub.xen"
extra="opt1=val opt2=val"

That's not what I meant. There is a standard on where to find files inside the domU.

Sigh..
There are likely ways to find out where grub was loaded from even on a PC, and use that as initial root=. In a PV guest no such thing exists because itself grub is the firmware. In OF I can imaging that it might be useful to point grub right away to some other device than listed in /chosen/bootpath.

Quoted 8 lines
Quoted 5 lines

And grub2 does not grab the cmdline provided via extra=. I think that providing root=xen/xvdb is the right way to control grub inside the domU.
In anycase, what the OF does today in its init code is valid and should stay.

Mixing up namespaces is certainly not valid. This will lead to both intended misuses like changing variables that shouldn't be and unintentional when e.g. root=/dev/xvda2 meant for Linux will sneak into grub breaking stuff

Since the kernel= is grub and the stuff in cmdline is obviously meant for that very kernel (grub), it can have no meaning for an OS that possibly loaded later. It does not even know about that string.

Olaf

#17 lore raw
Quoted 5 lines

Sigh..
There are likely ways to find out where grub was loaded from even on a PC, and use that as initial root=. In a PV guest no such thing exists because itself grub is the firmware.

grub-install already takes this into account.

Quoted 4 lines

In OF I can imaging that it might
be useful to point grub right away to some other device than listed in /chosen/bootpath.

We don't support loading modules from another version that what was compiled with kernel. And if you move different parts of GRUB install after grub-install, then you have only yourself to blame. Think of any other program: if you start moving its files around it will not work.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

And grub2 does not grab the cmdline provided via extra=. I think that providing root=xen/xvdb is the right way to control grub inside the domU.
In anycase, what the OF does today in its init code is valid and should stay.

Quoted 8 lines
Quoted 3 lines

Mixing up namespaces is certainly not valid. This will lead to both intended misuses like changing variables that shouldn't be and unintentional when e.g. root=/dev/xvda2 meant for Linux will sneak into grub breaking stuff

Since the kernel= is grub and the stuff in cmdline is obviously meant for that very kernel (grub), it can have no meaning for an OS that possibly loaded later. It does not even know about that string.

The GRUB which is used for kernel= may be programmed to use /vmlinuz and pass root= to it. merging unrelated namespaces is always

Quoted 7 lines

Olaf

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#18 lore raw
Quoted 6 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 5 lines

Sigh..
There are likely ways to find out where grub was loaded from even on a PC, and use that as initial root=. In a PV guest no such thing exists because itself grub is the firmware.

grub-install already takes this into account.

There is no grub-install in that case.

We run in circles, and to get out of the loop I have to show code.

Olaf

#19 lore raw
Quoted 7 lines · Olaf Hering
Quoted 5 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 5 lines

Sigh..
There are likely ways to find out where grub was loaded from even on a PC, and use that as initial root=. In a PV guest no such thing exists because itself grub is the firmware.

Quoted 6 lines
Quoted 1 line

grub-install already takes this into account.

There is no grub-install in that case.

We run in circles, and to get out of the loop I have to show code.

No, you need to show an actual usecase with enough details and explanation why the solutions that already exist are inadequate.

Quoted 7 lines

Olaf

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#20 lore raw
Quoted 8 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 7 lines · Olaf Hering
Quoted 5 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 5 lines

Sigh..
There are likely ways to find out where grub was loaded from even on a PC, and use that as initial root=. In a PV guest no such thing exists because itself grub is the firmware.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

grub-install already takes this into account.

There is no grub-install in that case.

We run in circles, and to get out of the loop I have to show code.

No, you need to show an actual usecase with enough details and explanation why the solutions that already exist are inadequate.

The way pv-grub2 is built by distributions now is grub-mkstandalone with grub.cfg that search several predefined directories for "real" guest grub.cfg. Passing its location as boot argument would make it possible to remove these harcdoded locations.

#21 lore raw
Quoted 16 lines · Andrei Borzenkov
Quoted 14 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 13 lines · Olaf Hering
Quoted 6 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 5 lines

Sigh..
There are likely ways to find out where grub was loaded from even on a PC, and use that as initial root=. In a PV guest no such thing exists because itself grub is the firmware.

grub-install already takes this into account.

There is no grub-install in that case.

We run in circles, and to get out of the loop I have to show code.

Quoted 9 lines
Quoted 2 lines

No, you need to show an actual usecase with enough details and explanation why the solutions that already exist are inadequate.

The way pv-grub2 is built by distributions now is grub-mkstandalone with grub.cfg that search several predefined directories for "real" guest grub.cfg. Passing its location as boot argument would make it possible to remove these harcdoded locations.

most other firmwares like EFI or BIOS look for boot image at hardcoded place e.g. MBR or ESP at predefined locations or uses NVRAM. The trouble with passing this info from dom0 is that it's difficult to discover for grub-install where to put image, in some cases this would even make install impossible without modifying dom0. I feel like location which changes all the time would create more confusion that hardcoded location (E.g. I ran grub-install but my system still uses old GRUB)

Quoted 5 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#22 lore raw
Quoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko

most other firmwares like EFI or BIOS look for boot image at hardcoded place e.g. MBR or ESP at predefined locations or uses NVRAM. The trouble with passing this info from dom0 is that it's difficult to discover for grub-install where to put image, in some cases this would even make install impossible without modifying dom0. I feel like location which changes all the time would create more confusion that hardcoded location (E.g. I ran grub-install but my system still uses old GRUB)

What do you expect from grub-install in a PV guest? Whatever it does today its result will be a noop. All that needs to be done is to write /boot/grub2/grub.cfg. In a PV guest grub2 is the firmware (kernel= in domU.cfg), and the NVRAM is the cmdline (extra= in domU.cfg).

Olaf

#37 lore raw
In reply to Andrei Borzenkov

2015-05-07 23:03 GMT+08:00 Andrei Borzenkov <[email protected]>:

Quoted 9 lines
Quoted 2 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 1 line · Olaf Hering

On Thu, May 07, Vladimir 'φ-coder/phcoder' Serbinenko wrote:

The way pv-grub2 is built by distributions now is grub-mkstandalone with grub.cfg that search several predefined directories for "real" guest grub.cfg. Passing its location as boot argument would make it possible to remove these harcdoded locations.

Just want to make the description more clear. We seen that pvgrub2 as a drop-in replacement for pvgrub. And pvgrub allows you specify config to load in domU.cfg while we found that it's not possible for pvgrub2.

eg.
kernel = "/usr/lib/xen/boot/pv-grub-x86_32.gz"
extra = "(hd0,0)/grub/menu.lst"

Thanks,
Michael

Quoted 5 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#23 lore raw
In reply to Olaf Hering
Quoted 11 lines · Olaf Hering
Quoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko

most other firmwares like EFI or BIOS look for boot image at hardcoded place e.g. MBR or ESP at predefined locations or uses NVRAM. The trouble with passing this info from dom0 is that it's difficult to discover for grub-install where to put image, in some cases this would even make install impossible without modifying dom0. I feel like location which changes all the time would create more confusion that hardcoded location (E.g. I ran grub-install but my system still uses old GRUB)

Quoted 5 lines

What do you expect from grub-install in a PV guest? Whatever it does today its result will be a noop. All that needs to be done is to write /boot/grub2/grub.cfg. In a PV guest grub2 is the firmware (kernel= in domU.cfg), and the NVRAM is the cmdline (extra= in domU.cfg).

That's not the plan which is pushed by xen guys. They propose to make grub stored on dom0 to just load grub from a predefined place in domU. This I.a. allows easier upgrade of bootloader for distros as they don't have to worry about dom0 having very old grub.
Also if cmdline is nvram then please tell me how to modify it from domU.

Quoted 6 lines

Olaf

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#24 lore raw
Quoted 18 lines · Vladimir 'phcoder' Serbinenko
Quoted 11 lines · Olaf Hering
Quoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko

most other firmwares like EFI or BIOS look for boot image at hardcoded place e.g. MBR or ESP at predefined locations or uses NVRAM. The trouble with passing this info from dom0 is that it's difficult to discover for grub-install where to put image, in some cases this would even make install impossible without modifying dom0. I feel like location which changes all the time would create more confusion that hardcoded location (E.g. I ran grub-install but my system still uses old GRUB)

Quoted 5 lines

What do you expect from grub-install in a PV guest? Whatever it does today its result will be a noop. All that needs to be done is to write /boot/grub2/grub.cfg. In a PV guest grub2 is the firmware (kernel= in domU.cfg), and the NVRAM is the cmdline (extra= in domU.cfg).

Quoted 4 lines

That's not the plan which is pushed by xen guys. They propose to make grub stored on dom0 to just load grub from a predefined place in domU. This I.a. allows easier upgrade of bootloader for distros as they don't have to worry about dom0 having very old grub.

that's fine but you need to be able to confgure at least disk on which guest grub is located, even if path to binary is fixed. How do you do it wihout passing some information to dom0 grub?

Quoted 14 lines

Also if cmdline is nvram then please tell me how to modify it from domU.

Quoted 6 lines

Olaf

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#25 lore raw
Quoted 3 lines · Andrei Borzenkov

that's fine but you need to be able to confgure at least disk on which guest grub is located, even if path to binary is fixed. How do you do it wihout passing some information to dom0 grub?

If a domU starts to be able to modify its "firmware" in dom0 then this can be used to modify its "NVRAM" as well.

Olaf

#26 lore raw
In reply to Vladimir 'phcoder' Serbinenko
Quoted 4 lines · Vladimir 'phcoder' Serbinenko

That's not the plan which is pushed by xen guys. They propose to make grub stored on dom0 to just load grub from a predefined place in domU. This I.a. allows easier upgrade of bootloader for distros as they don't have to worry about dom0 having very old grub.

Thats news, where was that proposed and discussed?

Olaf

#27 lore raw
Quoted 9 lines · Olaf Hering
Quoted 4 lines · Vladimir 'phcoder' Serbinenko

That's not the plan which is pushed by xen guys. They propose to make grub stored on dom0 to just load grub from a predefined place in domU. This I.a. allows easier upgrade of bootloader for distros as they don't have to worry about dom0 having very old grub.

Thats news, where was that proposed and discussed?

http://xenbits.xen.org/docs/unstable/misc/x86-xenpv-bootloader.html

#28 lore raw
Quoted 10 lines · Andrei Borzenkov
Quoted 8 lines · Olaf Hering
Quoted 4 lines · Vladimir 'phcoder' Serbinenko

That's not the plan which is pushed by xen guys. They propose to make grub stored on dom0 to just load grub from a predefined place in domU. This I.a. allows easier upgrade of bootloader for distros as they don't have to worry about dom0 having very old grub.

Thats news, where was that proposed and discussed?

http://xenbits.xen.org/docs/unstable/misc/x86-xenpv-bootloader.html

That is chainloading, and in that sense at a different layer.

The kernel= still looks just at the very first disk, or whatever disk is returned by "search -f /path". If grub2 would start to look at extra= it will be possible to select a configured disk.

I just browsed the code today, grub_xen_start_page_addr->cmd_line is what /boot/chosen is in OF. Should be easy to add similar code to set variables found in that cmdline. Its then up to the scripts running in the binary referenced by kernel= to make use of such variables.

Olaf

#29 lore raw
Quoted 7 lines · Olaf Hering
Quoted 4 lines · Andrei Borzenkov
Quoted 3 lines · Olaf Hering
Quoted 1 line · Vladimir 'phcoder' Serbinenko

That's not the plan which is pushed by xen guys. They propose to

make grub

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

stored on dom0 to just load grub from a predefined place in domU.

This I.a.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

allows easier upgrade of bootloader for distros as they don't have

to worry

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

about dom0 having very old grub.

Thats news, where was that proposed and discussed?

http://xenbits.xen.org/docs/unstable/misc/x86-xenpv-bootloader.html

That is chainloading, and in that sense at a different layer.

Quoted 9 lines

The kernel= still looks just at the very first disk, or whatever disk is returned by "search -f /path". If grub2 would start to look at extra= it will be possible to select a configured disk.

I just browsed the code today, grub_xen_start_page_addr->cmd_line is what /boot/chosen is in OF. Should be easy to add similar code to set variables found in that cmdline. Its then up to the scripts running in the binary referenced by kernel= to make use of such variables.

Last thing we want is to promote bad code to a more popular platform

Quoted 6 lines

Olaf

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#30 lore raw
In reply to Andrei Borzenkov
Quoted 9 lines · Andrei Borzenkov
Quoted 7 lines · Olaf Hering
Quoted 4 lines · Vladimir 'phcoder' Serbinenko

That's not the plan which is pushed by xen guys. They propose to make grub stored on dom0 to just load grub from a predefined place in domU. This I.a. allows easier upgrade of bootloader for distros as they don't have to worry about dom0 having very old grub.

Thats news, where was that proposed and discussed?

http://xenbits.xen.org/docs/unstable/misc/x86-xenpv-bootloader.html

Where is that implemented anyway? I fail to find code for that in grub2 sources. But as noted elsewhere, this is within the guest. Nothing would load binaries from the suggested location. And there can be several disks, each containing the suggested layout. Its still up to the host admin to start a guest with a given kernel= and extra= from domU.cfg.

But without changes such as <[email protected]> it will be impossible for the host admin to load files from a specific disk (be it a disk or a cdrom). Imagine your PC without the BIOS provided boot menu behind F12 (or whereever), everything would need to go to the first disk.

Olaf

#31 lore raw
Quoted 5 lines · Olaf Hering
Quoted 3 lines · Andrei Borzenkov
Quoted 2 lines · Olaf Hering

On Fri, May 08, Vladimir 'phcoder' Serbinenko wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

That's not the plan which is pushed by xen guys. They propose to make grub stored on dom0 to just load grub from a predefined place in domU. This I.a. allows easier upgrade of bootloader for distros as they don't have to worry about dom0 having very old grub.

Thats news, where was that proposed and discussed?

http://xenbits.xen.org/docs/unstable/misc/x86-xenpv-bootloader.html

Where is that implemented anyway?

I do not think it is right now. I also do not really know what is the status of this proposal. Still this two stage approach look more interesting as it gives domU admin full control over boot loader to use.

SUSE could be the first :)

Quoted 18 lines

I fail to find code for that in grub2
sources. But as noted elsewhere, this is within the guest. Nothing would
load binaries from the suggested location. And there can be several
disks, each containing the suggested layout. Its still up to the host
admin to start a guest with a given kernel= and extra= from domU.cfg.

But without changes such as <[email protected]> it will be impossible for the host admin to load files from a specific disk (be it a disk or a cdrom). Imagine your PC without the BIOS provided boot menu behind F12 (or whereever), everything would need to go to the first disk.

Olaf

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#33 lore raw

The patch has been reviewed upstream and needs improvement

Quoted 15 lines · Olaf Hering
Quoted 1 line · Andrei Borzenkov

SUSE could be the first :)

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759018 indicates that Debian uses the referenced patches. Looks like they are ignored upstream.

Olaf

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#34 lore raw
Quoted 1 line · Vladimir 'phcoder' Serbinenko

The patch has been reviewed upstream and needs improvement

I see no followup to v2 of the patch.

Olaf

#36 lore raw
In reply to Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko

most other firmwares like EFI or BIOS look for boot image at hardcoded place e.g. MBR or ESP at predefined locations or uses NVRAM. The trouble with passing this info from dom0 is that it's difficult to discover for grub-install where to put image, in some cases this would even make install impossible without modifying dom0. I feel like location which changes all the time would create more confusion that hardcoded location (E.g. I ran grub-install but my system still uses old GRUB)

Thats exactly the point: other firmware have a notion of a boot-device. A PV guest currently has not, simply because grub has no code which looks at the info passed to it. How that info is interpreted is up to that very grub itself.

Regerading discovery:
In a PV domU storing the boot binary within that domU is equal to all other systems: it goes where /boot/xen/ is. There is nothing to detect from within domU. And in case some scripts have to refer to a disk, that info is in sysfs: /dev/xvda translates to xen/xvda etc [1]. Not sure if grub-install within domU does include such info into the binary. If it does, fine. If not, we are back to square one:

The first grub (kernel= in domU.cfg) may get a variable where to look for the second (guest admin controlled) grub. And this variable should be passed on to that second grub to make it aware where it was loaded from.

If there is no variable the first grub is free to search for the second grub. Even in this case it makes sense to tell that second grub where it came from.

Olaf

[1]: I see grub-core/disk/xen/xendisk.c:fill uses either xen/ or xenid/ as prefix. No idea how the second case can happen in practice. I dont know the backend/frontend protocol well enough. This case can likely be detected as well within domU. After all the kernel has to assign some name to such device.

Olaf