Difference between revisions of "Adding PC-BSD to Grub Version 2"

From PC-BSD Wiki
Jump to: navigation, search
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Image:home.png|link=http://wiki.pcbsd.org/index.php/PC-BSD_Users_Handbook|center|Return to Table of Contents]] [[Image:previous1.png|left|link=http://wiki.pcbsd.org/index.php/Adding_PC-BSD_to_Grub_Version_1|Previous: Adding PC-BSD to Grub Version 1]] [[Image:next1.png|right|link=http://wiki.pcbsd.org/index.php/Dual_Boot_with_Windows_Using_EasyBCD|Next: Dual Boot with Windows Using EasyBCD]]
+
{{givechoiceVers|Dual Booting#Adding PC-BSD to GRUB Version 2}}
 
+
[[category:orphan]]
 
+
 
+
 
+
If your Linux distro is using grub version 2, the entry would now look like this:
+
 
+
title  PCBSD 8.1
+
root  (hd0,1,a)
+
kernel /boot/loader
+
boot
+
 
+
Here are some examples of more complex grub version 2 entries:
+
 
+
'''To set some sysctl values when loading the kernel:'''
+
 
+
menuentry "PCBSD (FreeBSD) 8.1" {
+
  insmod ufs2
+
  set root=(hd0,3)
+
  kfreebsd /boot/kernel/kernel
+
  set KFreeBSD.vfs.root.mountfrom=ufs:dev/label/rootfs0
+
  set KFreeBSD.vfs.root.mountfrom.options=rw
+
}
+
 
+
'''To use the specified drive UUID:'''
+
 
+
First, at a command prompt in the PC-BSD system, determine the UUID with this command:
+
 
+
# '''/usr/local/sbin/grub-probe -d /dev/ad4s1 -t fs_uuid'''
+
 
+
Then, use that UUID in the grub menu entry:
+
 
+
menuentry "FreeBSD ad4, direct" {
+
  insmod ufs2
+
  set root=(hd0,1,a)
+
  search --no-floppy --fs-uuid --set 4b22f9090565ab77
+
  kfreebsd /boot/kernel/kernel
+
  kfreebsd_loadenv /boot/device.hints
+
  set KFreeBSD.vfs.root.mountfrom=ufs:/dev/ad4s1a
+
  set KFreeBSD.vfs.root.mountfrom.options=rw
+
}
+
 
+
'''To use ZFS on GPT Partition:'''
+
 
+
zfs set mountpoint=legacy on all datasets on ${ZPOOL} and manage mountpoints in ${ZFSDATASET-INSTALLATION}/etc/fstab
+
menuentry "FreeBSD install in ${ZFSDATASET-INSTALLATION} (i.e. 8.1-RELEASE-amd64) on ${ZPOOL} (i.e. zroot)" {
+
          insmod zfs
+
          # search for ${ZPOOL}
+
          search -s -l zroot
+
# Load kernel of FreeBSD, kfreebsd /${ZFSROOTDATASET}/${ZFSDATASET-INSTALLATION}@/boot/kernel/kernel [http://www.freebsd.org/cgi/man.cgi?query=boot&sektion=8 (-aCcDdghmnPpqrsv)]
+
          kfreebsd /8.1-RELEASE-amd64@/boot/kernel/kernel
+
          kfreebsd_module_elf /8.1-RELEASE-amd64@/boot/kernel/opensolaris.ko
+
          kfreebsd_module_elf /8.1-RELEASE-amd64@/boot/kernel/zfs.ko
+
# Loading kernel modules (${VAR}_load="YES") here, /boot/loader.conf isn't processed
+
#        kfreebsd_module_elf /${ZFSDATASET-INSTALLATION}@/boot/kernel/${VAR}.ko
+
          kfreebsd_module /8.1-RELEASE-amd64@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
+
          set kFreeBSD.vfs.root.mountfrom=zfs:zroot/8.1-RELEASE-amd64
+
# Loader Tunables (${TUNABLE}="variable" -> set kFreeBSD.${TUNABLE}=variable)
+
}
+
 
+
CHECK IF NECESSARY:
+
 
+
After a Grub2 configuration change you need to run '''update-grub''' as the superuser or '''sudo update-grub'''.
+
 
+
For more information please refer to the [http://grub.enbug.org/Manual Grub 2 manual]
+

Latest revision as of 00:11, 23 December 2013

NOTE: This page or its content was moved. The handbook portion of the wiki now primarily focuses on two versions, the most recent release and the upcoming (work-in-progress). This is an imperfect solution to a recurring problem which may not always be solved by the provided links below.

[edit] Which would you like?

Release (10.0)
Dual Booting#Adding PC-BSD to GRUB Version 2
Upcoming (10.1)
Dual Booting#Adding PC-BSD to GRUB Version 2
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox