add the command setkey, remove the command keycode, fix the IBM special characters handling in the grub shell, and fix a bug in print_error.
This commit is contained in:
parent
3195af515d
commit
d0f94a1f1c
12 changed files with 552 additions and 111 deletions
61
ChangeLog
61
ChangeLog
|
@ -1,3 +1,64 @@
|
||||||
|
1999-10-29 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
* stage2/char_io.c (print_error) [!STAGE1_5]: Print "Error:"
|
||||||
|
before print the error message.
|
||||||
|
(print_error): Do not clear ERRNUM.
|
||||||
|
* stage2/cmdline.c (run_script): If ERRNUM is non-zero, set
|
||||||
|
ERRNUM to ERR_NONE.
|
||||||
|
(enter_cmdline): Clear ERRNUM after print_error.
|
||||||
|
|
||||||
|
1999-10-28 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
From Pavel Roskin:
|
||||||
|
* stage2/stage2.c (run_menu) [GRUB_UTIL]: Do not use IBM special
|
||||||
|
characters in the message, but use ascii names instead.
|
||||||
|
(run_menu) [!GRUB_UTIL]: Use DISP_UP and DISP_DOWN instead of
|
||||||
|
the ascii codes.
|
||||||
|
* stage2/shared.h [!ACS_ULCORNER] (ACS_ULCORNER): New macro.
|
||||||
|
[!ACS_ULCORNER] (ACS_URCORNER): Likewise.
|
||||||
|
[!ACS_ULCORNER] (ACS_LLCORNER): Likewise.
|
||||||
|
[!ACS_ULCORNER] (ACS_LRCORNER): Likewise.
|
||||||
|
[!ACS_ULCORNER] (ACS_HLINE): Likewise.
|
||||||
|
[!ACS_ULCORNER] (ACS_VLINE): Likewise.
|
||||||
|
[!ACS_ULCORNER] (ACS_LARROW): Likewise.
|
||||||
|
[!ACS_ULCORNER] (ACS_RARROW): Likewise.
|
||||||
|
[!ACS_ULCORNER] (ACS_UARROW): Likewise.
|
||||||
|
[!ACS_ULCORNER] (ACS_DARROW): Likewise.
|
||||||
|
[GRUB_UTIL] (DISP_UL): Set to ACS_ULCORNER.
|
||||||
|
[GRUB_UTIL] (DISP_UR): Set to ACS_URCORNER.
|
||||||
|
[GRUB_UTIL] (DISP_LL): Set to ACS_LLCORNER.
|
||||||
|
[GRUB_UTIL] (DISP_LR): Set to ACS_LRCORNER.
|
||||||
|
[GRUB_UTIL] (DISP_HORIZ): Set to ACS_HLINE.
|
||||||
|
[GRUB_UTIL] (DISP_VERT): Set to ACS_VLINE.
|
||||||
|
[GRUB_UTIL] (DISP_LEFT): Set to ACS_LARROW.
|
||||||
|
[GRUB_UTIL] (DISP_RIGHT): Set to ACS_RARROW.
|
||||||
|
[GRUB_UTIL] (DISP_UP): Set to ACS_UARROW.
|
||||||
|
[GRUB_UTIL] (DISP_DOWN): Set to ACS_DARROW.
|
||||||
|
|
||||||
|
1999-10-28 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
* stage2/builtins.c (keycode_func): Removed.
|
||||||
|
(builtin_keycode): Likewise.
|
||||||
|
(struct keysym): New structure.
|
||||||
|
(keysym_table): New variable.
|
||||||
|
(setkey_func): New function.
|
||||||
|
(builtin_setkey): New variable.
|
||||||
|
(builtin_table): Removed the pointer to BUILTIN_KEYCODE, and
|
||||||
|
added a pointer to BUILTIN_SETKEY.
|
||||||
|
* stage2/common.c [!STAGE1_5] (err_list): Added
|
||||||
|
ERR_BAD_ARGUMENT.
|
||||||
|
* stage2/shared.h (grub_error_t): Added ERR_BAD_ARGUMENT.
|
||||||
|
(KEY_MAP_SIZE): Set to 128.
|
||||||
|
(ascii_key_map): Declared.
|
||||||
|
* stage2/asm.S [!STAGE1_5] (remap_ascii_char): New function.
|
||||||
|
[!STAGE1_5] (ascii_key_map): New variable.
|
||||||
|
[!STAGE1_5] (getkey): Call remap_ascii_char after int16.
|
||||||
|
[!STAGE1_5] (checkkey): Likewise.
|
||||||
|
* grub/asmstub.c (ascii_key_map): New variable.
|
||||||
|
* docs/user-ref.texi (General commands): Added a description
|
||||||
|
about the command "setkey".
|
||||||
|
(Stage2 errors): Added a description about ERR_BAD_ARGUMENT.
|
||||||
|
|
||||||
1999-10-27 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
1999-10-27 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
* stage2/disk_io.c (set_device) [!STAGE1_5]: Remove the
|
* stage2/disk_io.c (set_device) [!STAGE1_5]: Remove the
|
||||||
|
|
2
NEWS
2
NEWS
|
@ -18,7 +18,7 @@ New in 0.5.94:
|
||||||
* The command "map" maps a drive to another drive so that we can
|
* The command "map" maps a drive to another drive so that we can
|
||||||
chain-load some foolish operating systems (such as DOS) even if such
|
chain-load some foolish operating systems (such as DOS) even if such
|
||||||
an operating system resides at a non-first drive.
|
an operating system resides at a non-first drive.
|
||||||
* The command "keycode" maps a key code to another.
|
* The command "setkey" maps a key to another.
|
||||||
* The GRUB manual is rewritten, and now consists of three parts and
|
* The GRUB manual is rewritten, and now consists of three parts and
|
||||||
appendices.
|
appendices.
|
||||||
|
|
||||||
|
|
48
TODO
48
TODO
|
@ -12,28 +12,52 @@ Priorities:
|
||||||
Things in this file are ranked with one to three !; the more, the
|
Things in this file are ranked with one to three !; the more, the
|
||||||
higher priority.
|
higher priority.
|
||||||
|
|
||||||
? Add a partition naming syntax that means ``the first partition of
|
|
||||||
this type''. We need this for clean Hurd install floppies.
|
* Add configuration inclusion support by adding a command "include". !
|
||||||
* Add a real scripting language, possibly retaining backward
|
|
||||||
compatibility so that old config files can be used.
|
|
||||||
* Add internationalization support, emulating gettext as much as is
|
|
||||||
feasible.
|
|
||||||
* Make symbolic links work for BSD FFS. !
|
* Make symbolic links work for BSD FFS. !
|
||||||
* Fix keyboard/gateA20 bug (???? at least look at the code). The
|
|
||||||
keyboard status bits may be checked wrong.
|
|
||||||
* Add indirect block support to the BSD FFS filesystem code, so files
|
* Add indirect block support to the BSD FFS filesystem code, so files
|
||||||
larger than 16MB can be read. !
|
larger than 16MB can be read. !
|
||||||
? Add command for modifying partition types.
|
|
||||||
* Fix-up FreeBSD, NetBSD (and OpenBSD ?) command-line boot
|
* Fix-up FreeBSD, NetBSD (and OpenBSD ?) command-line boot
|
||||||
parameters. !!
|
parameters. !!
|
||||||
|
|
||||||
* Support embedding a Stage 1.5 in the "bootloader" area of a FFS
|
* Support embedding a Stage 1.5 in the "bootloader" area of a FFS
|
||||||
partition. !!!
|
partition. !!!
|
||||||
|
|
||||||
* Clean up and enhance the manuals, especially indices. !!!
|
* Clean up and enhance the manuals, especially indices. !!!
|
||||||
* Add more filesystems support (XFS, NTFS, etc.)
|
|
||||||
* Add remote console support (serial, parallel and net).
|
|
||||||
* Add RAID support.
|
|
||||||
* Complete the netboot support. !
|
* Complete the netboot support. !
|
||||||
|
|
||||||
* Add automatic configuration support.
|
* Add automatic configuration support.
|
||||||
|
|
||||||
* Add bunzip2 support.
|
* Add bunzip2 support.
|
||||||
|
|
||||||
* Define the module system. !
|
* Define the module system. !
|
||||||
|
|
||||||
* Add ISA PnP support.
|
* Add ISA PnP support.
|
||||||
|
|
||||||
|
* Accept any extended partition when using it for chain-loading. !!!
|
||||||
|
|
||||||
|
* Fix the completion so that it works for BSD partitions as well. !!
|
||||||
|
|
||||||
|
* Add more filesystems support (XFS, NTFS, etc.)
|
||||||
|
|
||||||
|
* Add remote console support (serial, parallel and net).
|
||||||
|
|
||||||
|
* Add RAID support.
|
||||||
|
|
||||||
|
? Add a partition naming syntax that means ``the first partition of
|
||||||
|
this type''. We need this for clean Hurd install floppies.
|
||||||
|
|
||||||
|
* Add a real scripting language, possibly retaining backward
|
||||||
|
compatibility so that old config files can be used.
|
||||||
|
|
||||||
|
* Add internationalization support, emulating gettext as much as is
|
||||||
|
feasible.
|
||||||
|
|
||||||
|
* Fix keyboard/gateA20 bug (???? at least look at the code). The
|
||||||
|
keyboard status bits may be checked wrong.
|
||||||
|
|
||||||
|
? Add command for modifying partition types.
|
||||||
|
|
|
@ -598,6 +598,133 @@ type code. This is useful only for DOS or Windows when multiple primary
|
||||||
partitions exist in one disk.
|
partitions exist in one disk.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@deffn Command setkey to_key from_key
|
||||||
|
Change the keyboard map. The key @var{from_key} is mapped to the key
|
||||||
|
@var{to_key}. Note that this command @emph{does not} exchange the
|
||||||
|
keys. If you want to exchange the keys, run this command again with the
|
||||||
|
arguments exchanged, like this:
|
||||||
|
|
||||||
|
@example
|
||||||
|
grub> setkey capslock control
|
||||||
|
grub> setkey control capslock
|
||||||
|
@end example
|
||||||
|
|
||||||
|
A key must be an alphabet, a digit, or one of these symbols:
|
||||||
|
@samp{escape}, @samp{exclam}, @samp{at}, @samp{numbersign},
|
||||||
|
@samp{dollar}, @samp{percent}, @samp{caret}, @samp{ampersand},
|
||||||
|
@samp{asterisk}, @samp{parenleft}, @samp{parenright}, @samp{minus},
|
||||||
|
@samp{underscore}, @samp{equal}, @samp{plus}, @samp{backspace},
|
||||||
|
@samp{tab}, @samp{bracketleft}, @samp{braceleft}, @samp{bracketright},
|
||||||
|
@samp{braceright}, @samp{enter}, @samp{control}, @samp{semicolon},
|
||||||
|
@samp{colon}, @samp{quote}, @samp{doublequote}, @samp{backquote},
|
||||||
|
@samp{tilde}, @samp{shift}, @samp{backslash}, @samp{bar}, @samp{comma},
|
||||||
|
@samp{less}, @samp{period}, @samp{greater}, @samp{slash},
|
||||||
|
@samp{question}, @samp{alt}, @samp{space}, @samp{capslock}, @samp{FX}
|
||||||
|
(@samp{X} is a digit), and @samp{delete}. This table describes which
|
||||||
|
character each of the symbols corresponds to:
|
||||||
|
|
||||||
|
@table @samp
|
||||||
|
@item exclam
|
||||||
|
@samp{!}
|
||||||
|
|
||||||
|
@item at
|
||||||
|
@samp{@@}
|
||||||
|
|
||||||
|
@item numbersign
|
||||||
|
@samp{#}
|
||||||
|
|
||||||
|
@item dollar
|
||||||
|
@samp{$}
|
||||||
|
|
||||||
|
@item percent
|
||||||
|
@samp{%}
|
||||||
|
|
||||||
|
@item caret
|
||||||
|
@samp{^}
|
||||||
|
|
||||||
|
@item ampersand
|
||||||
|
@samp{&}
|
||||||
|
|
||||||
|
@item asterisk
|
||||||
|
@samp{*}
|
||||||
|
|
||||||
|
@item parenleft
|
||||||
|
@samp{(}
|
||||||
|
|
||||||
|
@item parenright
|
||||||
|
@samp{)}
|
||||||
|
|
||||||
|
@item minus
|
||||||
|
@samp{-}
|
||||||
|
|
||||||
|
@item underscore
|
||||||
|
@samp{_}
|
||||||
|
|
||||||
|
@item equal
|
||||||
|
@samp{=}
|
||||||
|
|
||||||
|
@item plus
|
||||||
|
@samp{+}
|
||||||
|
|
||||||
|
@item bracketleft
|
||||||
|
@samp{[}
|
||||||
|
|
||||||
|
@item braceleft
|
||||||
|
@samp{@{}
|
||||||
|
|
||||||
|
@item bracketright
|
||||||
|
@samp{]}
|
||||||
|
|
||||||
|
@item braceright
|
||||||
|
@samp{@}}
|
||||||
|
|
||||||
|
@item semicolon
|
||||||
|
@samp{;}
|
||||||
|
|
||||||
|
@item colon
|
||||||
|
@samp{:}
|
||||||
|
|
||||||
|
@item quote
|
||||||
|
@samp{'}
|
||||||
|
|
||||||
|
@item doublequote
|
||||||
|
@samp{"}
|
||||||
|
|
||||||
|
@item backquote
|
||||||
|
@samp{`}
|
||||||
|
|
||||||
|
@item tilde
|
||||||
|
@samp{~}
|
||||||
|
|
||||||
|
@item backslash
|
||||||
|
@samp{\}
|
||||||
|
|
||||||
|
@item bar
|
||||||
|
@samp{|}
|
||||||
|
|
||||||
|
@item comma
|
||||||
|
@samp{,}
|
||||||
|
|
||||||
|
@item less
|
||||||
|
@samp{<}
|
||||||
|
|
||||||
|
@item period
|
||||||
|
@samp{.}
|
||||||
|
|
||||||
|
@item greater
|
||||||
|
@samp{>}
|
||||||
|
|
||||||
|
@item slash
|
||||||
|
@samp{/}
|
||||||
|
|
||||||
|
@item question
|
||||||
|
@samp{?}
|
||||||
|
|
||||||
|
@item space
|
||||||
|
@samp{ }
|
||||||
|
@end table
|
||||||
|
@end deffn
|
||||||
|
|
||||||
@deffn Command unhide partition
|
@deffn Command unhide partition
|
||||||
Unhide @var{partition} by clearing the @dfn{hidden} bit in its partition
|
Unhide @var{partition} by clearing the @dfn{hidden} bit in its partition
|
||||||
type code. This is useful only for DOS or Windows when multiple primary
|
type code. This is useful only for DOS or Windows when multiple primary
|
||||||
|
@ -1043,6 +1170,9 @@ is simply too big.
|
||||||
This error is returned if there is a disk write error when trying to
|
This error is returned if there is a disk write error when trying to
|
||||||
write to a particular disk. This would generally only occur during an
|
write to a particular disk. This would generally only occur during an
|
||||||
install of set active partition command.
|
install of set active partition command.
|
||||||
|
|
||||||
|
@item 30 : Invalid argument specified
|
||||||
|
This error is returned if an argument specified to a command is invalid.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -613,6 +613,7 @@ unset_int15_handler (void)
|
||||||
|
|
||||||
/* The key map. */
|
/* The key map. */
|
||||||
unsigned short bios_key_map[KEY_MAP_SIZE + 1];
|
unsigned short bios_key_map[KEY_MAP_SIZE + 1];
|
||||||
|
unsigned short ascii_key_map[KEY_MAP_SIZE + 1];
|
||||||
|
|
||||||
/* Copy MAP to the drive map and set up the int13 handler. */
|
/* Copy MAP to the drive map and set up the int13 handler. */
|
||||||
void
|
void
|
||||||
|
|
42
stage2/asm.S
42
stage2/asm.S
|
@ -515,7 +515,7 @@ int15_skip_flag:
|
||||||
/* find the key code from the key map */
|
/* find the key code from the key map */
|
||||||
2:
|
2:
|
||||||
lodsw
|
lodsw
|
||||||
/* check if this the end */
|
/* check if this is the end */
|
||||||
testw %ax, %ax
|
testw %ax, %ax
|
||||||
jz 3f
|
jz 3f
|
||||||
/* check if this matches the key code */
|
/* check if this matches the key code */
|
||||||
|
@ -1878,7 +1878,6 @@ gottime:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
#ifndef STAGE1_5
|
|
||||||
/*
|
/*
|
||||||
* currticks()
|
* currticks()
|
||||||
* return the real time in ticks, of which there are about
|
* return the real time in ticks, of which there are about
|
||||||
|
@ -1906,8 +1905,40 @@ ENTRY(currticks)
|
||||||
popl %ecx
|
popl %ecx
|
||||||
popl %ebp
|
popl %ebp
|
||||||
ret
|
ret
|
||||||
#endif /* ! STAGE1_5 */
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* remap_ascii_char remaps the ascii code %bl to another if the code is
|
||||||
|
* contained in ASCII_KEY_MAP.
|
||||||
|
*/
|
||||||
|
.code16
|
||||||
|
|
||||||
|
remap_ascii_char:
|
||||||
|
pushw %si
|
||||||
|
|
||||||
|
movw $ABS(EXT_C(ascii_key_map)), %si
|
||||||
|
1:
|
||||||
|
lodsw
|
||||||
|
/* check if this is the end */
|
||||||
|
testw %ax, %ax
|
||||||
|
jz 2f
|
||||||
|
/* check if this matches the ascii code */
|
||||||
|
cmpb %al, %bl
|
||||||
|
jne 1b
|
||||||
|
/* if so, perform the mapping */
|
||||||
|
movb %ah, %bl
|
||||||
|
2:
|
||||||
|
/* restore %si */
|
||||||
|
popw %si
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
.code32
|
||||||
|
|
||||||
|
.align 4
|
||||||
|
ENTRY(ascii_key_map)
|
||||||
|
.space (KEY_MAP_SIZE + 1) * 2
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* getkey()
|
* getkey()
|
||||||
|
@ -1927,7 +1958,8 @@ ENTRY(getkey)
|
||||||
int $0x16
|
int $0x16
|
||||||
|
|
||||||
movw %ax, %bx /* real_to_prot uses %eax */
|
movw %ax, %bx /* real_to_prot uses %eax */
|
||||||
|
call remap_ascii_char
|
||||||
|
|
||||||
DATA32 call EXT_C(real_to_prot)
|
DATA32 call EXT_C(real_to_prot)
|
||||||
.code32
|
.code32
|
||||||
|
|
||||||
|
@ -1964,7 +1996,9 @@ ENTRY(checkkey)
|
||||||
int $0x16
|
int $0x16
|
||||||
|
|
||||||
DATA32 jz notpending
|
DATA32 jz notpending
|
||||||
|
|
||||||
movw %ax, %bx
|
movw %ax, %bx
|
||||||
|
call remap_ascii_char
|
||||||
DATA32 jmp pending
|
DATA32 jmp pending
|
||||||
|
|
||||||
notpending:
|
notpending:
|
||||||
|
|
|
@ -1478,81 +1478,6 @@ static struct builtin builtin_kernel =
|
||||||
" using this command."
|
" using this command."
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* keycode */
|
|
||||||
static int
|
|
||||||
keycode_func (char *arg, int flags)
|
|
||||||
{
|
|
||||||
char *to_code, *from_code;
|
|
||||||
int to, from;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
to_code = arg;
|
|
||||||
from_code = skip_to (0, to_code);
|
|
||||||
|
|
||||||
safe_parse_maxint (&to_code, &to);
|
|
||||||
if (errnum)
|
|
||||||
return 1;
|
|
||||||
if (to < 0 || to > 0xff)
|
|
||||||
{
|
|
||||||
/* FIXME: more appropriate error code! */
|
|
||||||
errnum = ERR_NUMBER_PARSING;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
safe_parse_maxint (&from_code, &from);
|
|
||||||
if (errnum)
|
|
||||||
return 1;
|
|
||||||
if (from < 0 || from > 0xff)
|
|
||||||
{
|
|
||||||
/* FIXME: more appropriate error code! */
|
|
||||||
errnum = ERR_NUMBER_PARSING;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find an empty slot. */
|
|
||||||
for (i = 0; i < KEY_MAP_SIZE; i++)
|
|
||||||
{
|
|
||||||
if ((bios_key_map[i] & 0xff) == from)
|
|
||||||
{
|
|
||||||
/* Perhaps the user wants to overwrite the map. */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! bios_key_map[i])
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == KEY_MAP_SIZE)
|
|
||||||
{
|
|
||||||
errnum = ERR_WONT_FIT;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (to == from)
|
|
||||||
/* If TO is equal to FROM, delete the entry. */
|
|
||||||
grub_memmove ((char *) &bios_key_map[i], (char *) &bios_key_map[i + 1],
|
|
||||||
sizeof (unsigned short) * (KEY_MAP_SIZE - i));
|
|
||||||
else
|
|
||||||
bios_key_map[i] = (to << 8) | from;
|
|
||||||
|
|
||||||
/* Ugly but should work. */
|
|
||||||
unset_int15_handler ();
|
|
||||||
set_int15_handler ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct builtin builtin_keycode =
|
|
||||||
{
|
|
||||||
"keycode",
|
|
||||||
keycode_func,
|
|
||||||
BUILTIN_CMDLINE | BUILTIN_MENU,
|
|
||||||
"keycode TO_CODE FROM_CODE",
|
|
||||||
"Change the keyboard map. The keycode FROM_CODE is mapped to the keycode"
|
|
||||||
" TO_CODE. They must be decimal or hexadecimal."
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* makeactive */
|
/* makeactive */
|
||||||
static int
|
static int
|
||||||
|
@ -1896,6 +1821,236 @@ static struct builtin builtin_rootnoverify =
|
||||||
" derived from attempting the mount will NOT work correctly."
|
" derived from attempting the mount will NOT work correctly."
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* setkey */
|
||||||
|
struct keysym
|
||||||
|
{
|
||||||
|
char *unshifted_name; /* the name in unshifted state */
|
||||||
|
char *shifted_name; /* the name in shifted state */
|
||||||
|
unsigned char unshifted_ascii; /* the ascii code in unshifted state */
|
||||||
|
unsigned char shifted_ascii; /* the ascii code in shifted state */
|
||||||
|
unsigned char keycode; /* keyboard scancode */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The table for key symbols. If the "unshifted" member of an entry is
|
||||||
|
NULL, the entry does not have shifted state. */
|
||||||
|
static struct keysym keysym_table[] =
|
||||||
|
{
|
||||||
|
{"escape", 0, 0x1b, 0, 0x01},
|
||||||
|
{"1", "exclam", '1', '!', 0x02},
|
||||||
|
{"2", "at", '2', '@', 0x03},
|
||||||
|
{"3", "numbersign", '3', '#', 0x04},
|
||||||
|
{"4", "dollar", '4', '$', 0x05},
|
||||||
|
{"5", "percent", '5', '%', 0x06},
|
||||||
|
{"6", "caret", '6', '^', 0x07},
|
||||||
|
{"7", "ampersand", '7', '&', 0x08},
|
||||||
|
{"8", "asterisk", '8', '*', 0x09},
|
||||||
|
{"9", "parenleft", '9', '(', 0x0a},
|
||||||
|
{"0", "parenright", '0', ')', 0x0b},
|
||||||
|
{"minus", "underscore", '-', '_', 0x0c},
|
||||||
|
{"equal", "plus", '=', '+', 0x0d},
|
||||||
|
{"backspace", 0, '\b', 0, 0x0e},
|
||||||
|
{"tab", 0, '\t', 0, 0x0f},
|
||||||
|
{"q", "Q", 'q', 'Q', 0x10},
|
||||||
|
{"w", "W", 'w', 'W', 0x11},
|
||||||
|
{"e", "E", 'e', 'E', 0x12},
|
||||||
|
{"r", "R", 'r', 'R', 0x13},
|
||||||
|
{"t", "T", 't', 'T', 0x14},
|
||||||
|
{"y", "Y", 'y', 'Y', 0x15},
|
||||||
|
{"u", "U", 'u', 'U', 0x16},
|
||||||
|
{"i", "I", 'i', 'I', 0x17},
|
||||||
|
{"o", "O", 'o', 'O', 0x18},
|
||||||
|
{"p", "P", 'p', 'P', 0x19},
|
||||||
|
{"bracketleft", "braceleft", '[', '{', 0x1a},
|
||||||
|
{"bracketright", "braceright", ']', '}', 0x1b},
|
||||||
|
{"enter", 0, '\n', 0, 0x1c},
|
||||||
|
{"control", 0, 0, 0, 0x1d},
|
||||||
|
{"a", "A", 'a', 'A', 0x1e},
|
||||||
|
{"s", "S", 's', 'S', 0x1f},
|
||||||
|
{"d", "D", 'd', 'D', 0x20},
|
||||||
|
{"f", "F", 'f', 'F', 0x21},
|
||||||
|
{"g", "G", 'g', 'G', 0x22},
|
||||||
|
{"h", "H", 'h', 'H', 0x23},
|
||||||
|
{"j", "J", 'j', 'J', 0x24},
|
||||||
|
{"k", "K", 'k', 'K', 0x25},
|
||||||
|
{"l", "L", 'l', 'L', 0x26},
|
||||||
|
{"semicolon", "colon", ';', ':', 0x27},
|
||||||
|
{"quote", "doublequote", '\'', '"', 0x28},
|
||||||
|
{"backquote", "tilde", '`', '~', 0x29},
|
||||||
|
{"shift", 0, 0, 0, 0x2a},
|
||||||
|
{"backslash", "bar", '\\', '|', 0x2b},
|
||||||
|
{"z", "Z", 'z', 'Z', 0x2c},
|
||||||
|
{"x", "X", 'x', 'X', 0x2d},
|
||||||
|
{"c", "C", 'c', 'C', 0x2e},
|
||||||
|
{"v", "V", 'v', 'V', 0x2f},
|
||||||
|
{"b", "B", 'b', 'B', 0x30},
|
||||||
|
{"n", "N", 'n', 'N', 0x31},
|
||||||
|
{"m", "M", 'm', 'M', 0x32},
|
||||||
|
{"comma", "less", ',', '<', 0x33},
|
||||||
|
{"period", "greater", '.', '>', 0x34},
|
||||||
|
{"slash", "question", '/', '?', 0x35},
|
||||||
|
{"alt", 0, 0, 0, 0x38},
|
||||||
|
{"space", 0, ' ', 0, 0x39},
|
||||||
|
{"capslock", 0, 0, 0, 0x3a},
|
||||||
|
{"F1", 0, 0, 0, 0x3b},
|
||||||
|
{"F2", 0, 0, 0, 0x3c},
|
||||||
|
{"F3", 0, 0, 0, 0x3d},
|
||||||
|
{"F4", 0, 0, 0, 0x3e},
|
||||||
|
{"F5", 0, 0, 0, 0x3f},
|
||||||
|
{"F6", 0, 0, 0, 0x40},
|
||||||
|
{"F7", 0, 0, 0, 0x41},
|
||||||
|
{"F8", 0, 0, 0, 0x42},
|
||||||
|
{"F9", 0, 0, 0, 0x43},
|
||||||
|
{"F10", 0, 0, 0, 0x44},
|
||||||
|
/* Caution: do not add NumLock here! we cannot deal with it properly. */
|
||||||
|
{"delete", 0, 0x7f, 0, 0x53}
|
||||||
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
setkey_func (char *arg, int flags)
|
||||||
|
{
|
||||||
|
char *to_key, *from_key;
|
||||||
|
int to_code, from_code;
|
||||||
|
int map_in_interrupt = 0;
|
||||||
|
|
||||||
|
static void null_terminate (char *str)
|
||||||
|
{
|
||||||
|
while (*str && ! grub_isspace (*str))
|
||||||
|
str++;
|
||||||
|
*str = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int find_key_code (char *key)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++)
|
||||||
|
{
|
||||||
|
if (grub_strcmp (key, keysym_table[i].unshifted_name) == 0)
|
||||||
|
return keysym_table[i].keycode;
|
||||||
|
else if (grub_strcmp (key, keysym_table[i].shifted_name) == 0)
|
||||||
|
return keysym_table[i].keycode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int find_ascii_code (char *key)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++)
|
||||||
|
{
|
||||||
|
if (grub_strcmp (key, keysym_table[i].unshifted_name) == 0)
|
||||||
|
return keysym_table[i].unshifted_ascii;
|
||||||
|
else if (grub_strcmp (key, keysym_table[i].shifted_name) == 0)
|
||||||
|
return keysym_table[i].shifted_ascii;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
to_key = arg;
|
||||||
|
from_key = skip_to (0, to_key);
|
||||||
|
|
||||||
|
null_terminate (to_key);
|
||||||
|
null_terminate (from_key);
|
||||||
|
|
||||||
|
to_code = find_ascii_code (to_key);
|
||||||
|
from_code = find_ascii_code (from_key);
|
||||||
|
if (! to_code || ! from_code)
|
||||||
|
{
|
||||||
|
map_in_interrupt = 1;
|
||||||
|
to_code = find_key_code (to_key);
|
||||||
|
from_code = find_key_code (from_key);
|
||||||
|
if (! to_code || ! from_code)
|
||||||
|
{
|
||||||
|
errnum = ERR_BAD_ARGUMENT;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (map_in_interrupt)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Find an empty slot. */
|
||||||
|
for (i = 0; i < KEY_MAP_SIZE; i++)
|
||||||
|
{
|
||||||
|
if ((bios_key_map[i] & 0xff) == from_code)
|
||||||
|
/* Perhaps the user wants to overwrite the map. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (! bios_key_map[i])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == KEY_MAP_SIZE)
|
||||||
|
{
|
||||||
|
errnum = ERR_WONT_FIT;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to_code == from_code)
|
||||||
|
/* If TO is equal to FROM, delete the entry. */
|
||||||
|
grub_memmove ((char *) &bios_key_map[i], (char *) &bios_key_map[i + 1],
|
||||||
|
sizeof (unsigned short) * (KEY_MAP_SIZE - i));
|
||||||
|
else
|
||||||
|
bios_key_map[i] = (to_code << 8) | from_code;
|
||||||
|
|
||||||
|
/* Ugly but should work. */
|
||||||
|
unset_int15_handler ();
|
||||||
|
set_int15_handler ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Find an empty slot. */
|
||||||
|
for (i = 0; i < KEY_MAP_SIZE; i++)
|
||||||
|
{
|
||||||
|
if ((ascii_key_map[i] & 0xff) == from_code)
|
||||||
|
/* Perhaps the user wants to overwrite the map. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (! ascii_key_map[i])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == KEY_MAP_SIZE)
|
||||||
|
{
|
||||||
|
errnum = ERR_WONT_FIT;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to_code == from_code)
|
||||||
|
/* If TO is equal to FROM, delete the entry. */
|
||||||
|
grub_memmove ((char *) &ascii_key_map[i],
|
||||||
|
(char *) &ascii_key_map[i + 1],
|
||||||
|
sizeof (unsigned short) * (KEY_MAP_SIZE - i));
|
||||||
|
else
|
||||||
|
ascii_key_map[i] = (to_code << 8) | from_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct builtin builtin_setkey =
|
||||||
|
{
|
||||||
|
"setkey",
|
||||||
|
setkey_func,
|
||||||
|
BUILTIN_CMDLINE | BUILTIN_MENU,
|
||||||
|
"setkey TO_KEY FROM_KEY",
|
||||||
|
"Change the keyboard map. The key FROM_KEY is mapped to the key TO_KEY."
|
||||||
|
" A key must be an alphabet, a digit, or one of these: escape, exclam,"
|
||||||
|
" at, numbersign, dollar, percent, caret, ampersand, asterisk, parenleft,"
|
||||||
|
" parenright, minus, underscore, equal, plus, backspace, tab, bracketleft,"
|
||||||
|
" braceleft, bracketright, braceright, enter, control, semicolon, colon,"
|
||||||
|
" quote, doublequote, backquote, tilde, shift, backslash, bar, comma,"
|
||||||
|
" less, period, greater, slash, question, alt, space, capslock, FX (X"
|
||||||
|
" is a digit), and delete."
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* setup */
|
/* setup */
|
||||||
static int
|
static int
|
||||||
|
@ -2316,7 +2471,6 @@ struct builtin *builtin_table[] =
|
||||||
&builtin_initrd,
|
&builtin_initrd,
|
||||||
&builtin_install,
|
&builtin_install,
|
||||||
&builtin_kernel,
|
&builtin_kernel,
|
||||||
&builtin_keycode,
|
|
||||||
&builtin_makeactive,
|
&builtin_makeactive,
|
||||||
&builtin_map,
|
&builtin_map,
|
||||||
&builtin_module,
|
&builtin_module,
|
||||||
|
@ -2327,6 +2481,7 @@ struct builtin *builtin_table[] =
|
||||||
&builtin_read,
|
&builtin_read,
|
||||||
&builtin_root,
|
&builtin_root,
|
||||||
&builtin_rootnoverify,
|
&builtin_rootnoverify,
|
||||||
|
&builtin_setkey,
|
||||||
&builtin_setup,
|
&builtin_setup,
|
||||||
&builtin_testload,
|
&builtin_testload,
|
||||||
&builtin_timeout,
|
&builtin_timeout,
|
||||||
|
|
|
@ -29,12 +29,10 @@ print_error (void)
|
||||||
if (errnum > ERR_NONE && errnum < MAX_ERR_NUM)
|
if (errnum > ERR_NONE && errnum < MAX_ERR_NUM)
|
||||||
#ifndef STAGE1_5
|
#ifndef STAGE1_5
|
||||||
/* printf("\7\n %s\n", err_list[errnum]); */
|
/* printf("\7\n %s\n", err_list[errnum]); */
|
||||||
printf ("\n %s\n", err_list[errnum]);
|
printf ("\nError: %s\n", err_list[errnum]);
|
||||||
#else /* STAGE1_5 */
|
#else /* STAGE1_5 */
|
||||||
printf ("Error: %u\n", errnum);
|
printf ("Error: %u\n", errnum);
|
||||||
#endif /* STAGE1_5 */
|
#endif /* STAGE1_5 */
|
||||||
|
|
||||||
errnum = ERR_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,8 @@ enter_cmdline (char *heap)
|
||||||
|
|
||||||
*heap = 0;
|
*heap = 0;
|
||||||
print_error ();
|
print_error ();
|
||||||
|
errnum = ERR_NONE;
|
||||||
|
|
||||||
/* Get the command-line with the minimal BASH-like interface. */
|
/* Get the command-line with the minimal BASH-like interface. */
|
||||||
if (get_cmdline (PACKAGE "> ", heap, 2048, 0, 1))
|
if (get_cmdline (PACKAGE "> ", heap, 2048, 0, 1))
|
||||||
return;
|
return;
|
||||||
|
@ -166,7 +167,8 @@ run_script (char *script, char *heap)
|
||||||
|
|
||||||
if (errnum)
|
if (errnum)
|
||||||
{
|
{
|
||||||
grub_printf ("Press any key to continue...");
|
errnum = ERR_NONE;
|
||||||
|
grub_printf ("\nPress any key to continue...");
|
||||||
(void) getkey ();
|
(void) getkey ();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ char *err_list[] =
|
||||||
[ERR_UNRECOGNIZED] = "Unrecognized command",
|
[ERR_UNRECOGNIZED] = "Unrecognized command",
|
||||||
[ERR_WONT_FIT] = "Selected item cannot fit into memory",
|
[ERR_WONT_FIT] = "Selected item cannot fit into memory",
|
||||||
[ERR_WRITE] = "Disk write error",
|
[ERR_WRITE] = "Disk write error",
|
||||||
|
[ERR_BAD_ARGUMENT] = "Invaild argument specified",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ extern char *grub_scratch_mem;
|
||||||
#define DRIVE_MAP_SIZE 8
|
#define DRIVE_MAP_SIZE 8
|
||||||
|
|
||||||
/* The size of the key map. */
|
/* The size of the key map. */
|
||||||
#define KEY_MAP_SIZE 32
|
#define KEY_MAP_SIZE 128
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -285,17 +285,44 @@ extern char *grub_scratch_mem;
|
||||||
# endif /* ! A_STANDOUT */
|
# endif /* ! A_STANDOUT */
|
||||||
#endif /* ! A_REVERSE */
|
#endif /* ! A_REVERSE */
|
||||||
|
|
||||||
|
/* Make sure that ACS_* are defined. */
|
||||||
|
#ifndef ACS_ULCORNER
|
||||||
|
# define ACS_ULCORNER '+'
|
||||||
|
# define ACS_URCORNER '+'
|
||||||
|
# define ACS_LLCORNER '+'
|
||||||
|
# define ACS_LRCORNER '+'
|
||||||
|
# define ACS_HLINE '-'
|
||||||
|
# define ACS_VLINE '|'
|
||||||
|
# define ACS_LARROW '<'
|
||||||
|
# define ACS_RARROW '>'
|
||||||
|
# define ACS_UARROW '^'
|
||||||
|
# define ACS_DARROW 'v'
|
||||||
|
#endif /* ! ACS_ULCORNER */
|
||||||
|
|
||||||
/* Special graphics characters for IBM displays. */
|
/* Special graphics characters for IBM displays. */
|
||||||
#define DISP_UL 218
|
#ifdef GRUB_UTIL
|
||||||
#define DISP_UR 191
|
# define DISP_UL ACS_ULCORNER
|
||||||
#define DISP_LL 192
|
# define DISP_UR ACS_URCORNER
|
||||||
#define DISP_LR 217
|
# define DISP_LL ACS_LLCORNER
|
||||||
#define DISP_HORIZ 196
|
# define DISP_LR ACS_LRCORNER
|
||||||
#define DISP_VERT 179
|
# define DISP_HORIZ ACS_HLINE
|
||||||
#define DISP_LEFT 0x1b
|
# define DISP_VERT ACS_VLINE
|
||||||
#define DISP_RIGHT 0x1a
|
# define DISP_LEFT ACS_LARROW
|
||||||
#define DISP_UP 0x18
|
# define DISP_RIGHT ACS_RARROW
|
||||||
#define DISP_DOWN 0x19
|
# define DISP_UP ACS_UARROW
|
||||||
|
# define DISP_DOWN ACS_DARROW
|
||||||
|
#else /* ! GRUB_UTIL */
|
||||||
|
# define DISP_UL 218
|
||||||
|
# define DISP_UR 191
|
||||||
|
# define DISP_LL 192
|
||||||
|
# define DISP_LR 217
|
||||||
|
# define DISP_HORIZ 196
|
||||||
|
# define DISP_VERT 179
|
||||||
|
# define DISP_LEFT 0x1b
|
||||||
|
# define DISP_RIGHT 0x1a
|
||||||
|
# define DISP_UP 0x18
|
||||||
|
# define DISP_DOWN 0x19
|
||||||
|
#endif /* ! GRUB_UTIL */
|
||||||
|
|
||||||
/* Remap some libc-API-compatible function names so that we prevent
|
/* Remap some libc-API-compatible function names so that we prevent
|
||||||
circularararity. */
|
circularararity. */
|
||||||
|
@ -373,6 +400,7 @@ typedef enum
|
||||||
ERR_UNRECOGNIZED,
|
ERR_UNRECOGNIZED,
|
||||||
ERR_WONT_FIT,
|
ERR_WONT_FIT,
|
||||||
ERR_WRITE,
|
ERR_WRITE,
|
||||||
|
ERR_BAD_ARGUMENT,
|
||||||
|
|
||||||
MAX_ERR_NUM
|
MAX_ERR_NUM
|
||||||
} grub_error_t;
|
} grub_error_t;
|
||||||
|
@ -512,6 +540,7 @@ void unset_int15_handler (void);
|
||||||
|
|
||||||
/* The key map. */
|
/* The key map. */
|
||||||
extern unsigned short bios_key_map[];
|
extern unsigned short bios_key_map[];
|
||||||
|
extern unsigned short ascii_key_map[];
|
||||||
|
|
||||||
/* calls for direct boot-loader chaining */
|
/* calls for direct boot-loader chaining */
|
||||||
void chain_stage1 (int segment, int offset, int part_table_addr)
|
void chain_stage1 (int segment, int offset, int part_table_addr)
|
||||||
|
|
|
@ -190,8 +190,14 @@ restart:
|
||||||
|
|
||||||
print_border (3, 12);
|
print_border (3, 12);
|
||||||
|
|
||||||
printf ("\n
|
#ifdef GRUB_UTIL
|
||||||
Use the \x18 and \x19 keys for selecting which entry is highlighted.\n");
|
grub_printf ("\n
|
||||||
|
Use the up and down arrows for selecting which entry is highlighted.\n");
|
||||||
|
#else
|
||||||
|
grub_printf ("\n
|
||||||
|
Use the %c and %c keys for selecting which entry is highlighted.\n",
|
||||||
|
DISP_UP, DISP_DOWN);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (password)
|
if (password)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue