Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/bebox/stand/boot Use loadfile.



details:   https://anonhg.NetBSD.org/src/rev/bb4f79f55711
branches:  trunk
changeset: 474092:bb4f79f55711
user:      sakamoto <sakamoto%NetBSD.org@localhost>
date:      Mon Jun 28 01:20:43 1999 +0000

description:
Use loadfile.
KNF
b* -> mem*

diffstat:

 sys/arch/bebox/stand/boot/Makefile     |   40 +-
 sys/arch/bebox/stand/boot/boot.c       |  270 +++-------
 sys/arch/bebox/stand/boot/boot.h       |   73 ++-
 sys/arch/bebox/stand/boot/clock.c      |   13 +-
 sys/arch/bebox/stand/boot/conf.c       |   18 +-
 sys/arch/bebox/stand/boot/cons.c       |   19 +-
 sys/arch/bebox/stand/boot/cons.h       |    2 +-
 sys/arch/bebox/stand/boot/cpu.c        |   44 +-
 sys/arch/bebox/stand/boot/devopen.c    |   14 +-
 sys/arch/bebox/stand/boot/fd.c         |  173 +++---
 sys/arch/bebox/stand/boot/filesystem.c |    4 +-
 sys/arch/bebox/stand/boot/inkernel.c   |   15 +-
 sys/arch/bebox/stand/boot/io.c         |   23 +-
 sys/arch/bebox/stand/boot/kbd.c        |   99 ++-
 sys/arch/bebox/stand/boot/monitor.c    |   61 +--
 sys/arch/bebox/stand/boot/ns16550.c    |   32 +-
 sys/arch/bebox/stand/boot/ns16550.h    |    8 +-
 sys/arch/bebox/stand/boot/prf.c        |    4 +-
 sys/arch/bebox/stand/boot/srt0.s       |   27 +-
 sys/arch/bebox/stand/boot/tgets.c      |    8 +-
 sys/arch/bebox/stand/boot/vga.c        |   57 +-
 sys/arch/bebox/stand/boot/video.c      |   36 +-
 sys/arch/bebox/stand/boot/vreset.c     |  824 ++++++++++++++++----------------
 23 files changed, 925 insertions(+), 939 deletions(-)

diffs (truncated from 3190 to 300 lines):

diff -r baa0680bc9c8 -r bb4f79f55711 sys/arch/bebox/stand/boot/Makefile
--- a/sys/arch/bebox/stand/boot/Makefile        Mon Jun 28 01:08:05 1999 +0000
+++ b/sys/arch/bebox/stand/boot/Makefile        Mon Jun 28 01:20:43 1999 +0000
@@ -1,9 +1,8 @@
-#      $NetBSD: Makefile,v 1.7 1999/06/24 01:10:31 sakamoto Exp $
+#      $NetBSD: Makefile,v 1.8 1999/06/28 01:20:43 sakamoto Exp $
 
 S= ${.CURDIR}/../../../..
 
-BASE= boot
-BOOTPROG= ${BASE}.pef
+BOOTPROG= boot
 NEWVERSWHAT= "BOOT"
 
 ASRCS+= srt0.s
@@ -11,14 +10,15 @@
 CSRCS+= fd.c filesystem.c inkernel.c io.c tgets.c prf.c monitor.c
 CSRCS+= kbd.c ns16550.c vreset.c vga.c video.c
 
-CLEANFILES+= vers.c vers.o netbsd.gz ${BASE} ${BOOTPROG} elf2pef
+CLEANFILES+= vers.c vers.o ${BOOTPROG} ${.CURDIR}/lib
 
-CPPFLAGS= -I${.CURDIR} -I${.CURDIR}/../../.. -I${S} -I${S}/lib/libsa
-CPPFLAGS+= -D_STANDALONE -DDBMONITOR -DRELOC=${RELOC} -DENTRY=${ENTRY}
-#CPPFLAGS+= -DUSE_SCAN
+CPPFLAGS= -I${.CURDIR} -I${.CURDIR}/../elf2pef -I${.CURDIR}/../../..
+CPPFLAGS+= -I${S} -I${S}/lib/libsa
+CPPFLAGS+= -D_STANDALONE -DDBMONITOR -DRELOC=${RELOC}
+CPPFLAGS+= -DUSE_SCAN
 #CPPFLAGS+= -DCONS_BE
-#CPPFLAGS+= -DCONS_VGA
-CPPFLAGS+= -DCONS_SERIAL -DCOMSPEED=9600 -DCOMPORT=0x3F8
+CPPFLAGS+= -DCONS_VGA
+#CPPFLAGS+= -DCONS_SERIAL -DCOMSPEED=9600 -DCOMPORT=0x3F8
 
 AOBJS= ${ASRCS:.s=.o}
 COBJS= ${CSRCS:.c=.o}
