On Mon, Sep 30, 2013 at 07:27:58PM +0100, Grant Likely 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.
OK. So we push the actual error condition of missing tree down to stub?
Makes sense.
> > 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.
Yes. This would be my preference.
> 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.
Since the current code doesn't UEFI-wise "load" the stub image, we'd
effectively need to reverse-reconstruct GRUB's runtime environment,
which I really wouldn't like.
/
Leif
On Mon, Sep 30, 2013 at 7:51 AM, Grant Likely <grant.likely(a)linaro.org> wrote:
> On Mon, Sep 30, 2013 at 2:59 PM, Leif Lindholm <leif.lindholm(a)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.
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.)
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.
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.
Thoughts?
/
Leif
Hi all,
The uefi-next.git tree [1] has been updated for the 13.09 cycle.
We're at -rc1, but the code freeze is today, so probably not enough time
for any changes before the release.
Snapshot binaries are available now [2]
What's included?
Well, not as much as I hoped because I've run out of time. So no ethernet
and no SMBIOS patches just yet.
Current topic branches:
linaro-topic-a5
linaro-topic-a9
linaro-topic-arndale
linaro-topic-bds
linaro-topic-fvp
linaro-topic-misc
linaro-topic-origen
linaro-topic-panda
linaro-topic-tc1
linaro-topic-tc2
As always, you should probably pull and build the "linaro-tracking" branch,
not one of the topic branches.
The main addition for this release is the (now) upstream aarch64 support.
The uefi_rtsm-ve-aemv8.bin snapshot binary will boot on the Aarch64 VE
model that is currently available to Linaro internal people from the usual
place [4]
I've tested A9, TC2, FVP on the snapshot binaries. I tested RTSMs, aarch64
VE model and Arndale on my own build of the code and Dave Long has tested
Panda on his own build of the same code.
One problem I note for aarch64 is that we don't have a similar fix to this
for native building:
4511a19 2012-12-12 BaseTools: allow native building [Leif Lindholm]
Probably not a big issue, who would want to compile aarch64 inside a model??
Regards,
Ryan.
[1] https://git.linaro.org/gitweb?p=arm/uefi/uefi-next.git;a=summary
[2] https://snapshots.linaro.org/components/kernel/uefi-next/152
[3]
https://snapshots.linaro.org/components/kernel/uefi-next/152/uefi_rtsm-ve-a…
[4] https://collaborate.linaro.org/display/ITS/FlexLM+and+Fast+Models
Hi,
I have checked out to the 2012.09.1 branch of the
u-boot-linaro-stable source and built the u-boot for panda. It worked
fine. Then I enabled the Debug prints and again built the u-boot. But
this time the u-boot hanged up in the middle. In my observations, it
hanged up at the end of the board_init_f() function in the
arch/arm/lib/board.c. At the end it has the relocate_code() function
that might cause the problem. Im stuck up with this and any help would
be appreciated.
Thanks,
Davidson. K
Hi,
a normal Linux kernel currently supports reading the start and end
address of a single binary blob via the FDT's /chosen node.
This will be interpreted as the location of an initial RAM disk.
The Xen hypervisor itself is a kernel, but needs up to _two_ binaries
for proper operation: a Dom0 Linux kernel and it's associated initrd.
On x86 this is solved via the multiboot protocol used by the Grub
bootloader, which supports to pass an arbitrary number of binary modules
to any kernel.
Since in the ARM world we have the versatile device tree, we don't need
to implement the mulitboot protocol.
So I'd like to propose a new binding which denotes binary modules a
kernel can use at it's own discretion.
The need is triggered by the Xen hypervisor (which already uses a very
similar scheme), but the approach is deliberately chosen to be as
generic as possible to allow future uses (like passing firmware blobs
for devices or the like).
Credits for this go to Ian Campbell, who started something very similar
[1] for the Xen hypervisor. The intention of this proposal is to make
this generic and publicly documented.
Looking forward to any comments!
Thanks,
Andre.
[1]
http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=docs/misc/arm/device-tree…
----------------------------
* Multiple boot modules device tree bindings
Boot loaders wanting to pass multiple additional binaries to a kernel
shall add a node "module" for each binary blob under the /chosen node
with the following properties:
- compatible:
compatible = "boot,module";
A bootloader may add names to more specifically describe the module,
e.g. Xen may use "xen,dom0-kernel" or "xen,dom0-ramdisk".
If possible a kernel should be able to use modules even without a
descriptive naming, by enumerating them in order and using hard-coded
meanings for each module (e.g. first is kernel, second is initrd).
- reg: specifies the base physical address and size of a region in
memory where the bootloader loaded the respective binary data to.
- bootargs:
An optional property describing arguments to use for this module.
Could be a command line or configuration data.
Example:
/chosen {
#size-cells = <0x1>;
#address-cells = <0x1>;
module@0 {
compatible = "xen,linux-zimage", "xen,multiboot-module",
"boot,module";
reg = <0x80000000 0x003dcff8>;
bootargs = "console=hvc0 earlyprintk ro root=/dev/sda1 nosmp";
};
module@1 {
compatible = "xen,linux-initrd", "xen,multiboot-module",
"boot,module";
reg = <0x08000000 0x00123456>;
};
...
Adding Dennis for a distro perspective.
On Wed, Sep 4, 2013 at 3:44 AM, Ian Campbell <Ian.Campbell(a)citrix.com> wrote:
> On Tue, 2013-09-03 at 17:00 -0500, Rob Herring wrote:
>> On Tue, Sep 3, 2013 at 10:53 AM, Andre Przywara
>> <andre.przywara(a)linaro.org> wrote:
>> > Hi,
>> >
>> > a normal Linux kernel currently supports reading the start and end address
>> > of a single binary blob via the FDT's /chosen node.
>> > This will be interpreted as the location of an initial RAM disk.
>> >
>> > The Xen hypervisor itself is a kernel, but needs up to _two_ binaries for
>> > proper operation: a Dom0 Linux kernel and it's associated initrd.
>> > On x86 this is solved via the multiboot protocol used by the Grub
>> > bootloader, which supports to pass an arbitrary number of binary modules to
>> > any kernel.
>> >
>> > Since in the ARM world we have the versatile device tree, we don't need to
>> > implement the mulitboot protocol.
>>
>> But surely there would be some advantage of reuse by using the
>> multi-boot protocol since Xen, grub, and OS tools already support it
>> for x86.
>
> Multiboot is pretty x86 specific (although MB2 has a MIPS port) and
> covers more stuff than we strictly require (e.g. on x86 it has
> requirements around which processor mode you enter in, has paging
> enabled etc).
>
>> > So I'd like to propose a new binding which denotes binary modules a kernel
>> > can use at it's own discretion.
>> > The need is triggered by the Xen hypervisor (which already uses a very
>> > similar scheme), but the approach is deliberately chosen to be as generic as
>> > possible to allow future uses (like passing firmware blobs for devices or
>> > the like).
>> > Credits for this go to Ian Campbell, who started something very similar [1]
>> > for the Xen hypervisor. The intention of this proposal is to make this
>> > generic and publicly documented.
>>
>> Can you describe how you see the boot flow working starting with OS
>> installer writes kernel, initrd, xen and ??? to disk.
>
> Kernel and initrd are written to /boot in the usual way (probably from
> kernel.deb or whatever). Xen would also normally come from a distro
> package (also in /boot).
>
>> How does the bootloader know what to load?
>
> It's in the bootloader config, e.g. boot.scr or grub.cfg, which are
> either hand written or produced by the distros tooling.
>
> grub on ARM could consume the same stanzas as are used by grub on x86 to
> boot Xen (which are produced by update-grub):
> echo 'Loading Xen 4.1-amd64 ...'
> multiboot /xen-4.1-amd64.gz placeholder
> echo 'Loading Linux 3.10-2-amd64 ...'
> module /vmlinuz-3.10-2-amd64 placeholder root=/dev/mapper/disks-root ro resume=/dev/mapper/disks-swap quiet
> echo 'Loading initial ramdisk ...'
> module /initrd.img-3.10-2-amd64
>
> Since there is no multiboot on ARM (and never will be) this is safe.
>
> If multiboot ever does come to ARM it will necessarily be multiboot2
> which uses a different keyword.
Right, this is just a text file with a list of binaries. It is not
really the multiboot spec. There is no reason for this part to be
different for grub on ARM. There is a big advantage to reusing the
distro side tooling. If there isn't really much reuse on the
bootloader side, then I'm fine with a different bootloader to Xen
interface. I would like to hear that from folks working on grub
though.
> For u-boot Andre has proposed some syntactic sugar over the "fdt"
> command to make boot.scr more trivial to use. We would of course need to
> implement support for using it in the relevant distro tools (but they
> tend to be very distro/machine specific already, e.g. Debian's
> flash-kernel)
And being machine specific is a PITA. flash-kernel is certainly not
something we want to expand on. There is not much love for boot.scr
either. There is work to address what are not really machine
differences, but largely vendor u-boot differences:
http://www.mail-archive.com/u-boot@lists.denx.de/msg119025.html
One option for u-boot which already supports syslinux style menu files
is to adopt the syslinux multiboot parsing support:
http://www.syslinux.org/wiki/index.php/Doc/mboot
We need to back-up and consider what this looks like in the end for
all the pieces and get input from folks on grub, UEFI, and armv8. The
UEFI answer may be this is a grub problem. For armv8, this proposal
does match up well as the kernel boot interface for v8 is DT. Despite
some claims, ACPI will not completely replace DT because of this.
Rob