diff options
Diffstat (limited to 'sys/arch/mvme68k')
-rw-r--r-- | sys/arch/mvme68k/stand/bootsd/Makefile | 44 | ||||
-rw-r--r-- | sys/arch/mvme68k/stand/bootsd/README | 10 | ||||
-rw-r--r-- | sys/arch/mvme68k/stand/bootsd/boot.c | 266 | ||||
-rw-r--r-- | sys/arch/mvme68k/stand/bootsd/version.c | 6 |
4 files changed, 37 insertions, 289 deletions
diff --git a/sys/arch/mvme68k/stand/bootsd/Makefile b/sys/arch/mvme68k/stand/bootsd/Makefile index a67b4e1102a..6d704dbbda3 100644 --- a/sys/arch/mvme68k/stand/bootsd/Makefile +++ b/sys/arch/mvme68k/stand/bootsd/Makefile @@ -1,53 +1,35 @@ # from: @(#)Makefile 8.1 (Berkeley) 6/10/93 -# $OpenBSD: Makefile,v 1.5 1996/05/10 20:03:46 deraadt Exp $ +# $OpenBSD: Makefile,v 1.6 1996/05/16 02:46:56 chuck Exp $ RELOC=0x3F0000 S= ${.CURDIR}/../../../.. -DEFS= -DSTANDALONE -DCOMPAT_NOLABEL # -DROMPRF -INCPATH=-I${.CURDIR} -I${S} -I${.OBJDIR} -I${S}/lib/libsa +DEFS= +INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \ + -I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa CFLAGS= -O2 ${INCPATH} ${DEFS} ${COPTS} -CLEANFILES+=sdboot bootsd bootsd.bug bootsd.bin machine +CLEANFILES+=bootsd -#.PATH: ${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH} -#.PATH: ${S}/lib/libsa - -.include "${S}/arch/${MACHINE}/stand/libsa/Makefile.inc" -.include "${S}/arch/${MACHINE}/stand/libbug/Makefile.inc" .include "${S}/arch/${MACHINE}/stand/bugcrt/Makefile.inc" -.include "${S}/arch/${MACHINE}/stand/wrtvid/Makefile.inc" +.include "${S}/arch/${MACHINE}/stand/libbug/Makefile.inc" +.include "${S}/arch/${MACHINE}/stand/libsa/Makefile.inc" -SRCS= boot.c filesystem.c bugdev.c version.c +SRCS= boot.c conf.c version.c LIBS= ${LIBSA} ${LIBBUG} OBJS= ${SRCS:N*.h:R:S/$/.o/g} -BOOTS= bootsd sdboot +BOOTS= bootsd ALL= ${BOOTS} -all: machine ${ALL} - -devopen.o machdep.o: Makefile +all: ${ALL} -bootsd.bug: ${OBJS} ${BUGCRT} ${LIBS} - ${LD} -N -T ${RELOC} ${BUGCRT} ${OBJS} ${LIBS} -o $@ - @size bootsd.bug - -bootsd sdboot: bootsd.bug ${WRTVID} - cp bootsd.bug bootsd.bin - strip bootsd.bin - @if [ `size bootsd.bin | awk 'BEGIN {getline} {print $$1+$$2;}'` -gt 7168 ];\ - then\ - echo BOOTBLOCKS ARE TOO BIG;\ - fail;\ - fi - ${WRTVID} bootsd.bin +bootsd: ${OBJS} ${LIBSA} ${BUGCRT} ${LIBBUG} + ${LD} -N -T ${RELOC} -o $@ \ + ${SRTOBJ} ${BUGCRT} ${OBJS} ${LIBSA} ${LIBBUG} install: install -c -m 555 -g bin -o bin ${BOOTS} ${DESTDIR}${MDEC_DIR} -machine: - rm -f machine; ln -s ${.CURDIR}/../../include machine - .include <bsd.prog.mk> diff --git a/sys/arch/mvme68k/stand/bootsd/README b/sys/arch/mvme68k/stand/bootsd/README index f3a503eb63e..86d2b194056 100644 --- a/sys/arch/mvme68k/stand/bootsd/README +++ b/sys/arch/mvme68k/stand/bootsd/README @@ -1,3 +1,7 @@ -In short: stick the the bootblocks into a partition with -something like: - cat sdboot bootsd > /dev/rsd0c +In short: + cd /usr/mdec + cp bootsd / + ./installboot -v /bootsd ./bootxx /dev/rsd0c + + (you will need to be single user to run installboot since it writes + to a raw disk device) diff --git a/sys/arch/mvme68k/stand/bootsd/boot.c b/sys/arch/mvme68k/stand/bootsd/boot.c index b8f3e793ad3..646dcb1d547 100644 --- a/sys/arch/mvme68k/stand/bootsd/boot.c +++ b/sys/arch/mvme68k/stand/bootsd/boot.c @@ -1,35 +1,6 @@ -/* $OpenBSD: boot.c,v 1.7 1996/04/28 10:48:17 deraadt Exp $ */ +/* $NetBSD: boot.c,v 1.2 1995/09/23 03:42:52 gwr Exp $ */ /*- - * Copyright (c) 1995 Theo de Raadt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Theo de Raadt for Willowglen Singapore. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * @@ -61,242 +32,33 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)boot.c 8.1 (Berkeley) 6/10/93 + * @(#)boot.c 8.1 (Berkeley) 6/10/93 */ #include <sys/param.h> -#include <sys/types.h> #include <sys/reboot.h> -#include <a.out.h> + #include <machine/prom.h> -#include "stand.h" -void copyunix __P((int io, char *addr)); -void parse_args __P((void)); +#include "stand.h" +#include "libsa.h" int debug; -int netif_debug; -#define RB_NOSYM 0x400 - -/* - * Boot device is derived from ROM provided information. - */ -extern char *version; -u_long esym; -char *strtab; -int strtablen; -#if 0 -struct nlist *nlp, *enlp; -#endif - -struct kernel { - void *entry; - void *symtab; - void *esym; - int bflags; - int bdev; - char *kname; - void *smini; - void *emini; - u_int end_loaded; -} kernel; - -extern struct mvmeprom_args bugargs; +int errno; +extern char *version; int main() { - struct exec x; - char *file; - void *addr; - int io, i; - - printf(">> OpenBSD sdboot [%s]\n", version); - - parse_args(); - file = kernel.kname; - - io = open(file, 0); - if (io < 0) { - printf("Can't open %s: %s\n", file, strerror(errno)); - mvmeprom_return(); - } - i = read(io, (char *)&x, sizeof(x)); - if (i != sizeof(x) || N_BADMAG(x)) { - printf("Bad format\n"); - return (0); - } - /* Make load address start of page which containes "start" */ - addr = (void *)(x.a_entry & ~0x0FFF); - lseek(io, 0, SEEK_SET); - - /*printf("load %s to 0x%x\n", file, addr);*/ - copyunix(io, addr); - return (0); -} - -/*ARGSUSED*/ -void -copyunix(io, addr) - int io; - char *addr; -{ - void (*entry)() = (void (*)())addr; - struct exec x; - int i, cnt; - - i = read(io, (char *)&x, sizeof(x)); - if (i != sizeof(x) || N_BADMAG(x)) { - printf("Bad format\n"); - return; - } + char *cp, *file; + int io, flag; - printf("%x", x.a_text); - if (N_GETMAGIC(x) == ZMAGIC) { - kernel.entry = entry = (void *)x.a_entry; - lseek(io, 0, SEEK_SET); - } - if (read(io, (char *)addr, x.a_text) != x.a_text) - goto shread; - addr += x.a_text; - if (N_GETMAGIC(x) == NMAGIC) - while ((int)addr & CLOFSET) - *addr++ = 0; - printf("+%x", x.a_data); - if (read(io, addr, x.a_data) != x.a_data) - goto shread; - addr += x.a_data; - printf("+%x", x.a_bss); - for (i = 0; i < x.a_bss; i++) - *addr++ = 0; - if (x.a_syms != 0 && !(kernel.bflags & RB_NOSYM)) { - bcopy(&x.a_syms, addr, sizeof(x.a_syms)); - addr += sizeof(x.a_syms); -#if 0 - nlp = (struct nlist *)addr; -#endif - printf("+[%x+", x.a_syms); - if (read(io, addr, x.a_syms) != x.a_syms) - goto shread; - addr += x.a_syms; -#if 0 - enlp = (struct nlist *)(strtab = addr); -#endif + printf(">> OpenBSD MVME%x bootsd [%s]\n", bugargs.cputyp, version); - if (read(io, &strtablen, sizeof(int)) != sizeof(int)) - goto shread; + parse_args(&file, &flag); - bcopy(&strtablen, addr, sizeof(int)); - if (i = strtablen) { - i -= sizeof(int); - addr += sizeof(int); - cnt = read(io, addr, i); - if (cnt != i) - printf("symwarn"); /* goto shread; */ - addr += i; - } - printf("%x]", i); - esym = KERNBASE + - (((int)addr + sizeof(int) - 1) & ~(sizeof(int) - 1)); - kernel.symtab = (void *) x.a_syms; - kernel.esym = addr; - } else { - kernel.symtab = 0; - kernel.esym = 0; - } - -#if 0 - while (nlp < enlp) { - register int strx = nlp->n_un.n_strx; - if (strx > strtablen) - continue; - if (strcmp(strtab+strx, "_esym") == 0) { - *(int*)(nlp->n_value - KERNBASE) = esym; - break; - } - nlp++; - } -#endif - - kernel.bdev = 0; - kernel.end_loaded = (u_int)addr; - kernel.smini = 0; - kernel.emini = 0; - kernel.kname = 0; - - printf("=%x\n", (u_int)addr - (u_int)entry); /* XXX wrong? */ - -#if 0 -printf("entry %x\n",kernel.entry); -printf("symtab %x\n",kernel.symtab); -printf("esym %x\n",kernel.esym); -printf("bflags %x\n",kernel.bflags); -printf("bdev %x\n",kernel.bdev); -printf("kname %x\n",kernel.kname); -printf("smini %x\n",kernel.smini); -printf("emini %x\n",kernel.emini); -printf("end_loaded %x\n",kernel.end_loaded); -#endif - - printf("start at 0x%x\n", (int)entry); - if (((u_long)entry &0xf) == 0x2) { - (entry)(&bugargs, &kernel); - } else { - /* is type fixing anything like price fixing? */ - typedef (* kernel_start) __P((int, int, void *,void *, void *)); - kernel_start addr; - addr = (void *)entry; - (addr)(kernel.bflags, 0, kernel.esym, kernel.smini, kernel.emini); - } - return; - -shread: - printf("short read\n"); -} - -struct flags { - char c; - short bit; -} bf[] = { - { 'a', RB_ASKNAME }, - { 'b', RB_HALT }, - { 'y', RB_NOSYM }, - { 'd', RB_KDB }, - { 'm', RB_MINIROOT }, - { 'r', RB_DFLTROOT }, - { 's', RB_SINGLE }, -}; - -void -parse_args() -{ - char *name = "/bsd", *ptr; - int i, howto = 0; - char c; + exec_mvme(file, flag); - if (bugargs.arg_start != bugargs.arg_end) { - ptr = bugargs.arg_start; - while (c = *ptr) { - while (c == ' ') - c = *++ptr; - if (c == '\0') - return; - if (c != '-') { - name = ptr; - while ((c = *++ptr) && c != ' ') - ; - if (c) - *ptr++ = 0; - continue; - } - while ((c = *++ptr) && c != ' ') { - for (i = 0; i < sizeof(bf)/sizeof(bf[0]); i++) - if (bf[i].c == c) { - howto |= bf[i].bit; - } - } - } - } - kernel.bflags = howto; - kernel.kname = name; + printf("boot: %s: %s\n", file, strerror(errno)); + return(0); } diff --git a/sys/arch/mvme68k/stand/bootsd/version.c b/sys/arch/mvme68k/stand/bootsd/version.c index dcb2a18ddf0..3303406d843 100644 --- a/sys/arch/mvme68k/stand/bootsd/version.c +++ b/sys/arch/mvme68k/stand/bootsd/version.c @@ -1,8 +1,8 @@ -/* $OpenBSD: version.c,v 1.4 1996/04/28 10:48:19 deraadt Exp $ */ +/* $OpenBSD: version.c,v 1.5 1996/05/16 02:46:57 chuck Exp $ */ /* * make a random change to this file when you want the bootblock - * revision to increase. like change this x to a y, or something. + * revision to increase. like change this x to a z, or something. */ -char *version = "$Revision: 1.4 $"; +char *version = "$Revision: 1.5 $"; |