BE Loader Menu (was Re: rcs)
Kris Moore
kris at pcbsd.org
Thu Oct 10 14:15:16 UTC 2013
On 10/10/2013 00:47, Thomas Mueller wrote:
> Sorry for previous typo in From: line, missing right angle bracket at end.
> Then, in a finger error, I resent that message just before finding the error and making the needed correction.
>
> from Devin Teske:
>
>> I'm late to the party again ;D (didn't realize the rcs thread had turned BE)
>> Both problems can be solved.
>> The loading of the kernel *after* choosing your boot device is trivial.
>> We've been doing it at $work for *years* (almost a decade?)
>> I can put that in, whenever. Probably at the same time as implementing
>> the live/dynamic BE menus for selecting the root device.
> I'd like to know how to boot FreeBSD >= 9.1 with grub2.
>
> Following the instructions under $PORTSDIR/sysutils/grub2
>
> insmod ufs2
> set root=(hd0,gpt3)
> kfreebsd /boot/loader
> boot
>
> stopped working around FreeBSD 9.1-stable.
>
> I used Super Grub2 Disk image on the System Rescue CD written to USB stick.
>
> Recently, I built sysutils/grub2, ran mkrescue, wrote that image to the System Rescue USB stick and made the entry in /syslinux/syslinux.cfg, but haven't tested that yet.
>
> What is the method you or PC-BSD uses?
>
> I want to use it on FreeBSD 9.2 and 10-current.
>
> I tried visiting pcbsd.org website but couldn't find any details.
>
> Tom
>
> _______________________________________________
> freebsd-current at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe at freebsd.org"
We use the same port, but have some custom grub.d/ scripts which builds
our /boot/grub/grub.cfg files.
https://github.com/pcbsd/pcbsd/tree/master/src-sh/pc-extractoverlay/ports-overlay/usr/local/etc/grub.d
The scripts do basic stuff like parsing output of "beadm" and creating a
list of Boot-Environment menus to build. Along with parsing
/boot/loader.conf, /boot/device.hints and friends. Lastly it even has
code to mount each of your BEs and copy the resulting grub.cfg file into
each, so that you have a unified menu regardless of which BE you are
currently booting.
One thing that I really want to fix is detecting which kernel modules
have what depends. Currently I have to ensure that /boot/loader.conf has
both the target module + depends in order for GRUB to load them properly.
If anybody wants to help hack on these and make them more "FreeBSD
generic" I think it could eventually go into the ports tree for everybody.
When grub-mkconfig is run, it generates a ZFS / BE specific boot-script,
with entries that look like this:
---------------------------------------------------------------
submenu "PC-BSD (default) - 2013-08-27 14:23" {
menuentry "Normal Bootup" {
insmod zfs
search -s -l tank1
kfreebsd /ROOT/default/@/boot/kernel/kernel
kfreebsd_module /ROOT/default/@/boot/zfs/zpool.cache
type=/boot/zfs/zpool.cache
set kFreeBSD.vfs.root.mountfrom=zfs:tank1/ROOT/default
kfreebsd_module_elf /ROOT/default/@/boot/kernel/siis.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/sdhci.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/geom_journal.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/geom_mirror.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/geom_eli.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/aesni.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/zfs.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/tmpfs.ko
kfreebsd_module_elf /ROOT/default/@/boot/modules/nvidia.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/dummynet.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/ipfw_nat.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/ipdivert.ko
kfreebsd_module_elf /ROOT/default/@/boot/modules/vboxdrv.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/zlib.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/opensolaris.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/linux.ko
kfreebsd_module_elf /ROOT/default/@/boot/kernel/crypto.ko
set kFreeBSD.hint.fdc.0.at=isa
set kFreeBSD.hint.fdc.0.port=0x3F0
set kFreeBSD.hint.fdc.0.irq=6
set kFreeBSD.hint.fdc.0.drq=2
set kFreeBSD.hint.fd.0.at=fdc0
set kFreeBSD.hint.fd.0.drive=0
set kFreeBSD.hint.fd.1.at=fdc0
set kFreeBSD.hint.fd.1.drive=1
set kFreeBSD.hint.atkbdc.0.at=isa
set kFreeBSD.hint.atkbdc.0.port=0x060
set kFreeBSD.hint.atkbd.0.at=atkbdc
set kFreeBSD.hint.atkbd.0.irq=1
set kFreeBSD.hint.psm.0.at=atkbdc
set kFreeBSD.hint.psm.0.irq=12
set kFreeBSD.hint.sc.0.at=isa
set kFreeBSD.hint.sc.0.flags=0x100
set kFreeBSD.hint.uart.0.at=isa
set kFreeBSD.hint.uart.0.port=0x3F8
set kFreeBSD.hint.uart.0.flags=0x10
set kFreeBSD.hint.uart.0.irq=4
set kFreeBSD.hint.uart.1.at=isa
set kFreeBSD.hint.uart.1.port=0x2F8
set kFreeBSD.hint.uart.1.irq=3
set kFreeBSD.hint.ppc.0.at=isa
set kFreeBSD.hint.ppc.0.irq=7
set kFreeBSD.hint.atrtc.0.at=isa
set kFreeBSD.hint.atrtc.0.port=0x70
set kFreeBSD.hint.atrtc.0.irq=8
set kFreeBSD.hint.attimer.0.at=isa
set kFreeBSD.hint.attimer.0.port=0x40
set kFreeBSD.hint.attimer.0.irq=0
set kFreeBSD.hint.wbwd.0.at=isa
set kFreeBSD.hint.psm.0.flags=0x1000
set kFreeBSD.kern.ipc.shmseg=1024
set kFreeBSD.kern.ipc.shmmni=1024
set kFreeBSD.kern.maxproc=10000
set kFreeBSD.legal.intel_ipw.license_ack=1
set kFreeBSD.legal.intel_iwi.license_ack=1
set kFreeBSD.vfs.zfs.prefetch_disable=1
set kFreeBSD.hint.acpi_throttle.0.disabled=1
set kFreeBSD.machdep.disable_mtrrs=1
set kFreeBSD.kern.geom.eli.visible_passphrase=2
}
--
Kris Moore
PC-BSD Software
iXsystems
More information about the freebsd-current
mailing list