set -e
# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR=@localedir@
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS="NetBSD"
else
OS="${GRUB_DISTRIBUTOR} NetBSD"
fi
{
karch="i386"
;;
x86-64)
karch="amd64"
;;
*)
return
;;
esac
ext2)
kmod="ext2fs"
;;
fat)
kmod="msdosfs"
;;
ntfs)
kmod="ntfs"
;;
ufs*)
kmod="ffs"
;;
*)
return
;;
esac
kversion=$(zcat -f "${kernel}" | strings | sed -n -e '/^@(#)NetBSD/ { s/^@(#)NetBSD \([0-9\.]*\) .*$/\1/g ; p ; q ; }')
kmodule="/stand/${karch}/${kversion}/modules/${kmod}/${kmod}.kmod"
return
fi
printf "\tknetbsd_module_elf %s\n" "${kmodule_rel}"
;;
printf "\tmodule %s\n" "${kmodule_rel}"
;;
esac
}
netbsd_entry ()
{
if ${recovery} ; then
else
fi
printf "%s\n" "${prepare_boot_cache}"
"${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}"
;;
"${kernel}" "${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}"
;;
esac
netbsd_load_fs_module "${loader}" "${kernel}"
printf "}\n"
}
# We look for NetBSD kernels in / but not in subdirectories. We simply
# pick all statically linked ELF executable files (or links) in / with a
# name that starts with `netbsd'.
pattern="^ELF[^,]*executable.*statically linked"
if ! grub_file_is_not_garbage "$k" ; then
continue
fi
continue
fi
echo "Found NetBSD kernel: $k" >&2
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
fi
done