Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/installboot - support optional secondary bootstrap ...



details:   https://anonhg.NetBSD.org/src/rev/2a0994bd8602
branches:  trunk
changeset: 525494:2a0994bd8602
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Apr 12 06:50:41 2002 +0000

description:
- support optional secondary bootstrap arg for install (unused by
  existing backends, but future ones need it)
- use "bootstrap" instead of "boot block" in various messages where appropriate
- rename some members of ib_params

diffstat:

 usr.sbin/installboot/arch/alpha.c   |  36 +++++++++++++++---------------
 usr.sbin/installboot/arch/pmax.c    |  30 ++++++++++++------------
 usr.sbin/installboot/arch/sparc64.c |  16 ++++++------
 usr.sbin/installboot/arch/vax.c     |  22 +++++++++---------
 usr.sbin/installboot/installboot.8  |  13 ++++++-----
 usr.sbin/installboot/installboot.c  |  43 +++++++++++++++++++++---------------
 usr.sbin/installboot/installboot.h  |   7 +++--
 7 files changed, 88 insertions(+), 79 deletions(-)

diffs (truncated from 511 to 300 lines):

diff -r bfbccd862232 -r 2a0994bd8602 usr.sbin/installboot/arch/alpha.c
--- a/usr.sbin/installboot/arch/alpha.c Fri Apr 12 06:21:57 2002 +0000
+++ b/usr.sbin/installboot/arch/alpha.c Fri Apr 12 06:50:41 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: alpha.c,v 1.4 2002/04/11 08:02:27 lukem Exp $  */
+/*     $NetBSD: alpha.c,v 1.5 2002/04/12 06:50:41 lukem Exp $  */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -98,7 +98,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: alpha.c,v 1.4 2002/04/11 08:02:27 lukem Exp $");
+__RCSID("$NetBSD: alpha.c,v 1.5 2002/04/12 06:50:41 lukem Exp $");
 #endif /* !__lint */
 
 #include <sys/param.h>
