Jump to content











Photo
- - - - -

Chainload FreeBSD with GRUB4DOS?


  • Please log in to reply
1 reply to this topic

#1 AnonVendetta

AnonVendetta

    Silver Member

  • Advanced user
  • 693 posts
  • Location:A new beginning.....
  • Interests:Self-development, computing

Posted 10 April 2019 - 11:31 PM

OK, so I've installed FreeBSD into a primary partition on one of my 3 internal SSDs. Drive is MBR partitioned and contains no other bootable OSes. I used the instructions at:

https://forums.freeb...nder-mbr.28925/

But with that method, no matter whether you allow the installer to create its' own partition, or instruct it to use an existing one, it does not install its' boot code into the MBR. But that is easily solved with this command while booted into the ISO:

boot0cfg -B <DRIVE HERE>

I am not sure whether it uses GRUB, GRUB2, or something else. In the linked topic they say that only the MBR sector is used, so that excludes GRUB2 but still allows for the possibility of legacy GRUB. Or maybe it is something that the FreeBSD people created themselves, they seem to be Mavericks and relish in doing things differently than the more mainstream Linux. They also proudly tout that they are a true Unix-based OS, with a complete kernel and userspace utils, in contrast to Linux which is technically just a kernel, with the GNU userland utils being added in separately and divided into distros. BASH isn't even installed as an available shell, though you can install it manually.

FreeBSD partitioning uses what are called 'slices' within a traditional primary partition, with the different mount points such as /, etc living in those slices. Slices are their way of logical partitions in a primary, but without an extended partition divided into logicals. When looking at the drive in another partition tool like GParted, FreeBSD's partition appears as a single primary, no extended or logicals. My install contains / and swap 'slices'.

I think it is easy enough to chainload FreeBSD's MBR with G4D. When booting it standalone, a menu comes up asking if you want to boot Windows with F1 or FreeBSD with F2, despite Windows not being present on the drive. Perhaps it sees the other NTFS partitions and assumes they are Windows. My 5 Linuxes, on separate drives, aren't listed, so I don't think it checks other drives.

After pressing F2 the real FreeBSD menu comes up, with options for multi-user mode, single-user mode, rescue mode. If nothing is pressed the default mode is auto-selected and kernel starts. From there you login via CLI and you're in the OS, simple.

What I would want to do with G4D is to skip the F1/F2 menu (no timeout on that screen, it just waits on the user), possibly simulate F2 keypress if necessary, and boot straight from G4D into FreeBSD's main boot menu. Or, creates G4D entries for each of FreeBSD's modes so I can skip the boot menu entirely and boot the kernel.

Thanks!

#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14778 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 11 April 2019 - 09:22 AM

A "typical" entry for BSD in grub4dos is

 

http://syrlug.org/co...ub-examples.txt

title BSD Loader
root (hd0,1,a)
kernel /boot/loader

but it has to be tested if the *whatever* filesystem you are using in BSD is readable by grub4dos.

 

In any case you can configure boot0cfg to have only one partition/slice/os:

https://dririan.com/...using-boot0cfg/

 

 

 

And then chainload (from a grub4dos on another disk) the MBR of the BSD disk *like*:

title BSD disk
rootnoverify (hd0)
 chainloader +1

And then further refine the boot0cfg configuration:

https://www.freebsd....t0cfg&sektion=8

 

:duff:

Wonko






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users