Porting U-Boot's UEFI Payload to coreboot

Ahamed Husni ahamedhusni73 at gmail.com
Sat Mar 12 16:22:54 CET 2022


Hello,

Sorry for the delay. Thank you for the replies.

On Tue, Mar 8, 2022 at 9:39 PM Simon Glass <sjg at chromium.org> wrote:
>
> Hi,
>
> On Tue, 8 Mar 2022 at 06:57, Heinrich Schuchardt <xypron.glpk at gmx.de>
wrote:
> >
> > On 3/8/22 13:59, Ahamed Husni wrote:
> > > Hi everyone,
> > >
> > > I am trying to work on a project to port the U-Boot UEFI code to
coreboot
> > > as a payload.
> > > I haven't worked with UEFI before except running a basic EFI payload
in a
> > > coreboot/u-boot environment. (Serial output:
> > > https://gist.github.com/drac98/6166d29f6c3a2baf2f4e791925ea98d3)
> > >
> > > I would like to know how UEFI is implemented in U-Boot. Is UEFI
integrated
> > > into u-boot or is it implemented like a payload?
> >
> > Hello Ahamed,
> >
> > the UEFI API implementation is an integral part of U-Boot.
> >
> > >
> > > Where is the UEFI source code? Is it the following files in the tree
> > > https://source.denx.de/u-boot/custodians/u-boot-efi
> > > lib/
> > > |__ efi/
> > > |__ efi_driver/
> > > |__ efi_loader/
> >
> > U-Boot can both be run on top of UEFI. This is the code you find in
> > /lib/efi/. Furthermore UEFI can run as a firmware providing the UEFI
> > API. This is what you find in /lib/efi_loader/ and /lib/efi_driver/.
Then I should look at the lib/efi_loader/ and lib/efi_driver/ I guess.
Thank you!

> >
> > You can build U-Boot as payload for coreboot which offers the UEFI API
> > implementation. See configs/coreboot64_defconfig.
> >
> > U-Boot runs ARM and RISC-V Linux successfully via UEFI.
> >
> > What architecture are you looking at?
I'll be mostly working with a x86_64 QEMU target.
I am proposing this project for the GSoC this year.
So the architecture could change after discussions.

> >
> > Simon (on CC) has been working on U-Boot on UEFI and Coreboot while I
> > have concentrated on the UEFI API implementation in U-Boot.
@Simon can I CC you to the discussion in coreboot?

>
> Yes you can use U-Boot as a coreboot payload - this is now running in
> CI so we make sure it works on each release. I plan to add more test
> cases to it but have been waiting to see if coreboot can add something
> similar to its CI.

I used U-Boot (v2019.4) as a coreboot payload to run my hello world EFI
payload and it
worked.

I also tried different combinations of the applications,
| Arch | U-Boot | EFI | Status |
|--------|---------|--------|-------------|
| 32bit | 32bit | 32bit | Success |
| 64bit | 32bit | 32bit | Success |
| 64bit | 64bit | 64bit | Fails and reboot |
| 64bit | 64bit | 32bit | Fails and returns back to shell printing the
error code |
| 64bit | 32bit | 64bit | Fails and returns back to shell printing the
error code |

The last two fail because the EFI does not support booting a 64-bit
application from a 32-bit EFI (or vice versa) as mentioned in the u-boot
docs. Is this something in the UEFI specification?

The third one fails because 64-bit EFI is not supported yet.

Is there a way to run 64-bit EFI with something like the 32-bit SPL binary
used to boot 64-bit u-boot in coreboot(32-bit)?
Ex: can we boot a 64bit Windows/Linux with 32-bit EFI? It seems linux can
work with 32bit EFI from this
<https://github.com/maharmstone/quibble/issues/2> thread.

Best Regards,
Husni Faiz.

>
> +Stefan Reinauer as we have been talking about this
>
> It seems better to go that way than trying to duplicate efforts. We
> have a program now to move UEFI to use driver model properly, for
> example.
>
> Regards,
> Simon


More information about the U-Boot mailing list