Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/stand nuke MD installboot (ok-ed by thorpej)



details:   https://anonhg.NetBSD.org/src/rev/87e1553f4a19
branches:  trunk
changeset: 526674:87e1553f4a19
user:      lukem <lukem%NetBSD.org@localhost>
date:      Wed May 08 04:09:46 2002 +0000

description:
nuke MD installboot (ok-ed by thorpej)

diffstat:

 sys/arch/alpha/stand/Makefile                  |    4 +-
 sys/arch/alpha/stand/installboot/Makefile      |    5 -
 sys/arch/alpha/stand/installboot/installboot.c |  461 -------------------------
 3 files changed, 2 insertions(+), 468 deletions(-)

diffs (truncated from 486 to 300 lines):

diff -r 000507d8b223 -r 87e1553f4a19 sys/arch/alpha/stand/Makefile
--- a/sys/arch/alpha/stand/Makefile     Wed May 08 04:05:41 2002 +0000
+++ b/sys/arch/alpha/stand/Makefile     Wed May 08 04:09:46 2002 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.14 2002/05/03 15:36:52 lukem Exp $
+# $NetBSD: Makefile,v 1.15 2002/05/08 04:09:46 lukem Exp $
 
-SUBDIR=                installboot mkbootimage setnetbootinfo
+SUBDIR=                mkbootimage setnetbootinfo
 SUBDIR+=       boot bootxx_cd9660 bootxx_ffs bootxx_lfs netboot ustarboot
 
 .include <bsd.subdir.mk>
