10_netbsd.in revision 2
# grub-mkconfig helper script. # Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc. # GRUB is free software: you can redistribute it and/or modify # 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 if [
"x${GRUB_DISTRIBUTOR}" =
"x" ] ;
then OS=
"${GRUB_DISTRIBUTOR} NetBSD" loader="$1" # "knetbsd" or "multiboot" kernel="$2" # absolute path to the kernel file 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" printf "\tknetbsd_module_elf %s\n" "${kmodule_rel}" printf "\tmodule %s\n" "${kmodule_rel}" loader="$1" # "knetbsd" or "multiboot" kernel="$2" # absolute path to the kernel file recovery="$3" # is this is a recovery entry? args="$4" # extra arguments appended to loader command printf "menuentry \"${title}\" {\n" \ "${OS}" "$(echo ${kernel} | sed -e 's,^.*/,,')" "${loader}" printf "%s\n" "${prepare_boot_cache}" printf "\tknetbsd %s -r %s %s\n" \ "${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}" printf "\tmultiboot %s %s root=%s %s\n" \ "${kernel}" "${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}" # 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" echo "Found NetBSD kernel: $k" >&
2 netbsd_entry "knetbsd" "$k" false "${GRUB_CMDLINE_NETBSD_DEFAULT}" netbsd_entry "multiboot" "$k" false "${GRUB_CMDLINE_NETBSD_DEFAULT}" if [
"x${GRUB_DISABLE_RECOVERY}" !=
"xtrue" ];
then