GPTin it's name the loader is not related to EFI/UEFI. The main goal of the loader is to provide ability to bootstrap the NetBSD from GPT partitioned disk on a PC BIOS computer.
By nature the GPT loader is very similar to usual NetBSD MBR loader. It comprised of the following three parts:
$ awk '/^WARNING:/ {print $(NF)}' gptboot.patch
NB: wedges are not supported on vnd(4) devices.# gpt create sd0 # gpt add -s 65536 -t efi sd0 # gpt add -t ffs sd0 # gpt showthen issue a set of dkctl addwedge commands or reattach the disk to configure dk wedges automatically
Next, format partitions accordingly:
Please note that newfs_msdos seems have a bug and can incorrectly determine filesystem size (check number of file sectors reported by newfs_msdos — it must be less or equal to partition size). It it appears, please reformat filesystem explicitly specifying correct fs size via# newfs_msdos -F 16 /dev/dk0 # newfs /dev/dk1
newfs_msdos -s
option.
Install loaders:
The gpt(8) will automatically find EFI System Partition on sd1 and instruct mbr_gpt where to load PBR from. But rest loaders should be installed on dk wedges. If you're confused about the names, you may use gpt(8) on a wedge, but in this case mbr_gpt will load PBR from the specified wedge:# .../gpt biosboot -c $NETBSDSRC_DIR/sys/arch/i386/stand/mbr/mbr_gpt/mbr_gpt sd0 # .../installboot /dev/rdk0 $NETBSDSRC_DIR/sys/arch/i386/stand/fatboot/fat16/bootxx_fat16 # mount -t msdos /dev/dk0 /mnt # cp $NETBSDSRC_DIR/sys/arch/i386/stand/boot/biosboot/boot /mnt # echo "menu=Boot NetBSD:boot hd0b:netbsd" > /mnt/boot.cfg # umount /mnt
# .../gpt biosboot -c $NETBSDSRC_DIR/sys/arch/i386/stand/mbr/mbr_gpt/mbr_gpt dk0
Install kernel and base system files:
# mount /dev/dk1 /mnt # cp /netbsd /mntthen create usual NetBSD hierarchy: /dev, /etc, /sbin, etc...
and specify root partition as it will be enumerated by DKWEDGE_AUTODISCOVER:# echo "/dev/dk1 / ffs rw 1 1" > /etc/fstab # umount /mnt
Please note disk names on previous steps. It might be somewhat confusing, so there is some explanation:
gpt biosboot ... sd0
: LBA0 means installation
in very first sector of physical disk, so we should specify
parent device of our GPT wedges. But a dk device can also be
used. In that case mbr_gpt will look for GUID partition matching
the dk device at moment of installation.installboot /dev/dk0 ...
: bootxx_fat16 should
be installed onto EFI System Partition. See gpt add
commands earlier.mount -t msdos /dev/dk0 ...
: the boot(8)
should be stored on EFI System Partition as well.echo "menu=Boot NetBSD:boot hd0b:netbsd" ...
:
the hd0b
means the second partition, which matches
dk1
after boot. Please see todo list about that.dk1
which is
NetBSD FFS partition.Reboot. Have fun.
The loader still work in progress
so please check todo, bugs, and caveats page for possible
misbehavior. Anyway, please feel free to contact me in case of
problems, and also with ideas or comments.