2009-10-26 Robert Millan <rmh.grub@aybabtu.com>
* util/grub.d/10_freebsd.in: Remove. * util/grub.d/10_kfreebsd.in: New file (based on 10_linux.in). * configure.ac: Set host_kernel=kfreebsd for FreeBSD and GNU/kFreeBSD.
This commit is contained in:
parent
67937d4dca
commit
ba36be4119
1 changed files with 49 additions and 49 deletions
|
@ -21,82 +21,82 @@ exec_prefix=@exec_prefix@
|
||||||
libdir=@libdir@
|
libdir=@libdir@
|
||||||
. ${libdir}/grub/grub-mkconfig_lib
|
. ${libdir}/grub/grub-mkconfig_lib
|
||||||
|
|
||||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
case "${GRUB_DISTRIBUTOR}" in
|
||||||
OS=GNU/Linux
|
Debian) OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" ;;
|
||||||
else
|
*) OS="FreeBSD" ;;
|
||||||
OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# loop-AES arranges things so that /dev/loop/X can be our root device, but
|
|
||||||
# the initrds that Linux uses don't like that.
|
|
||||||
case ${GRUB_DEVICE} in
|
|
||||||
/dev/loop/*|/dev/loop[0-9])
|
|
||||||
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
|
kfreebsd_entry ()
|
||||||
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then
|
|
||||||
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
|
|
||||||
else
|
|
||||||
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
|
|
||||||
fi
|
|
||||||
|
|
||||||
linux_entry ()
|
|
||||||
{
|
{
|
||||||
cat << EOF
|
cat << EOF
|
||||||
menuentry "$1" {
|
menuentry "$1" {
|
||||||
EOF
|
EOF
|
||||||
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
|
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
|
||||||
cat << EOF
|
cat << EOF
|
||||||
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2
|
kfreebsd ${rel_dirname}/${basename}
|
||||||
EOF
|
EOF
|
||||||
if test -n "${initrd}" ; then
|
|
||||||
|
if test -n "${devices}" ; then
|
||||||
cat << EOF
|
cat << EOF
|
||||||
initrd ${rel_dirname}/${initrd}
|
kfreebsd_loadenv ${devices_rel_dirname}/${devices_basename}
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -n "${acpi_ko}" ; then
|
||||||
|
cat << EOF
|
||||||
|
kfreebsd_module_elf ${acpi_ko_rel_dirname}/${acpi_ko_basename}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${GRUB_DEVICE}
|
||||||
|
set kFreeBSD.vfs.root.mountfrom.options=rw
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
|
list=`for i in /boot/kfreebsd-* /boot/kernel/kernel ; do
|
||||||
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
||||||
done`
|
done`
|
||||||
|
|
||||||
while [ "x$list" != "x" ] ; do
|
while [ "x$list" != "x" ] ; do
|
||||||
linux=`version_find_latest $list`
|
kfreebsd=`version_find_latest $list`
|
||||||
echo "Found linux image: $linux" >&2
|
echo "Found kernel of FreeBSD: $kfreebsd" >&2
|
||||||
basename=`basename $linux`
|
basename=`basename $kfreebsd`
|
||||||
dirname=`dirname $linux`
|
dirname=`dirname $kfreebsd`
|
||||||
rel_dirname=`make_system_path_relative_to_its_root $dirname`
|
rel_dirname=`make_system_path_relative_to_its_root $dirname`
|
||||||
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
|
|
||||||
alt_version=`echo $version | sed -e "s,\.old$,,g"`
|
|
||||||
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
|
|
||||||
|
|
||||||
initrd=
|
if [ -f /boot/device.hints ] ; then
|
||||||
for i in "initrd.img-${version}" "initrd-${version}.img" \
|
devices=/boot/device.hints
|
||||||
"initrd-${version}" "initrd.img-${alt_version}" \
|
devices_basename=`basename $devices`
|
||||||
"initrd-${alt_version}.img" "initrd-${alt_version}"; do
|
devices_dirname=`dirname $devices`
|
||||||
if test -e "${dirname}/${i}" ; then
|
devices_rel_dirname=`make_system_path_relative_to_its_root $devices_dirname`
|
||||||
initrd="$i"
|
fi
|
||||||
|
|
||||||
|
case ${GRUB_FS} in
|
||||||
|
ufs1 | ufs2) kfreebsd_fs=ufs ;;
|
||||||
|
*) kfreebsd_fs=${GRUB_FS} ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
version=`echo $basename | sed -e "s,^[^0-9]*-,,g;s/\.gz$//g"`
|
||||||
|
alt_version=`echo $version | sed -e "s,\.old$,,g"`
|
||||||
|
|
||||||
|
acpi_ko=
|
||||||
|
for i in "/lib/modules/${version}/acpi.ko" "/lib/modules/${alt_version}/acpi.ko" \
|
||||||
|
"/boot/kernel/acpi.ko"; do
|
||||||
|
if test -e "$i" ; then
|
||||||
|
acpi_ko="$i"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if test -n "${initrd}" ; then
|
if test -n "${acpi_ko}" ; then
|
||||||
echo "Found initrd image: ${dirname}/${initrd}" >&2
|
echo "Found ACPI module: ${acpi_ko}" >&2
|
||||||
else
|
acpi_ko_basename=`basename ${acpi_ko}`
|
||||||
# "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
|
acpi_ko_dirname=`dirname ${acpi_ko}`
|
||||||
linux_root_device_thisversion=${GRUB_DEVICE}
|
acpi_ko_rel_dirname=`make_system_path_relative_to_its_root $acpi_ko_dirname`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
linux_entry "${OS}, with Linux ${version}" \
|
kfreebsd_entry "${OS}, kFreeBSD ${version}"
|
||||||
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
|
||||||
if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
|
|
||||||
linux_entry "${OS}, with Linux ${version} (recovery mode)" \
|
|
||||||
"single ${GRUB_CMDLINE_LINUX}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
|
list=`echo $list | tr ' ' '\n' | grep -vx $kfreebsd | tr '\n' ' '`
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue