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
|
|
|
|
2008-08-03 16:38:40 +00:00
|
|
|
transform="@program_transform_name@"
|
|
|
|
|
2007-05-20 09:10:06 +00:00
|
|
|
prefix=@prefix@
|
|
|
|
exec_prefix=@exec_prefix@
|
|
|
|
libdir=@libdir@
|
2010-06-12 14:06:53 +00:00
|
|
|
locale_dir=`echo ${GRUB_PREFIX}/locale | sed ${transform}`
|
2009-11-21 21:05:15 +00:00
|
|
|
grub_lang=`echo $LANG | cut -d _ -f 1`
|
2007-05-20 09:10:06 +00:00
|
|
|
|
2008-09-29 14:57:05 +00:00
|
|
|
. ${libdir}/grub/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
|
2008-08-22 12:58:46 +00:00
|
|
|
if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=640x480 ; 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}"
|
|
|
|
else
|
|
|
|
set default="${GRUB_DEFAULT}"
|
|
|
|
fi
|
|
|
|
EOF
|
|
|
|
else
|
|
|
|
cat <<EOF
|
2009-12-08 00:57:46 +00:00
|
|
|
set default="${GRUB_DEFAULT}"
|
2010-05-23 12:11:11 +00:00
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
cat <<EOF
|
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
|
|
|
|
# Insert all available backends; GRUB will use the most appropriate.
|
|
|
|
for backend in $(cat "${GRUB_PREFIX}/video.lst"); do
|
|
|
|
cat <<EOF
|
|
|
|
insmod ${backend}
|
|
|
|
EOF
|
|
|
|
done
|
|
|
|
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
|
2010-06-12 14:06:53 +00:00
|
|
|
if ! test -e ${GRUB_PREFIX}/serial.mod ; then
|
2010-04-02 19:12:20 +00:00
|
|
|
echo "Serial terminal not available on this platform." >&2 ; exit 1
|
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
|
|
|
|
|
|
|
|
if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
|
2010-04-02 19:12:20 +00:00
|
|
|
grub_warn "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used."
|
|
|
|
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
|
2008-05-30 14:39:44 +00:00
|
|
|
# Make the font accessible
|
2010-04-09 15:44:03 +00:00
|
|
|
prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT_PATH}"`
|
2008-08-03 16:38:40 +00:00
|
|
|
|
2008-05-30 14:39:44 +00:00
|
|
|
cat << EOF
|
2010-04-09 15:44:03 +00:00
|
|
|
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
|
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
|
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
|
|
|
|
if terminal_input ${GRUB_TERMINAL_INPUT} ; then true ; else
|
|
|
|
# For backward compatibility with versions of terminal.mod that don't
|
|
|
|
# understand terminal_input
|
|
|
|
terminal ${GRUB_TERMINAL_INPUT}
|
|
|
|
fi
|
|
|
|
EOF
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case x${GRUB_TERMINAL_OUTPUT} in
|
|
|
|
x)
|
|
|
|
# Just use the native terminal
|
|
|
|
;;
|
|
|
|
x*)
|
|
|
|
cat << EOF
|
|
|
|
if terminal_output ${GRUB_TERMINAL_OUTPUT} ; then true ; else
|
|
|
|
# For backward compatibility with versions of terminal.mod that don't
|
|
|
|
# understand terminal_output
|
|
|
|
terminal ${GRUB_TERMINAL_OUTPUT}
|
|
|
|
fi
|
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
|
2010-04-02 19:12:20 +00:00
|
|
|
echo "Found theme: $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`
|
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
|
|
|
|
echo "Found background: $GRUB_BACKGROUND" >&2
|
|
|
|
case "$GRUB_BACKGROUND" in
|
|
|
|
*.png) reader=png ;;
|
|
|
|
*.tga) reader=tga ;;
|
|
|
|
*.jpg|*.jpeg) reader=jpeg ;;
|
|
|
|
*) echo "Unsupported image format" >&2; exit 1 ;;
|
|
|
|
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
|
|
|
|
2009-11-13 20:39:33 +00:00
|
|
|
# Gettext variables and module
|
2010-06-02 12:57:13 +00:00
|
|
|
if [ "x${LANG}" != "xC" ] && [ -d "${locale_dir}" ] ; then
|
2010-01-20 13:55:30 +00:00
|
|
|
prepare_grub_to_access_device $(${grub_probe} --target=device ${locale_dir})
|
2009-11-22 11:49:54 +00:00
|
|
|
cat << EOF
|
2010-01-20 13:55:30 +00:00
|
|
|
set locale_dir=(\$root)$(make_system_path_relative_to_its_root ${locale_dir})
|
2009-11-21 21:05:15 +00:00
|
|
|
set lang=${grub_lang}
|
2009-12-23 16:41:32 +00:00
|
|
|
insmod gettext
|
2009-11-13 20:39:33 +00:00
|
|
|
EOF
|
2009-11-22 11:49:54 +00:00
|
|
|
fi
|
2009-11-13 20:39:33 +00:00
|
|
|
|
2010-05-23 12:11:11 +00:00
|
|
|
make_timeout ()
|
|
|
|
{
|
|
|
|
if [ "x${1}" != "x" ] ; then
|
|
|
|
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
|
|
|
|
verbose=
|
|
|
|
else
|
|
|
|
verbose=" --verbose"
|
|
|
|
fi
|
|
|
|
cat << EOF
|
|
|
|
if sleep$verbose --interruptible ${1} ; then
|
|
|
|
set timeout=${2}
|
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
|
|
|
|
make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
|
|
|
|
echo else
|
|
|
|
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
|
|
|
|
echo fi
|
|
|
|
else
|
|
|
|
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
|
2009-08-13 20:08:23 +00:00
|
|
|
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
|