cvs commit: src/sys/sys gpt.h src/lib/libstand Makefile src/sbin/gpt Makefile add.c boot.c gpt.8 gpt.c gpt.h show.c src/sys/boot/common ufsread.c src/sys/boot/i386 Makefile src/sys/boot/i386/gptboot Makefile gptboot.c gptldr.S ...

John Baldwin jhb at
Wed Oct 24 14:45:17 PDT 2007

On Wednesday 24 October 2007 05:33:00 pm John Baldwin wrote:
> jhb         2007-10-24 21:33:00 UTC
>   FreeBSD src repository
>   Modified files:
>     sys/sys              gpt.h 
>     lib/libstand         Makefile 
>     sbin/gpt             Makefile add.c gpt.8 gpt.c gpt.h show.c 
>     sys/boot/common      ufsread.c 
>     sys/boot/i386        Makefile 
>     sys/boot/i386/gptboot Makefile gptboot.c 
>     sys/boot/i386/libi386 biosdisk.c devicename.c 
>     sys/geom/part        g_part.c g_part.h g_part_gpt.c 
>   Added files:
>     sbin/gpt             boot.c 
>     sys/boot/i386/gptboot gptldr.S 
>     sys/boot/i386/pmbr   Makefile pmbr.s 
>   Log:
>   First cut at support for booting a GPT labeled disk via the BIOS bootstrap
>   on i386 and amd64 machines.  The overall process is that /boot/pmbr lives
>   in the PMBR (similar to /boot/mbr for MBR disks) and is responsible for
>   locating and loading /boot/gptboot.

A quick way to use it is thus:

gpt create disk0
gpt boot disk0
-- use gpt add to add filesystems
-- newfs filesystems
-- populate filesystems

Some other notes:
- gptboot can not distinguish SCSI vs ATA disks since it has no bsdlabel to 
peek into.  However, since the loader reads /etc/fstab to determine the root 
device, this doesn't actually matter.
- Currently the algorithm to find / is not very optimal.  I've been talking 
some with Marcel about this so this will probably change.
- ZFS + GPT booting shouldn't be that difficult to do now.  It basically 
requires two things:
  1) A ZFS file system driver in libstand.
  2) A gptboot that can read ZFS.  This could either be a separate gptboot.zfs
     or gptboot could be expanded to read both UFS and ZFS.  Right now gptboot
     is a little over 8k and the default size of the boot partition is 64k,
     so there's a good bit of room there for read-only ZFS support.
- All the I/O for GPT disks uses EDD LBA with no C/H/S crap.  Ever.

John Baldwin

More information about the cvs-src mailing list