diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1997-09-14 12:54:30 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1997-09-14 12:54:30 +0000 |
commit | bd7544914aa4c8ec96723bbdd0a5885a7f88993f (patch) | |
tree | 0303481779e4d71d485dbc49c87b6431c57e672c | |
parent | a7162cd6abe395805da2514f42bca4d6e1ebe610 (diff) |
Make and install a raw version of uboot, too.
-rw-r--r-- | sys/arch/hp300/stand/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/hp300/stand/Makefile.inc | 19 | ||||
-rw-r--r-- | sys/arch/hp300/stand/common/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/hp300/stand/common/sd.c | 10 | ||||
-rw-r--r-- | sys/arch/hp300/stand/stripboot/Makefile | 12 | ||||
-rw-r--r-- | sys/arch/hp300/stand/stripboot/stripboot.c | 156 | ||||
-rw-r--r-- | sys/arch/hp300/stand/uboot/Makefile | 11 |
7 files changed, 206 insertions, 10 deletions
diff --git a/sys/arch/hp300/stand/Makefile b/sys/arch/hp300/stand/Makefile index 0942ebce943..c3914d4de5d 100644 --- a/sys/arch/hp300/stand/Makefile +++ b/sys/arch/hp300/stand/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.12 1997/07/14 08:13:24 downsj Exp $ +# $OpenBSD: Makefile,v 1.13 1997/09/14 12:54:19 downsj Exp $ # $NetBSD: Makefile,v 1.23 1997/02/04 03:51:37 thorpej Exp $ -SUBDIR= libsa libkern libz common mkboot uboot installboot +SUBDIR= libsa libkern libz common mkboot stripboot uboot installboot .include <bsd.subdir.mk> diff --git a/sys/arch/hp300/stand/Makefile.inc b/sys/arch/hp300/stand/Makefile.inc index 4cb194fad37..e5096129e11 100644 --- a/sys/arch/hp300/stand/Makefile.inc +++ b/sys/arch/hp300/stand/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.1 1997/07/14 08:13:25 downsj Exp $ +# $OpenBSD: Makefile.inc,v 1.2 1997/09/14 12:54:20 downsj Exp $ # $NetBSD: Makefile.inc,v 1.7 1997/05/12 07:43:18 thorpej Exp $ BINDIR= /usr/mdec @@ -80,6 +80,23 @@ MKBOOTOBJDIR= ${MKBOOTDIR} MKBOOT_PROG= ${MKBOOTOBJDIR}/mkboot +### Figure out what to use for stripboot +STRIPBOOTDIR= ${.CURDIR}/../stripboot + +.if exists(${STRIPBOOTDIR}/obj.${MACHINE}) +STRIPBOOTOBJDIR= ${STRIPBOOTDIR}/obj.${MACHINE} +.elif exists(${STRIPBOOTDIR}/obj) +STRIPBOOTOBJDIR= ${STRIPBOOTDIR}/obj +.else +STRIPBOOTOBJDIR= ${STRIPBOOTDIR} +.endif + +STRIPBOOT_PROG= ${STRIPBOOTOBJDIR}/stripboot + # Make sure ${MKBOOT_PROG} is always available ${MKBOOT_PROG}: @cd ${MKBOOTDIR} && make depend && make + +# Make sure ${STRIPBOOT_PROG} is always available +${STRIPBOOT_PROG}: + @cd ${STRIPBOOTDIR} && make depend && make diff --git a/sys/arch/hp300/stand/common/Makefile b/sys/arch/hp300/stand/common/Makefile index ec15758d024..79a2a66cb10 100644 --- a/sys/arch/hp300/stand/common/Makefile +++ b/sys/arch/hp300/stand/common/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 1997/07/14 08:23:51 downsj Exp $ +# $OpenBSD: Makefile,v 1.3 1997/09/14 12:54:22 downsj Exp $ LIB= common @@ -10,7 +10,7 @@ SRCS= apci.c autoconf.c cons.c ct.c dca.c dcm.c dnkbd.c \ nhpib.c prf.c scsi.c sd.c version.c CFLAGS= -O3 -msoft-float -I${.CURDIR}/../include \ - -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. + -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. -DCD9660_DUMMYLABEL ${OBJS}: ${.CURDIR}/../Makefile.inc diff --git a/sys/arch/hp300/stand/common/sd.c b/sys/arch/hp300/stand/common/sd.c index e27eb8f1978..4c2a946bf30 100644 --- a/sys/arch/hp300/stand/common/sd.c +++ b/sys/arch/hp300/stand/common/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.1 1997/07/14 08:14:29 downsj Exp $ */ +/* $OpenBSD: sd.c,v 1.2 1997/09/14 12:54:24 downsj Exp $ */ /* $NetBSD: sd.c,v 1.9 1996/12/21 21:34:41 thorpej Exp $ */ /* @@ -149,7 +149,13 @@ sdgetinfo(ss) ss->sc_ctlr, ss->sc_unit, ss->sc_part, msg); printf("defining `c' partition as entire disk\n"); pi->npart = 3; - pi->offset[0] = pi->offset[1] = -1; +#ifdef CD9660_DUMMYLABEL + pi->offset[0] = 0; + lp->d_partitions[0].p_fstype = FS_ISO9660; /* just for kicks */ +#else + pi->offset[0] = -1; +#endif + pi->offset[1] = -1; pi->offset[2] = 0; } else { pi->npart = lp->d_npartitions; diff --git a/sys/arch/hp300/stand/stripboot/Makefile b/sys/arch/hp300/stand/stripboot/Makefile new file mode 100644 index 00000000000..dd57bd3a818 --- /dev/null +++ b/sys/arch/hp300/stand/stripboot/Makefile @@ -0,0 +1,12 @@ +# $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 new file mode 100644 index 00000000000..e8d77677160 --- /dev/null +++ b/sys/arch/hp300/stand/stripboot/stripboot.c @@ -0,0 +1,156 @@ +/* $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 1f7afacb273..6ed1c44f26f 100644 --- a/sys/arch/hp300/stand/uboot/Makefile +++ b/sys/arch/hp300/stand/uboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 1997/07/14 08:14:54 downsj Exp $ +# $OpenBSD: Makefile,v 1.2 1997/09/14 12:54:29 downsj Exp $ PROG= uboot @@ -18,21 +18,26 @@ LIBS= ${LIBCOMMON} ${LIBSA} ${LIBZ} ${LIBKERN} ${OBJS}: ${.CURDIR}/../Makefile.inc -CLEANFILES+= uboot.lif +CLEANFILES+= uboot.lif uboot.raw 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 ${MKBOOT_PROG} +install: uboot.lif uboot.raw ${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 |