summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/hp300/stand/Makefile4
-rw-r--r--sys/arch/hp300/stand/Makefile.inc15
-rw-r--r--sys/arch/hp300/stand/cdboot/Makefile37
-rw-r--r--sys/arch/hp300/stand/cdboot/cdboot.c99
-rw-r--r--sys/arch/hp300/stand/cdboot/conf.c117
-rw-r--r--sys/arch/hp300/stand/cdboot/cons.c92
-rw-r--r--sys/arch/hp300/stand/cdboot/devopen.c254
-rw-r--r--sys/arch/hp300/stand/common/Makefile4
-rw-r--r--sys/arch/hp300/stand/common/version.c6
-rw-r--r--sys/arch/hp300/stand/isolif/Makefile11
-rw-r--r--sys/arch/hp300/stand/isolif/isolif.8110
-rw-r--r--sys/arch/hp300/stand/isolif/isolif.c264
-rw-r--r--sys/arch/hp300/stand/libsa/Makefile6
-rw-r--r--sys/arch/hp300/stand/libsaz/Makefile36
-rw-r--r--sys/arch/hp300/stand/mkboot/mkboot.c18
-rw-r--r--sys/arch/hp300/stand/stripboot/Makefile12
-rw-r--r--sys/arch/hp300/stand/stripboot/stripboot.c156
-rw-r--r--sys/arch/hp300/stand/uboot/Makefile15
18 files changed, 674 insertions, 582 deletions
diff --git a/sys/arch/hp300/stand/Makefile b/sys/arch/hp300/stand/Makefile
index 133eceb9a9a..2a66f50f36c 100644
--- a/sys/arch/hp300/stand/Makefile
+++ b/sys/arch/hp300/stand/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.14 1997/09/15 06:20:54 downsj Exp $
+# $OpenBSD: Makefile,v 1.15 1999/08/16 09:43:07 downsj Exp $
# $NetBSD: Makefile,v 1.23 1997/02/04 03:51:37 thorpej Exp $
-SUBDIR= libsa libkern libz common mkboot stripboot uboot installboot isolif
+SUBDIR= libsa libsaz libkern libz common mkboot uboot installboot
.include <bsd.subdir.mk>
diff --git a/sys/arch/hp300/stand/Makefile.inc b/sys/arch/hp300/stand/Makefile.inc
index e5096129e11..b1b016609d6 100644
--- a/sys/arch/hp300/stand/Makefile.inc
+++ b/sys/arch/hp300/stand/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.2 1997/09/14 12:54:20 downsj Exp $
+# $OpenBSD: Makefile.inc,v 1.3 1999/08/16 09:43:07 downsj Exp $
# $NetBSD: Makefile.inc,v 1.7 1997/05/12 07:43:18 thorpej Exp $
BINDIR= /usr/mdec
@@ -54,6 +54,19 @@ LIBSAOBJDIR= ${LIBSADIR}
LIBSA= ${LIBSAOBJDIR}/libsa.a
+### Figure out what to use for libsaz
+LIBSAZDIR= ${.CURDIR}/../libsaz
+
+.if exists(${LIBSAZDIR}/obj.${MACHINE})
+LIBSAZOBJDIR= ${LIBSAZDIR}/obj.${MACHINE}
+.elif exists(${LIBSAZDIR}/obj)
+LIBSAZOBJDIR= ${LIBSAZDIR}/obj
+.else
+LIBSAZOBJDIR= ${LIBSAZDIR}
+.endif
+
+LIBSAZ= ${LIBSAZOBJDIR}/libsaz.a
+
### Figure out what to use for libz
LIBZDIR= ${.CURDIR}/../libz
diff --git a/sys/arch/hp300/stand/cdboot/Makefile b/sys/arch/hp300/stand/cdboot/Makefile
new file mode 100644
index 00000000000..684f16f8ed6
--- /dev/null
+++ b/sys/arch/hp300/stand/cdboot/Makefile
@@ -0,0 +1,37 @@
+# $OpenBSD: Makefile,v 1.1 1999/08/16 09:43:08 downsj Exp $
+
+PROG= cdboot
+
+NOMAN=
+
+.PATH: ${.CURDIR}/../uboot
+
+CFLAGS= -O2 -msoft-float -I${.CURDIR}/../include \
+ -I${.CURDIR}/../libsa -I${.CURDIR}/../.. -I${.CURDIR}/../../.. \
+ -I${.CURDIR}/../../../..
+
+AFLAGS= -x assembler-with-cpp -traditional-cpp -I${.CURDIR}/../include \
+ -I${.CURDIR}/../libsa -I${.CURDIR}/../.. -I${.CURDIR}/../../.. \
+ -I${.CURDIR}/../../../..
+
+SRCS= srt0.S cdboot.c clock.c conf.c cons.c devopen.c
+
+LIBS= ${LIBCOMMON} ${LIBSA} ${LIBZ} ${LIBKERN}
+
+${OBJS}: ${.CURDIR}/../Makefile.inc
+
+CLEANFILES+= cdboot.lif
+
+cdboot.lif: cdboot
+ ${MKBOOT_PROG} cdboot $@
+
+cdboot: ${OBJS} ${LIBS}
+ ${LD} -N -T ${RELOC} -e begin ${OBJS} ${LIBS} -o $@
+ @size $@
+ @echo $@ total size may not exceed 30000 bytes
+
+install: cdboot.lif cdboot.raw ${MKBOOT_PROG}
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 cdboot.lif \
+ ${DESTDIR}/usr/mdec
+
+.include <bsd.prog.mk>
diff --git a/sys/arch/hp300/stand/cdboot/cdboot.c b/sys/arch/hp300/stand/cdboot/cdboot.c
new file mode 100644
index 00000000000..a8aa63ccefe
--- /dev/null
+++ b/sys/arch/hp300/stand/cdboot/cdboot.c
@@ -0,0 +1,99 @@
+/* $OpenBSD: cdboot.c,v 1.1 1999/08/16 09:43:08 downsj Exp $ */
+/* $NetBSD: uboot.c,v 1.3 1997/04/27 21:17:13 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * @(#)boot.c 8.1 (Berkeley) 6/10/93
+ */
+
+#include <sys/param.h>
+#include <sys/reboot.h>
+#include <machine/exec.h>
+#include <a.out.h>
+
+#include <lib/libsa/stand.h>
+
+#include "samachdep.h"
+
+/*
+ * Boot program... bits in `howto' determine whether boot stops to
+ * ask for system name. Boot device is derived from ROM provided
+ * information.
+ */
+
+char line[100];
+
+extern u_int opendev;
+extern char *lowram;
+extern int noconsole;
+
+extern const char version[];
+
+/*
+ * XXX UFS accepts a /, NFS doesn't.
+ */
+char *name;
+char *names[] = {
+ "bsd.rd", "bsd", "obsd", "bsd.old"
+};
+#define NUMNAMES (sizeof(names) / sizeof(char *))
+
+static int bdev, badapt, bctlr, bunit, bpart;
+
+main()
+{
+ int currname = 0;
+
+ printf("\n>> OpenBSD [%dKB] CDROM BOOT %s HP9000/%s CPU\n",
+ (__LDPGSZ / 1024), version, getmachineid());
+ printf(">> Enter \"reset\" to reset system.\n");
+
+ bdev = B_TYPE(bootdev);
+ badapt = B_ADAPTOR(bootdev);
+ bctlr = B_CONTROLLER(bootdev);
+ bunit = B_UNIT(bootdev);
+ bpart = B_PARTITION(bootdev);
+
+ for (;;) {
+ name = names[currname++];
+ if (currname == NUMNAMES)
+ currname = 0;
+
+ howto = RB_SINGLE;
+
+ printf(": %s\n", name);
+
+ exec(name, lowram, howto);
+ printf("boot: %s\n", strerror(errno));
+ }
+}
diff --git a/sys/arch/hp300/stand/cdboot/conf.c b/sys/arch/hp300/stand/cdboot/conf.c
new file mode 100644
index 00000000000..8dc30a69698
--- /dev/null
+++ b/sys/arch/hp300/stand/cdboot/conf.c
@@ -0,0 +1,117 @@
+/* $OpenBSD: conf.c,v 1.1 1999/08/16 09:43:08 downsj Exp $ */
+/* $NetBSD: conf.c,v 1.12 1996/10/14 07:29:15 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * @(#)conf.c 8.1 (Berkeley) 6/10/93
+ */
+
+#include <sys/param.h>
+
+#include <lib/libsa/stand.h>
+
+#include "samachdep.h"
+
+#include <lib/libsa/cd9660.h>
+
+int debug = 0; /* XXX */
+
+/*
+ * Device configuration
+ */
+int sdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
+int sdopen __P((struct open_file *, ...));
+int sdclose __P((struct open_file *));
+#define sdioctl noioctl
+
+#define xxstrategy \
+ (int (*) __P((void *, int, daddr_t, size_t, void *, size_t *)))nullsys
+#define xxopen (int (*) __P((struct open_file *, ...)))nodev
+#define xxclose (int (*) __P((struct open_file *)))nullsys
+
+struct devsw devsw[] = {
+ { "??", xxstrategy, xxopen, xxclose, noioctl }, /*0*/
+ { "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/
+ { "??", xxstrategy, xxopen, xxclose, noioctl }, /*2*/
+ { "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/
+ { "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/
+};
+int ndevs = (sizeof(devsw) / sizeof(devsw[0]));
+
+/*
+ * Physical unit/lun detection.
+ */
+int punitzero __P((int, int, int *));
+
+int
+punitzero(ctlr, slave, punit)
+ int ctlr, slave, *punit;
+{
+
+ *punit = 0;
+ return (0);
+}
+
+#define xxpunit punitzero
+#define sdpunit punitzero
+
+struct punitsw punitsw[] = {
+ { xxpunit },
+ { xxpunit },
+ { xxpunit },
+ { xxpunit },
+ { sdpunit },
+};
+int npunit = (sizeof(punitsw) / sizeof(punitsw[0]));
+
+/*
+ * Filesystem configuration
+ */
+struct fs_ops file_system_cd9660[] = {
+ { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
+ cd9660_stat },
+};
+
+struct fs_ops file_system[2];
+int nfsys = 1; /* default; changed per device type. */
+
+
+/*
+ * Inititalize controllers
+ *
+ * XXX this should be a table
+ */
+void ctlrinit()
+{
+ scsiinit();
+}
diff --git a/sys/arch/hp300/stand/cdboot/cons.c b/sys/arch/hp300/stand/cdboot/cons.c
new file mode 100644
index 00000000000..944daf3c5e2
--- /dev/null
+++ b/sys/arch/hp300/stand/cdboot/cons.c
@@ -0,0 +1,92 @@
+/* $OpenBSD: cons.c,v 1.1 1999/08/16 09:43:08 downsj Exp $ */
+/* $NetBSD: cons.c,v 1.2 1997/05/12 07:44:53 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * from: Utah Hdr: cons.c 1.7 92/02/28
+ *
+ * @(#)cons.c 8.1 (Berkeley) 6/10/93
+ */
+
+#include <sys/param.h>
+#include <dev/cons.h>
+
+#include "samachdep.h"
+
+
+int curcons_scode; /* select code of device currently being probed */
+int cons_scode; /* final select code of console device */
+
+struct consdev *cn_tab;
+int noconsole;
+extern int userom;
+extern int donottwiddle; /* from libsa */
+
+void
+cninit()
+{
+ cn_tab = NULL;
+ noconsole = 1;
+ cons_scode = 256; /* larger than last valid select code */
+ userom = 1;
+ donottwiddle = 1;
+}
+
+int
+cngetc()
+{
+ return(0);
+}
+
+int
+cnputc(c)
+ int c;
+{
+ romputchar(c);
+ return(0);
+}
+
+int
+putchar(c)
+ int c;
+{
+ cnputc(c);
+ if (c == '\n')
+ cnputc('\r');
+ return(0);
+}
diff --git a/sys/arch/hp300/stand/cdboot/devopen.c b/sys/arch/hp300/stand/cdboot/devopen.c
new file mode 100644
index 00000000000..3a93b1bf9b9
--- /dev/null
+++ b/sys/arch/hp300/stand/cdboot/devopen.c
@@ -0,0 +1,254 @@
+/* $OpenBSD: devopen.c,v 1.1 1999/08/16 09:43:08 downsj Exp $ */
+/* $NetBSD: devopen.c,v 1.7 1996/10/14 07:31:47 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
+ * Copyright (c) 1993 John Brezak
+ * All rights reserved.
+ *
+ * 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. 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.
+ */
+
+#include <sys/param.h>
+#include <sys/reboot.h>
+
+#include <lib/libsa/stand.h>
+
+#include "samachdep.h"
+
+u_int opendev;
+
+#define ispart(c) ((c) >= 'a' && (c) <= 'h')
+
+atoi(char *cp)
+{
+ int val = 0;
+ while(isdigit(*cp))
+ val = val * 10 + (*cp++ - '0');
+ return(val);
+}
+
+usage()
+{
+ printf("\
+Usage: device(adaptor, controller, drive, partition)file\n\
+ <device><unit><partitionletter>:file\n\
+");
+}
+
+devlookup(d, len)
+ const char *d;
+ int len;
+{
+ struct devsw *dp = devsw;
+ int i;
+
+ for (i = 0; i < ndevs; i++, dp++) {
+ if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0) {
+ /*
+ * Set the filesystem and startup up according to the device
+ * being opened.
+ */
+ switch (i) {
+ case 4: /* sd - only supports cd9660 */
+ bcopy(file_system_cd9660, file_system, sizeof(struct fs_ops));
+ break;
+
+ case 0: /* ct - not supported */
+ case 2: /* hd - not supported */
+ case 6: /* le - not supported */
+ default:
+ /* Agh! What happened?! */
+ goto bad;
+ }
+ return(i);
+ }
+ }
+
+ bad:
+ printf("No such device - Configured devices are:\n");
+ for (dp = devsw, i = 0; i < ndevs; i++, dp++)
+ if (dp->dv_name)
+ printf(" %s", dp->dv_name);
+ printf("\n");
+ errno = ENODEV;
+ return(-1);
+}
+
+/*
+ * Parse a device spec in one of two forms.
+ *
+ * dev(adapt, ctlr, unit, part)file
+ * [A-Za-z]*[0-9]*[A-Za-z]:file
+ * dev unit part
+ */
+devparse(fname, dev, adapt, ctlr, unit, part, file)
+ const char *fname;
+ int *dev, *adapt, *ctlr, *unit, *part;
+ char **file;
+{
+ int *argp, i;
+ char *s, *args[4];
+
+ /* get device name and make lower case */
+ for (s = (char *)fname; *s && *s != '/' && *s != ':' && *s != '('; s++)
+ if (isupper(*s)) *s = tolower(*s);
+
+ /* first form */
+ if (*s == '(') {
+ /* lookup device and get index */
+ if ((*dev = devlookup(fname, s - fname)) < 0)
+ goto baddev;
+
+ /* tokenize device ident */
+ args[0] = ++s;
+ for (args[0] = s, i = 1; *s && *s != ')'; s++) {
+ if (*s == ',')
+ args[i++] = ++s;
+ }
+ switch(i) {
+ case 4:
+ *adapt = atoi(args[0]);
+ *ctlr = atoi(args[1]);
+ *unit = atoi(args[2]);
+ *part = atoi(args[3]);
+ break;
+ case 3:
+ *ctlr = atoi(args[0]);
+ *unit = atoi(args[1]);
+ *part = atoi(args[2]);
+ break;
+ case 2:
+ *unit = atoi(args[0]);
+ *part = atoi(args[1]);
+ break;
+ case 1:
+ *part = atoi(args[0]);
+ break;
+ case 0:
+ break;
+ }
+ *file = ++s;
+ }
+
+ /* second form */
+ else if (*s == ':') {
+ int temp;
+
+ /* isolate device */
+ for (s = (char *)fname; *s != ':' && !isdigit(*s); s++);
+
+ /* lookup device and get index */
+ if ((*dev = devlookup(fname, s - fname)) < 0)
+ goto baddev;
+
+ /* isolate unit */
+ if ((temp = atoi(s)) > 255)
+ goto bad;
+ *adapt = temp / 8;
+ *ctlr = temp % 8;
+ for (; isdigit(*s); s++);
+
+ /* translate partition */
+ if (!ispart(*s))
+ goto bad;
+
+ *part = *s++ - 'a';
+ if (*s != ':')
+ goto bad;
+ *file = ++s;
+ }
+
+ /* no device present */
+ else
+ *file = (char *)fname;
+
+ /* return the remaining unparsed part as the file to boot */
+ return(0);
+
+ bad:
+ usage();
+
+ baddev:
+ return(-1);
+}
+
+
+devopen(f, fname, file)
+ struct open_file *f;
+ const char *fname;
+ char **file;
+{
+ int n, error;
+ int dev, adapt, ctlr, unit, part;
+ struct devsw *dp = &devsw[0];
+
+ dev = B_TYPE(bootdev);
+ adapt = B_ADAPTOR(bootdev);
+ ctlr = B_CONTROLLER(bootdev);
+ unit = B_UNIT(bootdev);
+ part = B_PARTITION(bootdev);
+
+ if (error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file))
+ return(error);
+
+ /*
+ * Set up filesystem type based on what device we're opening.
+ */
+ switch (dev) {
+ case 4: /* sd - only supports cd9660 */
+ bcopy(file_system_cd9660, file_system, sizeof(struct fs_ops));
+ break;
+
+ case 0: /* ct - not supported */
+ case 2: /* hd - not supported */
+ case 6: /* le - not supported */
+ default:
+ /* XXX what else should we do here? */
+ printf("WARNING: BOGUS BOOT DEV TYPE 0x%x!\n", dev);
+ return (EIO);
+ }
+
+ dp = &devsw[dev];
+
+ if (!dp->dv_open)
+ return(ENODEV);
+
+ f->f_dev = dp;
+
+ if ((error = (*dp->dv_open)(f, adapt, ctlr, part)) == 0) {
+ if ((error =
+ (*punitsw[dev].p_punit)(adapt, ctlr, &unit)) != 0) {
+ goto bad;
+ }
+ opendev = MAKEBOOTDEV(dev, adapt, ctlr, unit, part);
+ return(0);
+ }
+
+ bad:
+ printf("%s(%d,%d,%d,%d): %s\n", devsw[dev].dv_name,
+ adapt, ctlr, unit, part, strerror(error));
+
+ return(error);
+}
diff --git a/sys/arch/hp300/stand/common/Makefile b/sys/arch/hp300/stand/common/Makefile
index 79a2a66cb10..e7016d178b2 100644
--- a/sys/arch/hp300/stand/common/Makefile
+++ b/sys/arch/hp300/stand/common/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.3 1997/09/14 12:54:22 downsj Exp $
+# $OpenBSD: Makefile,v 1.4 1999/08/16 09:43:08 downsj Exp $
LIB= common
@@ -9,7 +9,7 @@ SRCS= apci.c autoconf.c cons.c ct.c dca.c dcm.c dnkbd.c \
ite_subr.c ite_tc.c ite_hy.c kbd.c kbdconf.c machdep.c \
nhpib.c prf.c scsi.c sd.c version.c
-CFLAGS= -O3 -msoft-float -I${.CURDIR}/../include \
+CFLAGS= -O2 -msoft-float -I${.CURDIR}/../include \
-I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. -DCD9660_DUMMYLABEL
${OBJS}: ${.CURDIR}/../Makefile.inc
diff --git a/sys/arch/hp300/stand/common/version.c b/sys/arch/hp300/stand/common/version.c
index f19cfc2ff60..ba1ad275830 100644
--- a/sys/arch/hp300/stand/common/version.c
+++ b/sys/arch/hp300/stand/common/version.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: version.c,v 1.3 1998/05/10 11:31:20 downsj Exp $ */
+/* $OpenBSD: version.c,v 1.4 1999/08/16 09:43:08 downsj Exp $ */
/*
* Record major changes in the boot code here, and increment the version
@@ -16,6 +16,8 @@
*
* 2.4 Added/fixed 425e support.
*
+ * 2.5 Added SYS_CDBOOT.
+ *
*/
-const char version[] = "2.4";
+const char version[] = "2.5";
diff --git a/sys/arch/hp300/stand/isolif/Makefile b/sys/arch/hp300/stand/isolif/Makefile
deleted file mode 100644
index be860a50a62..00000000000
--- a/sys/arch/hp300/stand/isolif/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 1999/07/08 20:11:52 deraadt Exp $
-
-PROG= isolif
-MAN= isolif.8
-MANSUBDIR=/hp300
-
-CFLAGS+= -I${.CURDIR}/../include
-
-${OBJS}: ${.CURDIR}/../Makefile.inc
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/hp300/stand/isolif/isolif.8 b/sys/arch/hp300/stand/isolif/isolif.8
deleted file mode 100644
index 8431960f9b9..00000000000
--- a/sys/arch/hp300/stand/isolif/isolif.8
+++ /dev/null
@@ -1,110 +0,0 @@
-.\" $OpenBSD: isolif.8,v 1.4 1999/07/08 22:56:03 deraadt Exp $
-.\"
-.\" Copyright (c) 1997, Jason Downs. All rights reserved.
-.\"
-.\" 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 by Jason Downs for the
-.\" OpenBSD system.
-.\" 4. Neither the name(s) of the author(s) nor the name OpenBSD
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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(S) 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.
-.\"
-.Dd September 14, 1997
-.Dt ISOLIF 8 hp300
-.Os
-.Sh NAME
-.Nm isolif
-.Nd make an ISO9660 filesystem bootable on an hp300
-.Sh SYNOPSIS
-.Nm /usr/mdec/isolif
-.Op Fl a
-.Fl s Ar isostart
-.Fl e Ar isoend
-.Fl n Ar name
-.Fl r Ar rawfile
-.Fl o Ar output
-.Sh DESCRIPTION
-.Nm isolif
-writes an appriopate LIF header to an ISO9660 filesystem, making it bootable
-an hp300.
-.Pp
-The ISO9660 filesystem must contain a
-.Em raw
-hp300 boot block file; this is normally found in
-.Pa /usr/mdec/uboot.raw .
-The position of that file within the ISO9660 filesystem image is then passed
-to
-.Nm
-and a LIF header is output to a file (which may be the actual ISO9660
-filesystem). When written to a CD or other media, this filesystem is then
-bootable.
-.Sh OPTIONS
-.Bl -tag -width XxXXXXXXXXX
-.It Fl a
-The
-.Fl a
-flag specifies that
-.Nm
-should not truncate it's output file; this allows the output file to be
-the actual ISO9660 filesystem image.
-.It Fl s Ar isostart
-The
-.Fl s
-option specifies the begining block in the ISO9660 filesystem of the
-.Em raw
-bootblock file.
-.It Fl e Ar isoend
-.Fl e
-specifies the ending block number of the boot block file. Both
-.Fl s
-and
-.Fl e
-values are taken from the verbose output of
-.Xr mkisofs 8 .
-.It Fl n Ar name
-The
-.Fl n
-option specifies the name of the boot block within the LIF header; this will
-be displayed by the ROM at boot time, in all capital letters and with
-.Dq SYS_
-prepended.
-.It Fl r Ar rawfile
-The name of the
-.Em raw
-boot file must be specified; data is required from it's header in order to
-build the LIF header.
-.It Fl o Ar outfile
-This specifies the output file name for the LIF header. Normally it is
-created if needed and truncated.
-.El
-.Sh BUGS
-The
-.Fl e
-option is not currently actually used by the program.
-.Sh SEE ALSO
-.Xr mkisofs 8 .
-.Sh HISTORY
-.Nm
-first appeared in
-.Ox 2.2 .
diff --git a/sys/arch/hp300/stand/isolif/isolif.c b/sys/arch/hp300/stand/isolif/isolif.c
deleted file mode 100644
index 7f9eb0e6c35..00000000000
--- a/sys/arch/hp300/stand/isolif/isolif.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/* $OpenBSD: isolif.c,v 1.1 1997/09/15 06:20:56 downsj Exp $ */
-
-/*
- * Copyright (c) 1997, Jason Downs. All rights reserved.
- *
- * 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 by Jason Downs for the
- * OpenBSD system.
- * 4. Neither the name(s) of the author(s) nor the name OpenBSD
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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(S) 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) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * 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 by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
- *
- * @(#)mkboot.c 8.1 (Berkeley) 7/15/93
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1990, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)mkboot.c 7.2 (Berkeley) 12/16/90";
-#endif
-static char rcsid[] = "$OpenBSD: isolif.c,v 1.1 1997/09/15 06:20:56 downsj Exp $";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/file.h>
-#include <a.out.h>
-
-#include "volhdr.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-
-#define LIF_NUMDIR 8
-
-#define LIF_VOLSTART 0
-#define LIF_VOLSIZE sizeof(struct lifvol)
-#define LIF_DIRSTART 512
-#define LIF_DIRSIZE (LIF_NUMDIR * sizeof(struct lifdir))
-#define LIF_FILESTART 8192
-
-#define btolifs(b) (((b) + (SECTSIZE - 1)) / SECTSIZE)
-#define lifstob(s) ((s) * SECTSIZE)
-
-#define ISO_BLOCKSIZE 2048
-
-static void usage __P((void));
-static char *lifname __P((char *));
-static void bcddate __P((char *));
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- int ch, isosblk, isoeblk, rfd, to, apply;
- char *name, *outfile, *rawfile;
- struct lifvol lifv;
- struct lifdir lifd[LIF_NUMDIR];
- struct load ld;
-
- name = outfile = rawfile = NULL;
- apply = isosblk = isoeblk = 0;
- while ((ch = getopt(argc, argv, "as:e:n:r:o:")) != -1) {
- switch (ch) {
- case 'a':
- apply++;
- break;
-
- case 's':
- isosblk = atoi(optarg);
- break;
-
- case 'e':
- isoeblk = atoi(optarg);
- break;
-
- case 'n':
- name = optarg;
- break;
-
- case 'r':
- rawfile = optarg;
- break;
-
- case 'o':
- outfile = optarg;
- break;
-
- default:
- usage();
- }
- }
-
- if ((name == NULL) || (outfile == NULL) || (isosblk == 0) ||
- (isoeblk == 0))
- usage();
-
- /* Need the ROM's header from the rawfile, unfortunately. */
- rfd = open(rawfile, O_RDONLY, 0600);
- if (rfd < 0) {
- perror(rawfile);
- exit(1);
- }
- if (read(rfd, &ld, sizeof(ld)) != sizeof(ld)) {
- perror("read");
- exit(1);
- }
- close(rfd);
-
- to = open(outfile, (apply ? O_WRONLY : O_WRONLY | O_TRUNC | O_CREAT),
- 0644);
- if (to < 0) {
- perror(outfile);
- exit(1);
- }
-
- /* clear possibly unused directory entries */
- strncpy(lifd[1].dir_name, " ", 10);
- lifd[1].dir_type = -1;
- lifd[1].dir_addr = 0;
- lifd[1].dir_length = 0;
- lifd[1].dir_flag = 0xFF;
- lifd[1].dir_exec = 0;
- lifd[7] = lifd[6] = lifd[5] = lifd[4] = lifd[3] = lifd[2] = lifd[1];
- /* record volume info */
- lifv.vol_id = VOL_ID;
- strncpy(lifv.vol_label, "BOOT43", 6);
- lifv.vol_addr = btolifs(LIF_DIRSTART);
- lifv.vol_oct = VOL_OCT;
- lifv.vol_dirsize = btolifs(LIF_DIRSIZE);
- lifv.vol_version = 1;
- /* output bootfile one */
- strcpy(lifd[0].dir_name, lifname(name));
- lifd[0].dir_type = DIR_TYPE;
- lifd[0].dir_addr = btolifs(isosblk * ISO_BLOCKSIZE);
- lifd[0].dir_length = btolifs(ld.count + sizeof(ld));
- bcddate(lifd[0].dir_toc);
- lifd[0].dir_flag = DIR_FLAG;
- lifd[0].dir_exec = ld.address;
- lifv.vol_length = lifd[0].dir_addr + lifd[0].dir_length;
- /* output volume/directory header info */
- lseek(to, LIF_VOLSTART, 0);
- write(to, &lifv, LIF_VOLSIZE);
- lseek(to, LIF_DIRSTART, 0);
- write(to, lifd, LIF_DIRSIZE);
-
- close(to);
- exit(0);
-}
-
-static void usage()
-{
- fprintf(stderr,
- "usage: isolif [-a] -s isostart -e isoend -n name -r rawfile -o outfile\n");
- exit(1);
-}
-
-static char *
-lifname(str)
- char *str;
-{
- static char lname[10] = "SYS_XXXXX";
- register int i;
-
- for (i = 4; i < 9; i++) {
- if (islower(*str))
- lname[i] = toupper(*str);
- else if (isalnum(*str) || *str == '_')
- lname[i] = *str;
- else
- break;
- str++;
- }
- for ( ; i < 10; i++)
- lname[i] = '\0';
- return(lname);
-}
-
-#include <sys/stat.h>
-#include <time.h> /* XXX */
-
-static void
-bcddate(toc)
- char *toc;
-{
- time_t now;
- struct tm *tm;
-
- time(&now);
- tm = localtime(&now);
- *toc = ((tm->tm_mon+1) / 10) << 4;
- *toc++ |= (tm->tm_mon+1) % 10;
- *toc = (tm->tm_mday / 10) << 4;
- *toc++ |= tm->tm_mday % 10;
- *toc = (tm->tm_year / 10) << 4;
- *toc++ |= tm->tm_year % 10;
- *toc = (tm->tm_hour / 10) << 4;
- *toc++ |= tm->tm_hour % 10;
- *toc = (tm->tm_min / 10) << 4;
- *toc++ |= tm->tm_min % 10;
- *toc = (tm->tm_sec / 10) << 4;
- *toc |= tm->tm_sec % 10;
-}
diff --git a/sys/arch/hp300/stand/libsa/Makefile b/sys/arch/hp300/stand/libsa/Makefile
index dfbbb802338..0cbacace464 100644
--- a/sys/arch/hp300/stand/libsa/Makefile
+++ b/sys/arch/hp300/stand/libsa/Makefile
@@ -1,10 +1,10 @@
-# $OpenBSD: Makefile,v 1.11 1997/09/14 07:02:04 downsj Exp $
+# $OpenBSD: Makefile,v 1.12 1999/08/16 09:43:09 downsj Exp $
LIB= sa
.PATH: ${.CURDIR}/../../../../lib/libsa
-CFLAGS= -O2 -msoft-float -D__INTERNAL_LIBSA_CREAD \
+CFLAGS= -O2 -msoft-float \
-I${.CURDIR} -I${.CURDIR}/../include -I${.CURDIR}/../.. \
-I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. \
-I${.CURDIR}/../../../../lib/libsa
@@ -15,7 +15,7 @@ SRCS= alloc.c devopen.c exit.c exec.c getfile.c gets.c globals.c \
# io routines
SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
- open.c read.c stat.c write.c cread.c
+ open.c read.c stat.c write.c
# network routines
SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c
diff --git a/sys/arch/hp300/stand/libsaz/Makefile b/sys/arch/hp300/stand/libsaz/Makefile
new file mode 100644
index 00000000000..116f29a52c2
--- /dev/null
+++ b/sys/arch/hp300/stand/libsaz/Makefile
@@ -0,0 +1,36 @@
+# $OpenBSD: Makefile,v 1.1 1999/08/16 09:43:10 downsj Exp $
+
+LIB= saz
+
+.PATH: ${.CURDIR}/../../../../lib/libsa ${.CURDIR}/../libsa
+
+CFLAGS= -O2 -msoft-float -D__INTERNAL_LIBSA_CREAD \
+ -I${.CURDIR} -I${.CURDIR}/../include -I${.CURDIR}/../.. \
+ -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. \
+ -I${.CURDIR}/../../../../lib/libsa
+
+# stand routines
+SRCS= alloc.c devopen.c exit.c exec.c getfile.c gets.c globals.c \
+ memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c
+
+# io routines
+SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
+ open.c read.c stat.c write.c cread.c
+
+# network routines
+SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c
+
+# network info services
+SRCS+= bootp.c bootparam.c rarp.c
+
+# boot filesystems
+SRCS+= ufs.c nfs.c rawfs.c cd9660.c
+
+${OBJS}: ${.CURDIR}/../Makefile.inc
+
+NOPROFILE=
+NOPIC=
+
+install:
+
+.include <bsd.lib.mk>
diff --git a/sys/arch/hp300/stand/mkboot/mkboot.c b/sys/arch/hp300/stand/mkboot/mkboot.c
index 7d664e15841..7d841da1619 100644
--- a/sys/arch/hp300/stand/mkboot/mkboot.c
+++ b/sys/arch/hp300/stand/mkboot/mkboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkboot.c,v 1.1 1997/07/14 08:14:53 downsj Exp $ */
+/* $OpenBSD: mkboot.c,v 1.2 1999/08/16 09:43:10 downsj Exp $ */
/*
* Copyright (c) 1990, 1993
@@ -46,7 +46,7 @@ static char copyright[] =
static char sccsid[] = "@(#)mkboot.c 7.2 (Berkeley) 12/16/90";
static char rcsid[] = "$NetBSD: mkboot.c,v 1.5 1994/10/26 07:27:45 cgd Exp $";
#endif
-static char rcsid[] = "$OpenBSD: mkboot.c,v 1.1 1997/07/14 08:14:53 downsj Exp $";
+static char rcsid[] = "$OpenBSD: mkboot.c,v 1.2 1999/08/16 09:43:10 downsj Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -156,7 +156,7 @@ main(argc, argv)
exit(1);
}
/* clear possibly unused directory entries */
- strncpy(lifd[1].dir_name, " ", 10);
+ bcopy(" ", lifd[1].dir_name, 10);
lifd[1].dir_type = -1;
lifd[1].dir_addr = 0;
lifd[1].dir_length = 0;
@@ -165,7 +165,7 @@ main(argc, argv)
lifd[7] = lifd[6] = lifd[5] = lifd[4] = lifd[3] = lifd[2] = lifd[1];
/* record volume info */
lifv.vol_id = VOL_ID;
- strncpy(lifv.vol_label, "BOOT43", 6);
+ bcopy("BOOT44", lifv.vol_label, 6);
lifv.vol_addr = btolifs(LIF_DIRSTART);
lifv.vol_oct = VOL_OCT;
lifv.vol_dirsize = btolifs(LIF_DIRSIZE);
@@ -174,7 +174,7 @@ main(argc, argv)
lseek(to, LIF_FILESTART, 0);
putfile(from1, to);
n = btolifs(ld.count + sizeof(ld));
- strcpy(lifd[0].dir_name, lifname(n1));
+ bcopy(lifname(n1), lifd[0].dir_name, 10);
lifd[0].dir_type = DIR_TYPE;
lifd[0].dir_addr = btolifs(LIF_FILESTART);
lifd[0].dir_length = n;
@@ -187,7 +187,7 @@ main(argc, argv)
lseek(to, LIF_FILESTART+lifstob(n), 0);
putfile(from2, to);
n = btolifs(ld.count + sizeof(ld));
- strcpy(lifd[1].dir_name, lifname(n2));
+ bcopy(lifname(n2), lifd[1].dir_name, 10);
lifd[1].dir_type = DIR_TYPE;
lifd[1].dir_addr = lifv.vol_length;
lifd[1].dir_length = n;
@@ -201,7 +201,7 @@ main(argc, argv)
lseek(to, LIF_FILESTART+lifstob(lifd[0].dir_length+n), 0);
putfile(from3, to);
n = btolifs(ld.count + sizeof(ld));
- strcpy(lifd[2].dir_name, lifname(n3));
+ bcopy(lifname(n3), lifd[2].dir_name, 10);
lifd[2].dir_type = DIR_TYPE;
lifd[2].dir_addr = lifv.vol_length;
lifd[2].dir_length = n;
@@ -296,7 +296,7 @@ lifname(str)
static char lname[10] = "SYS_XXXXX";
register int i;
- for (i = 4; i < 9; i++) {
+ for (i = 4; i < 10; i++) {
if (islower(*str))
lname[i] = toupper(*str);
else if (isalnum(*str) || *str == '_')
@@ -306,7 +306,7 @@ lifname(str)
str++;
}
for ( ; i < 10; i++)
- lname[i] = '\0';
+ lname[i] = ' ';
return(lname);
}
diff --git a/sys/arch/hp300/stand/stripboot/Makefile b/sys/arch/hp300/stand/stripboot/Makefile
deleted file mode 100644
index dd57bd3a818..00000000000
--- a/sys/arch/hp300/stand/stripboot/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 1997/09/14 12:54:26 downsj Exp $
-
-PROG= stripboot
-NOMAN=
-
-CFLAGS+= -I${.CURDIR}/../include
-
-${OBJS}: ${.CURDIR}/../Makefile.inc
-
-install:
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/hp300/stand/stripboot/stripboot.c b/sys/arch/hp300/stand/stripboot/stripboot.c
deleted file mode 100644
index e8d77677160..00000000000
--- a/sys/arch/hp300/stand/stripboot/stripboot.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* $OpenBSD: stripboot.c,v 1.1 1997/09/14 12:54:27 downsj Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * 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 by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
- *
- * @(#)mkboot.c 8.1 (Berkeley) 7/15/93
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1990, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)mkboot.c 7.2 (Berkeley) 12/16/90";
-#endif
-static char rcsid[] = "$OpenBSD: stripboot.c,v 1.1 1997/09/14 12:54:27 downsj Exp $";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/file.h>
-#include <a.out.h>
-
-#include "volhdr.h"
-
-#include <stdio.h>
-#include <ctype.h>
-
-/*
- * This does nothing but strip the a.out header from a boot file ala mkboot.
- */
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- int from, to;
- int n, tcnt, dcnt;
- struct load ld;
- struct exec ex;
- char buf[10240];
-
- if (argc != 3)
- usage();
-
- from = open(argv[1], O_RDONLY, 0600);
- if (from < 0) {
- perror(argv[1]);
- exit(1);
- }
- to = open(argv[2], O_WRONLY | O_TRUNC | O_CREAT, 0644);
- if (to < 0) {
- perror(argv[2]);
- exit(1);
- }
-
- n = read(from, &ex, sizeof(ex));
- if (n != sizeof(ex)) {
- fprintf(stderr, "error reading file header\n");
- exit(1);
- }
- if (N_GETMAGIC(ex) == OMAGIC) {
- tcnt = ex.a_text;
- dcnt = ex.a_data;
- }
- else if (N_GETMAGIC(ex) == NMAGIC) {
- tcnt = (ex.a_text + PGOFSET) & ~PGOFSET;
- dcnt = ex.a_data;
- }
- else {
- fprintf(stderr, "bad magic number\n");
- exit(1);
- }
- ld.address = ex.a_entry;
- ld.count = tcnt + dcnt;
- write(to, &ld, sizeof(ld));
- while (tcnt) {
- n = sizeof(buf);
- if (n > tcnt)
- n = tcnt;
- n = read(from, buf, n);
- if (n < 0) {
- perror("read");
- exit(1);
- }
- if (n == 0) {
- fprintf(stderr, "short read\n");
- exit(1);
- }
- if (write(to, buf, n) < 0) {
- perror("write");
- exit(1);
- }
- tcnt -= n;
- }
- while (dcnt) {
- n = sizeof(buf);
- if (n > dcnt)
- n = dcnt;
- n = read(from, buf, n);
- if (n < 0) {
- perror("read");
- exit(1);
- }
- if (n == 0) {
- fprintf(stderr, "short read\n");
- exit(1);
- }
- if (write(to, buf, n) < 0) {
- perror("write");
- exit(1);
- }
- dcnt -= n;
- }
-
- close(from);
- close(to);
-}
-
-usage()
-{
- fprintf(stderr,
- "usage: stripboot infile outfile\n");
- exit(1);
-}
diff --git a/sys/arch/hp300/stand/uboot/Makefile b/sys/arch/hp300/stand/uboot/Makefile
index 6ed1c44f26f..42d10186995 100644
--- a/sys/arch/hp300/stand/uboot/Makefile
+++ b/sys/arch/hp300/stand/uboot/Makefile
@@ -1,10 +1,10 @@
-# $OpenBSD: Makefile,v 1.2 1997/09/14 12:54:29 downsj Exp $
+# $OpenBSD: Makefile,v 1.3 1999/08/16 09:43:11 downsj Exp $
PROG= uboot
NOMAN=
-CFLAGS= -O3 -msoft-float -I${.CURDIR}/../include \
+CFLAGS= -O2 -msoft-float -I${.CURDIR}/../include \
-I${.CURDIR}/../libsa -I${.CURDIR}/../.. -I${.CURDIR}/../../.. \
-I${.CURDIR}/../../../..
@@ -14,30 +14,25 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -I${.CURDIR}/../include \
SRCS= srt0.S uboot.c tgets.c netio.c clock.c conf.c
-LIBS= ${LIBCOMMON} ${LIBSA} ${LIBZ} ${LIBKERN}
+LIBS= ${LIBCOMMON} ${LIBSAZ} ${LIBZ} ${LIBKERN}
${OBJS}: ${.CURDIR}/../Makefile.inc
-CLEANFILES+= uboot.lif uboot.raw
+CLEANFILES+= uboot.lif
uboot.lif: uboot
${MKBOOT_PROG} uboot $@
-uboot.raw: uboot
- ${STRIPBOOT_PROG} uboot $@
-
uboot: ${OBJS} ${LIBS}
${LD} -N -T ${RELOC} -e begin ${OBJS} ${LIBS} -o $@
@size $@
@echo $@ total size should not exceed 1044480 bytes
-install: uboot.lif uboot.raw ${MKBOOT_PROG}
+install: uboot.lif ${MKBOOT_PROG}
${INSTALL} -d -m 755 -o ${BINOWN} -g ${BINGRP} \
${DESTDIR}/usr/mdec/rbootd
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 uboot.lif \
${DESTDIR}/usr/mdec
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 uboot.raw \
- ${DESTDIR}/usr/mdec
rm -f ${DESTDIR}/usr/mdec/hdboot
ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/hdboot
rm -f ${DESTDIR}/usr/mdec/boothd