Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 May 2012 07:45:35 -0400
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        Eric McCorkle <eric@shadowsun.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: GSoC Project: EFI on amd64/i386
Message-ID:  <BA85B7AA-FEA5-40B0-A15A-B4E000206C59@xcllnt.net>
In-Reply-To: <4FA95960.7090908@shadowsun.net>
References:  <4FA95960.7090908@shadowsun.net>

next in thread | previous in thread | raw e-mail | index | archive | help

On May 8, 2012, at 1:35 PM, Eric McCorkle wrote:

> Here are some specific points to be decided:
> 
> * An EFI boot service could potentially function similarly to
> [zfs]loader.  Alternatively, it could function like gpt[zfs]boot,
> though this might require modifying loader(8) since EFI boot services
> run in protected/long mode, and have different system information
> table formats.

Your terminology is a bit confusing. EFI provides boot services
and runtime services. These services allow EFI applications (e.g.
loaders) to do stuff, like output to a console or read/write
file systems, etc.

The runtime services are not available to a kernel. Only the
boot services can be used by a kernel.

Now, as for the FreeBSD boot loader: it's currently an EFI
program/image that can be run from within EFI and that uses
the boot- and runtime services to load the FreeBSD kernel from
a file system it knows about in some GPT partition. The loader
is stored in the EFI system partition so that it can be found
and run.

> * How much of what EFI provides do we want to use?  There are
> advantages and disadvantages both ways.

I don't understand the question. Can you elaborate?

> * How much of the kernel needs to be changed to boot/run from an EFI boot?

The hand-off will be different. In particular, a proper loader
will not load the kernel at some hardcoded address. Instead it
will use EFI's memory allocation routines to get available
memory chunks and load a kernel there. Since the kernel may not
occupy a single contiguous range in physical memory this way,
you want the loader to set up page tables as well.

Put differently: the current state of affairs is that the EFI
loader we have loads a kernel, but can't boot it.

> * It seems possible to support booting from legacy BIOS as well as EFI
> (install a protective MBR, and gpt[zfs]boot on a FreeBSD boot
> partition, install the EFI boot loader in a way that the EFI firmware
> will find it and load it, and the system itself on another partition).
> Is it worth trying to do this?

You need to support both anyways. But not at the same time.
The machine either boots BIOS or EFI and depending on that
will it use the EFI loader or use the MBR to load boot code.
There's nothing to try.

Key is to have a single kernel loadable and bootable by
either the EFI loader or using the "legacy" loader.

-- 
Marcel Moolenaar
marcel@xcllnt.net





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BA85B7AA-FEA5-40B0-A15A-B4E000206C59>