@@ -28,7 +28,6 @@
 STRIPFLAG=
 BINMODE= 444
 
-ENTRY= 0x3100
 RELOC= 0x700000
 
 CLEANFILES+= ${.OBJDIR}/machine ${.OBJDIR}/powerpc
@@ -37,8 +36,6 @@
        @[ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine
        @[ -h powerpc ] || ln -s ${S}/arch/powerpc/include powerpc
 
-KERNEL?= ${S}/arch/bebox/compile/GENERIC/netbsd
-
 ### find out what to use for libkern
 KERN_AS=       library
 .include "${S}/lib/libkern/Makefile.inc"
@@ -51,27 +48,20 @@
 
 ### find out what to use for libsa
 SA_AS=         library
-SAMISCMAKEFLAGS= SA_USE_CREAD=yes
+SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
 .include "${S}/lib/libsa/Makefile.inc"
 LIBSA=         ${SALIB}
 
 all: ${BOOTPROG}
 
-${BOOTPROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} elf2pef
+${BOOTPROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
        sh ${.CURDIR}/../newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
        ${COMPILE.c} vers.c
-       ${LD} -o ${BASE} -s -N -T ld.script -Ttext ${RELOC} ${OBJS} \
+       ${LD} -o ${BOOTPROG} -s -N -T ld.script -Ttext ${RELOC} ${OBJS} \
                ${LIBSA} ${LIBZ} ${LIBKERN} vers.o
-.if exists (${KERNEL})
-       cat ${KERNEL} | gzip -9 > ${.CURDIR}/netbsd.gz
-       ${.CURDIR}/elf2pef ${BASE} $@ ${.CURDIR}/netbsd.gz
-.else
-       ${.CURDIR}/elf2pef ${BASE} $@
-.endif
 
-
-elf2pef: elf2pef.c pef.h
-       ${HOST_LINK.c} -I/usr/include -I${.CURDIR} \
-               -DENTRY=${ENTRY} -o ${.TARGET} ${.IMPSRC}
+remake: cleanobjs all
+cleanobjs:
+       rm -f ${OBJS}
 
 .include <bsd.prog.mk>
diff -r baa0680bc9c8 -r bb4f79f55711 sys/arch/bebox/stand/boot/boot.c
--- a/sys/arch/bebox/stand/boot/boot.c  Mon Jun 28 01:08:05 1999 +0000
+++ b/sys/arch/bebox/stand/boot/boot.c  Mon Jun 28 01:20:43 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: boot.c,v 1.8 1999/06/24 01:10:31 sakamoto Exp $        */
+/*     $NetBSD: boot.c,v 1.9 1999/06/28 01:20:43 sakamoto Exp $        */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -31,45 +31,38 @@
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include <stand.h>
-
-#include <sys/exec_elf.h>
+#include <loadfile.h>
 #include <sys/reboot.h>
-#include <machine/cpu.h>
-#include <machine/param.h>
-#include <bebox/include/bootinfo.h>
+#include <machine/bootinfo.h>
 #include "boot.h"
 
-char *name;
 char *names[] = {
        "in()",
        "fd(0,1,0)netbsd", "fd(0,1,0)netbsd.gz",
        "fd(0,1,0)netbsd.old", "fd(0,1,0)netbsd.old.gz",
        "fd(0,1,0)onetbsd", "fd(0,1,0)onetbsd.gz"
 };
-#define NUMNAMES (sizeof (names) / sizeof (names[0]))
+#define        NUMNAMES (sizeof (names) / sizeof (names[0]))
 
-#define NAMELEN        128
+#define        NAMELEN 128
 char namebuf[NAMELEN];
 char nametmp[NAMELEN];
-int args;
-void *startsym, *endsym, *bootinfo;
+
 struct btinfo_memory btinfo_memory;
 struct btinfo_console btinfo_console;
 struct btinfo_clock btinfo_clock;
-extern int errno;
+
+extern char bootprog_name[], bootprog_rev[], bootprog_maker[], bootprog_date[];
+
+void exec_kernel __P((char *, void *));
 
 void
 main()
 {
-       int fd, n = 0;
+       int n = 0;
        int addr, speed;
-       char *cnname;
-       void *p;
-       void start_CPU1();
-       extern int CPU1_alive;
-       extern char bootprog_name[], bootprog_rev[],
-               bootprog_maker[], bootprog_date[];
-       extern char *cninit();
+       char *name, *cnname;
+       void *p, *bootinfo;
 
        if (whichCPU() == 1)
                cpu1();
@@ -109,18 +102,18 @@
        btinfo_clock.ticks_per_sec = TICKS_PER_SEC;
 
        p = bootinfo;
-       bcopy((void *)&btinfo_memory, p, sizeof (btinfo_memory));
+       memcpy(p, (void *)&btinfo_memory, sizeof (btinfo_memory));
        p += sizeof (btinfo_memory);
-       bcopy((void *)&btinfo_console, p, sizeof (btinfo_console));
+       memcpy(p, (void *)&btinfo_console, sizeof (btinfo_console));
        p += sizeof (btinfo_console);
-       bcopy((void *)&btinfo_clock, p, sizeof (btinfo_clock));
+       memcpy(p, (void *)&btinfo_clock, sizeof (btinfo_clock));
 
        /*
         * attached kernel check
         */
        init_in();
 
-       runCPU1(start_CPU1);
+       runCPU1((void *)start_CPU1);
        wait_for(&CPU1_alive);
 
        printf(">> %s, Revision %s\n", bootprog_name, bootprog_rev);
@@ -128,200 +121,99 @@
        printf(">> Memory: %d k\n", btinfo_memory.memsize / 1024);
 
        for (;;) {
-               args = 0;
                name = names[n++];
                if (n >= NUMNAMES)
                        n = 0;
 
-               getbootdev(&args);
-               fd = open(name, 0);
-               if (fd >= 0) {
-                       exec_kernel(fd, &args);
-                       close(fd);      /* exec failed */
-               } else {
-                       printf("open error:%s\n",  strerror(errno));
-               }
+               exec_kernel(name, bootinfo);
        }
 }
 
 /*
- * Get boot device, file name, flag
+ * Exec kernel
  */
-getbootdev(howto)
-       int *howto;
+void
+exec_kernel(name, bootinfo)
+       char *name;
+       void *bootinfo;
 {
+       int howto = 0;
        char c, *ptr;
+       u_long marks[MARK_MAX];
 #ifdef DBMONITOR
-       extern int load_flag;
+       int go_monitor;
+       extern int db_monitor __P((void));
 #endif /* DBMONITOR */
+       extern int tgets __P((char *buf));
 
-#ifdef DBMONITOR
 ret:
-       if (load_flag)
-               printf("Load: ");
-       else
-#endif /* DBMONITOR */
-               printf("Boot: ");
+       do {
+               printf("\nBoot: ");
+
+               memset(namebuf, 0, sizeof (namebuf));
+       } while (tgets(namebuf) == -1);
 
-       bzero(namebuf, sizeof (namebuf));
-       if (tgets(namebuf) != -1) {
-               ptr = namebuf;
+       ptr = namebuf;
 #ifdef DBMONITOR
-               if (*ptr == '!') {
+       go_monitor = 0;
+       if (*ptr == '!') {
+               if (*(++ptr) == NULL) {
                        db_monitor();
                        printf("\n");
                        goto ret;
+               } else {
+                       go_monitor++;
                }
+       }
 #endif /* DBMONITOR */
-               while (c = *ptr) {
-                       while (c == ' ')
-                               c = *++ptr;
-                       if (!c)
-                               return;
-                       if (c == '-')
-                               while ((c = *++ptr) && c != ' ') {
-                                       if (c == 'a')
-                                               *howto |= RB_ASKNAME;
-                                       else if (c == 'b')
-                                               *howto |= RB_HALT;
-                                       else if (c == 'd')
-                                               *howto |= RB_KDB;
-                                       else if (c == 'r')
-                                               *howto |= RB_DFLTROOT;
-                                       else if (c == 's')
-                                               *howto |= RB_SINGLE;
-                               }
-                       else {
-                               name = ptr;
-                               while ((c = *++ptr) && c != ' ');
-                               if (c)
-                                       *ptr++ = 0;
+       while ((c = *ptr)) {
+               while (c == ' ')
+                       c = *++ptr;
+               if (!c)
+                       goto next;
+               if (c == '-') {
+                       while ((c = *++ptr) && c != ' ') {
+                               if (c == 'a')
+                                       howto |= RB_ASKNAME;
+                               else if (c == 'b')
+                                       howto |= RB_HALT;
+                               else if (c == 'd')
+                                       howto |= RB_KDB;
+                               else if (c == 'r')
+                                       howto |= RB_DFLTROOT;
+                               else if (c == 's')
+                                       howto |= RB_SINGLE;
                        }
+               } else {
+                       name = ptr;
+                       while ((c = *++ptr) && c != ' ');
+                       if (c)
+                               *ptr++ = 0;
                }
-       } else {
-               putchar('\n');
        }



Home | Main Index | Thread Index | Old Index