[1893] 2008-11-04 Robert Millan <[email protected]>

Robert Millan <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 1893
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1893
Author:   robertmh
Date:     2008-11-04 15:20:35 +0000 (Tue, 04 Nov 2008)

Log Message:
-----------
2008-11-04  Robert Millan  <[email protected]>

        * util/grub.d/10_freebsd.in: New file.  Generate grub configuration
        for FreeBSD.
        * conf/common.rmk (grub-mkconfig_SCRIPTS): Add 10_freebsd.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/DISTLIST
    trunk/grub2/conf/common.mk
    trunk/grub2/conf/common.rmk

Added Paths:
-----------
    trunk/grub2/util/grub.d/10_freebsd.in

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2008-11-03 13:08:21 UTC (rev 1892)
+++ trunk/grub2/ChangeLog	2008-11-04 15:20:35 UTC (rev 1893)
@@ -1,3 +1,9 @@
+2008-11-04  Robert Millan  <[email protected]>
+
+	* util/grub.d/10_freebsd.in: New file.  Generate grub configuration
+	for FreeBSD.
+	* conf/common.rmk (grub-mkconfig_SCRIPTS): Add 10_freebsd.
+
 2008-11-03  Bean  <[email protected]>
 
 	* kern/elf.c (grub_elf32_load): Revert to previous code.

Modified: trunk/grub2/DISTLIST
===================================================================
--- trunk/grub2/DISTLIST	2008-11-03 13:08:21 UTC (rev 1892)
+++ trunk/grub2/DISTLIST	2008-11-04 15:20:35 UTC (rev 1893)
@@ -429,6 +429,7 @@
 util/update-grub_lib.in
 util/elf/grub-mkimage.c
 util/grub.d/00_header.in
+util/grub.d/10_freebsd.in
 util/grub.d/10_hurd.in
 util/grub.d/10_linux.in
 util/grub.d/10_windows.in

Modified: trunk/grub2/conf/common.mk
===================================================================
--- trunk/grub2/conf/common.mk	2008-11-03 13:08:21 UTC (rev 1892)
+++ trunk/grub2/conf/common.mk	2008-11-04 15:20:35 UTC (rev 1893)
@@ -548,7 +548,7 @@
 %: util/grub.d/%.in config.status
 	./config.status --file=$@:$<
 	chmod +x $@
-grub-mkconfig_SCRIPTS = 00_header 10_linux 10_hurd 30_os-prober 40_custom
+grub-mkconfig_SCRIPTS = 00_header 10_linux 10_hurd 10_freebsd 30_os-prober 40_custom
 ifeq ($(target_os), cygwin)
 grub-mkconfig_SCRIPTS += 10_windows
 endif

Modified: trunk/grub2/conf/common.rmk
===================================================================
--- trunk/grub2/conf/common.rmk	2008-11-03 13:08:21 UTC (rev 1892)
+++ trunk/grub2/conf/common.rmk	2008-11-04 15:20:35 UTC (rev 1893)
@@ -137,7 +137,7 @@
 %: util/grub.d/%.in config.status
 	./config.status --file=$@:$<
 	chmod +x $@
-grub-mkconfig_SCRIPTS = 00_header 10_linux 10_hurd 30_os-prober 40_custom
+grub-mkconfig_SCRIPTS = 00_header 10_linux 10_hurd 10_freebsd 30_os-prober 40_custom
 ifeq ($(target_os), cygwin)
 grub-mkconfig_SCRIPTS += 10_windows
 endif

Added: trunk/grub2/util/grub.d/10_freebsd.in
===================================================================
--- trunk/grub2/util/grub.d/10_freebsd.in	                        (rev 0)
+++ trunk/grub2/util/grub.d/10_freebsd.in	2008-11-04 15:20:35 UTC (rev 1893)
@@ -0,0 +1,60 @@
+#! /bin/sh -e
+
+# grub-mkconfig helper script.
+# Copyright (C) 2008  Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+. ${libdir}/grub/grub-mkconfig_lib
+
+devices=/boot/devices.hints
+if ! test -e ${devices} ; then
+  # not FreeBSD
+  exit 0
+fi
+
+if test -e /boot/kernel/kernel ; then
+  kfreebsd=/boot/kernel/kernel
+fi
+
+if [ "x$kfreebsd" != "x" ] ; then
+  echo "Found kernel of FreeBSD: $kfreebsd" >&2
+
+  kfreebsd_basename=`basename $kfreebsd`
+  kfreebsd_dirname=`dirname $kfreebsd`
+  kfreebsd_rel_dirname=`make_system_path_relative_to_its_root $kfreebsd_dirname`
+
+  devices_basename=`basename $devices`
+  devices_dirname=`dirname $devices`
+  devices_rel_dirname=`make_system_path_relative_to_its_root $devices_dirname`
+
+  root_device=`basename ${GRUB_DEVICE}`
+
+  # For "ufs" it's the same.  Do we care about the others?
+  kfreebsd_fs=${GRUB_FS}
+
+  cat << EOF
+menuentry "FreeBSD" {
+EOF
+  prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
+  cat << EOF
+	freebsd			${kfreebsd_rel_dirname}/${kfreebsd_basename}
+	freebsd_loadenv		${devices_rel_dirname}/${devices_basename}
+	set FreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${root_device}
+}
+EOF
+fi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.