On Mon, Sep 30, 2013 at 7:51 AM, Grant Likely grant.likely@linaro.org wrote:
On Mon, Sep 30, 2013 at 2:59 PM, Leif Lindholm leif.lindholm@linaro.org wrote:
Hi guys,
I've been looking at the patches Matthew Garrett wrote for loading a UEFI stub kernel through GRUB, and noticed one thing that may require updates to the stub code: it uses GRUB to load the initrd. Doing this of course means the initrd does not need to go into the EFI System Partition, which is a lot nicer from the distros' position.
Now, in x86 land GRUB just passes the stub a bootparam structure, and I assume it just keeps filling the same structure in before passing it on to the kernel .
On ARM*, we would need to get this information over "some other way", where the obvious candidate would be FDT.
GRUB could register an empty devicetree, with only the initrd information in it, as a UEFI configuration table. (Getting a UUID for this was discussed in New Orleans.)
Right. It would be a trivial feature to have a UUID in the system table pointing to an allocated block of memory containing an FDT. It would also be nice to give the FDT some extra space when loaded so that the libfdt functions can work in-place... but I digress; the flat tree structure already contains enough information to do that.
Or, on systems using FDT for hardware description, once firmware becomes mature enough to do this themselves - add this information to the system-provided one.
The stub would then need to look for this devicetree, and if present, copy the initrd nodes across into the one it loads itself.
I was thinking that the stub would want to use the FDT passed by grub if one is passed, but I hadn't thought about the case where grub wants to pass information to the stub, but the stub still loads the FDT. The easiest thing would be to straight out say that if GRUB is loading the initrd, then it is mandatory for GRUB to also load the FDT. That eliminates the corner case and I can't think of any situation where we'd want GRUB loading the initrd, but use the stub to load the FDT.
I'd also like to avoid having the stub merge FDT contents from different trees.
If we add this table, then it seems this would be the right way to handle passing the FDT to the EFI stub, even without GRUB involved. Is there a reason not to move to this method in general?
Alternatively, we could define a special protocol for passing additional parameters to the stubbed kernel ... or a special protocol to pass a special FDT but I'm not sure we want yet another interface.
Indeed. I definitely don't want to do this.
Agreed...
g.
On Mon, Sep 30, 2013 at 08:05:59AM -0700, Roy Franz wrote:
I was thinking that the stub would want to use the FDT passed by grub if one is passed, but I hadn't thought about the case where grub wants to pass information to the stub, but the stub still loads the FDT. The easiest thing would be to straight out say that if GRUB is loading the initrd, then it is mandatory for GRUB to also load the FDT. That eliminates the corner case and I can't think of any situation where we'd want GRUB loading the initrd, but use the stub to load the FDT.
I'd also like to avoid having the stub merge FDT contents from different trees.
If we add this table, then it seems this would be the right way to handle passing the FDT to the EFI stub, even without GRUB involved. Is there a reason not to move to this method in general?
Not really. So ... I guess that would modify the stub behaviour to: - Look for an FDT_GUID configuration table. - If there, use it. - If not there, require one to be loaded based on command line.
And the GRUB behaviour to: - If no FDT_GUID, require FDT if initrd. - If FDT_GUID, copy FDT + add initrd information.
The x86 code uses bootparam to pass the kernel command line. Could we use the FDT exists) for the kernel command line too? This would make more code shared between x86 and ARM*, since otherwise we would need to explicitly implement (UCS?) command line passing to stub?
Note that current code does not use CALL_IMAGE, it simply loads the kernel into memory and jumps to it (passing it GRUB image handle and System Table pointer).
Alternatively, we could define a special protocol for passing additional parameters to the stubbed kernel ... or a special protocol to pass a special FDT but I'm not sure we want yet another interface.
Indeed. I definitely don't want to do this.
Agreed...
I'm glad :)
/ Leif
boot-architecture@lists.linaro.org