diff -r 000507d8b223 -r 87e1553f4a19 sys/arch/alpha/stand/installboot/Makefile
--- a/sys/arch/alpha/stand/installboot/Makefile Wed May 08 04:05:41 2002 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-# $NetBSD: Makefile,v 1.12 1999/04/05 03:07:37 cgd Exp $
-
-PROG=  installboot
-
-.include <bsd.prog.mk>
diff -r 000507d8b223 -r 87e1553f4a19 sys/arch/alpha/stand/installboot/installboot.c
--- a/sys/arch/alpha/stand/installboot/installboot.c    Wed May 08 04:05:41 2002 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,461 +0,0 @@
-/* $NetBSD: installboot.c,v 1.24 2002/04/03 06:16:02 lukem Exp $ */
-
-/*
- * Copyright (c) 1999 Ross Harvey.  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 Ross Harvey
- *     for the NetBSD Project.
- * 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) 1999 Christopher G. Demetriou.  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 Christopher G. Demetriou
- *     for the NetBSD Project.
- * 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.
- */
-
-#include <sys/param.h>         /* XXX for roundup, howmany */
-#include <sys/stat.h>
-#include <sys/disklabel.h>
-#include <dev/sun/disklabel.h>
-#include <assert.h>
-#include <err.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <dev/dec/dec_boot.h>
-
-static void usage(void);
-static void clr_bootstrap(const char *disk);
-void check_sparc(const struct alpha_boot_block * const, const char *);
-static u_int16_t compute_sparc(const u_int16_t *);
-static void sun_bootstrap(struct alpha_boot_block * const);
-static void set_bootstrap(const char *disk, const char *bootstrap);
-
-int sunrewrite, sunflag, verbose, nowrite;
-
-static void
-usage()
-{
-       fprintf(stderr, "usage:\n");
-       fprintf(stderr, "\t%s [-nsv] disk bootstrap\n", getprogname());
-       fprintf(stderr, "\t%s [-nsv] -c disk\n", getprogname());
-       exit(EXIT_FAILURE);
-}
-
-int
-main(int argc, char **argv)
-{
-       const char *disk, *bootstrap;
-       int c, clearflag;
-
-       clearflag = verbose = nowrite = 0;
-
-       while ((c = getopt(argc, argv, "cnsSv")) != -1) {
-               switch (c) {
-               case 'c':
-                       /* Clear any existing boot block */
-                       if (sunflag)
-                               goto argdeath;
-                       clearflag = 1;
-                       break;
-               case 'n':
-                       /* Do not actually write the boot file */
-                       nowrite = 1;
-                       break;
-               case 'S':
-                       /* undocumented transition period fixup flag */
-                       sunrewrite = 1;
-                       /* fall thru */
-               case 's':
-                       /*
-                        * Sun checksum and magic number overlay
-                        */
-                       if (clearflag)
-                               goto argdeath;
-                       sunflag = 1;
-                       break;
-               case 'v':
-                       /* Chat */
-                       verbose = 1;
-                       break;
-               default:
-                       usage();
-               }
-       }
-
-       argc -= optind;
-       argv += optind;
-
-       if (sunrewrite) {
-               if(argc != 1)
-                       usage();
-       } else if ((clearflag && argc != 1) || (!clearflag && argc != 2))
-               usage();
-
-       disk = argv[0];
-       bootstrap = argv[1];            /* NULL if argc == 1 */
-
-       if (verbose) {
-               fprintf(stderr, "disk: %s\n", disk);
-               fprintf(stderr, "bootstrap: %s\n",
-                   bootstrap != NULL ? bootstrap : "to be cleared");
-       }
-       if (sizeof (struct alpha_boot_block) != ALPHA_BOOT_BLOCK_BLOCKSIZE)
-               errx(EXIT_FAILURE,
-                   "alpha_boot_block structure badly sized (build error)");
-
-       if (clearflag)
-               clr_bootstrap(disk);
-       else
-               set_bootstrap(disk, bootstrap);
-
-       exit(EXIT_SUCCESS);
-argdeath:
-       errx(EXIT_FAILURE, "incompatible options");
-}
-
-static void
-clr_bootstrap(const char *disk)
-{
-       struct alpha_boot_block bb;
-       u_int64_t cksum;
-       ssize_t rv;
-       int diskfd;
-
-       if ((diskfd = open(disk, nowrite ? O_RDONLY : O_RDWR)) == -1)
-               err(EXIT_FAILURE, "open %s", disk);
-
-       rv = pread(diskfd, &bb, sizeof bb, ALPHA_BOOT_BLOCK_OFFSET);
-       if (rv == -1)
-               err(EXIT_FAILURE, "read %s", disk);
-       else if (rv != sizeof bb)
-               errx(EXIT_FAILURE, "read %s: short read", disk);
-
-       ALPHA_BOOT_BLOCK_CKSUM(&bb, &cksum);
-       if (cksum != bb.bb_cksum) {
-               fprintf(stderr,
-                   "old boot block checksum invalid (was %#llx,"
-                   " calculated %#llx)\n",
-                   (unsigned long long)bb.bb_cksum,
-                   (unsigned long long)cksum);
-               fprintf(stderr, "boot block invalid\n");
-               goto done;
-       } else if (verbose) {
-               fprintf(stderr, "old boot block checksum: %#llx\n",
-                   (unsigned long long)bb.bb_cksum);
-               fprintf(stderr, "old boot block start sector: %#llx\n",
-                   (unsigned long long)bb.bb_secstart);
-               fprintf(stderr, "old boot block size: %#llx\n",
-                   (unsigned long long)bb.bb_secsize);
-       }
-
-       bb.bb_secstart = bb.bb_secsize = bb.bb_flags = 0;
-       ALPHA_BOOT_BLOCK_CKSUM(&bb, &bb.bb_cksum);
-
-       fprintf(stderr, "new boot block checksum: %#llx\n",
-           (unsigned long long)bb.bb_cksum);
-       fprintf(stderr, "new boot block start sector: %#llx\n",
-           (unsigned long long)bb.bb_secstart);
-       fprintf(stderr, "new boot block size: %#llx\n",
-           (unsigned long long)bb.bb_secsize);
-
-       if (nowrite) {
-           if (verbose)
-                   fprintf(stderr, "not writing\n");
-           goto done;
-       }
-
-       if (verbose)
-               fprintf(stderr, "writing\n");
-       
-       rv = pwrite(diskfd, &bb, sizeof bb, ALPHA_BOOT_BLOCK_OFFSET);
-       if (rv == -1)
-               err(EXIT_FAILURE, "write %s", disk);
-       else if (rv != sizeof bb)
-               errx(EXIT_FAILURE, "write %s: short write", disk);
-
-done:
-       (void)close(diskfd);
-}
-
-static void
-set_bootstrap(const char *disk, const char *bootstrap)
-{
-       struct stat bootstrapsb;
-       struct alpha_boot_block bb;
-       int bootstrapfd, diskfd;
-       char *bootstrapbuf;
-       size_t bootstrapsize;
-       ssize_t rv;
-
-       if (sunrewrite)
-               goto bbonly;
-       /* Open the input file and check it out */
-       if ((bootstrapfd = open(bootstrap, O_RDONLY)) == -1)
-               err(EXIT_FAILURE, "open %s", bootstrap);
-       if (fstat(bootstrapfd, &bootstrapsb) == -1)
-               err(EXIT_FAILURE, "fstat %s", bootstrap);
-       if (!S_ISREG(bootstrapsb.st_mode))
-               errx(EXIT_FAILURE, "%s must be a regular file", bootstrap);
-
-       /*
-        * Allocate a buffer, with space to round up the input file
-        * to the next block size boundary, and with space for the boot
-        * block. 
-        */
-       bootstrapsize = roundup(bootstrapsb.st_size,
-           ALPHA_BOOT_BLOCK_BLOCKSIZE);
-
-       bootstrapbuf = malloc(bootstrapsize);
-       if (bootstrapbuf == NULL)
-               err(EXIT_FAILURE, "allocating buffer to hold bootstrap");
-       memset(bootstrapbuf, 0, bootstrapsize);
-
-       /* read the file into the buffer */
-       rv = read(bootstrapfd, bootstrapbuf, bootstrapsb.st_size);
-       if (rv == -1)
-               err(EXIT_FAILURE, "read %s", bootstrap);
-       else if (rv != bootstrapsb.st_size)
-               errx(EXIT_FAILURE, "read %s: short read", bootstrap);
-       (void)close(bootstrapfd);
-
-bbonly:
-       if ((diskfd = open(disk, nowrite ? O_RDONLY : O_RDWR)) == -1)
-               err(EXIT_FAILURE, "open %s", disk);
-



Home | Main Index | Thread Index | Old Index