diff --git a/ChangeLog b/ChangeLog index 961b6d977..5d0e2d6c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-02-28 OKUJI Yoshinori + + From HASEGAWA Tomoki : + * lib/device.c (get_ide_disk_name) [__FreeBSD__]: Add support + for FreeBSD-4.0 or later. Use "/dev/rad0". + * util/grub-install.in (convert): Add code for FreeBSD + disklabels. + 2001-02-28 OKUJI Yoshinori From Thierry Laronde : diff --git a/lib/device.c b/lib/device.c index 4a58b006f..91051d29e 100644 --- a/lib/device.c +++ b/lib/device.c @@ -208,7 +208,11 @@ get_ide_disk_name (char *name, int unit) 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__ <= 3 */ #elif defined(__NetBSD__) && defined(HAVE_OPENDISK) /* NetBSD */ char shortname[16]; diff --git a/util/grub-install.in b/util/grub-install.in index fefd114b3..b7f24d484 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -86,6 +86,13 @@ convert () { 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 's%r\{0,1\}\([saw]d[0-9]*\).*$%r\1%' \ + | sed '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 ;; @@ -121,6 +128,20 @@ convert () { | 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 + echo "$tmp_drive" ;; esac else # If no partition is specified, just print the drive name.