Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/sysinst/arch/x68k x68k part of sysinst.



details:   https://anonhg.NetBSD.org/src/rev/c0175207f174
branches:  trunk
changeset: 474518:c0175207f174
user:      minoura <minoura%NetBSD.org@localhost>
date:      Fri Jul 09 15:29:44 1999 +0000

description:
x68k part of sysinst.

diffstat:

 distrib/utils/sysinst/arch/x68k/Makefile    |   17 +
 distrib/utils/sysinst/arch/x68k/md.c        |  609 ++++++++++++++++++++++++++++
 distrib/utils/sysinst/arch/x68k/md.h        |  130 +++++
 distrib/utils/sysinst/arch/x68k/menus.md.en |   69 +++
 distrib/utils/sysinst/arch/x68k/msg.md.en   |  100 ++++
 5 files changed, 925 insertions(+), 0 deletions(-)

diffs (truncated from 945 to 300 lines):

diff -r ea8b44dbdb03 -r c0175207f174 distrib/utils/sysinst/arch/x68k/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/utils/sysinst/arch/x68k/Makefile  Fri Jul 09 15:29:44 1999 +0000
@@ -0,0 +1,17 @@
+#      $NetBSD: Makefile,v 1.1 1999/07/09 15:29:44 minoura Exp $
+#
+# Makefile for x68k
+#
+
+# have to have all of them here for crunch ...
+
+SRCS=  menu_defs.c msg_defs.c main.c install.c upgrade.c \
+       txtwalk.c run.c factor.c net.c disks.c util.c geom.c \
+       label.c target.c md.c
+
+md.o:  menu_defs.h msg_defs.h
+
+.include "../../Makefile.inc"
+
+# Note: we have no french messages, because x68k console does not
+# support ISO-8859-1 (right half) character set.
diff -r ea8b44dbdb03 -r c0175207f174 distrib/utils/sysinst/arch/x68k/md.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/utils/sysinst/arch/x68k/md.c      Fri Jul 09 15:29:44 1999 +0000
@@ -0,0 +1,609 @@
+/*     $NetBSD: md.c,v 1.1 1999/07/09 15:29:45 minoura Exp $ */
+
+/*
+ * Copyright 1997 Piermont Information Systems Inc.
+ * All rights reserved.
+ *
+ * Based on code written by Philip A. Nelson for Piermont Information
+ * Systems Inc.  Modified by Minoura Makoto for x68k.
+ *
+ * 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 for the NetBSD Project by
+ *      Piermont Information Systems Inc.
+ * 4. The name of Piermont Information Systems Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``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 PIERMONT INFORMATION SYSTEMS INC. 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.
+ */
+
+/* md.c -- Machine specific code for x68k */
+
+#include <stdio.h>
+#include <sys/disklabel.h>
+#include <sys/ioctl.h>
+#include <sys/param.h>
+#include <util.h>
+
+#include "defs.h"
+#include "md.h"
+#include "msg_defs.h"
+#include "menu_defs.h"
+
+/*
+ * Symbolic names for disk partitions.
+ */
+#define        PART_ROOT       A
+#define        PART_RAW        C
+#define        PART_USR        D
+
+
+#ifdef notyet
+#undef NDOSPART 8
+#define NDOSPART 16
+typedef struct parttab {
+       struct dos_partition dosparts[NDOSPART];
+} parttab;
+
+parttab md_disklabel;
+int md_freepart;
+int md_nfreepart;
+#endif
+int md_need_newdisk = 0;
+
+/* prototypes */
+static int md_newdisk __P((void));
+static int md_check_partition_order __P((void));
+
+int
+md_get_info()
+{
+       char buf[1024];
+       int fd;
+       char devname[100];
+       struct disklabel disklabel;
+
+       snprintf(devname, 100, "/dev/r%sc", diskdev);
+
+       fd = open(devname, O_RDONLY, 0);
+       if (fd < 0) {
+               endwin();
+               fprintf(stderr, "Can't open %s\n", devname);
+               exit(1);
+       }
+
+       if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) {
+               endwin();
+               fprintf(stderr, "Can't read disklabel on %s.\n", devname);
+               close(fd);
+               exit(1);
+       }
+       if (disklabel.d_secsize != 512) {
+               endwin();
+               fprintf(stderr, "Non-512byte/sector disk is not supported.\n");
+               close(fd);
+               exit(1);
+       }
+
+       dlcyl = disklabel.d_ncylinders;
+       dlhead = disklabel.d_ntracks;
+       dlsec = disklabel.d_nsectors;
+       sectorsize = disklabel.d_secsize;
+       dlcylsize = disklabel.d_secpercyl;
+       dlsize = dlcyl*dlhead*dlsec;
+
+       if (read(fd, buf, 1024) < 0) {
+               endwin();
+               fprintf(stderr, "Can't read %s\n", devname);
+               close(fd);
+               exit(1);
+       }
+       if (memcmp(buf, "X68SCSI1", 8) != 0)
+               md_need_newdisk = 1;
+#ifdef notyet
+       else
+               if (read(fd, md_disklabel, sizeof(md_disklabel)) < 0) {
+                       endwin();
+                       fprintf(stderr, "Can't read %s\n", devname);
+                       close(fd);
+                       exit(1);
+               }
+#endif
+       /* preserve first 64 sectors for system. */
+       dlsize -= 64;
+
+       /* preserve existing partitions? */
+
+       close(fd);
+
+       /* Compute minimum NetBSD partition sizes (in sectors). */
+       minfsdmb = (80 + 4*rammb) * (MEG / sectorsize);
+
+       return 1;
+}
+
+#ifndef DEBUG
+static int
+md_newdisk(void)
+       int fd;
+       size_t size;
+{
+       int mbootfd;
+       char devname[100];
+       int fd;
+       char buf[1024];
+       size_t size = dlsize + 64;
+
+       snprintf(devname, 100, "/dev/r%sc", diskdev);
+       fd = open (devname, O_WRONLY);
+       if (fd < 0) {
+               endwin();
+               fprintf(stderr, "Can't open %s\n", devname);
+               exit(1);
+       }
+
+       msg_display(MSG_newdisk, diskdev, diskdev);
+
+       /* Write disk mark */
+       memset(buf, 0, 1024);
+       sprintf(buf, "X68SCSI1%c%c%c%c%c%c%c%c"
+                    "NetBSD/x68k SCSI primary boot. "
+                    "(C) 1999 by The NetBSD Foundation, Inc.",
+               2, 0,
+               (size>>24)&0xff, (size>>16)&0xff, (size>>8)&0xff, size&0xff,
+               1, 0);
+       lseek(fd, 0, SEEK_SET);
+       if (write(fd, buf, 1024) < 0) {
+               endwin();
+               close(fd);
+               fprintf(stderr, "Can't write mark on %s\n", devname);
+               exit(1);
+       }
+
+       /* Write primary boot */
+       memset(buf, 0, 1024);
+       mbootfd = open("/usr/mdec/mboot", O_RDONLY);
+       if (mbootfd < 0) {
+               endwin();
+               close(fd);
+               fprintf(stderr, "Can't read mboot.\n");
+               exit(1);
+       }
+       if (read(mbootfd, buf, 1024) < 0) {
+               endwin();
+               close(fd);
+               close(mbootfd);
+               fprintf(stderr, "Can't read mboot.\n");
+               exit(1);
+       }
+       close(mbootfd);
+       if (write(fd, buf, 1024) != 1024) {
+               endwin();
+               close(fd);
+               fprintf(stderr, "Can't write mboot.\n");
+               exit(1);
+       }
+
+       /* Create empty partition map */
+#ifdef notyet
+       memset(&md_disklabel, 0, sizeof(md_disklabel));
+       sprintf((char*) md_disklabel, "X68K%c%c%c%c%c%c%c%c%c%c%c%c",
+               (size>>24)&0xff, (size>>16)&0xff, (size>>8)&0xff, size&0xff,
+               (size>>24)&0xff, (size>>16)&0xff, (size>>8)&0xff, size&0xff,
+               ((size-64)>>24)&0xff, ((size-64)>>16)&0xff,
+               ((size-64)>>8)&0xff, (size-64)&0xff);
+       if (write(fd, md_disklabel, 1024) < 0) {
+               endwin();
+               close(fd);
+               fprintf(stderr, "Can't create partition table.\n");
+               exit(1);
+       }
+#else
+       memset(buf, 0, 1024);
+       sprintf(buf, "X68K%c%c%c%c%c%c%c%c%c%c%c%c",
+               (size>>24)&0xff, (size>>16)&0xff, (size>>8)&0xff, size&0xff,
+               (size>>24)&0xff, (size>>16)&0xff, (size>>8)&0xff, size&0xff,
+               ((size-64)>>24)&0xff, ((size-64)>>16)&0xff,
+               ((size-64)>>8)&0xff, (size-64)&0xff);
+       if (write(fd, buf, 1024) < 0) {
+               endwin();
+               close(fd);
+               fprintf(stderr, "Can't create partition table.\n");
+               exit(1);
+       }
+#endif
+
+       close (fd);
+
+       return 0;
+}
+#else
+static int
+md_newdisk(fd, size, buf)
+       int fd;
+       size_t size;
+       char *buf;
+{
+       return 0;
+}
+#endif
+
+#ifdef notyet
+static int
+md_check_partitions(void)
+{
+       int i, j;
+       int preserve;
+
+       /* check existing BSD partitions. */
+       for (i = 0; i < NDOSPART; i++) {
+               if (md_disklabel.dosparts[i].dp_size == 0)
+                       break;
+               if (memcmp(md_disklabel.dosparts[i].dp_typename, "Human68k", 8)) {
+                       msg_display(MSG_existing);
+                       process_menu(MENU_noyes);
+                       preserve = yesno;
+                       break;
+               }
+       }
+       emptylabel(bsdlabel);
+       bsdlabel[C].pi_fstype = FS_UNUSED;
+       bsdlabel[C].pi_offset = 0;
+       bsdlabel[C].pi_size = dlsize;
+       for (i = 0, j = A; i < NDOSPART;) {
+               if (j == C) {
+                       j++;
+                       continue;



Home | Main Index | Thread Index | Old Index