[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch] grub-install for FreeBSD
From: |
HASEGAWA Tomoki |
Subject: |
[patch] grub-install for FreeBSD |
Date: |
Mon, 26 Feb 2001 20:49:53 +0900 (JST) |
I hack grub-install utility for FreeBSD(-4.2). I test only
installation to /dev/ad0 on my FreeBSD-4.2-STABLE machine, but even da
or so will work.
ChangeLog:
* lib/device.c [__FreeBSD__] (get_ide_disk_name): Add support for FreeBSD-4.0
or later. Use "/dev/rad0".
* util/grub-install.in (convert): Add the code for FreeBSD disklabels.
--- lib/device.c.orig Sat Dec 9 12:43:26 2000
+++ lib/device.c Mon Feb 26 19:59:47 2001
@@ -208,7 +208,11 @@
sprintf (name, "/dev/hd%d", unit);
#elif defined(__FreeBSD__)
/* FreeBSD */
+# if __FreeBSD__ >= 4
+ sprintf (name, "/dev/rad%d", unit);
+# else /* __FreeBSD__ <= 3 */
sprintf (name, "/dev/rwd%d", unit);
+#endif /* __FreeBSD__ */
#elif defined(__NetBSD__) && defined(HAVE_OPENDISK)
/* NetBSD */
char shortname[16];
--- util/grub-install.in.orig Fri Dec 15 20:33:32 2000
+++ util/grub-install.in Mon Feb 26 20:03:54 2001
@@ -86,6 +86,11 @@
gnu*)
tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'`
tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;;
+ freebsd*)
+ tmp_disk=`echo "$1" | sed -e 's%r\{0,1\}\([saw]d[0-9]*\).*$%r\1%' \
+ | sed -e 's%r\{0,1\}\(da[0-9]*\).*$%r\1%'`
+ tmp_part=`echo "$1" | sed
"s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" \
+ | sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%"` ;;
*)
echo "grub-install does not support your OS yet." 1>&2
exit 1 ;;
@@ -117,6 +122,20 @@
if echo $tmp_part | grep "[a-g]$" >/dev/null; then
tmp_bsd_partition=`echo "$tmp_part" \
| sed "s%[^a-g]*\([a-g]\)$%\1%"`
+ tmp_drive=`echo "$tmp_drive" \
+ | sed "s%)%,$tmp_bsd_partition)%"`
+ fi
+ echo "$tmp_drive" ;;
+ freebsd*)
+ if echo $tmp_part | grep "^s" >/dev/null; then
+ tmp_pc_slice=`echo $tmp_part \
+ | sed "s%s\([0-9]*\)[a-h]*$%\1%"`
+ tmp_drive=`echo "$tmp_drive" \
+ | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"`
+ fi
+ if echo $tmp_part | grep "[a-h]$" >/dev/null; then
+ tmp_bsd_partition=`echo "$tmp_part" \
+ | sed "s%s\{0,1\}[0-9]*\([a-h]\)$%\1%"`
tmp_drive=`echo "$tmp_drive" \
| sed "s%)%,$tmp_bsd_partition)%"`
fi
- [patch] grub-install for FreeBSD,
HASEGAWA Tomoki <=