Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add 'C' option to bootblock to enable serial console.



details:   https://anonhg.NetBSD.org/src/rev/826554e98e10
branches:  trunk
changeset: 342948:826554e98e10
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Fri Jan 15 08:27:04 2016 +0000

description:
Add 'C' option to bootblock to enable serial console.

diffstat:

 share/man/man8/man8.amiga/boot.8                   |  36 ++++++++-----
 sys/arch/amiga/stand/bootblock/boot/Makefile       |   4 +-
 sys/arch/amiga/stand/bootblock/boot/console.c      |  58 ++++++++++++++++++---
 sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile |   4 +-
 4 files changed, 75 insertions(+), 27 deletions(-)

diffs (237 lines):

diff -r e860a8eb6f3d -r 826554e98e10 share/man/man8/man8.amiga/boot.8
--- a/share/man/man8/man8.amiga/boot.8  Fri Jan 15 07:49:41 2016 +0000
+++ b/share/man/man8/man8.amiga/boot.8  Fri Jan 15 08:27:04 2016 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: boot.8,v 1.12 2009/09/05 11:37:52 wiz Exp $
+.\"    $NetBSD: boot.8,v 1.13 2016/01/15 08:27:04 mlelstv Exp $
 .\"
 .\" Copyright (c) 1990, 1991 The Regents of the University of California.
 .\" All rights reserved.
@@ -85,13 +85,11 @@
 The command line looks like:
 .Bd -ragged -offset indent
 .Ar kernel-path
-.Op Fl abknpqstvADZ
+.Op Fl abkpqsvACDS
 .Op Fl c Ar model
 .Op Fl m Ar memsize
 .Op Fl n Ar memsegments
 .Op Fl I Ar mask
-.Op Fl S Ar amount
-.Op Fl T Ar amount
 .Ed
 .Pp
 .Bl -tag -width flag
@@ -129,8 +127,13 @@
 Boot into single-user mode.
 .It Fl v
 Boot in verbose mode.
+.It Fl A
+Enable AGA display modes.
+.It Fl C
+Use the serial port as console.
 .It Fl D
-Enter the kernel debugger (best used with -S)
+Enter the kernel debugger (best used with
+.Fl S ) .
 .It Fl I Ar mask
 inhibit sync negotiation as follows: The
 .Ar mask
@@ -142,7 +145,8 @@
 The bytes are used up
 from right to left by SCSI bus drivers using this convention.
 .It Fl S
-Load the  kernel symbols
+include kernel debug symbols (for use by
+.Fl D ) .
 .El
 .Ss Booting NetBSD using the loadbsd program
 When you want (or have to) start
@@ -153,13 +157,11 @@
 The loadbsd command line specification is:
 .Bd -ragged -offset indent
 .Nm loadbsd
-.Op Fl abknpstADZ
+.Op Fl abkpqstvACDSZ
 .Op Fl c Ar model
 .Op Fl m Ar memsize
 .Op Fl n Ar memsegments
 .Op Fl I Ar mask
-.Op Fl S Ar amount
-.Op Fl T Ar amount
 .Ar kernel-path
 .Ed
 .Pp
@@ -186,17 +188,22 @@
 2 segments, 2: 3 or more segments.
 .It Fl p
 Select kernel load segment by priority instead of size.
+.It Fl q
+Boot in quiet mode.
 .It Fl s
 Boot into single-user mode.
 .It Fl t
 Test loading of the kernel but don't start
 .Nx .
+.It Fl v
+Boot in verbose mode.
 .It Fl A
-enable AGA modes.
+enable AGA display modes.
+.It Fl C
+Use the serial port as console
 .It Fl D
-Enter the kernel debugger after booting.
-Best with
-.Fl S .
+Enter the kernel debugger (best used with
+.Fl S ) .
 .It Fl I Ar mask
 inhibit sync negotiation as follows: The
 .Ar mask
@@ -208,7 +215,8 @@
 The bytes are used up
 from right to left by SCSI bus drivers using this convention.
 .It Fl S
-include kernel debug symbols (for use by -D).
+include kernel debug symbols (for use by
+.Fl D ) .
 .It Fl Z
 Force load via chip memory.
 Won't work if kernel is larger than the chip memory size or on the
