Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sun68k/stand Removed the old installboot, we now us...



details:   https://anonhg.NetBSD.org/src/rev/a6041767f2cd
branches:  trunk
changeset: 525983:a6041767f2cd
user:      fredette <fredette%NetBSD.org@localhost>
date:      Mon Apr 22 21:15:40 2002 +0000

description:
Removed the old installboot, we now use the new /usr/sbin/installboot.
Now install a raw binary version of bootxx, since that's what this
new installboot expects.

diffstat:

 sys/arch/sun68k/stand/Makefile                  |    4 +-
 sys/arch/sun68k/stand/bootxx/Makefile           |    7 +-
 sys/arch/sun68k/stand/installboot/Makefile      |   22 -
 sys/arch/sun68k/stand/installboot/installboot.c |  347 ------------------------
 4 files changed, 3 insertions(+), 377 deletions(-)

diffs (truncated from 406 to 300 lines):

diff -r 3f3c8b55a0a0 -r a6041767f2cd sys/arch/sun68k/stand/Makefile
--- a/sys/arch/sun68k/stand/Makefile    Mon Apr 22 21:13:34 2002 +0000
+++ b/sys/arch/sun68k/stand/Makefile    Mon Apr 22 21:15:40 2002 +0000
@@ -1,5 +1,5 @@
-#      $NetBSD: Makefile,v 1.1 2001/06/14 12:57:12 fredette Exp $
+#      $NetBSD: Makefile,v 1.2 2002/04/22 21:15:40 fredette Exp $
 
-SUBDIR= installboot libsa bootxx bootyy ufsboot netboot tapeboot
+SUBDIR= libsa bootxx bootyy ufsboot netboot tapeboot
 
 .include <bsd.subdir.mk>
diff -r 3f3c8b55a0a0 -r a6041767f2cd sys/arch/sun68k/stand/bootxx/Makefile
--- a/sys/arch/sun68k/stand/bootxx/Makefile     Mon Apr 22 21:13:34 2002 +0000
+++ b/sys/arch/sun68k/stand/bootxx/Makefile     Mon Apr 22 21:15:40 2002 +0000
@@ -1,13 +1,8 @@
-#      $NetBSD: Makefile,v 1.3 2002/02/09 09:36:02 lukem Exp $
+#      $NetBSD: Makefile,v 1.4 2002/04/22 21:15:41 fredette Exp $
 
 SA_PROG= bootxx
 SRCS=   bootxx.c conf.c
 
-# Do not strip or remove a.out header for this one.
-proginstall: ${SA_PROG}
-       ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
-               ${SA_PROG} ${DESTDIR}${MDEC_DIR}/${SA_PROG}
-
 PROG=  ${SA_PROG}
 NOMAN= # defined
 
