add console emulation into serial terminal support using vt100-compatible escape sequences, add --enable-serial into configure, and fix some bugs in the support.

This commit is contained in:
okuji 2000-08-20 12:14:14 +00:00
parent 7d54a86a52
commit 2455b65f2e
16 changed files with 485 additions and 144 deletions

View file

@ -1,3 +1,62 @@
2000-08-20 OKUJI Yoshinori <okuji@gnu.org>
* configure.in (--enable-serial): New option. Serial terminal
support will be enabled by default, once it is stabilized.
(SERIAL_SUPPORT): New conditional.
* grub/Makefile.am (AM_CFLAGS): Added -DSUPPORT_SERIAL=1.
* grub/asmstub.c (cls): Renamed to ...
(console_cls): ... this.
(getxy): Renamed to ...
(console_getxy): ... this.
(gotoxy): Renamed to ...
(console_gotoxy): ... this.
* stage2/Makefile.am (libgrub_a_CFLAGS): Added
-DSUPPORT_SERIAL=1.
(NETBOOT_FLAGS): New variable.
(SERIAL_FLAGS): Likewise.
(STAGE2_COMPILE): Added $(NETBOOT_FLAGS) and $(SERIAL_FLAGS).
* stage2/asm.S [!STAGE1_5] (cls): Renamed to ...
[!STAGE1_5] (console_cls): ... this.
[!STAGE1_5] (getxy): Renamed to ...
[!STAGE1_5] (console_getxy): ... this.
[!STAGE1_5] (gotoxy): Renamed to ...
[!STAGE1_5] (console_gotoxy): ... this.
* stage2/builtins.c (terminal_func): If the bit flag
BUILTIN_CMDLINE in FLAGS is set, call init_page. But this should
be fixed so that it restarts enter_cmdline instead.
* stage2/char_io.c [!STAGE1_5] (gotoxy): New function.
[!STAGE1_5] (serial_gotoxy): Likewise.
[!STAGE1_5] (getxy): Likewise.
[!STAGE1_5] (serial_getxy): Likewise.
[!STAGE1_5] (cls): Likewise.
[!STAGE1_5] (serial_cls): Likewise.
* stage2/serial.h (serial_cls): Declared.
(serial_getxy): Likewise.
(serial_gotoxy): Likewise.
* stage2/shared.h (console_cls): Likewise.
(console_getxy): Likewise.
(console_gotoxy): Likewise.
* stage2/stage2.c (print_entries): If serial terminal is
enabled, print ACS_UARROW and ACS_DARROW instead of DISP_UP and
DISP_DOWN, respectively.
(print_border): If serial terminal is enabled, print
ACS_ULCORNER, ACS_URCORNER, ACS_LLCORNER, ACS_LRCORNER,
ACS_HLINE and ACS_VLINE instead of DISP_UL, DISP_UR, DISP_LL,
DISP_LR, DISP_HORIZ and DISP_VERT, respectively.
(print_border) [SUPPORT_SERIAL]: Color the menu only if console
is used.
(set_line): Take two more arguments, ENTRYNO and MENU_ENTRIES.
(set_line_normal): Likewise.
(set_line_highlight): Likewise.
(set_line) [SUPPORT_SERIAL]: If serial terminal is enabled, get
the menu entry whose attributes are being changed and redraw the
line.
(set_line_highlight) [SUPPORT_SERIAL]: If serial terminal is
enabled, print `ESC [ 7 m' and `ESC [ 0 m' before and after
calling set_line, respectively.
(run_menu) [SUPPORT_SERIAL]: Call nocursor only if console is
used.
2000-08-20 OKUJI Yoshinori <okuji@gnu.org>
Now the serial console support is partially working.

4
NEWS
View file

@ -20,6 +20,10 @@ New in 0.5.96 - XXXX-XX-XX:
* One violation against the Network Boot Image Proposal was found and
fixed. So now the image `nbgrub' can work fine even with a card such
as rtl8139.
* Serial terminal support is added. The configure script accepts
a new option `--enable-serial'. If it is specified, you can use two
new commands, "serial" and "terminal" in the command-line and the
menu. See the manual, for more details.
New in 0.5.95 - 2000-06-27:
* NetBSD ELF kernel support is added. You have to specify the new option

2
TODO
View file

@ -52,7 +52,7 @@ Priorities:
* Add more filesystems support (XFS, NTFS, etc.)
* Add remote console support (serial, parallel and net). !!
* Add remote console support (parallel and net). !
* Add RAID support.

180
configure vendored
View file

@ -114,6 +114,8 @@ ac_help="$ac_help
--enable-cs-scan=LIST probe for CS89x0 base address using LIST"
ac_help="$ac_help
--enable-diskless enable diskless support"
ac_help="$ac_help
--enable-serial enable serial terminal support"
# Initialize some variables set by options.
# The variables have the same names as the options, with
@ -655,7 +657,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:659: checking for a BSD compatible install" >&5
echo "configure:661: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -708,7 +710,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
echo "configure:712: checking whether build environment is sane" >&5
echo "configure:714: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@ -780,7 +782,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:784: checking for $ac_word" >&5
echo "configure:786: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -810,7 +812,7 @@ test -n "$AWK" && break
done
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
echo "configure:814: checking whether ${MAKE-make} sets \${MAKE}" >&5
echo "configure:816: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -936,7 +938,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:940: checking host system type" >&5
echo "configure:942: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@ -970,7 +972,7 @@ esac
#
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
echo "configure:974: checking whether to enable maintainer-specific portions of Makefiles" >&5
echo "configure:976: checking whether to enable maintainer-specific portions of Makefiles" >&5
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
enableval="$enable_maintainer_mode"
@ -996,7 +998,7 @@ if test "x$enable_maintainer_mode" = xyes; then
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1000: checking for $ac_word" >&5
echo "configure:1002: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1043,7 +1045,7 @@ fi
#
echo $ac_n "checking build system type""... $ac_c" 1>&6
echo "configure:1047: checking build system type" >&5
echo "configure:1049: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@ -1069,7 +1071,7 @@ fi
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1073: checking for $ac_word" >&5
echo "configure:1075: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1101,7 +1103,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1105: checking for $ac_word" >&5
echo "configure:1107: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1131,7 +1133,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1135: checking for $ac_word" >&5
echo "configure:1137: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1182,7 +1184,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1186: checking for $ac_word" >&5
echo "configure:1188: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1214,7 +1216,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:1218: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:1220: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -1225,12 +1227,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 1229 "configure"
#line 1231 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:1234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -1256,12 +1258,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:1260: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:1262: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:1265: checking whether we are using GNU C" >&5
echo "configure:1267: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1270,7 +1272,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1274: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1276: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -1289,7 +1291,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:1293: checking whether ${CC-cc} accepts -g" >&5
echo "configure:1295: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1322,7 +1324,7 @@ fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1326: checking how to run the C preprocessor" >&5
echo "configure:1328: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -1337,13 +1339,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 1341 "configure"
#line 1343 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1347: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1349: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1354,13 +1356,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1358 "configure"
#line 1360 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1364: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1366: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1371,13 +1373,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 1375 "configure"
#line 1377 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1381: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1410,7 +1412,7 @@ echo "$ac_t""$CPP" 1>&6
depcc="$CC"
depcpp="$CPP"
echo $ac_n "checking dependency style of $depcc""... $ac_c" 1>&6
echo "configure:1414: checking dependency style of $depcc" >&5
echo "configure:1416: checking dependency style of $depcc" >&5
if eval "test \"`echo '$''{'am_cv_CC_dependencies_compiler_type'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1466,7 +1468,7 @@ if test "x$with_binutils" != x; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1470: checking for $ac_word" >&5
echo "configure:1472: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1503,7 +1505,7 @@ else
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1507: checking for $ac_word" >&5
echo "configure:1509: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1543,7 +1545,7 @@ if test "x$ac_cv_prog_gcc" = xyes; then
STAGE1_CFLAGS="-O2"
GRUB_CFLAGS="-O2"
echo $ac_n "checking whether optimization for size works""... $ac_c" 1>&6
echo "configure:1547: checking whether optimization for size works" >&5
echo "configure:1549: checking whether optimization for size works" >&5
if eval "test \"`echo '$''{'size_flag'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1551,14 +1553,14 @@ else
saved_CFLAGS=$CFLAGS
CFLAGS="-Os -g"
cat > conftest.$ac_ext <<EOF
#line 1555 "configure"
#line 1557 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
if { (eval echo configure:1562: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1564: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
size_flag=yes
else
@ -1593,7 +1595,7 @@ if test "x$with_binutils" != x; then
# Extract the first word of "objcopy", so it can be a program name with args.
set dummy objcopy; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1597: checking for $ac_word" >&5
echo "configure:1599: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_OBJCOPY'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1629,7 +1631,7 @@ else
# Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args.
set dummy ${ac_tool_prefix}objcopy; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1633: checking for $ac_word" >&5
echo "configure:1635: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1663,7 +1665,7 @@ fi
# Defined in acinclude.m4.
echo $ac_n "checking if C symbols get an underscore after compilation""... $ac_c" 1>&6
echo "configure:1667: checking if C symbols get an underscore after compilation" >&5
echo "configure:1669: checking if C symbols get an underscore after compilation" >&5
if eval "test \"`echo '$''{'grub_cv_asm_uscore'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1676,7 +1678,7 @@ func (int *list)
}
EOF
if { ac_try='${CC-cc} ${CFLAGS} -S conftest.c'; { (eval echo configure:1680: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then
if { ac_try='${CC-cc} ${CFLAGS} -S conftest.c'; { (eval echo configure:1682: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then
true
else
{ echo "configure: error: ${CC-cc} failed to produce assembly code" 1>&2; exit 1; }
@ -1702,7 +1704,7 @@ fi
echo "$ac_t""$grub_cv_asm_uscore" 1>&6
echo $ac_n "checking whether ${OBJCOPY} works for absolute addresses""... $ac_c" 1>&6
echo "configure:1706: checking whether ${OBJCOPY} works for absolute addresses" >&5
echo "configure:1708: checking whether ${OBJCOPY} works for absolute addresses" >&5
if eval "test \"`echo '$''{'grub_cv_prog_objcopy_absolute'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1714,21 +1716,21 @@ cmain (void)
}
EOF
if { (eval echo configure:1718: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then :
if { (eval echo configure:1720: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then :
else
{ echo "configure: error: ${CC-cc} cannot compile C source code" 1>&2; exit 1; }
fi
grub_cv_prog_objcopy_absolute=yes
for link_addr in 2000 8000 7C00; do
if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec'; { (eval echo configure:1724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec'; { (eval echo configure:1726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
else
{ echo "configure: error: ${CC-cc} cannot link at address $link_addr" 1>&2; exit 1; }
fi
if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo configure:1728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo configure:1730: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
else
{ echo "configure: error: ${OBJCOPY-objcopy} cannot create binary files" 1>&2; exit 1; }
fi
if test ! -f conftest.old || { ac_try='cmp -s conftest.old conftest'; { (eval echo configure:1732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
if test ! -f conftest.old || { ac_try='cmp -s conftest.old conftest'; { (eval echo configure:1734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
mv -f conftest conftest.old
else
grub_cv_prog_objcopy_absolute=no
@ -1745,7 +1747,7 @@ fi
echo $ac_n "checking whether addr32 must be in the same line as the instruction""... $ac_c" 1>&6
echo "configure:1749: checking whether addr32 must be in the same line as the instruction" >&5
echo "configure:1751: checking whether addr32 must be in the same line as the instruction" >&5
if eval "test \"`echo '$''{'grub_cv_asm_prefix_requirement'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1754,7 +1756,7 @@ else
l1: addr32 movb %al, l1
EOF
if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1760: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
grub_cv_asm_prefix_requirement=yes
else
grub_cv_asm_prefix_requirement=no
@ -1786,7 +1788,7 @@ echo "$ac_t""$grub_cv_asm_prefix_requirement" 1>&6
echo $ac_n "checking for .code16 addr32 assembler support""... $ac_c" 1>&6
echo "configure:1790: checking for .code16 addr32 assembler support" >&5
echo "configure:1792: checking for .code16 addr32 assembler support" >&5
if eval "test \"`echo '$''{'grub_cv_asm_addr32'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1801,7 +1803,7 @@ else
sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s
fi
if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1807: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
grub_cv_asm_addr32=yes
else
grub_cv_asm_addr32=no
@ -1818,7 +1820,7 @@ fi
echo $ac_n "checking whether an absolute indirect call/jump must not be prefixed with an asterisk""... $ac_c" 1>&6
echo "configure:1822: checking whether an absolute indirect call/jump must not be prefixed with an asterisk" >&5
echo "configure:1824: checking whether an absolute indirect call/jump must not be prefixed with an asterisk" >&5
if eval "test \"`echo '$''{'grub_cv_asm_absolute_without_asterisk'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1829,7 +1831,7 @@ offset:
.word 0
EOF
if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1835: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
grub_cv_asm_absolute_without_asterisk=no
else
grub_cv_asm_absolute_without_asterisk=yes
@ -1850,19 +1852,19 @@ echo "$ac_t""$grub_cv_asm_absolute_without_asterisk" 1>&6
echo $ac_n "checking if start is defined by the compiler""... $ac_c" 1>&6
echo "configure:1854: checking if start is defined by the compiler" >&5
echo "configure:1856: checking if start is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_start_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1859 "configure"
#line 1861 "configure"
#include "confdefs.h"
int main() {
asm ("incl start")
; return 0; }
EOF
if { (eval echo configure:1866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_start_symbol=yes
else
@ -1886,19 +1888,19 @@ echo "$ac_t""$grub_cv_check_start_symbol" 1>&6
echo $ac_n "checking if _start is defined by the compiler""... $ac_c" 1>&6
echo "configure:1890: checking if _start is defined by the compiler" >&5
echo "configure:1892: checking if _start is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_uscore_start_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1895 "configure"
#line 1897 "configure"
#include "confdefs.h"
int main() {
asm ("incl _start")
; return 0; }
EOF
if { (eval echo configure:1902: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_uscore_start_symbol=yes
else
@ -1927,19 +1929,19 @@ fi
echo $ac_n "checking if __bss_start is defined by the compiler""... $ac_c" 1>&6
echo "configure:1931: checking if __bss_start is defined by the compiler" >&5
echo "configure:1933: checking if __bss_start is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_uscore_uscore_bss_start_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1936 "configure"
#line 1938 "configure"
#include "confdefs.h"
int main() {
asm ("incl __bss_start")
; return 0; }
EOF
if { (eval echo configure:1943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_uscore_uscore_bss_start_symbol=yes
else
@ -1963,19 +1965,19 @@ echo "$ac_t""$grub_cv_check_uscore_uscore_bss_start_symbol" 1>&6
echo $ac_n "checking if _edata is defined by the compiler""... $ac_c" 1>&6
echo "configure:1967: checking if _edata is defined by the compiler" >&5
echo "configure:1969: checking if _edata is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_uscore_edata_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1972 "configure"
#line 1974 "configure"
#include "confdefs.h"
int main() {
asm ("incl _edata")
; return 0; }
EOF
if { (eval echo configure:1979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_uscore_edata_symbol=yes
else
@ -1999,19 +2001,19 @@ echo "$ac_t""$grub_cv_check_uscore_edata_symbol" 1>&6
echo $ac_n "checking if edata is defined by the compiler""... $ac_c" 1>&6
echo "configure:2003: checking if edata is defined by the compiler" >&5
echo "configure:2005: checking if edata is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_edata_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2008 "configure"
#line 2010 "configure"
#include "confdefs.h"
int main() {
asm ("incl edata")
; return 0; }
EOF
if { (eval echo configure:2015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_edata_symbol=yes
else
@ -2041,19 +2043,19 @@ fi
echo $ac_n "checking if end is defined by the compiler""... $ac_c" 1>&6
echo "configure:2045: checking if end is defined by the compiler" >&5
echo "configure:2047: checking if end is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_end_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2050 "configure"
#line 2052 "configure"
#include "confdefs.h"
int main() {
asm ("incl end")
; return 0; }
EOF
if { (eval echo configure:2057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_end_symbol=yes
else
@ -2077,19 +2079,19 @@ echo "$ac_t""$grub_cv_check_end_symbol" 1>&6
echo $ac_n "checking if _end is defined by the compiler""... $ac_c" 1>&6
echo "configure:2081: checking if _end is defined by the compiler" >&5
echo "configure:2083: checking if _end is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_uscore_end_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2086 "configure"
#line 2088 "configure"
#include "confdefs.h"
int main() {
asm ("incl _end")
; return 0; }
EOF
if { (eval echo configure:2093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_uscore_end_symbol=yes
else
@ -2127,7 +2129,7 @@ fi
# Get the filename or the whole disk and open it.
# Known to work on NetBSD.
echo $ac_n "checking for opendisk in -lutil""... $ac_c" 1>&6
echo "configure:2131: checking for opendisk in -lutil" >&5
echo "configure:2133: checking for opendisk in -lutil" >&5
ac_lib_var=`echo util'_'opendisk | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -2135,7 +2137,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lutil $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2139 "configure"
#line 2141 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2146,7 +2148,7 @@ int main() {
opendisk()
; return 0; }
EOF
if { (eval echo configure:2150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2174,7 +2176,7 @@ fi
# Unless the user specify --without-curses, check for curses.
if test "x$with_curses" != "xno"; then
echo $ac_n "checking for wgetch in -lncurses""... $ac_c" 1>&6
echo "configure:2178: checking for wgetch in -lncurses" >&5
echo "configure:2180: checking for wgetch in -lncurses" >&5
ac_lib_var=`echo ncurses'_'wgetch | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -2182,7 +2184,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lncurses $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2186 "configure"
#line 2188 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2193,7 +2195,7 @@ int main() {
wgetch()
; return 0; }
EOF
if { (eval echo configure:2197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2216,7 +2218,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for wgetch in -lcurses""... $ac_c" 1>&6
echo "configure:2220: checking for wgetch in -lcurses" >&5
echo "configure:2222: checking for wgetch in -lcurses" >&5
ac_lib_var=`echo curses'_'wgetch | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -2224,7 +2226,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcurses $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2228 "configure"
#line 2230 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2235,7 +2237,7 @@ int main() {
wgetch()
; return 0; }
EOF
if { (eval echo configure:2239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2270,17 +2272,17 @@ for ac_hdr in string.h strings.h ncurses/curses.h ncurses.h curses.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2274: checking for $ac_hdr" >&5
echo "configure:2276: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2279 "configure"
#line 2281 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2286: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -2795,6 +2797,22 @@ else
DISKLESS_SUPPORT_FALSE=
fi
# Check whether --enable-serial or --disable-serial was given.
if test "${enable_serial+set}" = set; then
enableval="$enable_serial"
:
fi
if test "x$enable_serial" = xyes; then
SERIAL_SUPPORT_TRUE=
SERIAL_SUPPORT_FALSE='#'
else
SERIAL_SUPPORT_TRUE='#'
SERIAL_SUPPORT_FALSE=
fi
# Sanity check.
if test "x$enable_diskless" = xyes; then
if test "x$NET_CFLAGS" = x; then
@ -2987,6 +3005,8 @@ s%@NETBOOT_SUPPORT_TRUE@%$NETBOOT_SUPPORT_TRUE%g
s%@NETBOOT_SUPPORT_FALSE@%$NETBOOT_SUPPORT_FALSE%g
s%@DISKLESS_SUPPORT_TRUE@%$DISKLESS_SUPPORT_TRUE%g
s%@DISKLESS_SUPPORT_FALSE@%$DISKLESS_SUPPORT_FALSE%g
s%@SERIAL_SUPPORT_TRUE@%$SERIAL_SUPPORT_TRUE%g
s%@SERIAL_SUPPORT_FALSE@%$SERIAL_SUPPORT_FALSE%g
s%@FSYS_CFLAGS@%$FSYS_CFLAGS%g
s%@NET_CFLAGS@%$NET_CFLAGS%g
s%@NET_EXTRAFLAGS@%$NET_EXTRAFLAGS%g

View file

@ -479,6 +479,11 @@ AC_ARG_ENABLE(diskless,
[ --enable-diskless enable diskless support])
AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes)
dnl Serial terminal
AC_ARG_ENABLE(serial,
[ --enable-serial enable serial terminal support])
AM_CONDITIONAL(SERIAL_SUPPORT, test "x$enable_serial" = xyes)
# Sanity check.
if test "x$enable_diskless" = xyes; then
if test "x$NET_CFLAGS" = x; then

View file

@ -1,9 +1,9 @@
sbin_PROGRAMS = grub
AM_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \
-DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings \
-I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1 \
-I$(top_srcdir)/lib
-DFSYS_FFS=1 -DFSYS_MINIX=1 -DSUPPORT_SERIAL=1 \
-fwritable-strings -I$(top_srcdir)/stage2 \
-I$(top_srcdir)/stage1 -I$(top_srcdir)/lib
grub_SOURCES = main.c asmstub.c
grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS)

View file

@ -90,9 +90,9 @@ install_sh = @install_sh@
sbin_PROGRAMS = grub
AM_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \
-DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings \
-I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1 \
-I$(top_srcdir)/lib
-DFSYS_FFS=1 -DFSYS_MINIX=1 -DSUPPORT_SERIAL=1 \
-fwritable-strings -I$(top_srcdir)/stage2 \
-I$(top_srcdir)/stage1 -I$(top_srcdir)/lib
grub_SOURCES = main.c asmstub.c

View file

@ -430,7 +430,7 @@ getrtsecs (void)
/* low-level character I/O */
void
cls (void)
console_cls (void)
{
#ifdef HAVE_LIBCURSES
if (use_curses)
@ -441,7 +441,7 @@ cls (void)
/* returns packed values, LSB+1 is x, LSB is y */
int
getxy (void)
console_getxy (void)
{
int y, x;
#ifdef HAVE_LIBCURSES
@ -455,7 +455,7 @@ getxy (void)
void
gotoxy (int x, int y)
console_gotoxy (int x, int y)
{
#ifdef HAVE_LIBCURSES
if (use_curses)

View file

@ -19,7 +19,8 @@ libgrub_a_SOURCES = boot.c builtins.c common.c char_io.c cmdline.c \
fsys_minix.c fsys_reiserfs.c stage2.c
libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
-DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
-DFSYS_MINIX=1 -DFSYS_REISERFS=1 -fwritable-strings
-DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DSUPPORT_SERIAL \
-fwritable-strings
# Stage 2 and Stage 1.5's.
pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
@ -48,13 +49,22 @@ PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
if NETBOOT_SUPPORT
STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
-I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1
NETBOOT_FLAGS = -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1
else
STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc
NETBOOT_FLAGS =
endif
if SERIAL_SUPPORT
SERIAL_FLAGS = -DSUPPORT_SERIAL=1
else
SERIAL_FLAGS =
endif
STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
$(NETBOOT_FLAGS) $(SERIAL_FLAGS)
STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1

View file

@ -109,7 +109,8 @@ libgrub_a_SOURCES = boot.c builtins.c common.c char_io.c cmdline.c \
libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
-DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
-DFSYS_MINIX=1 -DFSYS_REISERFS=1 -fwritable-strings
-DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DSUPPORT_SERIAL \
-fwritable-strings
# Stage 2 and Stage 1.5's.
@ -135,9 +136,14 @@ PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
@NETBOOT_SUPPORT_TRUE@STAGE2_COMPILE = @NETBOOT_SUPPORT_TRUE@$(STAGE2_CFLAGS) -fno-builtin -nostdinc \
@NETBOOT_SUPPORT_TRUE@ -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1
@NETBOOT_SUPPORT_FALSE@STAGE2_COMPILE = @NETBOOT_SUPPORT_FALSE@$(STAGE2_CFLAGS) -fno-builtin -nostdinc
@NETBOOT_SUPPORT_TRUE@NETBOOT_FLAGS = @NETBOOT_SUPPORT_TRUE@-I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1
@NETBOOT_SUPPORT_FALSE@NETBOOT_FLAGS =
@SERIAL_SUPPORT_TRUE@SERIAL_FLAGS = @SERIAL_SUPPORT_TRUE@-DSUPPORT_SERIAL=1
@SERIAL_SUPPORT_FALSE@SERIAL_FLAGS =
STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
$(NETBOOT_FLAGS) $(SERIAL_FLAGS)
STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1

View file

@ -1756,7 +1756,7 @@ ENTRY(multi_boot)
/*
* cls()
* console_cls()
* BIOS call "INT 10H Function 0Fh" to get current video mode
* Call with %ah = 0x0f
* Returns %al = (video mode)
@ -1767,7 +1767,7 @@ ENTRY(multi_boot)
*/
ENTRY(cls)
ENTRY(console_cls)
push %ebp
push %eax
push %ebx /* save EBX */
@ -1821,7 +1821,7 @@ ENTRY(nocursor)
/*
* getxy()
* console_getxy()
* BIOS call "INT 10H Function 03h" to get cursor position
* Call with %ah = 0x03
* %bh = page
@ -1832,7 +1832,7 @@ ENTRY(nocursor)
*/
ENTRY(getxy)
ENTRY(console_getxy)
push %ebp
push %ebx /* save EBX */
push %ecx /* save ECX */
@ -1859,7 +1859,7 @@ ENTRY(getxy)
/*
* gotoxy(x,y)
* console_gotoxy(x,y)
* BIOS call "INT 10H Function 02h" to set cursor position
* Call with %ah = 0x02
* %bh = page
@ -1868,7 +1868,7 @@ ENTRY(getxy)
*/
ENTRY(gotoxy)
ENTRY(console_gotoxy)
push %ebp
push %eax
push %ebx /* save EBX */

View file

@ -3319,6 +3319,12 @@ terminal_func (char *arg, int flags)
{
terminal = TERMINAL_SERIAL;
(void) getkey ();
if (flags & BUILTIN_CMDLINE)
{
/* FIXME: It is better to restart enter_cmdline except
for init_cmdline. */
init_page ();
}
break;
}

View file

@ -815,6 +815,149 @@ grub_putchar (int c)
#endif /* ! STAGE1_5 */
}
#ifndef STAGE1_5
void
gotoxy (int x, int y)
{
if (terminal & TERMINAL_CONSOLE)
console_gotoxy (x, y);
#ifdef SUPPORT_SERIAL
else if (terminal & TERMINAL_SERIAL)
serial_gotoxy (x, y);
#endif
}
#ifdef SUPPORT_SERIAL
/* The serial part of gotoxy. */
void
serial_gotoxy (int x, int y)
{
grub_printf ("\e[%d;%dH", y + 1, x + 1);
}
#endif /* SUPPORT_SERIAL */
int
getxy (void)
{
int ret = 0;
if (terminal & TERMINAL_CONSOLE)
ret = console_getxy ();
#ifdef SUPPORT_SERIAL
else if (terminal & TERMINAL_SERIAL)
ret = serial_getxy ();
#endif
return ret;
}
#ifdef SUPPORT_SERIAL
/* The serial part of getxy. */
int
serial_getxy (void)
{
int x, y;
int start, now;
char buf[32]; /* XXX */
int i;
int c;
char *p;
/* Drain the input buffer. */
while (serial_checkkey () != -1)
serial_getkey ();
/* CPR. */
grub_printf ("\e[6n");
/* Get current time. */
while ((start = getrtsecs ()) == 0xFF)
;
again:
i = 0;
c = 0;
do
{
if (serial_checkkey () != -1)
{
c = serial_getkey ();
if (i == 1 && c != '[')
i = 0;
if (i == 0 && c != '\e')
continue;
if (i != 0 && c == '\e')
i = 0;
buf[i] = c;
i++;
}
else
{
/* Get current time. */
while ((now = getrtsecs ()) == 0xFF)
;
/* FIXME: Remove this magic number. */
if (now - start > 10)
{
/* Something is quite wrong. */
return 0;
}
}
}
while (c != 'R' && i < sizeof (buf));
if (c != 'R')
goto again;
p = buf + 2;
if (! safe_parse_maxint (&p, &y))
{
errnum = 0;
goto again;
}
if (*p != ';')
goto again;
p++;
if (! safe_parse_maxint (&p, &x))
{
errnum = 0;
goto again;
}
if (*p != 'R')
goto again;
return ((x - 1) << 8) | (y - 1);
}
#endif /* SUPPORT_SERIAL */
void
cls (void)
{
if (terminal & TERMINAL_CONSOLE)
console_cls ();
#ifdef SUPPORT_SERIAL
else if (terminal & TERMINAL_SERIAL)
serial_cls ();
#endif
}
#ifdef SUPPORT_SERIAL
/* The serial part of cls. */
void
serial_cls (void)
{
grub_printf ("\e[H\e[J");
}
#endif /* SUPPORT_SERIAL */
#endif /* ! STAGE1_5 */
int
substring (char *s1, char *s2)
{

View file

@ -77,6 +77,15 @@ int serial_getkey (void);
/* The serial part of checkkey. */
int serial_checkkey (void);
/* The serial part of cls. */
void serial_cls (void);
/* The serial part of getxy. */
int serial_getxy (void);
/* The serial part of gotoxy. */
void serial_gotoxy (int x, int y);
/* Return the port number for the UNITth serial device. */
unsigned short serial_get_port (int unit);

View file

@ -639,6 +639,9 @@ int currticks (void);
/* Clear the screen. */
void cls (void);
/* The console part of cls. */
void console_cls (void);
#ifndef GRUB_UTIL
/* Turn off cursor. */
void nocursor (void);
@ -649,9 +652,15 @@ void nocursor (void);
(RET & 0xff) is y. */
int getxy (void);
/* The console part of getxy. */
int console_getxy (void);
/* Set the cursor position. */
void gotoxy (int x, int y);
/* The console part of gotoxy. */
void console_gotoxy (int x, int y);
/* Displays an ASCII character. IBM displays will translate some
characters to special graphical ones (see the DISP_* constants). */
void grub_putchar (int c);

View file

@ -44,13 +44,23 @@ static void
print_entries (int y, int size, int first, char *menu_entries)
{
int i;
int disp_up = DISP_UP;
int disp_down = DISP_DOWN;
#ifdef SUPPORT_SERIAL
if (terminal & TERMINAL_SERIAL)
{
disp_up = ACS_UARROW;
disp_down = ACS_DARROW;
}
#endif /* SUPPORT_SERIAL */
gotoxy (77, y + 1);
if (first)
putchar (DISP_UP);
grub_putchar (disp_up);
else
putchar (' ');
grub_putchar (' ');
menu_entries = get_entry (menu_entries, first, 0);
@ -64,7 +74,7 @@ print_entries (int y, int size, int first, char *menu_entries)
{
if (j < 71)
{
putchar (*menu_entries);
grub_putchar (*menu_entries);
j++;
}
@ -75,15 +85,15 @@ print_entries (int y, int size, int first, char *menu_entries)
menu_entries++;
for (; j < 71; j++)
putchar (' ');
grub_putchar (' ');
}
gotoxy (77, y + size);
if (*menu_entries)
putchar (DISP_DOWN);
grub_putchar (disp_down);
else
putchar (' ');
grub_putchar (' ');
}
@ -91,26 +101,49 @@ static void
print_border (int y, int size)
{
int i;
int disp_ul = DISP_UL;
int disp_ur = DISP_UR;
int disp_ll = DISP_LL;
int disp_lr = DISP_LR;
int disp_horiz = DISP_HORIZ;
int disp_vert = DISP_VERT;
#ifdef SUPPORT_SERIAL
if (terminal & TERMINAL_SERIAL)
{
disp_ul = ACS_ULCORNER;
disp_ur = ACS_URCORNER;
disp_ll = ACS_LLCORNER;
disp_lr = ACS_LRCORNER;
disp_horiz = ACS_HLINE;
disp_vert = ACS_VLINE;
}
#endif /* SUPPORT_SERIAL */
#ifndef GRUB_UTIL
/* Color the menu. The menu is 75 * 14 characters. */
for (i = 0; i < 14; i++)
#ifdef SUPPORT_SERIAL
if (terminal & TERMINAL_CONSOLE)
#endif
{
int j;
for (j = 0; j < 75; j++)
for (i = 0; i < 14; i++)
{
gotoxy (j + 1, i + y);
set_attrib (normal_color);
int j;
for (j = 0; j < 75; j++)
{
gotoxy (j + 1, i + y);
set_attrib (normal_color);
}
}
}
#endif
gotoxy (1, y);
putchar (DISP_UL);
grub_putchar (disp_ul);
for (i = 0; i < 73; i++)
putchar (DISP_HORIZ);
putchar (DISP_UR);
grub_putchar (disp_horiz);
grub_putchar (disp_ur);
i = 1;
@ -121,51 +154,79 @@ print_border (int y, int size)
if (i > size)
break;
putchar (DISP_VERT);
grub_putchar (disp_vert);
gotoxy (75, y + i);
putchar (DISP_VERT);
grub_putchar (disp_vert);
i++;
}
putchar (DISP_LL);
grub_putchar (disp_ll);
for (i = 0; i < 73; i++)
putchar (DISP_HORIZ);
putchar (DISP_LR);
grub_putchar (disp_horiz);
grub_putchar (disp_lr);
}
static void
set_line (int y, int attr)
set_line (int y, int entryno, int attr, char *menu_entries)
{
int x;
for (x = 2; x < 75; x++)
#ifdef SUPPORT_SERIAL
if (terminal & TERMINAL_SERIAL)
{
gotoxy (x, y);
set_attrib (attr);
menu_entries = get_entry (menu_entries, entryno, 0);
gotoxy (2, y);
grub_putchar (' ');
for (x = 3; x < 75; x++)
{
if (*menu_entries && x < 71)
grub_putchar (*menu_entries++);
else
grub_putchar (' ');
}
}
else
#endif /* SUPPORT_SERIAL */
{
for (x = 2; x < 75; x++)
{
gotoxy (x, y);
set_attrib (attr);
}
}
}
/* Set the attribute of the line Y to normal state. */
static void
set_line_normal (int y)
set_line_normal (int y, int entryno, char *menu_entries)
{
#ifdef GRUB_UTIL
set_line (y, A_NORMAL);
set_line (y, entryno, A_NORMAL, menu_entries);
#else
set_line (y, normal_color);
set_line (y, entryno, normal_color, menu_entries);
#endif
}
/* Set the attribute of the line Y to highlight state. */
static void
set_line_highlight (int y)
set_line_highlight (int y, int entryno, char *menu_entries)
{
#ifdef SUPPORT_SERIAL
if (terminal & TERMINAL_SERIAL)
grub_printf ("\e[7m");
#endif /* SUPPORT_SERIAL */
#ifdef GRUB_UTIL
set_line (y, A_REVERSE);
set_line (y, entryno, A_REVERSE, menu_entries);
#else
set_line (y, highlight_color);
set_line (y, entryno, highlight_color, menu_entries);
#endif
#ifdef SUPPORT_SERIAL
if (terminal & TERMINAL_SERIAL)
grub_printf ("\e[0m");
#endif /* SUPPORT_SERIAL */
}
static void
@ -228,8 +289,11 @@ restart:
{
init_page ();
#ifndef GRUB_UTIL
nocursor ();
#endif
# ifdef SUPPORT_SERIAL
if (terminal & TERMINAL_CONSOLE)
# endif /* SUPPORT_SERIAL */
nocursor ();
#endif /* ! GRUB_UTIL */
print_border (3, 12);
@ -265,7 +329,7 @@ restart:
print_entries (3, 12, first_entry, menu_entries);
/* highlight initial line */
set_line_highlight (4 + entryno);
set_line_highlight (4 + entryno, first_entry + entryno, menu_entries);
}
/* XX using RT clock now, need to initialize value */
@ -309,15 +373,17 @@ restart:
{
if (entryno > 0)
{
set_line_normal (4 + entryno);
set_line_normal (4 + entryno, first_entry + entryno,
menu_entries);
entryno--;
set_line_highlight (4 + entryno);
set_line_highlight (4 + entryno, first_entry + entryno,
menu_entries);
}
else if (first_entry > 0)
{
first_entry--;
print_entries (3, 12, first_entry, menu_entries);
set_line_highlight (4);
set_line_highlight (4, first_entry + entryno, menu_entries);
}
}
if (((c == KEY_DOWN) || (ASCII_CHAR (c) == 14))
@ -325,15 +391,17 @@ restart:
{
if (entryno < 11)
{
set_line_normal (4 + entryno);
set_line_normal (4 + entryno, first_entry + entryno,
menu_entries);
entryno++;
set_line_highlight (4 + entryno);
set_line_highlight (4 + entryno, first_entry + entryno,
menu_entries);
}
else if (num_entries > 12 + first_entry)
{
first_entry++;
print_entries (3, 12, first_entry, menu_entries);
set_line_highlight (15);
set_line_highlight (15, first_entry + entryno, menu_entries);
}
}
@ -348,7 +416,8 @@ restart:
{
if ((c == 'd') || (c == 'o') || (c == 'O'))
{
set_line_normal (4 + entryno);
set_line_normal (4 + entryno, first_entry + entryno,
menu_entries);
/* insert after is almost exactly like insert before */
if (c == 'o')
@ -397,7 +466,8 @@ restart:
}
print_entries (3, 12, first_entry, menu_entries);
set_line_highlight (4 + entryno);
set_line_highlight (4 + entryno, first_entry + entryno,
menu_entries);
}
cur_entry = menu_entries;