On Mon, Sep 30, 2013 at 11:27 AM, Grant Likely grant.likely@linaro.org wrote:
On Mon, Sep 30, 2013 at 5:46 PM, Leif Lindholm leif.lindholm@linaro.org wrote:
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.
Create a mostly empty one for passing freeform data to the kernel proper; this is what it will look like on ACPI systems.
So for ACPI systems the stub will package the ACPI data into the FDT? What would the stub be putting into the FDT that an ACPI/UEFI aware kernel couldn't get itself at runtime from UEFI?
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?
Yes, I think that makes sense. That also means GRUB will need to always create an FDT, even if it is empty.
I'm not following something here - why would GRUB create an empty FDT?
Is GRUB going to be responsible for the complete FDT, or just passing the initrd and/or command line in an FDT?
The other option would be to pass the command line via the LoadOptions from the EFI_LOADED_IMAGE protocol. I believe that is what Roy's patches currently rely on for getting a command line.
Yes, both my implementation and the x86 implementation get the command line from the EFI_LOADED_IMAGE protocol, and do conversion from UCS-2 (I think) to ASCII/UTF-8 to pass to the kernel. The format of the command line does not seem to be specified by UEFI.
g.
On Mon, Sep 30, 2013 at 12:16:08PM -0700, Roy Franz wrote:
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.
Create a mostly empty one for passing freeform data to the kernel proper; this is what it will look like on ACPI systems.
So for ACPI systems the stub will package the ACPI data into the FDT? What would the stub be putting into the FDT that an ACPI/UEFI aware kernel couldn't get itself at runtime from UEFI?
No - it would just pass the EFI System Table pointer, just like it does now.
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?
Yes, I think that makes sense. That also means GRUB will need to always create an FDT, even if it is empty.
I'm not following something here - why would GRUB create an empty FDT?
Well, not empty - it would contain an empty command line string.
Is GRUB going to be responsible for the complete FDT, or just passing the initrd and/or command line in an FDT?
If UEFI already had an FDT registered as a configuration table, it would use that, and add a few nodes.
If not, it could either load one (and register as a UEFI configuration table) or create one without any hardware description (and still register it as a UEFI configuration table).
In either case, the stub would still be responsible to add the memory map and system table pointer to the FDT.
The other option would be to pass the command line via the LoadOptions from the EFI_LOADED_IMAGE protocol. I believe that is what Roy's patches currently rely on for getting a command line.
Yes, both my implementation and the x86 implementation get the command line from the EFI_LOADED_IMAGE protocol, and do conversion from UCS-2 (I think) to ASCII/UTF-8 to pass to the kernel. The format of the command line does not seem to be specified by UEFI.
So just to make things more fun - if we do the above, then you would need to be able to deal with both cases: - Command line through FDT. - Command line through EFI_LOADED_IMAGE (as fallback), if using a loader like rEFIned or Gummiboot.
/ Leif
On Mon, Sep 30, 2013 at 12:26 PM, Leif Lindholm leif.lindholm@linaro.org wrote:
On Mon, Sep 30, 2013 at 12:16:08PM -0700, Roy Franz wrote:
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.
Create a mostly empty one for passing freeform data to the kernel proper; this is what it will look like on ACPI systems.
So for ACPI systems the stub will package the ACPI data into the FDT? What would the stub be putting into the FDT that an ACPI/UEFI aware kernel couldn't get itself at runtime from UEFI?
No - it would just pass the EFI System Table pointer, just like it does now.
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?
Yes, I think that makes sense. That also means GRUB will need to always create an FDT, even if it is empty.
I'm not following something here - why would GRUB create an empty FDT?
Well, not empty - it would contain an empty command line string.
Is GRUB going to be responsible for the complete FDT, or just passing the initrd and/or command line in an FDT?
If UEFI already had an FDT registered as a configuration table, it would use that, and add a few nodes.
If not, it could either load one (and register as a UEFI configuration table) or create one without any hardware description (and still register it as a UEFI configuration table).
In either case, the stub would still be responsible to add the memory map and system table pointer to the FDT.
OK, so when GRUB is used, it will always pass the only FDT that the EFI stub will use. The EFI stub will just add the final memory map, and system table pointer to the the FDT from GRUB. This means that in the GRUB case, the EFI stub will never load any files.
The other option would be to pass the command line via the LoadOptions from the EFI_LOADED_IMAGE protocol. I believe that is what Roy's patches currently rely on for getting a command line.
Yes, both my implementation and the x86 implementation get the command line from the EFI_LOADED_IMAGE protocol, and do conversion from UCS-2 (I think) to ASCII/UTF-8 to pass to the kernel. The format of the command line does not seem to be specified by UEFI.
So just to make things more fun - if we do the above, then you would need to be able to deal with both cases:
- Command line through FDT.
- Command line through EFI_LOADED_IMAGE (as fallback), if using a loader like rEFIned or Gummiboot.
Handling the 2 cases is not a problem. I just don't want to handle 'mixed' cases where a command line and an FDT are passed to the stub, and information from both is used.
As I understand it, the two cases are:
FDT_GUID present == GRUB case * GRUB loads initrd if present * GRUB provides complete FDT to stub (includes command line, hardware description, initrd entry, etc.) * EFI stub loads FDT using FDT_GUID, adds memory map and system table pointer to FDT, starts kernel. * (any command line present in EFI_LOADED_IMAGE is ignored.)
FDT_GUID absent == current case * stub loads FDT and initrd from system partition * stub adds command line from EFI_LOADED_IMAGE to FDT * stub adds initrd entry to FDT * stub adds memory map and system table pointer to FDT, starts kernel.
In the case of UEFI owning the FDT, and providing it to the stub, where does the initrd come from? I think this adds another case to handle...
/ Leif
boot-architecture@lists.linaro.org