Dual Booting With FreeBSD 9: Difference between revisions
m (moved Dual Booting With FreeBSD 9+ to Dual Booting With FreeBSD 9: + messes up the link) |
mNo edit summary |
||
Line 69: | Line 69: | ||
=Notes= | =Notes= | ||
The Slackware partition uses ext4 and the huge kernel with no initrd. For, say, xfs you should use 'insmod xfs'. For an initrd you need to look up the appropriate docs. | |||
Caveat: This was tested on FreeBSD 9.0Beta3. I can't see that it wouldn't work when release is out but you never know. | Caveat: This was tested on FreeBSD 9.0Beta3. I can't see that it wouldn't work when release is out but you never know. | ||
[[User:Dive|Dive]] | [[User:Dive|Dive]] |
Revision as of 10:55, 25 October 2011
Introduction
FreeBSD 9+ differs from older releases by using GPT (GUID Partition Table). This means that lilo and grub version 1 will no longer work. Grub version 2 however does work.
There are two way of doings this - either install grub2 in Slackware, or install it in FreeBSD. Grub2 in Slackware does not seem to be able to pick up the FreeBSD partition and Grub2 in FreeBSD doesn't seem to pick up the Linux partitions. You will need to manually add these to /usr/local/etc/grub.d/40_custom.
To pick up all your Slackware kernels it's probably best to install grub2 in Slackware and add the FreeBSD partition manually. I've shown both methods here though, for completeness.
For this howto we'll assume that Slackware / is on /dev/sda2 (with no separate /boot partition), and that FreeBSD is on /dev/sdb2 (/dev/ada1p2 in FreeBSD-speak). These correspond to (hd0,2) and (hd1,2) in Grub2.
To install Grub2 in Slackware
To install Grub2 in Slackware, you can use the slackbuild script here: http://slackbuilds.org/repository/13.37/system/grub2/ and its dependencies. Once installed, issue:
# grub-install --modules=part_gpt /dev/sda
Edit /etc/grub.d/40_custom to add your FreeBSD partition (see mine below for an example). Once done:
# grub-mkconfig -o /boot/grub/grub.cfg
grub-mkconfig will pickup all your Linux partitions and all kernels (hopefully).
To install in FreeBSD
To install Grub2 in FreeBSD, you need to use ports.
I won't give an extended howto on using ports but these are the steps:
Fire up your FreeBSD system and navigate your way to /usr/ports/sysutils/grub2 as root
# make install && rm -rf work # grub-install --modules=part_gpt /dev/ad0
Edit /usr/local/etc/grub.d/40_custom to add your Slackware partition (see mine below for an example). Once done:
# grub-mkconfig -o /boot/grub/grub.cfg
grub-mkconfig will pick up FreeBSD automatically. /usr/local/etc/grub.d/40_custom will contain the extra OS's and FreeBSD boot loader if req'd.
Custom Rule
This is my 40_custom:
#!/bin/sh exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. menuentry 'Slackware' --class slackware --class gnu-linux --class os { insmod gzio insmod part_msdos insmod ext2 set root='(hd0,2)' linux /boot/vmlinuz root=/dev/sdb2 ro } menuentry "FreeBSD /boot/loader" --class freebsd --class bsd --class os { insmod ufs2 set root='(hd1,2)' kfreebsd /boot/loader }
(You choose which section you want to add - FreeBSD or Slackware - depending on where you installed Grub2.)
That's pretty much it.
Notes
The Slackware partition uses ext4 and the huge kernel with no initrd. For, say, xfs you should use 'insmod xfs'. For an initrd you need to look up the appropriate docs.
Caveat: This was tested on FreeBSD 9.0Beta3. I can't see that it wouldn't work when release is out but you never know.