Skip to content

Commit

Permalink
Add 'C' option to bootblock to enable serial console.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlelstv committed Jan 15, 2016
1 parent f6ac5d2 commit 227e24a
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 27 deletions.
36 changes: 22 additions & 14 deletions share/man/man8/man8.amiga/boot.8
@@ -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.
Expand Down Expand Up @@ -85,13 +85,11 @@ typing in an alternate command sequence.
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
Expand Down Expand Up @@ -129,8 +127,13 @@ Boot in quiet mode.
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
Expand All @@ -142,7 +145,8 @@ real SCSI busses, but not, e.g., to internal IDE.
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
Expand All @@ -153,13 +157,11 @@ program that is supplied in the utils directory of the distribution.
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
Expand All @@ -186,17 +188,22 @@ of memory to use, encoded as follows: 0 (default): 1 segment, 1:
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
Expand All @@ -208,7 +215,8 @@ real SCSI busses, but not, e.g., to internal IDE.
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
Expand Down
4 changes: 2 additions & 2 deletions sys/arch/amiga/stand/bootblock/boot/Makefile
@@ -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
Expand Down Expand Up @@ -52,7 +52,7 @@ OBJS= $(SOBJS) $(COBJS)
#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 \
Expand Down
58 changes: 49 additions & 9 deletions sys/arch/amiga/stand/bootblock/boot/console.c
@@ -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.
Expand Down Expand Up @@ -71,6 +71,39 @@ static struct Console myConsole;

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;
Expand Down Expand Up @@ -116,7 +149,9 @@ consinit(void *consptr) {
goto err;

#ifdef SERCONSOLE
RawIOInit();
conspreinit();
if (use_serconsole)
RawIOInit();
#endif

ConsoleBase = mc;
Expand Down Expand Up @@ -189,7 +224,8 @@ putchar(int c)
mc->cnior->cmd = Cmd_Wr;

#ifdef SERCONSOLE
RawPutChar((int32_t)c);
if (use_serconsole)
RawPutChar((int32_t)c);
#endif

(void)DoIO(mc->cnior);
Expand All @@ -205,8 +241,10 @@ puts(char *s)
mc->cnior->cmd = Cmd_Wr;

#ifdef SERCONSOLE
while (*s)
RawPutChar(*s++);
if (use_serconsole) {
while (*s)
RawPutChar(*s++);
}
#endif

(void)DoIO(mc->cnior);
Expand Down Expand Up @@ -245,10 +283,12 @@ getchar(void)
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)
Expand Down
4 changes: 2 additions & 2 deletions sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile
@@ -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:

Expand Down Expand Up @@ -33,7 +33,7 @@ SOBJS += libstubs.o memcmp.o memmove.o memset.o strncmp.o

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

Expand Down

0 comments on commit 227e24a

Please sign in to comment.