cmostest support.
* commands/i386/cmostest.c: New file. * conf/i386-coreboot.rmk (pkglib_MODULES): Add cmostest.mod. (cmostest_mod_SOURCES): New variable. (cmostest_mod_CFLAGS): Likewise. (cmostest_mod_LDFLAGS): Likewise. * conf/i386-pc.rmk: Likewise. * docs/grub.texi (Vendor power-on keys): New section. * util/grub-mkconfig.in: export GRUB_DEFAULT_BUTTON, GRUB_HIDDEN_TIMEOUT_BUTTON, GRUB_TIMEOUT_BUTTON and GRUB_BUTTON_CMOS_ADDRESS. * util/grub.d/00_header.in: Handle powering-on by separate button.
This commit is contained in:
commit
f24f430030
7 changed files with 154 additions and 12 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
cmostest support.
|
||||||
|
|
||||||
|
* commands/i386/cmostest.c: New file.
|
||||||
|
* conf/i386-coreboot.rmk (pkglib_MODULES): Add cmostest.mod.
|
||||||
|
(cmostest_mod_SOURCES): New variable.
|
||||||
|
(cmostest_mod_CFLAGS): Likewise.
|
||||||
|
(cmostest_mod_LDFLAGS): Likewise.
|
||||||
|
* conf/i386-pc.rmk: Likewise.
|
||||||
|
* docs/grub.texi (Vendor power-on keys): New section.
|
||||||
|
* util/grub-mkconfig.in: export GRUB_DEFAULT_BUTTON,
|
||||||
|
GRUB_HIDDEN_TIMEOUT_BUTTON, GRUB_TIMEOUT_BUTTON
|
||||||
|
and GRUB_BUTTON_CMOS_ADDRESS.
|
||||||
|
* util/grub.d/00_header.in: Handle powering-on by separate button.
|
||||||
|
|
||||||
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
|
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* gfxmenu/gui_list.c (draw_menu): Don't add scrollbar width to padding.
|
* gfxmenu/gui_list.c (draw_menu): Don't add scrollbar width to padding.
|
||||||
|
|
59
commands/i386/cmostest.c
Normal file
59
commands/i386/cmostest.c
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2009 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
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/dl.h>
|
||||||
|
#include <grub/command.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/cmos.h>
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_cmostest (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
|
int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int byte, bit;
|
||||||
|
char *rest;
|
||||||
|
|
||||||
|
if (argc != 1)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
|
||||||
|
|
||||||
|
byte = grub_strtoul (argv[0], &rest, 0);
|
||||||
|
if (*rest != ':')
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
|
||||||
|
|
||||||
|
bit = grub_strtoul (rest + 1, 0, 0);
|
||||||
|
|
||||||
|
if (grub_cmos_read (byte) & (1 << bit))
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
|
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_command_t cmd;
|
||||||
|
|
||||||
|
|
||||||
|
GRUB_MOD_INIT(cmostest)
|
||||||
|
{
|
||||||
|
cmd = grub_register_command ("cmostest", grub_cmd_cmostest,
|
||||||
|
"cmostest BYTE:BIT",
|
||||||
|
"Test bit at BYTE:BIT in CMOS.");
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI(cmostest)
|
||||||
|
{
|
||||||
|
grub_unregister_command (cmd);
|
||||||
|
}
|
|
@ -68,5 +68,11 @@ datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For cmostest.mod
|
||||||
|
pkglib_MODULES += cmostest.mod
|
||||||
|
cmostest_mod_SOURCES = commands/i386/cmostest.c
|
||||||
|
cmostest_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
cmostest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
include $(srcdir)/conf/i386.mk
|
||||||
include $(srcdir)/conf/common.mk
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
|
@ -244,6 +244,12 @@ hdparm_mod_SOURCES = commands/hdparm.c lib/hexdump.c
|
||||||
hdparm_mod_CFLAGS = $(COMMON_CFLAGS)
|
hdparm_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For cmostest.mod
|
||||||
|
pkglib_MODULES += cmostest.mod
|
||||||
|
cmostest_mod_SOURCES = commands/i386/cmostest.c
|
||||||
|
cmostest_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
cmostest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
ifeq ($(enable_efiemu), yes)
|
ifeq ($(enable_efiemu), yes)
|
||||||
|
|
||||||
efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
|
efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
|
||||||
|
|
|
@ -80,6 +80,7 @@ This edition documents version @value{VERSION}.
|
||||||
* Configuration:: Writing your own configuration file
|
* Configuration:: Writing your own configuration file
|
||||||
* Network:: Downloading OS images from a network
|
* Network:: Downloading OS images from a network
|
||||||
* Serial terminal:: Using GRUB via a serial line
|
* Serial terminal:: Using GRUB via a serial line
|
||||||
|
* Vendor power-on keys:: Changing GRUB behaviour on vendor power-on keys
|
||||||
* Preset Menu:: Embedding a configuration file into GRUB
|
* Preset Menu:: Embedding a configuration file into GRUB
|
||||||
* Images:: GRUB image files
|
* Images:: GRUB image files
|
||||||
* Filesystem:: Filesystem syntax and semantics
|
* Filesystem:: Filesystem syntax and semantics
|
||||||
|
@ -747,6 +748,23 @@ implements few VT100 escape sequences. If you specify this option then
|
||||||
GRUB provides you with an alternative menu interface, because the normal
|
GRUB provides you with an alternative menu interface, because the normal
|
||||||
menu requires several fancy features of your terminal.
|
menu requires several fancy features of your terminal.
|
||||||
|
|
||||||
|
@node Vendor power-on keys
|
||||||
|
@chapter Using GRUB with vendor power-on keys
|
||||||
|
Some laptop vendor provide an additional power-on button which boots another OS.
|
||||||
|
GRUB supports such buttons with GRUB_TIMEOUT_BUTTON, GRUB_DEFAULT_BUTTON,
|
||||||
|
GRUB_HIDDEN_TIMEOUT_BUTTON and GRUB_BUTTON_CMOS_ADDRESS variables in
|
||||||
|
default/grub. GRUB_TIMEOUT_BUTTON, GRUB_DEFAULT_BUTTON and
|
||||||
|
GRUB_HIDDEN_TIMEOUT_BUTTON are used instead of corresponding variables without
|
||||||
|
_BUTTON suffix when powered using special button.
|
||||||
|
GRUB_BUTTON_CMOS_ADDRESS is vendor specific and partially model-specific.
|
||||||
|
Values known to GRUB team are:
|
||||||
|
|
||||||
|
@table @key
|
||||||
|
@item Dell XPS M1530
|
||||||
|
85:3
|
||||||
|
@end table
|
||||||
|
|
||||||
|
To take full advantage of this function install GRUB into MBR.
|
||||||
|
|
||||||
@node Filesystem
|
@node Filesystem
|
||||||
@chapter Filesystem syntax and semantics
|
@chapter Filesystem syntax and semantics
|
||||||
|
|
|
@ -246,6 +246,10 @@ export GRUB_DEFAULT \
|
||||||
GRUB_HIDDEN_TIMEOUT \
|
GRUB_HIDDEN_TIMEOUT \
|
||||||
GRUB_HIDDEN_TIMEOUT_QUIET \
|
GRUB_HIDDEN_TIMEOUT_QUIET \
|
||||||
GRUB_TIMEOUT \
|
GRUB_TIMEOUT \
|
||||||
|
GRUB_DEFAULT_BUTTON \
|
||||||
|
GRUB_HIDDEN_TIMEOUT_BUTTON \
|
||||||
|
GRUB_TIMEOUT_BUTTON \
|
||||||
|
GRUB_BUTTON_CMOS_ADDRESS \
|
||||||
GRUB_DISTRIBUTOR \
|
GRUB_DISTRIBUTOR \
|
||||||
GRUB_CMDLINE_LINUX \
|
GRUB_CMDLINE_LINUX \
|
||||||
GRUB_CMDLINE_LINUX_DEFAULT \
|
GRUB_CMDLINE_LINUX_DEFAULT \
|
||||||
|
|
|
@ -38,11 +38,29 @@ if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then GRUB_DEFAULT='${saved_entry}' ; fi
|
||||||
if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
|
if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
|
||||||
if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=640x480 ; fi
|
if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=640x480 ; fi
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
if [ -s \$prefix/grubenv ]; then
|
if [ -s \$prefix/grubenv ]; then
|
||||||
load_env
|
load_env
|
||||||
fi
|
fi
|
||||||
|
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
|
||||||
set default="${GRUB_DEFAULT}"
|
set default="${GRUB_DEFAULT}"
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
cat <<EOF
|
||||||
if [ \${prev_saved_entry} ]; then
|
if [ \${prev_saved_entry} ]; then
|
||||||
set saved_entry=\${prev_saved_entry}
|
set saved_entry=\${prev_saved_entry}
|
||||||
save_env saved_entry
|
save_env saved_entry
|
||||||
|
@ -186,21 +204,36 @@ insmod gettext
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then
|
make_timeout ()
|
||||||
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
|
{
|
||||||
verbose=
|
if [ "x${1}" != "x" ] ; then
|
||||||
else
|
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
|
||||||
verbose=" --verbose"
|
verbose=
|
||||||
fi
|
else
|
||||||
cat << EOF
|
verbose=" --verbose"
|
||||||
if sleep$verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
|
fi
|
||||||
set timeout=${GRUB_TIMEOUT}
|
cat << EOF
|
||||||
|
if sleep$verbose --interruptible ${1} ; then
|
||||||
|
set timeout=${2}
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
cat << EOF
|
cat << EOF
|
||||||
set timeout=${GRUB_TIMEOUT}
|
set timeout=${2}
|
||||||
EOF
|
EOF
|
||||||
|
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}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Play an initial tune
|
# Play an initial tune
|
||||||
|
|
Loading…
Reference in a new issue