Add a terrible hack to GPT which allows non-EFI BIOSes to boot from it.
authorMatthew Dillon <dillon@dragonflybsd.org>
Wed, 30 Jul 2008 00:45:26 +0000 (00:45 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Wed, 30 Jul 2008 00:45:26 +0000 (00:45 +0000)
commit210143e4adb94adc21693f94a9ed6a57110ffdcd
treeebe470a3f1124ca3f99fdf6f1a843641e10214c6
parent5dacbb2e940ff330a16f9ff68378476a29e1c771
Add a terrible hack to GPT which allows non-EFI BIOSes to boot from it.
With a freshly made gpt on a disk you can run 'gpt boot da0' (specifying
the correct whole-disk name) and GPT will do the following:

* It will create a 100MB partition #0 in the GPT

* It will fake up a slice 1 in the PMBR for the BIOS and the loader that
  aliases partition #0 in the GPT.

The BIOS and loader will see a bootable slice 1 while the kernel, once
booted, will see a GPT.  This can cause confusion because the kernel
will NOT see the fake slice 1 any more, and the partition number in the
GPT of the boot partition 0 (aka da0s0).

The boot partition (da0s0 from the point of view of the kernel) needs
to have a 32 bit disklabel and a UFS filesystem in da0s0a which contains
the kernel image and boot sub-directory.  In the boot sub-directory the
loader.conf file must contain a line that points to the root mount, which
say you may have created with gpt add as partition #1.

Older kernels may require the root mount to also be in a disklabel, so you
might have to put a 32 or 64 bit disklabel in partition #1 as well.
This requirement will be removed soon relative to this commit (since the
idea with GPT is to not have to use disklabels).

    vfs.root.mountfrom="ufs:ad0s1a"
    vfs.root.mountfrom="ufs:ad0s1"
sbin/gpt/Makefile
sbin/gpt/boot.c [new file with mode: 0644]
sbin/gpt/gpt.c
sbin/gpt/gpt.h