i386 EFI loader -- need help

From: Doug White <dwhite_at_gumbysoft.com>
Date: Sat, 21 Jan 2006 16:57:05 -0800 (PST)
Hey folks,

I've done some work to try to get the EFI loader to work on i386 and have
run into some snags and gaps in my knowledge and could use a hand from
people who have more experience with the boot process and toolchains and
assembly code.

There are 3 prinicipal parts that I need help with:

1. libefi elf32 exec() -- The code that actually goes between exiting EFI
and jumping into the kernel image itself needs to be written.
src/sys/boot/efi/libefi/elf_freebsd.c has the EFI part already taken care
of. But from just after the call to ExitBootServices() down needs to do
the necessary dance on i386 to start the kernel. I don't know what the
expected environment is supposed to be and whether it needs to change from
how EFI leaves things. EFI uses a flat space and disables paging when it
exits. More details are in the EFI spec which is freely downloadable from
Intel.

2. ELF32 self-relocator -- The self-relocation code in
src/sys/boot/ia64/efi/start.S is in ia64 assembly and needs to be
converted into i386 so the PE32+-wrapped-ELF-objects loader.efi binary can
function. I'm not well versed enough in ia64 assembly or ELF in general to
undertake this without going really, really slowly. :)

3. efi-app-ia32 toolchain target -- The spec defines PE32+ as the official
binary format (32-bit PE with 64-bit relocations). Both us (via NetBSD?)
and GNU cheat by having objcopy build a PE32+ binary but with a small shim
that performs the ELF relocations. Our libbfd on i386 isn't configured
with the efi-app-ia32 target. We include the efi-app-ia64 target on ia64
so this should just require adding some bits to the Makefile and building.
_Should_. (This doesn't actually look so horrible so I'll give it a try.)

After loader.efi is functional there is still the big job of
conditionalizing BIOS calls in the kernel and providing EFI replacements
where needed. A module to perform EFI calls from the kernel is also needed
to allow access to the nvram variables and use the EFI ResetSystem() call
if needed.

If you need a test environment you can download the Sample Implementation
from Intel which will give you a boot floppy you can pop in any PC and
start up into EFI. I also have real hardware to test on that is big,
white, and has a certain fruit for its logo. :)

-- 
Doug White                    |  FreeBSD: The Power to Serve
dwhite_at_gumbysoft.com          |  www.FreeBSD.org
Received on Sat Jan 21 2006 - 23:57:10 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:51 UTC