diff -r 3f3c8b55a0a0 -r a6041767f2cd sys/arch/sun68k/stand/installboot/Makefile
--- a/sys/arch/sun68k/stand/installboot/Makefile        Mon Apr 22 21:13:34 2002 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#      $NetBSD: Makefile,v 1.6 2001/12/15 23:09:51 fredette Exp $
-
-NOMAN= # defined
-
-.include <bsd.own.mk>
-
-PROG=  installboot
-BINDIR=/usr/mdec
-S= ${.CURDIR}/../../../..
-LIBSA=${S}/lib/libsa
-CPPFLAGS+= -I${LIBSA} -I. -I${.CURDIR}/../libsa
-WARNS?= 1
-
-# Need this to work in the miniroot
-LDSTATIC?=     -static
-
-.PATH.c: ${LIBSA} ${S}/ufs/ffs
-
-SRCS=  installboot.c byteorder.c ffs_bswap.c \
-       loadfile.c loadfile_aout.c loadfile_elf32.c
-
-.include <bsd.prog.mk>
diff -r 3f3c8b55a0a0 -r a6041767f2cd sys/arch/sun68k/stand/installboot/installboot.c
--- a/sys/arch/sun68k/stand/installboot/installboot.c   Mon Apr 22 21:13:34 2002 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,347 +0,0 @@
-/*     $NetBSD: installboot.c,v 1.3 2001/12/17 21:55:13 fredette Exp $ */
-
-/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Paul Kranenburg.
- *
- * 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 NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <ufs/ufs/dinode.h>
-#include <ufs/ufs/dir.h>
-#include <ufs/ffs/fs.h>
-#include <ufs/ffs/ffs_extern.h>
-#include <err.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "loadfile.h"
-#include "byteorder.h"
-#include "bbinfo.h"
-
-int    verbose, nowrite;
-char   *boot, *proto, *dev;
-
-struct bbinfo *bbinfop;                /* bbinfo in prototype image */
-
-int32_t        max_block_count;
-
-char           *loadprotoblocks __P((char *, size_t *));
-int            loadblocknums __P((char *, int));
-static void    devread __P((int, void *, daddr_t, size_t, char *));
-static void    usage __P((void));
-int            main __P((int, char *[]));
-
-static void
-usage()
-{
-       fprintf(stderr,
-               "usage: installboot [-n] [-v] [-h] <boot> <proto> <device>\n");
-       exit(1);
-}
-
-int
-main(argc, argv)
-       int argc;
-       char *argv[];
-{
-       int     c;
-       int     devfd;
-       char    *protostore;
-       size_t  protosize;
-
-       while ((c = getopt(argc, argv, "vnh")) != -1) {
-               switch (c) {
-               case 'h':
-                       /* Don't strip a.out header */
-                       warnx("-h option is obsolete");
-                       break;
-               case 'n':
-                       /* Do not actually write the bootblock to disk */
-                       nowrite = 1;
-                       break;
-               case 'v':
-                       /* Chat */
-                       verbose = 1;
-                       break;
-               default:
-                       usage();
-               }
-       }
-
-       if (argc - optind < 3) {
-               usage();
-       }
-
-       boot = argv[optind];
-       proto = argv[optind + 1];
-       dev = argv[optind + 2];
-
-       if (verbose) {
-               printf("boot: %s\n", boot);
-               printf("proto: %s\n", proto);
-               printf("device: %s\n", dev);
-       }
-
-       /* Load proto blocks into core */
-       if ((protostore = loadprotoblocks(proto, &protosize)) == NULL)
-               exit(1);
-
-       if (protosize & (DEV_BSIZE - 1))
-               err(1, "proto bootblock bad size=%lu", (u_long)protosize);
-
-       /* Open and check raw disk device */
-       if ((devfd = open(dev, O_RDONLY, 0)) < 0)
-               err(1, "open: %s", dev);
-
-       /* Extract and load block numbers */
-       if (loadblocknums(boot, devfd) != 0)
-               exit(1);
-
-       (void)close(devfd);
-
-       if (nowrite)
-               return 0;
-
-       /* Write patched proto bootblocks into the superblock */
-       if (protosize > SBSIZE - DEV_BSIZE)
-               errx(1, "proto bootblocks too big");
-
-       if ((devfd = open(dev, O_RDWR, 0)) < 0)
-               err(1, "open: %s", dev);
-
-       if (lseek(devfd, DEV_BSIZE, SEEK_SET) != DEV_BSIZE)
-               err(1, "lseek bootstrap");
-
-       /* Sync filesystems (to clean in-memory superblock?) */
-       sync();
-
-       if (write(devfd, protostore, protosize) != protosize)
-               err(1, "write bootstrap");
-       (void)close(devfd);
-       return 0;
-}
-
-char *
-loadprotoblocks(fname, size)
-       char *fname;
-       size_t *size;
-{
-       int     fd, sz;
-       u_long  ap, bp, st, en, bbi;
-       u_long  marks[MARK_MAX];
-
-       marks[MARK_START] = 0;
-       if ((fd = loadfile(fname, marks, COUNT_TEXT|COUNT_DATA)) == -1)
-               return NULL;
-       (void)close(fd);
-
-       sz = (marks[MARK_END] - marks[MARK_START]);
-       sz = roundup(sz, DEV_BSIZE);
-       st = marks[MARK_START];
-       en = marks[MARK_ENTRY];
-
-       if ((ap = (u_long)malloc(sz)) == NULL) {
-               warn("malloc: %s", "");
-               return NULL;
-       }
-
-       bp = ap;
-       marks[MARK_START] = bp - st;
-       if ((fd = loadfile(fname, marks, LOAD_TEXT|LOAD_DATA)) == -1)
-               return NULL;
-       (void)close(fd);
-
-       /* Look for the bbinfo structure. */
-       for (bbi = bp; bbi < (bp + sz); bbi += sizeof(uint32_t)) {
-               bbinfop = (void *) bbi;
-               if (memcmp(bbinfop->bbi_magic, BBINFO_MAGIC,
-                           BBINFO_MAGICSIZE) == 0)
-               break;
-       }
-       if (bbi >= (bp + sz)) {
-               warn("%s: unable to locate bbinfo structure\n", fname);
-               free((void *)ap);
-               return NULL;
-       }
-
-       max_block_count = sa_be32toh(bbinfop->bbi_block_count);
-
-       if (verbose) {
-               printf("%s: entry point %#lx\n", fname, en);
-               printf("proto bootblock size %d\n", sz);
-               printf("room for %d filesystem blocks at %#lx\n",
-                       max_block_count,
-                       bbi - bp + offsetof(struct bbinfo, bbi_block_table));
-       }
-
-       *size = sz;
-       return (char *)ap;
-}
-
-static void
-devread(fd, buf, blk, size, msg)
-       int     fd;
-       void    *buf;
-       daddr_t blk;
-       size_t  size;
-       char    *msg;
-{
-       if (lseek(fd, dbtob(blk), SEEK_SET) != dbtob(blk))
-               err(1, "%s: devread: lseek", msg);
-
-       if (read(fd, buf, size) != size)
-               err(1, "%s: devread: read", msg);
-}
-
-static char sblock[SBSIZE];
-
-int
-loadblocknums(boot, devfd)
-char   *boot;
-int    devfd;
-{
-       int             i, fd;



Home | Main Index | Thread Index | Old Index