Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Oct 2013 10:15:13 -0400
From:      Kris Moore <kris@pcbsd.org>
To:        Thomas Mueller <mueller6724@bellsouth.net>,  freebsd-current@freebsd.org
Cc:        "Teske, Devin" <Devin.Teske@fisglobal.com>
Subject:   Re: BE Loader Menu (was Re: rcs)
Message-ID:  <5256B671.2040105@pcbsd.org>
In-Reply-To: <59.81.16944.C6136525@cdptpa-oedge02>
References:  <60177810-8DC4-4EA3-8040-A834B79039D2@orthanc.ca> <52538EDC.2080001@freebsd.org> <52541202.3010707@mu.org> <20131008.170444.74714516.sthaug@nethelp.no> <52542BD4.5070706@FreeBSD.org> <52542E1D.9000000@mu.org> <CAOjFWZ4xq3fTQc_%2B7i68HVa3xO6-uXUPt=hAPnH5fv0z9D5WRQ@mail.gmail.com> <52555D1C.8010407@freebsd.org> <CAOjFWZ70-or1_873iOgeLMThqAJV_y0ZA0%2BfWhJYTwHygq=pYA@mail.gmail.com> <CAOjFWZ5bsrQ5TuT0W1yTK=T%2Bj4Q=oAPhE-CfN9z1Ydeg_5BF3g@mail.gmail.com> <52558577.5020401@allanjude.com> <52558779.2070203@pcbsd.org> <517D65A3D61F684FAE2B2EC2D2DA06C3@fisglobal.com> <13CA24D6AB415D428143D44749F57D720FC4B2A3@LTCFISWMSGMB21.FNFIS.com> <59.81.16944.C6136525@cdptpa-oedge02>

next in thread | previous in thread | raw e-mail | index | archive | help
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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe@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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5256B671.2040105>