Source-Changes-HG archive

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

[src/netbsd-1-4]: src Apply patch (requested by toddpw):



details:   https://anonhg.NetBSD.org/src/rev/e638daf7d79b
branches:  netbsd-1-4
changeset: 470452:e638daf7d79b
user:      he <he%NetBSD.org@localhost>
date:      Wed Mar 01 12:38:48 2000 +0000

description:
Apply patch (requested by toddpw):
  Finish porting sysinst to vax, and build various bootable installers
  in new directory distrib/vax/bootfs.

diffstat:

 distrib/utils/sysinst/arch/vax/md.c    |  136 ++++++++++++++++++++++----------
 distrib/utils/sysinst/arch/vax/md.h    |    4 +-
 distrib/vax/Makefile                   |    6 +-
 distrib/vax/ramdisk/Makefile           |   11 +-
 distrib/vax/ramdisk/disktab.preinstall |   30 +-------
 distrib/vax/ramdisk/list               |   16 ++-
 distrib/vax/ramdisk/ramdiskbin.conf    |   13 ++-
 sys/arch/vax/boot/Makefile.inc         |    6 +-
 sys/arch/vax/boot/boot/Makefile        |    8 +-
 sys/arch/vax/boot/boot/boot.c          |    9 +-
 sys/arch/vax/boot/boot/conf.c          |    7 +-
 sys/arch/vax/boot/conf.c               |    4 +-
 sys/arch/vax/conf/INSTALL              |   26 +++---
 13 files changed, 163 insertions(+), 113 deletions(-)

diffs (truncated from 720 to 300 lines):

diff -r 7442c932d21b -r e638daf7d79b distrib/utils/sysinst/arch/vax/md.c
--- a/distrib/utils/sysinst/arch/vax/md.c       Wed Mar 01 12:35:56 2000 +0000
+++ b/distrib/utils/sysinst/arch/vax/md.c       Wed Mar 01 12:38:48 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.3.2.2 1999/06/24 22:57:08 cgd Exp $   */
+/*     $NetBSD: md.c,v 1.3.2.3 2000/03/01 12:38:48 he Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -39,6 +39,7 @@
 /* changes from the i386 version made by mrg */
 
 /* md.c -- vax machine specific routines */
+/* This file is in close sync with pmax, sparc, and x68k md.c */
 
 #include <sys/types.h>
 #include <sys/disklabel.h>
@@ -59,11 +60,18 @@
  * Symbolic names for disk partitions.
  */
 #define        PART_ROOT       A
+#define PART_SWAP      B
 #define        PART_RAW        C
-#define        PART_USR        G
+#define PART_USR       D       /* Can be after PART_FIRST_FREE */
+#define PART_FIRST_FREE        E
+#define PART_LAST      H
+
+#define DEFSWAPRAM     16      /* Assume at least this RAM for swap calc */
+#define DEFROOTSIZE    32      /* Default root size */
+#define STDNEEDMB      80      /* Min space for non X install */
 
 int
-md_get_info()
+md_get_info(void)
 {
        struct disklabel disklabel;
        int fd;
@@ -107,7 +115,7 @@
                dlsize = disklabel.d_secperunit;
 
        /* Compute minimum NetBSD partition sizes (in sectors). */
-       minfsdmb = (80 + 4*rammb) * (MEG / sectorsize);
+       minfsdmb = STDNEEDMB * (MEG / sectorsize);
 
        return 1;
 }
@@ -116,15 +124,16 @@
  * hook called before writing new disklabel.
  */
 int
-md_pre_disklabel()
+md_pre_disklabel(void)
 {
-       return 1;
+       return 0;
 }
 
 /*
  * hook called after writing disklabel to new target disk.
  */
-int    md_post_disklabel (void)
+int
+md_post_disklabel(void)
 {
        return 0;
 }
@@ -132,14 +141,14 @@
 /*
  * MD hook called after upgrade() or install() has finished setting
  * up the target disk but immediately before the user is given the
- * ``disks are now set up'' message that, if power fails, they can
+ * ``disks are now set up'' message, so that if power fails, they can
  * continue installation by booting the target disk and doing an
  * `upgrade'.
  *
  * On the vax, we use this opportunity to install the boot blocks.
  */
 int