diff -r e860a8eb6f3d -r 826554e98e10 sys/arch/amiga/stand/bootblock/boot/Makefile
--- a/sys/arch/amiga/stand/bootblock/boot/Makefile      Fri Jan 15 07:49:41 2016 +0000
+++ b/sys/arch/amiga/stand/bootblock/boot/Makefile      Fri Jan 15 08:27:04 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.52 2014/04/19 00:55:37 tsutsui Exp $
+#      $NetBSD: Makefile,v 1.53 2016/01/15 08:27:04 mlelstv Exp $
 
 .include <bsd.own.mk>
 .include <bsd.sys.mk>          # for HOST_SH
@@ -52,7 +52,7 @@
 #XX#DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER -DDYNAMIC_CRC_TABLE -DNOBYFOUR -UBYFOUR 
 DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER 
 DEFS += -D__INTERNAL_LIBSA_CREAD
-#DEFS += -DSERCONSOLE
+DEFS += -DSERCONSOLE
 SOBJS += cread.o
 
 #XX#SOBJS += adler32.o crc32.o inflate.o trees.o \
diff -r e860a8eb6f3d -r 826554e98e10 sys/arch/amiga/stand/bootblock/boot/console.c
--- a/sys/arch/amiga/stand/bootblock/boot/console.c     Fri Jan 15 07:49:41 2016 +0000
+++ b/sys/arch/amiga/stand/bootblock/boot/console.c     Fri Jan 15 08:27:04 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: console.c,v 1.13 2009/10/17 11:18:18 mlelstv Exp $ */
+/* $NetBSD: console.c,v 1.14 2016/01/15 08:27:04 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -71,6 +71,39 @@
 
 u_int16_t timelimit;
 
+#ifdef SERCONSOLE
+static int use_serconsole;
+extern char default_command[];
+
+static void
+conspreinit(void)
+{
+       char *p = default_command;
+       char c;
+
+       /*
+        * preparse the default command to check for -C option
+        * that selects the serial console
+        */
+       while ((c = *p)) {
+               while (c == ' ')
+                       c = *++p;
+               if (c == '-') {
+                       while ((c = *++p) && c != ' ') {
+                               switch (c) {
+                               case 'C':
+                                       use_serconsole = 1;
+                                       break;
+                               }
+                       }
+               } else {
+                       while ((c = *++p) && c != ' ')
+                               ;
+               }
+       }
+}
+#endif
+
 int
 consinit(void *consptr) {
        struct Console *mc;
@@ -116,7 +149,9 @@
                goto err;
 
 #ifdef SERCONSOLE
-       RawIOInit();
+       conspreinit();
+       if (use_serconsole)
+               RawIOInit();
 #endif
 
        ConsoleBase = mc;
@@ -189,7 +224,8 @@
        mc->cnior->cmd = Cmd_Wr;
 
 #ifdef SERCONSOLE
-       RawPutChar((int32_t)c);
+       if (use_serconsole)
+               RawPutChar((int32_t)c);
 #endif
 
        (void)DoIO(mc->cnior);
@@ -205,8 +241,10 @@
        mc->cnior->cmd = Cmd_Wr;
 
 #ifdef SERCONSOLE
-       while (*s)
-               RawPutChar(*s++);
+       if (use_serconsole) {
+               while (*s)
+                       RawPutChar(*s++);
+       }
 #endif
 
        (void)DoIO(mc->cnior);
@@ -245,10 +283,12 @@
                        ticks = 1;
                } else /* if (ior == mc->tmior) */ {
 #ifdef SERCONSOLE
-                       r = RawMayGetChar();
-                       if (r != -1) {
-                               c = r;
-                               ticks = 1;
+                       if (use_serconsole) {
+                               r = RawMayGetChar();
+                               if (r != -1) {
+                                       c = r;
+                                       ticks = 1;
+                               }
                        }
 #endif
                        if (ticks == 1)
diff -r e860a8eb6f3d -r 826554e98e10 sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile
--- a/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile        Fri Jan 15 07:49:41 2016 +0000
+++ b/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile        Fri Jan 15 08:27:04 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.22 2014/04/29 08:11:46 martin Exp $
+#      $NetBSD: Makefile,v 1.23 2016/01/15 08:27:04 mlelstv Exp $
 
 ### what we need:
 
@@ -33,7 +33,7 @@
 
 OBJS=  $(SOBJS) $(COBJS)
 
-DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER -D_PRIMARY_BOOT
+DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER -D_PRIMARY_BOOT -DSERCONSOLE
 
 .NOPATH: ${OBJS} x.out f.out libboot.a xxstart.o
 



Home | Main Index | Thread Index | Old Index