Grub and disk partitioning

News and Announcements related to GhostBSD
Post Reply
ASX
Posts: 988
Joined: Wed May 06, 2015 12:46 pm

Grub and disk partitioning

Post by ASX »

Just made a few tests using grub bootloader, with alternate success and failures.

- grub-install failed on a GPT partitioned disk, with the following error:
# grub-install /dev/ada0
/usr/local/sbin/grub-bios-setup: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
/usr/local/sbin/grub-bios-setup: error: embedding is not possible, but this is required for cross-disk install.
Grub require a BIOS-BOOT partitiion, better described here:
http://en.wikipedia.org/wiki/BIOS_boot_partition

The current partitioning as implemented from "partition editor" and "gbi" aren't compatible with grub2 booloader.

Just something to consider in case of future adoption of grub as alternate boot loader.

~~~

- grub-install succeed on a MBR partitioned disk

I was able to boot using two methods:
- booting the loader
- booting the kernel

Code: Select all

insmod ufs2

menuentry "GhostBSD Loader" {
        set root="(hd0,msdos1,bsd1)"
        kfreebsd /boot/loader
}
booting the kernel directly, including loading optional modules which also succeed:

Code: Select all

insmod ufs2
set timeout=8

menuentry "GhostBSD Kernel" {
  set root="(hd0,msdos1,bsd1)"
  kfreebsd /boot/kernel/kernel
  kfreebsd_loadenv /boot/device.hints
  kfreebsd_module_elf /boot/kernel/ums.ko
  kfreebsd_module_elf /boot/kernel/crypto.ko
  kfreebsd_module_elf /boot/kernel/aesni.ko
  kfreebsd_module_elf /boot/kernel/geom_eli.ko
  kfreebsd_module_elf /boot/kernel/nullfs.ko
  kfreebsd_module_elf /boot/kernel/geom_uzip.ko
  kfreebsd_module_elf /boot/kernel/drm2.ko
  set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ada0s1a
  set kFreeBSD.kern.geom.eli.visible_passphrase=2
  set kFreeBSD.hw.memtest.tests=0
  set kFreeBSD.grub.platform=$grub_platform
  set kFreeBSD.vfs.zfs.arc_max=128M
  set kFreeBSD.kern.vty=vt
  set kFreeBSD.kern.geom.label.disk_ident.enable=0
  set kFreeBSD.kern.geom.label.gptid.enable=0
  set kFreeBSD.kern.geom.label.ufsid.enable=0
}
Note that in the above example, loading of drm2.ko failed because of missing dependencies, like when using loader.conf grub loader doesn't automatically take care of dependencies.
ASX
Posts: 988
Joined: Wed May 06, 2015 12:46 pm

Re: Grub and disk partitioning

Post by ASX »

As I have written above, a bios-boot partition is needed to be able to install grub on an GPT based setup.
For compatibility with future grub2 support, It would be desirable to setup a bios-boot partition, or at least, or as a first step, support for adding a bios-boot partition while manually partitioning a GPT disk in partition editor.

The partition type is described in gpart man page too:

man 8 gpart:
bios-boot
The system partition dedicated to second stage of
the boot loader program. Usually it is used by
the GRUB 2 loader for GPT partitioning schemes.
The scheme-specific type is "!21686148-6449-6E6F-744E-656564454649".
MBR setup doesn't require a bios-boot partition, because the related code is embedded in the sectors between the end of the MBR and the start of the first partition.
Post Reply