Hi Ahamed, On Sat, 12 Mar 2022 at 08:23, Ahamed Husni <ahamedhusn...@gmail.com> wrote: > > Hello, > > Sorry for the delay. Thank you for the replies. > > On Tue, Mar 8, 2022 at 9:39 PM Simon Glass <s...@chromium.org> wrote: > > > > Hi, > > > > On Tue, 8 Mar 2022 at 06:57, Heinrich Schuchardt <xypron.g...@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 that is OK. > > > > > 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? Yes. +Ilias Apalodimas might comment on that too. > > The third one fails because 64-bit EFI is not supported yet. It is supported now but there are some problems and it needs some work. You are welcome to look at it and I can help. +Christian Melki was testing that > > 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 thread. It sounds like you found the coreboot64 build which uses SPL to switch to 64bit, then runs 64-bit U-Boot. But if I understand correctly, your question is more for Linux and Windows I think, so I would check there. > > 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