2010-06-29 15:20:49 +00:00
|
|
|
#! /bin/sh
|
|
|
|
set -e
|
2007-05-04 07:11:44 +00:00
|
|
|
|
2009-08-08 17:59:19 +00:00
|
|
|
# grub-mkconfig helper script.
|
2010-01-11 18:19:24 +00:00
|
|
|
# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
2007-05-04 07:11:44 +00:00
|
|
|
#
|
2007-07-21 23:32:33 +00:00
|
|
|
# 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
|
2007-05-04 07:11:44 +00:00
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
2007-07-21 23:32:33 +00:00
|
|
|
# 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.
|
2007-05-04 07:11:44 +00:00
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-07-21 23:32:33 +00:00
|
|
|
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
2007-05-04 07:11:44 +00:00
|
|
|
|
2012-01-24 12:17:36 +00:00
|
|
|
prefix="@prefix@"
|
|
|
|
exec_prefix="@exec_prefix@"
|
|
|
|
datarootdir="@datarootdir@"
|
2010-12-10 11:45:08 +00:00
|
|
|
grub_lang=`echo $LANG | cut -d . -f 1`
|
2007-05-20 09:10:06 +00:00
|
|
|
|
2012-02-29 23:40:02 +00:00
|
|
|
export TEXTDOMAIN=@PACKAGE@
|
|
|
|
export TEXTDOMAINDIR="@localedir@"
|
|
|
|
|
2012-01-24 12:17:36 +00:00
|
|
|
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
2007-05-04 07:11:44 +00:00
|
|
|
|
2008-01-12 15:11:57 +00:00
|
|
|
# Do this as early as possible, since other commands might depend on it.
|
2009-02-11 00:36:58 +00:00
|
|
|
# (e.g. the `loadfont' command might need lvm or raid modules)
|
2008-01-12 15:11:57 +00:00
|
|
|
for i in ${GRUB_PRELOAD_MODULES} ; do
|
|
|
|
echo "insmod $i"
|
|
|
|
done
|
|
|
|
|
2007-05-04 07:11:44 +00:00
|
|
|
if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
|
2009-11-20 08:41:20 +00:00
|
|
|
if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then GRUB_DEFAULT='${saved_entry}' ; fi
|
2007-05-04 07:11:44 +00:00
|
|
|
if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
|
2010-12-14 16:22:19 +00:00
|
|
|
if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=auto ; fi
|
2007-05-04 07:11:44 +00:00
|
|
|
|
2010-05-23 12:11:11 +00:00
|
|
|
if [ "x${GRUB_DEFAULT_BUTTON}" = "x" ] ; then GRUB_DEFAULT_BUTTON="$GRUB_DEFAULT" ; fi
|
|
|
|
if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_entry}' ; fi
|
|
|
|
if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi
|
|
|
|
|
2007-05-04 07:11:44 +00:00
|
|
|
cat << EOF
|
2009-12-08 00:59:26 +00:00
|
|
|
if [ -s \$prefix/grubenv ]; then
|
|
|
|
load_env
|
|
|
|
fi
|
2010-05-23 12:11:11 +00:00
|
|
|
EOF
|
|
|
|
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
|
|
|
|
cat <<EOF
|
|
|
|
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
|
|
|
|
set default="${GRUB_DEFAULT_BUTTON}"
|
2013-05-06 18:13:34 +00:00
|
|
|
elif [ "\${next_entry}" ] ; then
|
|
|
|
set default="\${next_entry}"
|
|
|
|
set next_entry=
|
|
|
|
save_env next_entry
|
|
|
|
set boot_once=true
|
2010-05-23 12:11:11 +00:00
|
|
|
else
|
|
|
|
set default="${GRUB_DEFAULT}"
|
|
|
|
fi
|
|
|
|
EOF
|
|
|
|
else
|
|
|
|
cat <<EOF
|
2013-05-06 18:13:34 +00:00
|
|
|
if [ "\${next_entry}" ] ; then
|
|
|
|
set default="\${next_entry}"
|
|
|
|
set next_entry=
|
|
|
|
save_env next_entry
|
|
|
|
set boot_once=true
|
|
|
|
else
|
|
|
|
set default="${GRUB_DEFAULT}"
|
|
|
|
fi
|
2010-05-23 12:11:11 +00:00
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
cat <<EOF
|
2012-03-04 13:55:13 +00:00
|
|
|
|
|
|
|
if [ x"\${feature_menuentry_id}" = xy ]; then
|
|
|
|
menuentry_id_option="--id"
|
|
|
|
else
|
|
|
|
menuentry_id_option=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
export menuentry_id_option
|
|
|
|
|
2010-06-07 13:22:40 +00:00
|
|
|
if [ "\${prev_saved_entry}" ]; then
|
2010-06-05 19:44:44 +00:00
|
|
|
set saved_entry="\${prev_saved_entry}"
|
2009-11-20 08:41:20 +00:00
|
|
|
save_env saved_entry
|
2009-12-08 01:01:21 +00:00
|
|
|
set prev_saved_entry=
|
2009-11-20 08:41:20 +00:00
|
|
|
save_env prev_saved_entry
|
2010-01-05 10:30:14 +00:00
|
|
|
set boot_once=true
|
2009-11-20 08:41:20 +00:00
|
|
|
fi
|
2010-01-05 10:41:51 +00:00
|
|
|
|
|
|
|
function savedefault {
|
2010-06-07 13:22:40 +00:00
|
|
|
if [ -z "\${boot_once}" ]; then
|
2010-06-05 19:44:44 +00:00
|
|
|
saved_entry="\${chosen}"
|
2010-01-05 10:41:51 +00:00
|
|
|
save_env saved_entry
|
|
|
|
fi
|
|
|
|
}
|
2010-06-17 15:01:17 +00:00
|
|
|
|
|
|
|
function load_video {
|
|
|
|
EOF
|
|
|
|
if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
|
|
|
|
cat <<EOF
|
|
|
|
insmod ${GRUB_VIDEO_BACKEND}
|
|
|
|
EOF
|
|
|
|
else
|
2012-02-26 17:09:07 +00:00
|
|
|
# If all_video.mod isn't available load all modules available
|
|
|
|
# with versions prior to introduction of all_video.mod
|
|
|
|
cat <<EOF
|
|
|
|
if [ x\$feature_all_video_module = xy ]; then
|
|
|
|
insmod all_video
|
|
|
|
else
|
|
|
|
insmod efi_gop
|
|
|
|
insmod efi_uga
|
|
|
|
insmod ieee1275_fb
|
|
|
|
insmod vbe
|
|
|
|
insmod vga
|
|
|
|
insmod video_bochs
|
|
|
|
insmod video_cirrus
|
|
|
|
fi
|
|
|
|
EOF
|
2010-06-17 15:01:17 +00:00
|
|
|
fi
|
|
|
|
cat <<EOF
|
|
|
|
}
|
|
|
|
|
2007-06-06 18:08:56 +00:00
|
|
|
EOF
|
|
|
|
|
2010-04-02 19:12:20 +00:00
|
|
|
serial=0;
|
|
|
|
gfxterm=0;
|
|
|
|
for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
|
|
|
|
if [ xserial = "x$x" ]; then
|
|
|
|
serial=1;
|
|
|
|
fi
|
|
|
|
if [ xgfxterm = "x$x" ]; then
|
|
|
|
gfxterm=1;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "x$serial" = x1 ]; then
|
2008-11-07 Robert Millan <rmh@aybabtu.com>
Modularize at_keyboard.mod:
* conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
(at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
(at_keyboard_mod_LDFLAGS): New variables.
Actual terminal split:
* include/grub/term.h (struct grub_term): Split in ...
(struct grub_term_input): ... this, and ...
(struct grub_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/term.c (grub_term_list): Split in ...
(grub_term_list_input): ... this, and ...
(grub_term_list_output): ... this. Update all users.
(grub_cur_term): Split in ...
(grub_cur_term_input): ... this, and ...
(grub_cur_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/misc.c (grub_abort): Split use of grub_term_get_current() into
a check for input and one for output (and only attempt to get keys
from user when input works).
* util/grub-probe.c (grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
* util/grub-fstest.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-editenv.c: Likewise.
Portability adjustments:
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
`term/i386/pc/at_keyboard.c'.
* kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
grub_keyboard_controller_init() (now handled by terminal .init).
* kern/i386/coreboot/init.c (grub_machine_init): Add call to
grub_at_keyboard_init().
* include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
(grub_console_checkkey, grub_console_getkey): Remove (now provided by
at_keyboard.mod via input terminal interface).
* include/grub/i386/coreboot/console.h: Convert into a stub for
`<grub/i386/pc/console.h>'.
Migrate full terminals to new API:
* term/efi/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
* term/ieee1275/ofconsole.c: Remove __i386__ hack.
(grub_ofconsole_init): Split into ...
(grub_ofconsole_init_input): ... this, and ...
(grub_ofconsole_init_output): ... this.
(grub_ofconsole_term): Split into ...
(grub_ofconsole_term_input): ... this, and ...
(grub_ofconsole_term_output): ... this. Update all users.
* term/i386/pc/serial.c (grub_serial_term): Split into ...
(grub_serial_term_input): ... this, and ...
(grub_serial_term_output): ... this. Update all users.
* term/i386/pc/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
(grub_console_term_input): Only enable it on PC/BIOS platform.
(grub_console_init): Remove grub_keyboard_controller_init() call.
Migrate input terminals to new API:
* term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
`i386' and `i386/pc' to enable build on x86_64 (this driver is
i386-specific anyway).
(grub_console_checkkey): Rename to ...
(grub_at_keyboard_checkkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_orig): New variable.
(grub_console_getkey): Rename to ...
(grub_at_keyboard_getkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_init): Static-ize. Save original
controller value so that it can be restored ...
(grub_keyboard_controller_fini): ... here (new function).
(grub_at_keyboard_term): New structure.
(GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
functions.
Migrate output terminals to new API:
* term/i386/pc/vga.c (grub_vga_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* term/gfxterm.c (grub_video_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* include/grub/i386/pc/console.h (grub_console_checkkey)
(grub_console_getkey): Do not export (no longer needed by gfxterm,
etc).
Migrate `terminal' command and userland tools to new API:
* commands/terminal.c (grub_cmd_terminal): Split into ...
(grub_cmd_terminal_input): ... this, and ...
(grub_cmd_terminal_output): ... this.
(GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
`terminal_input' and `terminal_output'.
* util/grub.d/00_header.in: Adjust `terminal' calls to new
`terminal_input' / `terminal_output' API.
* util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
provided ${GRUB_TERMINAL}, convert it).
2008-11-07 19:11:39 +00:00
|
|
|
if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
|
2012-02-03 10:42:22 +00:00
|
|
|
grub_warn "$(gettext "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used.")"
|
2010-04-02 19:12:20 +00:00
|
|
|
GRUB_SERIAL_COMMAND=serial
|
2008-11-07 Robert Millan <rmh@aybabtu.com>
Modularize at_keyboard.mod:
* conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
(at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
(at_keyboard_mod_LDFLAGS): New variables.
Actual terminal split:
* include/grub/term.h (struct grub_term): Split in ...
(struct grub_term_input): ... this, and ...
(struct grub_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/term.c (grub_term_list): Split in ...
(grub_term_list_input): ... this, and ...
(grub_term_list_output): ... this. Update all users.
(grub_cur_term): Split in ...
(grub_cur_term_input): ... this, and ...
(grub_cur_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/misc.c (grub_abort): Split use of grub_term_get_current() into
a check for input and one for output (and only attempt to get keys
from user when input works).
* util/grub-probe.c (grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
* util/grub-fstest.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-editenv.c: Likewise.
Portability adjustments:
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
`term/i386/pc/at_keyboard.c'.
* kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
grub_keyboard_controller_init() (now handled by terminal .init).
* kern/i386/coreboot/init.c (grub_machine_init): Add call to
grub_at_keyboard_init().
* include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
(grub_console_checkkey, grub_console_getkey): Remove (now provided by
at_keyboard.mod via input terminal interface).
* include/grub/i386/coreboot/console.h: Convert into a stub for
`<grub/i386/pc/console.h>'.
Migrate full terminals to new API:
* term/efi/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
* term/ieee1275/ofconsole.c: Remove __i386__ hack.
(grub_ofconsole_init): Split into ...
(grub_ofconsole_init_input): ... this, and ...
(grub_ofconsole_init_output): ... this.
(grub_ofconsole_term): Split into ...
(grub_ofconsole_term_input): ... this, and ...
(grub_ofconsole_term_output): ... this. Update all users.
* term/i386/pc/serial.c (grub_serial_term): Split into ...
(grub_serial_term_input): ... this, and ...
(grub_serial_term_output): ... this. Update all users.
* term/i386/pc/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
(grub_console_term_input): Only enable it on PC/BIOS platform.
(grub_console_init): Remove grub_keyboard_controller_init() call.
Migrate input terminals to new API:
* term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
`i386' and `i386/pc' to enable build on x86_64 (this driver is
i386-specific anyway).
(grub_console_checkkey): Rename to ...
(grub_at_keyboard_checkkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_orig): New variable.
(grub_console_getkey): Rename to ...
(grub_at_keyboard_getkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_init): Static-ize. Save original
controller value so that it can be restored ...
(grub_keyboard_controller_fini): ... here (new function).
(grub_at_keyboard_term): New structure.
(GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
functions.
Migrate output terminals to new API:
* term/i386/pc/vga.c (grub_vga_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* term/gfxterm.c (grub_video_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* include/grub/i386/pc/console.h (grub_console_checkkey)
(grub_console_getkey): Do not export (no longer needed by gfxterm,
etc).
Migrate `terminal' command and userland tools to new API:
* commands/terminal.c (grub_cmd_terminal): Split into ...
(grub_cmd_terminal_input): ... this, and ...
(grub_cmd_terminal_output): ... this.
(GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
`terminal_input' and `terminal_output'.
* util/grub.d/00_header.in: Adjust `terminal' calls to new
`terminal_input' / `terminal_output' API.
* util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
provided ${GRUB_TERMINAL}, convert it).
2008-11-07 19:11:39 +00:00
|
|
|
fi
|
|
|
|
echo "${GRUB_SERIAL_COMMAND}"
|
2008-11-10 08:49:26 +00:00
|
|
|
fi
|
2008-11-07 Robert Millan <rmh@aybabtu.com>
Modularize at_keyboard.mod:
* conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
(at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
(at_keyboard_mod_LDFLAGS): New variables.
Actual terminal split:
* include/grub/term.h (struct grub_term): Split in ...
(struct grub_term_input): ... this, and ...
(struct grub_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/term.c (grub_term_list): Split in ...
(grub_term_list_input): ... this, and ...
(grub_term_list_output): ... this. Update all users.
(grub_cur_term): Split in ...
(grub_cur_term_input): ... this, and ...
(grub_cur_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/misc.c (grub_abort): Split use of grub_term_get_current() into
a check for input and one for output (and only attempt to get keys
from user when input works).
* util/grub-probe.c (grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
* util/grub-fstest.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-editenv.c: Likewise.
Portability adjustments:
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
`term/i386/pc/at_keyboard.c'.
* kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
grub_keyboard_controller_init() (now handled by terminal .init).
* kern/i386/coreboot/init.c (grub_machine_init): Add call to
grub_at_keyboard_init().
* include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
(grub_console_checkkey, grub_console_getkey): Remove (now provided by
at_keyboard.mod via input terminal interface).
* include/grub/i386/coreboot/console.h: Convert into a stub for
`<grub/i386/pc/console.h>'.
Migrate full terminals to new API:
* term/efi/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
* term/ieee1275/ofconsole.c: Remove __i386__ hack.
(grub_ofconsole_init): Split into ...
(grub_ofconsole_init_input): ... this, and ...
(grub_ofconsole_init_output): ... this.
(grub_ofconsole_term): Split into ...
(grub_ofconsole_term_input): ... this, and ...
(grub_ofconsole_term_output): ... this. Update all users.
* term/i386/pc/serial.c (grub_serial_term): Split into ...
(grub_serial_term_input): ... this, and ...
(grub_serial_term_output): ... this. Update all users.
* term/i386/pc/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
(grub_console_term_input): Only enable it on PC/BIOS platform.
(grub_console_init): Remove grub_keyboard_controller_init() call.
Migrate input terminals to new API:
* term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
`i386' and `i386/pc' to enable build on x86_64 (this driver is
i386-specific anyway).
(grub_console_checkkey): Rename to ...
(grub_at_keyboard_checkkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_orig): New variable.
(grub_console_getkey): Rename to ...
(grub_at_keyboard_getkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_init): Static-ize. Save original
controller value so that it can be restored ...
(grub_keyboard_controller_fini): ... here (new function).
(grub_at_keyboard_term): New structure.
(GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
functions.
Migrate output terminals to new API:
* term/i386/pc/vga.c (grub_vga_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* term/gfxterm.c (grub_video_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* include/grub/i386/pc/console.h (grub_console_checkkey)
(grub_console_getkey): Do not export (no longer needed by gfxterm,
etc).
Migrate `terminal' command and userland tools to new API:
* commands/terminal.c (grub_cmd_terminal): Split into ...
(grub_cmd_terminal_input): ... this, and ...
(grub_cmd_terminal_output): ... this.
(GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
`terminal_input' and `terminal_output'.
* util/grub.d/00_header.in: Adjust `terminal' calls to new
`terminal_input' / `terminal_output' API.
* util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
provided ${GRUB_TERMINAL}, convert it).
2008-11-07 19:11:39 +00:00
|
|
|
|
2010-04-02 19:12:20 +00:00
|
|
|
if [ "x$gfxterm" = x1 ]; then
|
2012-02-24 10:18:06 +00:00
|
|
|
if [ -n "$GRUB_FONT" ] ; then
|
|
|
|
# Make the font accessible
|
|
|
|
prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT}"`
|
|
|
|
cat << EOF
|
|
|
|
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT}"` ; then
|
|
|
|
EOF
|
2012-02-26 17:21:31 +00:00
|
|
|
else
|
|
|
|
for dir in "${pkgdatadir}" "`echo '/@bootdirname@/@grubdirname@' | sed "s,//*,/,g"`" /usr/share/grub ; do
|
|
|
|
for basename in unicode unifont ascii; do
|
|
|
|
path="${dir}/${basename}.pf2"
|
|
|
|
if is_path_readable_by_grub "${path}" > /dev/null ; then
|
|
|
|
font_path="${path}"
|
|
|
|
else
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
break 2
|
2012-02-24 10:18:06 +00:00
|
|
|
done
|
2012-02-26 17:21:31 +00:00
|
|
|
done
|
|
|
|
if [ -n "${font_path}" ] ; then
|
2012-02-24 10:18:06 +00:00
|
|
|
cat << EOF
|
|
|
|
if [ x\$feature_default_font_path = xy ] ; then
|
|
|
|
font=unicode
|
|
|
|
else
|
|
|
|
EOF
|
|
|
|
# Make the font accessible
|
|
|
|
prepare_grub_to_access_device `${grub_probe} --target=device "${font_path}"`
|
|
|
|
cat << EOF
|
|
|
|
font="`make_system_path_relative_to_its_root "${font_path}"`"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if loadfont \$font ; then
|
|
|
|
EOF
|
|
|
|
else
|
|
|
|
cat << EOF
|
|
|
|
if loadfont unicode ; then
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
fi
|
2008-08-03 16:38:40 +00:00
|
|
|
|
2008-05-30 14:39:44 +00:00
|
|
|
cat << EOF
|
2008-08-22 12:58:46 +00:00
|
|
|
set gfxmode=${GRUB_GFXMODE}
|
2010-06-17 15:01:17 +00:00
|
|
|
load_video
|
2008-02-03 18:27:41 +00:00
|
|
|
insmod gfxterm
|
2011-04-06 11:18:11 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# Gettext variables and module
|
2013-10-26 18:11:55 +00:00
|
|
|
if [ "x${LANG}" != "xC" ] && [ "x${LANG}" != "x" ]; then
|
2011-04-06 11:18:11 +00:00
|
|
|
cat << EOF
|
2012-02-26 17:09:07 +00:00
|
|
|
set locale_dir=\$prefix/locale
|
2011-04-06 11:18:11 +00:00
|
|
|
set lang=${grub_lang}
|
|
|
|
insmod gettext
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat <<EOF
|
2010-07-06 08:42:37 +00:00
|
|
|
fi
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
|
|
|
case x${GRUB_TERMINAL_INPUT} in
|
|
|
|
x)
|
|
|
|
# Just use the native terminal
|
|
|
|
;;
|
|
|
|
x*)
|
|
|
|
cat << EOF
|
2010-07-21 04:44:38 +00:00
|
|
|
terminal_input ${GRUB_TERMINAL_INPUT}
|
2010-07-06 08:42:37 +00:00
|
|
|
EOF
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case x${GRUB_TERMINAL_OUTPUT} in
|
|
|
|
x)
|
|
|
|
# Just use the native terminal
|
|
|
|
;;
|
|
|
|
x*)
|
|
|
|
cat << EOF
|
2010-07-21 04:44:38 +00:00
|
|
|
terminal_output ${GRUB_TERMINAL_OUTPUT}
|
2010-01-05 20:24:33 +00:00
|
|
|
EOF
|
2010-07-06 08:42:37 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ "x$gfxterm" = x1 ]; then
|
2010-04-09 15:44:03 +00:00
|
|
|
if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \
|
|
|
|
&& is_path_readable_by_grub "$GRUB_THEME"; then
|
2012-02-03 10:42:22 +00:00
|
|
|
gettext_printf "Found theme: %s\n" "$GRUB_THEME" >&2
|
|
|
|
|
2010-07-06 08:42:37 +00:00
|
|
|
prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"`
|
2010-04-02 19:12:20 +00:00
|
|
|
cat << EOF
|
2010-07-06 08:42:37 +00:00
|
|
|
insmod gfxmenu
|
2010-04-09 14:56:07 +00:00
|
|
|
EOF
|
2010-04-09 15:44:03 +00:00
|
|
|
themedir="`dirname "$GRUB_THEME"`"
|
2010-04-09 14:56:07 +00:00
|
|
|
for x in "$themedir"/*.pf2 "$themedir"/f/*.pf2; do
|
|
|
|
if [ -f "$x" ]; then
|
|
|
|
cat << EOF
|
2010-07-06 08:42:37 +00:00
|
|
|
loadfont (\$root)`make_system_path_relative_to_its_root $x`
|
2010-04-09 14:56:07 +00:00
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
done
|
2010-04-09 15:44:03 +00:00
|
|
|
if [ x"`echo "$themedir"/*.jpg`" != x"$themedir/*.jpg" ] || [ x"`echo "$themedir"/*.jpeg`" != x"$themedir/*.jpeg" ]; then
|
2010-04-09 14:56:07 +00:00
|
|
|
cat << EOF
|
2010-07-06 08:42:37 +00:00
|
|
|
insmod jpeg
|
2010-04-09 14:56:07 +00:00
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
if [ x"`echo "$themedir"/*.png`" != x"$themedir/*.png" ]; then
|
|
|
|
cat << EOF
|
2010-07-06 08:42:37 +00:00
|
|
|
insmod png
|
2010-04-09 14:56:07 +00:00
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
if [ x"`echo "$themedir"/*.tga`" != x"$themedir/*.tga" ]; then
|
|
|
|
cat << EOF
|
2010-07-06 08:42:37 +00:00
|
|
|
insmod tga
|
2010-04-09 14:56:07 +00:00
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat << EOF
|
2010-07-06 08:42:37 +00:00
|
|
|
set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
|
2012-02-23 05:26:00 +00:00
|
|
|
export theme
|
2010-04-09 15:37:38 +00:00
|
|
|
EOF
|
|
|
|
elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \
|
|
|
|
&& is_path_readable_by_grub "$GRUB_BACKGROUND"; then
|
2012-02-03 10:42:22 +00:00
|
|
|
gettext_printf "Found background: %s\n" "$GRUB_BACKGROUND" >&2
|
2010-04-09 15:37:38 +00:00
|
|
|
case "$GRUB_BACKGROUND" in
|
|
|
|
*.png) reader=png ;;
|
|
|
|
*.tga) reader=tga ;;
|
|
|
|
*.jpg|*.jpeg) reader=jpeg ;;
|
2012-02-03 10:42:22 +00:00
|
|
|
*) gettext "Unsupported image format" >&2; echo >&2; exit 1 ;;
|
2010-04-09 15:37:38 +00:00
|
|
|
esac
|
2010-07-06 08:42:37 +00:00
|
|
|
prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"`
|
2010-04-09 15:37:38 +00:00
|
|
|
cat << EOF
|
2010-07-06 08:42:37 +00:00
|
|
|
insmod $reader
|
|
|
|
background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
|
2010-04-02 19:12:20 +00:00
|
|
|
EOF
|
|
|
|
fi
|
2010-01-05 20:24:33 +00:00
|
|
|
fi
|
2010-04-02 19:12:20 +00:00
|
|
|
|
2010-05-23 12:11:11 +00:00
|
|
|
make_timeout ()
|
|
|
|
{
|
2013-11-29 16:11:53 +00:00
|
|
|
if [ "x${1}${3}" != "x" ] ; then
|
|
|
|
if [ "x${3}" != "x" ] ; then
|
|
|
|
timeout="${2}"
|
|
|
|
style="${3}"
|
|
|
|
else
|
|
|
|
# Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme.
|
|
|
|
timeout="${1}"
|
|
|
|
if [ "x${2}" != "x0" ] ; then
|
|
|
|
grub_warn "$(gettext "Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.")"
|
|
|
|
fi
|
|
|
|
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
|
|
|
|
style="hidden"
|
2013-11-28 02:27:13 +00:00
|
|
|
else
|
2013-11-29 16:11:53 +00:00
|
|
|
style="countdown"
|
2013-11-28 02:27:13 +00:00
|
|
|
fi
|
|
|
|
fi
|
2013-11-29 16:11:53 +00:00
|
|
|
if [ "x${style}" = "xcountdown" ] ; then
|
2010-05-23 12:11:11 +00:00
|
|
|
verbose=" --verbose"
|
2013-11-29 16:11:53 +00:00
|
|
|
else
|
|
|
|
verbose=
|
2010-05-23 12:11:11 +00:00
|
|
|
fi
|
|
|
|
cat << EOF
|
2013-11-28 02:27:13 +00:00
|
|
|
if [ x\$feature_timeout_style = xy ] ; then
|
2013-11-29 16:11:53 +00:00
|
|
|
set timeout_style=${style}
|
|
|
|
set timeout=${timeout}
|
|
|
|
EOF
|
|
|
|
if [ "x${style}" != "xmenu" ] ; then
|
|
|
|
cat << EOF
|
|
|
|
# Fallback hidden-timeout code in case the timeout_style feature is
|
|
|
|
# unavailable.
|
|
|
|
elif sleep${verbose} --interruptible ${timeout} ; then
|
2013-11-29 15:30:44 +00:00
|
|
|
set timeout=0
|
2013-11-29 16:11:53 +00:00
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
cat << EOF
|
2009-08-13 20:08:23 +00:00
|
|
|
fi
|
|
|
|
EOF
|
2010-05-23 12:11:11 +00:00
|
|
|
else
|
|
|
|
cat << EOF
|
|
|
|
set timeout=${2}
|
2009-08-13 20:08:23 +00:00
|
|
|
EOF
|
2010-05-23 12:11:11 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
|
|
|
|
cat <<EOF
|
|
|
|
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
|
|
|
|
EOF
|
2013-11-29 15:18:05 +00:00
|
|
|
make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_STYLE_BUTTON}"
|
2010-05-23 12:11:11 +00:00
|
|
|
echo else
|
2013-11-29 15:18:05 +00:00
|
|
|
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}" "${GRUB_TIMEOUT_STYLE}"
|
2010-05-23 12:11:11 +00:00
|
|
|
echo fi
|
|
|
|
else
|
2013-11-29 15:18:05 +00:00
|
|
|
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}" "${GRUB_TIMEOUT_STYLE}"
|
2009-08-13 20:08:23 +00:00
|
|
|
fi
|
2010-02-18 07:56:31 +00:00
|
|
|
|
2010-09-18 23:15:44 +00:00
|
|
|
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ] && [ "x$GRUB_BUTTON_CMOS_CLEAN" = "xyes" ]; then
|
|
|
|
cat <<EOF
|
|
|
|
cmosclean $GRUB_BUTTON_CMOS_ADDRESS
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
2010-02-18 07:56:31 +00:00
|
|
|
# Play an initial tune
|
|
|
|
if [ "x${GRUB_INIT_TUNE}" != "x" ] ; then
|
2010-06-28 21:52:03 +00:00
|
|
|
echo "play ${GRUB_INIT_TUNE}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "x${GRUB_BADRAM}" != "x" ] ; then
|
|
|
|
echo "badram ${GRUB_BADRAM}"
|
2010-02-18 07:56:31 +00:00
|
|
|
fi
|