Ok. I will send you the version using the compiling option
'GRUB_SERIAL_CONSOLE'. This works quite good and is the basic of
further implementations as the serial driver can be used, etc.

In this first test the BAUDRATE is fixed to 9600 and to i/f COM1.

Further I added the command 'reboot' to the builtins.c, as this
is really needed for embedded machines, as they oftem some meters
away in an embedded environment and they have no keyboard for
Ctrl-Alt-Del. I want to program the reboot by writeing a '1' to
port '0x92' which is designed for a reset on PC-compatible machines,
but GRUB only hangs. Also the 'bad hack' writing a '0xfe' to port
'0x64', which also does a reset by side effect, does not work. The
machine only hangs again. So I decided to use the jump to the
bios address 0xffff:0x0000 (0x000ffff0), which finally works.

Open problems on the serial console (except to make it runtime
configurable, etc...)
        * if the line typed in the command interpreter is longer than
        80 character, then the line overwrites the beginning of the
        same line but not continuing in the next line. A solution is
        to scroll the line to the left (as also done by the bash on
        some terminals). This can be implemented in the logical
        structure of the lineediting, as far as I know the code now.

        * I don't use any handshaking. XON/XOFF can be a good idea to
        use. In normal operation situations, there are no problems, but
        sometimes, when I change from menu into the command interpreter
        I can see some cursor set commands, because the 'esc' or '['
        sign was lost. Alteratively hardware handshake can also be
        used, but only as option. Many serial console are connected
        over a 3-wire kable.

But in all other aspects (except using the GRUB in emacs), I like
to use my hack at home and it works for my need in the meantime.

I will send you the 'cvs diff -u', done on the 2000-06-03, the base
I used was from 2000-06-01.

By the way: I added the tag '150' in the netboot/main.c for my private
use, you can ignore this ...

----------------------------------------------------------------------
private:        [EMAIL PROTECTED]
company:        [EMAIL PROTECTED]
? grub/OBJECTS.jumptec-diskless
? grub/.deps
? grub/OBJECTS.jumptec-local
? grub/OBJECTS.clio100-diskless
? grub/OBJECTS.clio10-diskless
Index: grub/configure
===================================================================
RCS file: /cvs/grub/configure,v
retrieving revision 1.68
diff -u -r1.68 configure
--- grub/configure      2000/05/31 02:15:13     1.68
+++ grub/configure      2000/06/03 09:49:01
@@ -111,6 +111,8 @@
   --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 support"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -652,7 +654,7 @@
 # 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:656: checking for a BSD compatible install" >&5
+echo "configure:658: 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
@@ -705,7 +707,7 @@
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:709: checking whether build environment is sane" >&5
+echo "configure:711: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -772,12 +774,12 @@
   echo "configure: warning: ${am_backtick}missing' script is too old or missing" 1>&2
 fi
 
-for ac_prog in mawk gawk nawk awk
+for ac_prog in gawk mawk nawk awk
 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:781: checking for $ac_word" >&5
+echo "configure:783: 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
@@ -807,7 +809,7 @@
 done
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:811: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:813: 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
@@ -933,7 +935,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:937: checking host system type" >&5
+echo "configure:939: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -967,7 +969,7 @@
 #
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... 
$ac_c" 1>&6
-echo "configure:971: checking whether to enable maintainer-specific portions of 
Makefiles" >&5
+echo "configure:973: 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"
@@ -993,7 +995,7 @@
   # 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:997: checking for $ac_word" >&5
+echo "configure:999: 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
@@ -1040,7 +1042,7 @@
 #
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1044: checking build system type" >&5
+echo "configure:1046: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -1066,7 +1068,7 @@
 # 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:1070: checking for $ac_word" >&5
+echo "configure:1072: 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
@@ -1098,7 +1100,7 @@
 # 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:1102: checking for $ac_word" >&5
+echo "configure:1104: 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
@@ -1128,7 +1130,7 @@
   # 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:1132: checking for $ac_word" >&5
+echo "configure:1134: 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
@@ -1179,7 +1181,7 @@
       # 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:1183: checking for $ac_word" >&5
