add freebsd 4.x support into the grub shell and grub-install.

This commit is contained in:
okuji 2001-02-28 11:19:39 +00:00
parent 348785cfbc
commit dfee6ac3ec
3 changed files with 33 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2001-02-28 OKUJI Yoshinori <okuji@gnu.org>
From HASEGAWA Tomoki <thasegawa@mta.biglobe.ne.jp>:
* 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 <okuji@gnu.org> 2001-02-28 OKUJI Yoshinori <okuji@gnu.org>
From Thierry Laronde <thierry@cri74.org>: From Thierry Laronde <thierry@cri74.org>:

View file

@ -208,7 +208,11 @@ get_ide_disk_name (char *name, int unit)
sprintf (name, "/dev/hd%d", unit); sprintf (name, "/dev/hd%d", unit);
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
/* FreeBSD */ /* FreeBSD */
# if __FreeBSD__ >= 4
sprintf (name, "/dev/rad%d", unit);
# else /* __FreeBSD__ <= 3 */
sprintf (name, "/dev/rwd%d", unit); sprintf (name, "/dev/rwd%d", unit);
# endif /* __FreeBSD__ <= 3 */
#elif defined(__NetBSD__) && defined(HAVE_OPENDISK) #elif defined(__NetBSD__) && defined(HAVE_OPENDISK)
/* NetBSD */ /* NetBSD */
char shortname[16]; char shortname[16];

View file

@ -86,6 +86,13 @@ convert () {
gnu*) gnu*)
tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'` tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'`
tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;; 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 echo "grub-install does not support your OS yet." 1>&2
exit 1 ;; exit 1 ;;
@ -121,6 +128,20 @@ convert () {
| sed "s%)%,$tmp_bsd_partition)%"` | sed "s%)%,$tmp_bsd_partition)%"`
fi fi
echo "$tmp_drive" ;; 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 esac
else else
# If no partition is specified, just print the drive name. # If no partition is specified, just print the drive name.