2010-08-20 Robert Millan <rmh@gnu.org>

Make kFreeBSD code more generic to support ext2fs as root, ufs as
	a separate module and maybe other interesting combinations.
	
	* util/grub.d/10_kfreebsd.in (load_kfreebsd_module): New function.
	(kfreebsd_entry): Use load_kfreebsd_module() to load modules.
	(kfreebsd_entry): Add generic filesystem module load routine.
	Map GRUB `ext2' to kFreeBSD `ext2fs'.
This commit is contained in:
Robert Millan 2010-08-20 16:36:07 +02:00
parent 63c734a63e
commit 21a313dedc
2 changed files with 43 additions and 21 deletions

View file

@ -1,3 +1,13 @@
2010-08-20 Robert Millan <rmh@gnu.org>
Make kFreeBSD code more generic to support ext2fs as root, ufs as
a separate module and maybe other interesting combinations.
* util/grub.d/10_kfreebsd.in (load_kfreebsd_module): New function.
(kfreebsd_entry): Use load_kfreebsd_module() to load modules.
(kfreebsd_entry): Add generic filesystem module load routine.
Map GRUB `ext2' to kFreeBSD `ext2fs'.
2010-08-20 Colin Watson <cjwatson@ubuntu.com> 2010-08-20 Colin Watson <cjwatson@ubuntu.com>
* commands/i386/pc/sendkey.c (keysym_table): Rename "numlock" to * commands/i386/pc/sendkey.c (keysym_table): Rename "numlock" to

View file

@ -39,6 +39,31 @@ case "${GRUB_DISTRIBUTOR}" in
;; ;;
esac esac
load_kfreebsd_module ()
{
mod="$1"
allow_fail="$2"
if ! test -e "${module_dir}/${mod}.ko" ; then
if [ "${allow_fail}" = "true" ] ; then
# Return silently
return
else
# Print an error and fail.
ls "${module_dir}/${mod}.ko" > /dev/null
fi
fi
if [ -z "${prepare_module_dir_cache}" ]; then
prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_module_dir_cache}"
cat << EOF
kfreebsd_module_elf ${module_dir_rel}/${mod}.ko
EOF
}
kfreebsd_entry () kfreebsd_entry ()
{ {
os="$1" os="$1"
@ -51,9 +76,6 @@ kfreebsd_entry ()
if [ -z "${prepare_boot_cache}" ]; then if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi fi
if [ -z "${prepare_module_dir_cache}" ]; then
prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}" printf '%s\n' "${prepare_boot_cache}"
cat << EOF cat << EOF
@ -67,26 +89,13 @@ EOF
EOF EOF
fi fi
if test -e "${module_dir}/acpi.ko" ; then load_kfreebsd_module acpi true
printf '%s\n' "${prepare_module_dir_cache}"
cat << EOF
kfreebsd_module_elf ${module_dir_rel}/acpi.ko
EOF
fi
case "${kfreebsd_fs}" in case "${kfreebsd_fs}" in
zfs) zfs)
for i in "${module_dir}/opensolaris.ko" "${module_dir}/zfs.ko" \ load_kfreebsd_module opensolaris false
"${dirname}/zfs/zpool.cache" ; do
ls "$i" > /dev/null
done
printf '%s\n' "${prepare_module_dir_cache}"
cat << EOF
kfreebsd_module_elf ${module_dir_rel}/opensolaris.ko
kfreebsd_module_elf ${module_dir_rel}/zfs.ko
EOF
ls "${dirname}/zfs/zpool.cache" > /dev/null
printf '%s\n' "${prepare_boot_cache}" printf '%s\n' "${prepare_boot_cache}"
cat << EOF cat << EOF
kfreebsd_module ${rel_dirname}/zfs/zpool.cache type=/boot/zfs/zpool.cache kfreebsd_module ${rel_dirname}/zfs/zpool.cache type=/boot/zfs/zpool.cache
@ -94,6 +103,8 @@ EOF
;; ;;
esac esac
load_kfreebsd_module ${kfreebsd_fs} false
cat << EOF cat << EOF
set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${kfreebsd_device} set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${kfreebsd_device}
set kFreeBSD.vfs.root.mountfrom.options=rw set kFreeBSD.vfs.root.mountfrom.options=rw
@ -122,6 +133,7 @@ while [ "x$list" != "x" ] ; do
case ${GRUB_FS} in case ${GRUB_FS} in
ufs1 | ufs2) kfreebsd_fs=ufs ;; ufs1 | ufs2) kfreebsd_fs=ufs ;;
ext2) kfreebsd_fs=ext2fs ;;
*) kfreebsd_fs=${GRUB_FS} ;; *) kfreebsd_fs=${GRUB_FS} ;;
esac esac