+echo "configure:1185: 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
@@ -1211,7 +1213,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 
1>&6
-echo "configure:1215: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" 
>&5
+echo "configure:1217: 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.
@@ -1222,12 +1224,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1226 "configure"
+#line 1228 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test 
-s conftest${ac_exeext}; then
+if { (eval echo configure:1233: \"$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
@@ -1253,12 +1255,12 @@
   { 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:1257: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a 
cross-compiler" >&5
+echo "configure:1259: 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:1262: checking whether we are using GNU C" >&5
+echo "configure:1264: 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
@@ -1267,7 +1269,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1271: \"$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:1273: \"$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
@@ -1286,7 +1288,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1290: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1292: 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
@@ -1319,7 +1321,7 @@
 
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1323: checking how to run the C preprocessor" >&5
+echo "configure:1325: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1334,13 +1336,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1338 "configure"
+#line 1340 "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:1344: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1346: \"$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
   :
@@ -1351,13 +1353,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1355 "configure"
+#line 1357 "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:1361: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1363: \"$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
   :
@@ -1368,13 +1370,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1372 "configure"
+#line 1374 "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:1378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1380: \"$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
   :
@@ -1407,7 +1409,7 @@
 depcc="$CC"
 depcpp="$CPP"
 echo $ac_n "checking dependency style of $depcc""... $ac_c" 1>&6
-echo "configure:1411: checking dependency style of $depcc" >&5
+echo "configure:1413: 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
@@ -1463,7 +1465,7 @@
   # 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:1467: checking for $ac_word" >&5
+echo "configure:1469: 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
@@ -1500,7 +1502,7 @@
   # 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:1504: checking for $ac_word" >&5
+echo "configure:1506: 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
@@ -1540,7 +1542,7 @@
     STAGE1_CFLAGS="-O2"
     GRUB_CFLAGS="-O2"
     echo $ac_n "checking whether optimization for size works""... $ac_c" 1>&6
-echo "configure:1544: checking whether optimization for size works" >&5
+echo "configure:1546: 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
@@ -1548,14 +1550,14 @@
       saved_CFLAGS=$CFLAGS
       CFLAGS="-Os -g"
       cat > conftest.$ac_ext <<EOF
-#line 1552 "configure"
+#line 1554 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1559: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; 
then
+if { (eval echo configure:1561: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; 
+then
   rm -rf conftest*
   size_flag=yes
 else
@@ -1589,7 +1591,7 @@
   # 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:1593: checking for $ac_word" >&5
+echo "configure:1595: 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
@@ -1625,7 +1627,7 @@
   # 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:1629: checking for $ac_word" >&5
+echo "configure:1631: 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
@@ -1659,7 +1661,7 @@
 # Defined in acinclude.m4.
 
 echo $ac_n "checking if C symbols get an underscore after compilation""... $ac_c" 1>&6
-echo "configure:1663: checking if C symbols get an underscore after compilation" >&5
+echo "configure:1665: 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
@@ -1672,7 +1674,7 @@
 }
 EOF
 
-if { ac_try='${CC-cc} ${CFLAGS} -S conftest.c'; { (eval echo configure:1676: 
\"$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:1678: 
+\"$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; }
@@ -1698,7 +1700,7 @@
 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:1702: checking whether ${OBJCOPY} works for absolute addresses" >&5
+echo "configure:1704: 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
@@ -1710,21 +1712,21 @@
 }
 EOF
 
-if { (eval echo configure:1714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && 
test -s conftest.o; then :
+if { (eval echo configure:1716: \"$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:1720: \"$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:1722: \"$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:1724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
+  if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo 
+configure:1726: \"$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:1728: \"$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:1730: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
     mv -f conftest conftest.old
   else
     grub_cv_prog_objcopy_absolute=no
@@ -1741,7 +1743,7 @@
 
 
 echo $ac_n "checking whether addr32 must be in the same line as the instruction""... 
$ac_c" 1>&6
-echo "configure:1745: checking whether addr32 must be in the same line as the 
instruction" >&5
+echo "configure:1747: 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
@@ -1750,7 +1752,7 @@
 l1:    addr32  movb    %al, l1
 EOF
 
-if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1754: 
\"$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:1756: 
+\"$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
@@ -1782,7 +1784,7 @@
 
 
 echo $ac_n "checking for .code16 addr32 assembler support""... $ac_c" 1>&6
-echo "configure:1786: checking for .code16 addr32 assembler support" >&5
+echo "configure:1788: 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
@@ -1797,7 +1799,7 @@
   sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s
 fi
 
-if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1801: 
\"$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:1803: 
+\"$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
@@ -1814,7 +1816,7 @@
 
 
 echo $ac_n "checking whether an absolute indirect call/jump must not be prefixed with 
an asterisk""... $ac_c" 1>&6
-echo "configure:1818: checking whether an absolute indirect call/jump must not be 
prefixed with an asterisk" >&5
+echo "configure:1820: 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
@@ -1825,7 +1827,7 @@
        .word   0
 EOF
 
-if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1829: 
\"$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:1831: 
+\"$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
@@ -1846,19 +1848,19 @@
 
 
 echo $ac_n "checking if start is defined by the compiler""... $ac_c" 1>&6
-echo "configure:1850: checking if start is defined by the compiler" >&5
+echo "configure:1852: 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 1855 "configure"
+#line 1857 "configure"
 #include "confdefs.h"
 
 int main() {
 asm ("incl start")
 ; return 0; }
 EOF
-if { (eval echo configure:1862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test 
-s conftest${ac_exeext}; then
+if { (eval echo configure:1864: \"$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
@@ -1882,19 +1884,19 @@
 
 
 echo $ac_n "checking if _start is defined by the compiler""... $ac_c" 1>&6
-echo "configure:1886: checking if _start is defined by the compiler" >&5
+echo "configure:1888: 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 1891 "configure"
+#line 1893 "configure"
 #include "confdefs.h"
 
 int main() {
 asm ("incl _start")
 ; return 0; }
 EOF
-if { (eval echo configure:1898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test 
-s conftest${ac_exeext}; then
+if { (eval echo configure:1900: \"$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
@@ -1923,19 +1925,19 @@
 
 
 echo $ac_n "checking if __bss_start is defined by the compiler""... $ac_c" 1>&6
-echo "configure:1927: checking if __bss_start is defined by the compiler" >&5
+echo "configure:1929: 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 1932 "configure"
+#line 1934 "configure"
 #include "confdefs.h"
 
 int main() {
 asm ("incl __bss_start")
 ; return 0; }
 EOF
-if { (eval echo configure:1939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test 
-s conftest${ac_exeext}; then
+if { (eval echo configure:1941: \"$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
@@ -1959,19 +1961,19 @@
 
 
 echo $ac_n "checking if _edata is defined by the compiler""... $ac_c" 1>&6
-echo "configure:1963: checking if _edata is defined by the compiler" >&5
+echo "configure:1965: 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 1968 "configure"
+#line 1970 "configure"
 #include "confdefs.h"
 
 int main() {
 asm ("incl _edata")
 ; return 0; }
 EOF
-if { (eval echo configure:1975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test 
-s conftest${ac_exeext}; then
+if { (eval echo configure:1977: \"$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
@@ -1995,19 +1997,19 @@
 
 
 echo $ac_n "checking if edata is defined by the compiler""... $ac_c" 1>&6
-echo "configure:1999: checking if edata is defined by the compiler" >&5
+echo "configure:2001: 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 2004 "configure"
+#line 2006 "configure"
 #include "confdefs.h"
 
 int main() {
 asm ("incl edata")
 ; return 0; }
 EOF
-if { (eval echo configure:2011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test 
-s conftest${ac_exeext}; then
+if { (eval echo configure:2013: \"$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
@@ -2037,19 +2039,19 @@
 
 
 echo $ac_n "checking if end is defined by the compiler""... $ac_c" 1>&6
-echo "configure:2041: checking if end is defined by the compiler" >&5
+echo "configure:2043: 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 2046 "configure"
+#line 2048 "configure"
 #include "confdefs.h"
 
 int main() {
 asm ("incl end")
 ; return 0; }
 EOF
-if { (eval echo configure:2053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test 
-s conftest${ac_exeext}; then
+if { (eval echo configure:2055: \"$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
@@ -2073,19 +2075,19 @@
 
 
 echo $ac_n "checking if _end is defined by the compiler""... $ac_c" 1>&6
-echo "configure:2077: checking if _end is defined by the compiler" >&5
+echo "configure:2079: 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 2082 "configure"
+#line 2084 "configure"
 #include "confdefs.h"
 
 int main() {
 asm ("incl _end")
 ; return 0; }
 EOF
-if { (eval echo configure:2089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test 
-s conftest${ac_exeext}; then
+if { (eval echo configure:2091: \"$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
@@ -2123,7 +2125,7 @@
 # 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:2127: checking for opendisk in -lutil" >&5
+echo "configure:2129: 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
@@ -2131,7 +2133,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lutil  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2135 "configure"
+#line 2137 "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
@@ -2142,7 +2144,7 @@
 opendisk()
 ; return 0; }
 EOF
-if { (eval echo configure:2146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test 
-s conftest${ac_exeext}; then
+if { (eval echo configure:2148: \"$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
@@ -2170,7 +2172,7 @@
 # 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:2174: checking for wgetch in -lncurses" >&5
+echo "configure:2176: 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
@@ -2178,7 +2180,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2182 "configure"
+#line 2184 "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
@@ -2189,7 +2191,7 @@
 wgetch()
 ; return 0; }
 EOF
-if { (eval echo configure:2193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test 
-s conftest${ac_exeext}; then
+if { (eval echo configure:2195: \"$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
@@ -2212,7 +2214,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for wgetch in -lcurses""... $ac_c" 1>&6
-echo "configure:2216: checking for wgetch in -lcurses" >&5
+echo "configure:2218: 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
@@ -2220,7 +2222,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2224 "configure"
+#line 2226 "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
@@ -2231,7 +2233,7 @@
 wgetch()
 ; return 0; }
 EOF
-if { (eval echo configure:2235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test 
-s conftest${ac_exeext}; then
+if { (eval echo configure:2237: \"$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
@@ -2266,17 +2268,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2270: checking for $ac_hdr" >&5
+echo "configure:2272: 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 2275 "configure"
+#line 2277 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2280: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2282: \"$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*
@@ -2788,6 +2790,22 @@
   fi
 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
+
 
 
 
@@ -2973,6 +2991,8 @@
 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
Index: grub/configure.in
===================================================================
RCS file: /cvs/grub/configure.in,v
retrieving revision 1.43
diff -u -r1.43 configure.in
--- grub/configure.in   2000/05/31 02:15:13     1.43
+++ grub/configure.in   2000/06/03 09:49:02
@@ -478,6 +478,11 @@
   fi
 fi
 
+dnl Serial Console
+AC_ARG_ENABLE(serial,
+  [  --enable-serial       enable serial support])
+AM_CONDITIONAL(SERIAL_SUPPORT, test "x$enable_serial" = xyes)
+
 dnl Now substitute the variables.
 AC_SUBST(FSYS_CFLAGS)
 AC_SUBST(NET_CFLAGS)
Index: grub/netboot/main.c
===================================================================
RCS file: /cvs/grub/netboot/main.c,v
retrieving revision 1.8
diff -u -r1.8 main.c
--- grub/netboot/main.c 2000/05/29 08:59:38     1.8
+++ grub/netboot/main.c 2000/06/03 09:49:07
@@ -922,6 +922,18 @@
              p++;
              continue;
            }
+         else if (c == 150)  /* special code */
+           {
+             extern char config_file[];
+             int l;
+               
+              p++;
+             l = (int)(*(char *)p);
+             p++;
+             grub_memmove((void *)config_file,p,l);
+             p += l;
+             continue;
+           }
          else if (c == RFC1533_END)
            {
              end_of_rfc1533 = endp = p;
Index: grub/stage2/Makefile.am
===================================================================
RCS file: /cvs/grub/stage2/Makefile.am,v
retrieving revision 1.24
diff -u -r1.24 Makefile.am
--- grub/stage2/Makefile.am     2000/05/27 07:40:52     1.24
+++ grub/stage2/Makefile.am     2000/06/03 09:49:09
@@ -46,11 +46,18 @@
 PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
 START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
 PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
+
+if SERIAL_SUPPORT
+SERIAL_SUPP = -DGRUB_SERIAL_CONSOLE
+else
+SERIAL_SUPP =
+endif
+
 if NETBOOT_SUPPORT
 STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
-       -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1
+       -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1 $(SERIAL_SUPP)
 else
-STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc
+STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc $(SERIAL_SUPP)
 endif
 
 STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
Index: grub/stage2/Makefile.in
===================================================================
RCS file: /cvs/grub/stage2/Makefile.in,v
retrieving revision 1.39
diff -u -r1.39 Makefile.in
--- grub/stage2/Makefile.in     2000/05/31 02:15:13     1.39
+++ grub/stage2/Makefile.in     2000/06/03 09:49:11
@@ -133,9 +133,11 @@
 PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
 START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
 PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
+@SERIAL_SUPPORT_TRUE@SERIAL_SUPP = @SERIAL_SUPPORT_TRUE@-DGRUB_SERIAL_CONSOLE
+@SERIAL_SUPPORT_FALSE@SERIAL_SUPP = 
 @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@ -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1 $(SERIAL_SUPP)
+@NETBOOT_SUPPORT_FALSE@STAGE2_COMPILE = @NETBOOT_SUPPORT_FALSE@$(STAGE2_CFLAGS) 
+-fno-builtin -nostdinc $(SERIAL_SUPP)
 
 STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
 STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1
@@ -1346,57 +1348,54 @@
 check-TESTS: $(TESTS)
        @failed=0; all=0; xfail=0; xpass=0; \
        srcdir=$(srcdir); export srcdir; \
-       list='$(TESTS)'; \
-       if test -n "$$list"; then \
-         for tst in $$list; do \
-           if test -f ./$$tst; then dir=./; \
-           elif test -f $$tst; then dir=; \
-           else dir="$(srcdir)/"; fi; \
-           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
-             all=`expr $$all + 1`; \
-             case " $(XFAIL_TESTS) " in \
-             *" $$tst "*) \
-               xpass=`expr $$xpass + 1`; \
-               failed=`expr $$failed + 1`; \
-               echo "XPASS: $$tst"; \
-             ;; \
-             *) \
-               echo "PASS: $$tst"; \
-             ;; \
-             esac; \
-           elif test $$? -ne 77; then \
-             all=`expr $$all + 1`; \
-             case " $(XFAIL_TESTS) " in \
-             *" $$tst "*) \
-               xfail=`expr $$xfail + 1`; \
-               echo "XFAIL: $$tst"; \
-             ;; \
-             *) \
-               failed=`expr $$failed + 1`; \
-               echo "FAIL: $$tst"; \
-             ;; \
-             esac; \
-           fi; \
-         done; \
-         if test "$$failed" -eq 0; then \
-           if test "$$xfail" -eq 0; then \
-             banner="All $$all tests passed"; \
-           else \
-             banner="All $$all tests behaved as expected ($$xfail expected 
failures)"; \
-           fi; \
+       for tst in $(TESTS); do \
+         if test -f ./$$tst; then dir=./; \
+         elif test -f $$tst; then dir=; \
+         else dir="$(srcdir)/"; fi; \
+         if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+           all=`expr $$all + 1`; \
+           case " $(XFAIL_TESTS) " in \
+           *" $$tst "*) \
+             xpass=`expr $$xpass + 1`; \
+             failed=`expr $$failed + 1`; \
+             echo "XPASS: $$tst"; \
+           ;; \
+           *) \
+             echo "PASS: $$tst"; \
+           ;; \
+           esac; \
+         elif test $$? -ne 77; then \
+           all=`expr $$all + 1`; \
+           case " $(XFAIL_TESTS) " in \
+           *" $$tst "*) \
+             xfail=`expr $$xfail + 1`; \
+             echo "XFAIL: $$tst"; \
+           ;; \
+           *) \
+             failed=`expr $$failed + 1`; \
+             echo "FAIL: $$tst"; \
+           ;; \
+           esac; \
+         fi; \
+       done; \
+       if test "$$failed" -eq 0; then \
+         if test "$$xfail" -eq 0; then \
+           banner="All $$all tests passed"; \
+         else \
+           banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+         fi; \
+       else \
+         if test "$$xpass" -eq 0; then \
+           banner="$$failed of $$all tests failed"; \
          else \
-           if test "$$xpass" -eq 0; then \
-             banner="$$failed of $$all tests failed"; \
-           else \
-             banner="$$failed of $$all tests did not behave as expected ($$xpass 
unexpected passes)"; \
-           fi; \
+           banner="$$failed of $$all tests did not behave as expected ($$xpass 
+unexpected passes)"; \
          fi; \
-         dashes=`echo "$$banner" | sed s/./=/g`; \
-         echo "$$dashes"; \
-         echo "$$banner"; \
-         echo "$$dashes"; \
-         test "$$failed" -eq 0; \
-       fi
+       fi; \
+       dashes=`echo "$$banner" | sed s/./=/g`; \
+       echo "$$dashes"; \
+       echo "$$banner"; \
+       echo "$$dashes"; \
+       test "$$failed" -eq 0
 
 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
 
Index: grub/stage2/asm.S
===================================================================
RCS file: /cvs/grub/stage2/asm.S,v
retrieving revision 1.31
diff -u -r1.31 asm.S
--- grub/stage2/asm.S   2000/05/31 02:15:13     1.31
+++ grub/stage2/asm.S   2000/06/03 09:49:14
@@ -1321,7 +1321,8 @@
        incl    %eax
 0:     jmp     *20(%ecx)               /* done, return.... */
 
-       
+
+#ifndef GRUB_SERIAL_CONSOLE            
 /*
  * putchar(c)   : Puts character on the screen, interpreting '\n' as in the
  *                UNIX fashion.
@@ -1366,7 +1367,8 @@
        pop     %eax
        pop     %ebp
        ret
-
+#endif
+       
 #ifndef STAGE1_5
 /* get_code_end() :  return the address of the end of the code
  * This is here so that it can be replaced by asmstub.c.
@@ -1702,6 +1704,8 @@
  */
 
 
+#ifndef GRUB_SERIAL_CONSOLE
+               
 ENTRY(cls)
        push    %ebp
        push    %eax
@@ -1892,7 +1896,8 @@
        pop     %ebp
        ret
 
-
+#endif
+       
 /*
  * getrtsecs()
  *     if a seconds value can be read, read it and return it (BCD),
@@ -1998,7 +2003,7 @@
 ENTRY(ascii_key_map)
        .space  (KEY_MAP_SIZE + 1) * 2
        
-
+#ifndef GRUB_SERIAL_CONSOLE
 /*
  * getkey()
  * BIOS call "INT 16H Function 00H" to read character from keyboard
@@ -2073,6 +2078,8 @@
        pop     %ebp
        ret
 
+#endif /* GRUB_SERIAL_CONSOLE */
+       
 #endif /* STAGE1_5 */
 
 /*
Index: grub/stage2/builtins.c
===================================================================
RCS file: /cvs/grub/stage2/builtins.c,v
retrieving revision 1.61
diff -u -r1.61 builtins.c
--- grub/stage2/builtins.c      2000/06/01 06:26:52     1.61
+++ grub/stage2/builtins.c      2000/06/03 09:49:20
@@ -2273,6 +2273,26 @@
 };
 
 
+/* rebooting the system */
+static int
+reboot_func (char *arg, int flags)
+{
+  __asm__ __volatile__ ("ljmp $0xffff, $0x0000" : : );
+
+  /* never reach this point */
+  return 0;
+}
+
+static struct builtin builtin_reboot =
+{
+  "reboot",
+  reboot_func,
+  BUILTIN_CMDLINE,
+  "reboot machine",
+  "Reboots the target machine immidiately"
+};
+
+
 /* Print the root device information.  */
 static void
 print_root_device (void)
@@ -3101,6 +3121,7 @@
   &builtin_quit,
   &builtin_rarp,
   &builtin_read,
+  &builtin_reboot,
   &builtin_root,
   &builtin_rootnoverify,
   &builtin_setkey,
Index: grub/stage2/char_io.c
===================================================================
RCS file: /cvs/grub/stage2/char_io.c,v
retrieving revision 1.25
diff -u -r1.25 char_io.c
--- grub/stage2/char_io.c       2000/05/30 15:58:09     1.25
+++ grub/stage2/char_io.c       2000/06/03 09:49:22
@@ -21,7 +21,228 @@
 
 #include "shared.h"
 
+#ifdef GRUB_SERIAL_CONSOLE
+
+#define COMPARAMS  0x03  /* 8,n,1     */
+#define BAUDDIV    12    /* 9600 baud */
+#define COMPORT    0x3f8 /* ttyS0     */
+
+static unsigned serport = 0;
+
+int serial_init (unsigned short);
+inline void outb (unsigned char, unsigned short);
+inline unsigned char inb (unsigned short);
+void serial_putc (int);
+
+
+/* inb () and outb () are derived from `linux/include/asm/io.h' */
+
+inline void
+outb (unsigned char b, unsigned short p)
+{
+  __asm__ __volatile__ ("outb %b0,%w1" : : "a" (b), "Nd" (p));
+}
+
+inline unsigned char
+inb (unsigned short p)
+{
+  unsigned char b;
+  
+  __asm__ __volatile__ ("inb %w1,%0" : "=a" (b) : "Nd" (p));
+  return b;
+}
+
+/* serial i/o functions */
+
+void 
+serial_putc (int c)
+{
+  int timeout;
+  
+  if (serport == 0)
+    serial_init (COMPORT);
+  
+  /* timout value is derived from the etherboot's serial.S  */
+  timeout = 10000;
+
+  /* wait for an empty TX buffer */
+  while ((timeout > 0) && ((inb (serport + 5) & 0x20) == 0))
+    timeout--;
+
+  outb ((unsigned char) c, serport);
+}
+
+int 
+getkey (void)
+{
+  unsigned char c;
+  
+  while ((inb (serport + 5) & 0x01) == 0)
+    ;
+  
+  c = inb (serport);
+
+  return (int)c;
+}
+
+/* this routine returns the code, as GRUB expects:
+   -1 for 'no character availabe'
+   other for character available
+*/
+
+int 
+checkkey (void)
+{
+  if (inb (serport + 5) & 0x01)
+    return 1;
+  
+  return -1;
+}
+
+int
+serial_init (unsigned short port)
+{
+  unsigned short bdiv = 0;
+  unsigned char b;
+  
+  if (port == 0)
+    return -1;
+  
+  bdiv = BAUDDIV;
+  
+  /* enable DLAB */
+  outb (0x80, port + 3);
+  
+  /* write low & high byte of bdiv, abd readback to check,
+     if device is present */
+
+  b = (unsigned char)(bdiv & 0xffu);
+  outb (b, port);
+  if (inb (port) != b)
+    return -1;
+  
+  b = (unsigned char)(bdiv >> 8);
+  outb (b, port + 1);
+  if (inb (port + 1) != b)
+    return -1;
+  
+  /* ok, device is found and baudreae set */
+  serport = port;
+
+  /* disable fifo */
+  outb (0x00, port + 2);
+  
+  /* set line control reg to data bits, parity and stop bits */
+  outb (COMPARAMS, port + 3);
+  
+  /* set modem controls, enable DTR, RTS */
+  outb (0x03, port + 4);
+  
+  /* flush the input buffer */
+  while (inb (port + 5) & 0x01)
+    b = inb (port);    /* dummy read */
+  
+  return 0;
+}
+
+void
+putchar (int c)
+{
+  /* do a vt100 like onlcr, instert a cr before new line */
+  if (c == 0x0a)
+    serial_putc (0x0d);
+
+  serial_putc (c);
+}
+
+void
+cls (void)
+{
+  /* cls on terminal is esc[2J */
+  
+  serial_putc (0x1b);
+  serial_putc ('[');
+  serial_putc ('H');
+  serial_putc (0x1b);
+  serial_putc ('[');
+  serial_putc ('J');
+}
+
 void
+gotoxy (int x, int y)
+{
+  y++;
+  x++;
+  
+  /* set positions is done with esc[<y>;<x>H */
+  serial_putc (0x1b);
+  serial_putc ('[');
+  if (y >= 10)
+    {
+      serial_putc ((y / 10) + 0x30);
+    }
+  serial_putc ((y % 10) + 0x30);
+  serial_putc (';');
+  if (x >= 10)
+    {
+      serial_putc ((x / 10) + 0x30);
+    }
+  serial_putc ((x % 10) + 0x30);
+  serial_putc ('H');
+}
+
+int
+getxy (void)
+{
+  char buf[10];
+  char c;
+  int i;
+  int x, y;
+  
+  serial_putc (0x1b);
+  serial_putc ('[');
+  serial_putc ('6');
+  serial_putc ('n');
+
+  i = 0;
+  c = 0;
+  
+  while ((i < 9) && (c != 'R'))
+    {
+      c = ASCII_CHAR (getkey ()); 
+      buf [i] = c;
+      i++;
+    }
+
+  y = buf [2] - 0x30;
+  i = 3;
+  if (buf [i] != ';')
+    {
+      y = (y * 10) + buf [i] - 0x30;
+      i++;
+    }
+  i++;
+  x = buf [i] - 0x30;
+  i++;
+  if (buf [i] != 'R')
+    {
+      x = (x * 10) + buf [i] - 0x30;
+      i++;
+    }
+  y--;
+  x--;
+  
+  return ((x << 8) + y);
+}  
+
+void
+nocursor (void)
+{
+}
+
+#endif  /* GRUB_SERIAL_CONSOLE */
+
+void
 print_error (void)
 {
   if (errnum > ERR_NONE && errnum < MAX_ERR_NUM)
@@ -358,6 +579,88 @@
        case KEY_BACKSPACE:
          c = 8;
          break;
+#ifdef GRUB_SERIAL_CONSOLE
+       case 0x1b:
+         c = getkey ();
+         if (ASCII_CHAR (c) == '[')
+           {
+             char c1;
+             int cdummy;
+
+             c = 0;                  /* to filter illegal states     */
+             c1 = (char) ASCII_CHAR ( getkey () );
+             switch (c1) {
+             case 'A':
+               c = 16;
+               break;
+             case 'B':
+               c = 14;
+               break;
+             case 'C':
+               c = 6;
+               break;
+             case 'D':
+               c = 2;
+               break;
+             case 'F':                 /* End */
+               c = 5;
+               break;
+             case 'H':                 /* Pos1 */
+               c = 1;
+               break;
+             case '1':
+               cdummy = getkey ();
+               if (cdummy == '~')      /* one of control keys (pos1,....) */
+                 {
+                   c = 1;
+                 }
+               else                    /* function key, not used here     */
+                 {
+                   c = 0;
+                   cdummy = getkey ();
+                 }
+               break;
+             case '2':
+               c = 0;                  /* insert key or function key      */
+               cdummy = getkey ();
+               if (cdummy != '~')      /* one of control keys (pos1,....) */
+                 {
+                   c = 0;
+                   cdummy = getkey ();
+                 }
+               break;
+             case '3':
+               cdummy = getkey ();
+               if (cdummy == '~')      /* one of control keys (del,....) */
+                 {
+                   c = 4;
+                 }
+               else                    /* function key, not used here     */
+                 {
+                   c = 0;
+                   cdummy = getkey ();
+                 }
+               break;
+             case '4':
+               cdummy = getkey ();
+               c = 4;
+               break;
+             case '5':                 /* PgUp */
+               cdummy = getkey ();
+               c = 0;
+               break;
+             case '6':                 /* PgDn */
+               cdummy = getkey ();
+               c = 0;
+               break;
+             case '[':
+               c = 0;
+               cdummy = getkey ();
+               break;
+             }
+           }
+         break;
+#endif
        }
 
       c = ASCII_CHAR (c);
Index: grub/stage2/shared.h
===================================================================
RCS file: /cvs/grub/stage2/shared.h,v
retrieving revision 1.47
diff -u -r1.47 shared.h
--- grub/stage2/shared.h        2000/05/30 15:58:09     1.47
+++ grub/stage2/shared.h        2000/06/03 09:49:24
@@ -315,7 +315,7 @@
 #endif /* ! ACS_ULCORNER */
 
 /* Special graphics characters for IBM displays. */
-#ifdef GRUB_UTIL
+#if defined (GRUB_UTIL) || defined (GRUB_SERIAL_CONSOLE)
 # define DISP_UL       ACS_ULCORNER
 # define DISP_UR       ACS_URCORNER
 # define DISP_LL       ACS_LLCORNER
Index: grub/stage2/stage2.c
===================================================================
RCS file: /cvs/grub/stage2/stage2.c,v
retrieving revision 1.14
diff -u -r1.14 stage2.c
--- grub/stage2/stage2.c        2000/04/22 23:29:23     1.14
+++ grub/stage2/stage2.c        2000/06/03 09:49:26
@@ -92,6 +92,7 @@
 {
   int i;
 
+#ifndef GRUB_SERIAL_CONSOLE
 #ifndef GRUB_UTIL
   /* Color the menu. The menu is 75 * 14 characters.  */
   for (i = 0; i < 14; i++)
@@ -104,7 +105,7 @@
        }
     }
 #endif
-
+#endif
   gotoxy (1, y);
 
   putchar (DISP_UL);
@@ -139,11 +140,34 @@
 {
   int x;
 
+#ifdef GRUB_SERIAL_CONSOLE
+  gotoxy (2, y);
+#ifdef GRUB_UTIL
+  if (attr == A_REVERSE)
+#else
+  if (attr == highlight_color)
+#endif
+      putchar ('>');
+  else
+      putchar (' ');
+  gotoxy (74, y);
+#ifdef GRUB_UTIL
+  if (attr == A_REVERSE)
+#else
+  if (attr == highlight_color)
+#endif
+      putchar ('<');
+  else
+      putchar (' ');
+  gotoxy (1, 22);
+
+#else /* GRUB_SERIAL_CONSOLE */  
   for (x = 2; x < 75; x++)
     {
       gotoxy (x, y);
       set_attrib (attr);
     }
+#endif
 }
 
 /* Set the attribute of the line Y to normal state.  */
@@ -252,7 +276,88 @@
       if (checkkey () != -1)
        {
          c = getkey ();
-
+#ifdef GRUB_SERIAL_CONSOLE
+         if (ASCII_CHAR (c) == 0x1b)
+           {
+             c = getkey ();
+             if (ASCII_CHAR (c) == '[')
+               {
+                 char c1;
+                 int cdummy;
+                 
+                 c1 = (char) ASCII_CHAR ( getkey () );
+                 switch (c1) {
+                 case 'A':
+                   c = 16;
+                   break;
+                 case 'B':
+                   c = 14;
+                   break;
+                 case 'C':
+                   c = 6;
+                   break;
+                 case 'D':
+                   c = 2;
+                   break;
+                 case 'F':                 /* End */
+                   c = 5;
+                   break;
+                 case 'H':                 /* Pos1 */
+                   c = 1;
+                   break;
+                 case '1':
+                   cdummy = getkey ();
+                   if (cdummy == '~')      /* HOME/Pos1 keys      */
+                     {
+                       c = 1;
+                     }
+                   else                    /* function key        */
+                     {
+                       c = 0;
+                       cdummy = getkey ();
+                     }
+                   break;
+                 case '2':
+                   c = 0;                  /* insert key          */
+                   cdummy = getkey ();
+                   if (cdummy != '~')
+                     {
+                       c = 0;
+                       cdummy = getkey ();
+                     }
+                   break;
+                 case '3':
+                   cdummy = getkey ();
+                   if (cdummy == '~')      /* DEL key        */
+                     {
+                       c = 4;
+                     }
+                   else                    /* function key   */
+                     {
+                       c = 0;
+                       cdummy = getkey ();
+                     }
+                   break;
+                 case '4':
+                   cdummy = getkey ();
+                   c = 4;
+                   break;
+                 case '5':                 /* PgUp */
+                   cdummy = getkey ();
+                   c = 0;
+                   break;
+                 case '6':                 /* PgDn */
+                   cdummy = getkey ();
+                   c = 0;
+                   break;
+                 case '[':
+                   c = 0;
+                   cdummy = getkey ();
+                   break;
+                 }
+               }
+           } 
+#endif
          if (grub_timeout >= 0)
            {
              gotoxy (3, 22);

Reply via email to