@@ -175,11 +175,11 @@
        }
 
        if (params->flags & IB_VERBOSE) {
-               printf("Old boot block start sector: %#llx\n",
+               printf("Old bootstrap start sector: %#llx\n",
                    (unsigned long long)le64toh(bb.bb_secstart));
-               printf("Old boot block size:         %#llx\n",
+               printf("Old bootstrap size:         %#llx\n",
                    (unsigned long long)le64toh(bb.bb_secsize));
-               printf("Old boot block checksum:     %#llx\n",
+               printf("Old bootstrap checksum:     %#llx\n",
                    (unsigned long long)bb.bb_cksum);
        }
 
@@ -189,11 +189,11 @@
        if (params->flags & IB_SUNSUM)
                sun_bootstrap(params, &bb);
 
-       printf("New boot block start sector: %#llx\n",
+       printf("New bootstrap start sector: %#llx\n",
            (unsigned long long)le64toh(bb.bb_secstart));
-       printf("New boot block size:         %#llx\n",
+       printf("New bootstrap size:         %#llx\n",
            (unsigned long long)le64toh(bb.bb_secsize));
-       printf("New boot block checksum:     %#llx\n",
+       printf("New bootstrap checksum:     %#llx\n",
            (unsigned long long)bb.bb_cksum);
 
        if (params->flags & IB_VERBOSE)
@@ -228,8 +228,8 @@
        assert(params != NULL);
        assert(params->fsfd != -1);
        assert(params->filesystem != NULL);
-       assert(params->bbfd != -1);
-       assert(params->bootblock != NULL);
+       assert(params->s1fd != -1);
+       assert(params->stage1 != NULL);
        assert(sizeof(struct alpha_boot_block) == ALPHA_BOOT_BLOCK_BLOCKSIZE);
 
        retval = 0;
@@ -241,12 +241,12 @@
                goto done;
        }
 
-       if (fstat(params->bbfd, &bootstrapsb) == -1) {
-               warn("Examining `%s'", params->bootblock);
+       if (fstat(params->s1fd, &bootstrapsb) == -1) {
+               warn("Examining `%s'", params->stage1);
                goto done;
        }
        if (!S_ISREG(bootstrapsb.st_mode)) {
-               warnx("`%s' must be a regular file", params->bootblock);
+               warnx("`%s' must be a regular file", params->stage1);
                goto done;
        }
        /*
@@ -265,12 +265,12 @@
        memset(bootstrapbuf, 0, bootstrapsize);
 
        /* read the file into the buffer */
-       rv = pread(params->bbfd, bootstrapbuf, bootstrapsb.st_size, 0);
+       rv = pread(params->s1fd, bootstrapbuf, bootstrapsb.st_size, 0);
        if (rv == -1) {
-               warn("Reading `%s'", params->bootblock);
+               warn("Reading `%s'", params->stage1);
                return (0);
        } else if (rv != bootstrapsb.st_size) {
-               warnx("Reading `%s': short read", params->bootblock);
+               warnx("Reading `%s': short read", params->stage1);
                return (0);
        }
 
@@ -286,7 +286,7 @@
        if (params->flags & IB_SUNSUM)
                check_sparc(&bb, "Initial");
 
-               /* fill in the updated boot block fields */
+               /* fill in the updated bootstrap fields */
        if (params->flags & IB_APPEND) {
                struct stat     filesyssb;
 
@@ -296,7 +296,7 @@
                }
                if (!S_ISREG(filesyssb.st_mode)) {
                        warnx(
-                   "`%s' must be a regular file to append a boot block",
+                   "`%s' must be a regular file to append a bootstrap",
                            params->filesystem);
                        goto done;
                }
diff -r bfbccd862232 -r 2a0994bd8602 usr.sbin/installboot/arch/pmax.c
--- a/usr.sbin/installboot/arch/pmax.c  Fri Apr 12 06:21:57 2002 +0000
+++ b/usr.sbin/installboot/arch/pmax.c  Fri Apr 12 06:50:41 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmax.c,v 1.2 2002/04/09 02:06:29 thorpej Exp $ */
+/*     $NetBSD: pmax.c,v 1.3 2002/04/12 06:50:41 lukem Exp $   */
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: pmax.c,v 1.2 2002/04/09 02:06:29 thorpej Exp $");
+__RCSID("$NetBSD: pmax.c,v 1.3 2002/04/12 06:50:41 lukem Exp $");
 #endif /* !__lint */
 
 #include <sys/param.h>
@@ -211,8 +211,8 @@
        assert(params != NULL);
        assert(params->fsfd != -1);
        assert(params->filesystem != NULL);
-       assert(params->bbfd != -1);
-       assert(params->bootblock != NULL);
+       assert(params->s1fd != -1);
+       assert(params->stage1 != NULL);
        assert(sizeof(struct pmax_boot_block) == PMAX_BOOT_BLOCK_BLOCKSIZE);
 
        retval = 0;
@@ -224,12 +224,12 @@
                goto done;
        }
 
-       if (fstat(params->bbfd, &bootstrapsb) == -1) {
-               warn("Examining `%s'", params->bootblock);
+       if (fstat(params->s1fd, &bootstrapsb) == -1) {
+               warn("Examining `%s'", params->stage1);
                goto done;
        }
        if (!S_ISREG(bootstrapsb.st_mode)) {
-               warnx("`%s' must be a regular file", params->bootblock);
+               warnx("`%s' must be a regular file", params->stage1);
                goto done;
        }
        if (! load_bootstrap(params, &bootstrapbuf, &bootstrapload,
@@ -255,7 +255,7 @@
                }
                if (!S_ISREG(filesyssb.st_mode)) {
                        warnx(
-                   "`%s' must be a regular file to append a boot block",
+                   "`%s' must be a regular file to append a bootstrap",
                            params->filesystem);
                        goto done;
                }
@@ -348,13 +348,13 @@
        Elf32_Phdr      phdr;
        struct seglist  seglist[MAX_SEGMENTS];
 
-       if ((pread(params->bbfd, &ehdr, sizeof(ehdr), 0)) != sizeof(ehdr)) {
-               warn("Reading `%s'", params->bootblock);
+       if ((pread(params->s1fd, &ehdr, sizeof(ehdr), 0)) != sizeof(ehdr)) {
+               warn("Reading `%s'", params->stage1);
                return (0);
        }
        if ((memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) ||
            (ehdr.e_ident[EI_CLASS] != ELFCLASS32)) {
-               warnx("No ELF header in `%s'", params->bootblock);
+               warnx("No ELF header in `%s'", params->stage1);
                return (0);
        }
 
@@ -362,10 +362,10 @@
        lowaddr = (u_int32_t) ULONG_MAX;
 
        for (i = 0; i < le16toh(ehdr.e_phnum); i++) {
-               if (pread(params->bbfd, &phdr, sizeof(phdr),
+               if (pread(params->s1fd, &phdr, sizeof(phdr),
                    (off_t) le32toh(ehdr.e_phoff) + i * sizeof(phdr))
                    != sizeof(phdr)) {
-                       warn("Reading `%s'", params->bootblock);
+                       warn("Reading `%s'", params->stage1);
                        return (0);
                }
                if (le32toh(phdr.p_type) != PT_LOAD)
@@ -393,10 +393,10 @@
 
        /* Now load the bootstrap into memory */
        for (i = 0; i < nsegs; i++) {
-               if (pread(params->bbfd, *data + seglist[i].addr - lowaddr,
+               if (pread(params->s1fd, *data + seglist[i].addr - lowaddr,
                    seglist[i].f_size, (off_t)seglist[i].f_offset)
                    != seglist[i].f_size) {
-                       warn("Reading `%s'", params->bootblock);
+                       warn("Reading `%s'", params->stage1);
                        return (0);
                }
        }
diff -r bfbccd862232 -r 2a0994bd8602 usr.sbin/installboot/arch/sparc64.c
--- a/usr.sbin/installboot/arch/sparc64.c       Fri Apr 12 06:21:57 2002 +0000
+++ b/usr.sbin/installboot/arch/sparc64.c       Fri Apr 12 06:50:41 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sparc64.c,v 1.5 2002/04/11 07:56:14 lukem Exp $        */
+/*     $NetBSD: sparc64.c,v 1.6 2002/04/12 06:50:41 lukem Exp $        */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: sparc64.c,v 1.5 2002/04/11 07:56:14 lukem Exp $");
+__RCSID("$NetBSD: sparc64.c,v 1.6 2002/04/12 06:50:41 lukem Exp $");
 #endif /* !__lint */
 
 #include <sys/param.h>
@@ -145,22 +145,22 @@
        assert(params != NULL);
        assert(params->fsfd != -1);
        assert(params->filesystem != NULL);
-       assert(params->bbfd != -1);
-       assert(params->bootblock != NULL);
+       assert(params->s1fd != -1);
+       assert(params->stage1 != NULL);
 
        retval = 0;
 
-       if (fstat(params->bbfd, &bootstrapsb) == -1) {
-               warn("Examining `%s'", params->bootblock);
+       if (fstat(params->s1fd, &bootstrapsb) == -1) {
+               warn("Examining `%s'", params->stage1);
                goto done;
        }
        if (!S_ISREG(bootstrapsb.st_mode)) {
-               warnx("`%s' must be a regular file", params->bootblock);
+               warnx("`%s' must be a regular file", params->stage1);
                goto done;
        }
 
        memset(&bb, 0, SPARC64_BOOT_BLOCK_MAX_SIZE);
-       rv = read(params->bbfd, &bb, sizeof bb);
+       rv = read(params->s1fd, &bb, sizeof bb);
        if (rv == -1) {
                warn("Reading `%s'", params->filesystem);
                goto done;
diff -r bfbccd862232 -r 2a0994bd8602 usr.sbin/installboot/arch/vax.c
--- a/usr.sbin/installboot/arch/vax.c   Fri Apr 12 06:21:57 2002 +0000
+++ b/usr.sbin/installboot/arch/vax.c   Fri Apr 12 06:50:41 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vax.c,v 1.1 2002/04/03 09:09:04 lukem Exp $    */
+/*     $NetBSD: vax.c,v 1.2 2002/04/12 06:50:41 lukem Exp $    */
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: vax.c,v 1.1 2002/04/03 09:09:04 lukem Exp $");
+__RCSID("$NetBSD: vax.c,v 1.2 2002/04/12 06:50:41 lukem Exp $");
 #endif /* !__lint */
 
 #include <sys/param.h>
@@ -182,8 +182,8 @@
        assert(params != NULL);
        assert(params->fsfd != -1);
        assert(params->filesystem != NULL);
-       assert(params->bbfd != -1);
-       assert(params->bootblock != NULL);
+       assert(params->s1fd != -1);
+       assert(params->stage1 != NULL);
        assert(sizeof(struct vax_boot_block) == VAX_BOOT_BLOCK_BLOCKSIZE);
 
        retval = 0;
@@ -195,12 +195,12 @@
                goto done;
        }
 
-       if (fstat(params->bbfd, &bootstrapsb) == -1) {
-               warn("Examining `%s'", params->bootblock);
+       if (fstat(params->s1fd, &bootstrapsb) == -1) {
+               warn("Examining `%s'", params->stage1);
                goto done;
        }
        if (!S_ISREG(bootstrapsb.st_mode)) {
-               warnx("`%s' must be a regular file", params->bootblock);
+               warnx("`%s' must be a regular file", params->stage1);
                goto done;
        }
        if (! load_bootstrap(params, &bootstrapbuf, &bootstrapload,
@@ -226,7 +226,7 @@
                }



Home | Main Index | Thread Index | Old Index