-md_post_newfs()
+md_post_newfs(void)
 {
 
        printf(msg_string(MSG_dobootblks), diskdev);
@@ -151,13 +160,16 @@
  * some ports use this to copy the MD filesystem, we do not.
  */
 int
-md_copy_filesystem()
+md_copy_filesystem(void)
 {
        return 0;
 }
 
+/*
+ * md back-end code for menu-driven BSD disklabel editor.
+ */
 int
-md_make_bsd_partitions()
+md_make_bsd_partitions(void)
 {
        int i, part;
        int remain;
@@ -198,14 +210,13 @@
        
        /* Standard fstypes */
        bsdlabel[A].pi_fstype = FS_BSDFFS;
-       bsdlabel[B].pi_fstype = FS_SWAP;
+       bsdlabel[B].pi_fstype = FS_UNUSED;
        /* Conventionally, C is whole disk. */
        bsdlabel[D].pi_fstype = FS_UNUSED;      /* fill out below */
        bsdlabel[E].pi_fstype = FS_UNUSED;
        bsdlabel[F].pi_fstype = FS_UNUSED;
        bsdlabel[G].pi_fstype = FS_UNUSED;
        bsdlabel[H].pi_fstype = FS_UNUSED;
-       part = D;
 
 
        switch (layoutkind) {
@@ -214,22 +225,23 @@
                partstart = ptstart;
 
                /* Root */
-               /* NetBSD/vax uses a 16 Mbyte root */
-               partsize= NUMSEC(16, MEG/sectorsize, dlcylsize);
-               bsdlabel[A].pi_offset = partstart;
-               bsdlabel[A].pi_size = partsize;
-               bsdlabel[A].pi_bsize = 8192;
-               bsdlabel[A].pi_fsize = 1024;
-               strcpy (fsmount[A], "/");
+               partsize = NUMSEC(DEFROOTSIZE, MEG/sectorsize, dlcylsize);
+               bsdlabel[PART_ROOT].pi_offset = partstart;
+               bsdlabel[PART_ROOT].pi_size = partsize;
+               bsdlabel[PART_ROOT].pi_bsize = 8192;
+               bsdlabel[PART_ROOT].pi_fsize = 1024;
+               strcpy(fsmount[PART_ROOT], "/");
                partstart += partsize;
 
                /* swap */
-               i = NUMSEC(layoutkind * 2 * (rammb < 16 ? 16 : rammb),
+               i = NUMSEC(layoutkind * 2 *
+                          (rammb < DEFSWAPRAM ? DEFSWAPRAM : rammb),
                           MEG/sectorsize, dlcylsize) + partstart;
                partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
                           dlcylsize) - partstart;
-               bsdlabel[B].pi_offset = partstart;
-               bsdlabel[B].pi_size = partsize;
+               bsdlabel[PART_SWAP].pi_fstype = FS_SWAP;
+               bsdlabel[PART_SWAP].pi_offset = partstart;
+               bsdlabel[PART_SWAP].pi_size = partsize;
                partstart += partsize;
 
                /* /usr */
@@ -248,40 +260,56 @@
                /* root */
                partstart = ptstart;
                remain = fsdsize - partstart;
-               /* NetBSD/vax uses a 32Mbyte root */
-               partsize = NUMSEC (32, MEG/sectorsize, dlcylsize);
+               partsize = NUMSEC(DEFROOTSIZE, MEG/sectorsize, dlcylsize);
                snprintf (isize, 20, "%d", partsize/sizemult);
                msg_prompt (MSG_askfsroot, isize, isize, 20,
                            remain/sizemult, multname);
                partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
-               bsdlabel[A].pi_offset = partstart;
-               bsdlabel[A].pi_size = partsize;
-               bsdlabel[A].pi_bsize = 8192;
-               bsdlabel[A].pi_fsize = 1024;
-               strcpy (fsmount[A], "/");
+               /* If less than a 'unit' left, also use it */
+               if (remain - partsize < sizemult)
+                       partsize = remain;
+               bsdlabel[PART_ROOT].pi_offset = partstart;
+               bsdlabel[PART_ROOT].pi_size = partsize;
+               bsdlabel[PART_ROOT].pi_bsize = 8192;
+               bsdlabel[PART_ROOT].pi_fsize = 1024;
+               strcpy(fsmount[PART_ROOT], "/");
                partstart += partsize;
                
                /* swap */
                remain = fsdsize - partstart;
-               i = NUMSEC(2 * (rammb < 32 ? 32 : rammb),
+               if (remain > 0) {
+                       i = NUMSEC(2 *
+                                  (rammb < DEFSWAPRAM ? DEFSWAPRAM : rammb),
                           MEG/sectorsize, dlcylsize) + partstart;
                partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
                           dlcylsize) - partstart;
+                       if (partsize > remain)
+                               partsize = remain;
                snprintf (isize, 20, "%d", partsize/sizemult);
                msg_prompt_add (MSG_askfsswap, isize, isize, 20,
                            remain/sizemult, multname);
                partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
-               bsdlabel[B].pi_offset = partstart;
-               bsdlabel[B].pi_size = partsize;
+                       if (partsize) {
+                               /* If less than a 'unit' left, also use it */
+                               if (remain - partsize < sizemult)
+                                       partsize = remain;
+                               bsdlabel[PART_SWAP].pi_fstype = FS_SWAP;
+                               bsdlabel[PART_SWAP].pi_offset = partstart;
+                               bsdlabel[PART_SWAP].pi_size = partsize;
                partstart += partsize;
+                       }
+               }
                
                /* /usr */
                remain = fsdsize - partstart;
-               partsize = fsdsize - partstart;
+               if (remain > 0) {
+                       partsize = remain;
                snprintf (isize, 20, "%d", partsize/sizemult);
                msg_prompt_add (MSG_askfsusr, isize, isize, 20,
                            remain/sizemult, multname);
                partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
+                       if (partsize) {
+                               /* If less than a 'unit' left, also use it */
                if (remain - partsize < sizemult)
                        partsize = remain;
                bsdlabel[PART_USR].pi_fstype = FS_BSDFFS;
@@ -291,19 +319,24 @@
                bsdlabel[PART_USR].pi_fsize = 1024;
                strcpy (fsmount[PART_USR], "/usr");
                partstart += partsize;
+                       }
+               }
 
                /* Others ... */
                remain = fsdsize - partstart;
-               part = F;
                if (remain > 0)
                        msg_display (MSG_otherparts);
-               while (remain > 0 && part <= H) {
+               part = PART_FIRST_FREE;
+               for (; remain > 0 && part <= PART_LAST; ++part ) {
+                       if (bsdlabel[part].pi_fstype != FS_UNUSED)
+                               continue;
                        partsize = fsdsize - partstart;
                        snprintf (isize, 20, "%d", partsize/sizemult);
                        msg_prompt_add (MSG_askfspart, isize, isize, 20,
                                        diskdev, partname[part],
                                        remain/sizemult, multname);
                        partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
+                       /* If less than a 'unit' left, also use it */
                        if (remain - partsize < sizemult)
                                partsize = remain;
                        bsdlabel[part].pi_fstype = FS_BSDFFS;
@@ -311,17 +344,15 @@
                        bsdlabel[part].pi_size = partsize;
                        bsdlabel[part].pi_bsize = 8192;
                        bsdlabel[part].pi_fsize = 1024;
-                       msg_prompt_add (MSG_mountpoint, NULL,
-                                       fsmount[part], 20);
+                       msg_prompt_add(MSG_mountpoint, NULL, fsmount[part],
+                                   20);
                        partstart += partsize;
                        remain = fsdsize - partstart;
-                       part++;
                }
 
                break;
        }
 
-
        /*
         * OK, we have a partition table. Give the user the chance to
         * edit it and verify it's OK, or abort altogether.
@@ -337,16 +368,14 @@
        /* save label to disk for MI code to update. */
        (void) savenewlabel(bsdlabel, 8);       /* 8 partitions in  label */
 
-
        /* Everything looks OK. */
        return (1);
 }
 
 /* Upgrade support */
 int
-md_update()
+md_update(void)
 {
-
        endwin();
        md_copy_filesystem ();
        md_post_newfs();
@@ -357,7 +386,26 @@
 }
 
 void
-md_cleanup_install()
+md_cleanup_install(void)
 {
+       char realfrom[STRSIZE];
+       char realto[STRSIZE];
+       char sedcmd[STRSIZE];
 
+       strncpy(realfrom, target_expand("/etc/rc.conf"), STRSIZE);
+       strncpy(realto, target_expand("/etc/rc.conf.install"), STRSIZE);
+



Home | Main Index | Thread Index | Old Index