On Fri, Aug 7, 2009 at 2:12 PM, Robert Millan<r...@aybabtu.com> wrote:
>
> This patch reimplements 10_freebsd.in using 10_linux.in as a base, with
> the kFreeBSD-specific parts of 10_freebsd.in.
>
> The new version brings in support for multiple kernel versions (the reason
> for the rewrite) and also handling of acpi.ko.
>
> It is diffed against 10_linux.in, since the old code structure is no longer
> used.
As discussed on IRC this patch has problems on FreeBSD.
Among them
1) stat and readlink are different. Does anyone have an idea how to
make scripts always use right syntax?
2) "FreeBSD, kFreeBSD ..." isn't what FreeBSD user expects.
3) Version isn't detected correctly.
4) Doesn't use UUID
5) device.hints are forgotten
6) Doesn't support ZFS
Attached patch fixes 1 (breaking linux), 2,4 and 5
1,3 and 6 remain
>
> --
> Robert Millan
>
>  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
>  how) you may access your data; but nobody's threatening your freedom: we
>  still allow you to remove your data and not access it at all."
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 3585a68..cc6065f 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -39,7 +39,7 @@ make_system_path_relative_to_its_root ()
   fi
 
   # canonicalize
-  if path=`readlink -f $path` ; then : ; else
+  if path=`realpath $path` ; then : ; else
     return 1
   fi
 
@@ -50,12 +50,12 @@ make_system_path_relative_to_its_root ()
     dir=`echo $path | sed -e "s,/[^/]*$,,g"`
   fi
 
-  num=`stat -c %d $dir`
+  num=`stat -f %d $dir`
 
   # this loop sets $dir to the root directory of the filesystem we're 
inspecting
   while : ; do
-    parent=`readlink -f $dir/..`
-    if [ "x`stat -c %d $parent`" = "x$num" ] ; then : ; else
+    parent=`realpath $dir/..`
+    if [ "x`stat -f %d $parent`" = "x$num" ] ; then : ; else
       # $parent is another filesystem; we found it.
       break
     fi
diff --git a/util/grub.d/10_freebsd.in b/util/grub.d/10_freebsd.in
index 891a20f..ce0a9a1 100644
--- a/util/grub.d/10_freebsd.in
+++ b/util/grub.d/10_freebsd.in
@@ -22,7 +22,7 @@ libd...@libdir@
 . ${libdir}/grub/grub-mkconfig_lib
 
 case "${GRUB_DISTRIBUTOR}" in
-  Debian)      OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" ;;
+  Debian)      OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD, kFreeBSD " ;;
   *)           OS="FreeBSD" ;;
 esac
 
@@ -49,7 +49,7 @@ EOF
   fi
 
   cat << EOF
-       set FreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${GRUB_DEVICE}
+       set 
FreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${kfreebsd_fs}id/${GRUB_DEVICE_UUID}
        set FreeBSD.vfs.root.mountfrom.options=rw
 }
 EOF
@@ -66,7 +66,8 @@ while [ "x$list" != "x" ] ; do
   dirname=`dirname $kfreebsd`
   rel_dirname=`make_system_path_relative_to_its_root $dirname`
 
-  if [ x"$devices" != "x" ] ; then
+  if [ -f /boot/device.hints ] ; then
+    devices=/boot/device.hints
     devices_basename=`basename $devices`
     devices_dirname=`dirname $devices`
     devices_rel_dirname=`make_system_path_relative_to_its_root 
$devices_dirname`
@@ -93,7 +94,7 @@ while [ "x$list" != "x" ] ; do
     acpi_ko_rel_dirname=`make_system_path_relative_to_its_root 
$acpi_ko_dirname`
   fi
 
-  kfreebsd_entry "${OS}, kFreeBSD ${version}"
+  kfreebsd_entry "${OS} ${version}"
 
   list=`echo $list | tr ' ' '\n' | grep -vx $kfreebsd | tr '\n' ' '`
 done
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to