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/i386 Don't overwrite existing boo...



details:   https://anonhg.NetBSD.org/src/rev/3e53dbe3727a
branches:  trunk
changeset: 547304:3e53dbe3727a
user:      dsl <dsl%NetBSD.org@localhost>
date:      Fri May 16 19:48:29 2003 +0000

description:
Don't overwrite existing bootsel config when reading new bootcode.
configure_bootsel moved to MI code (I have plans for it...)
Make menu file language independant.
Move menus and message for MBR to MI files.

diffstat:

 distrib/utils/sysinst/arch/i386/Makefile    |    8 +-
 distrib/utils/sysinst/arch/i386/md.c        |   63 +----
 distrib/utils/sysinst/arch/i386/md.h        |    3 +-
 distrib/utils/sysinst/arch/i386/menus.md    |  197 ++++++++++++++++++
 distrib/utils/sysinst/arch/i386/menus.md.en |  186 ++++++++--------
 distrib/utils/sysinst/arch/i386/msg.md.en   |  288 ++++++++++----------------
 distrib/utils/sysinst/arch/i386/msg.md.fr   |  293 +++++++++++----------------
 distrib/utils/sysinst/arch/i386/msg.md.pl   |  292 ++++++++++----------------
 8 files changed, 669 insertions(+), 661 deletions(-)

diffs (truncated from 1740 to 300 lines):

diff -r 7f448205ea08 -r 3e53dbe3727a distrib/utils/sysinst/arch/i386/Makefile
--- a/distrib/utils/sysinst/arch/i386/Makefile  Fri May 16 19:44:23 2003 +0000
+++ b/distrib/utils/sysinst/arch/i386/Makefile  Fri May 16 19:48:29 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.11 2002/10/17 02:05:38 lukem Exp $
+#      $NetBSD: Makefile,v 1.12 2003/05/16 19:48:29 dsl Exp $
 #
 # Makefile for i386
 #
@@ -11,4 +11,10 @@
 
 fdisk.o md.o:  menu_defs.h msg_defs.h
 
+MENUS_MD=      menus.md menus.mbr
+MSG_MD=                msg.md.${SYSINSTLANG} msg.mbr.${SYSINSTLANG}
+MD_OPTIONS=    BOOTSEL
+
+CPPFLAGS+=     -DBOOTSEL
+
 .include "../../Makefile.inc"
diff -r 7f448205ea08 -r 3e53dbe3727a distrib/utils/sysinst/arch/i386/md.c
--- a/distrib/utils/sysinst/arch/i386/md.c      Fri May 16 19:44:23 2003 +0000
+++ b/distrib/utils/sysinst/arch/i386/md.c      Fri May 16 19:48:29 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.75 2003/05/07 19:02:57 dsl Exp $ */
+/*     $NetBSD: md.c,v 1.76 2003/05/16 19:48:29 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -63,10 +63,6 @@
 struct nativedisk_info *nativedisk;
 struct biosdisk_info *biosdisk = NULL;
 int netbsd_mbr_installed = 0;
-int netbsd_bootsel_installed = 0;
-
-struct mbr_bootsel *mbs;
-int defbootselpart, defbootseldisk;
 
 /* prototypes */
 
@@ -74,7 +70,6 @@
 static int count_mbr_parts(struct mbr_partition *);
 static int mbr_part_above_chs(struct mbr_partition *);
 static int mbr_partstart_above_chs(struct mbr_partition *);
-static void configure_bootsel(void);
 static void md_upgrade_mbrtype(void);
 static char *get_bootmodel(void);
 
@@ -110,7 +105,7 @@
                if (yesno) {
                        mbr_len = md_read_bootcode(_PATH_BOOTSEL, &mbr);
                        configure_bootsel();
-                       netbsd_mbr_installed = netbsd_bootsel_installed = 1;
+                       netbsd_mbr_installed = 2;
                } else {
                        msg_display(MSG_installnormalmbr);
                        process_menu(MENU_yesno);
@@ -124,7 +119,7 @@
                netbsd_mbr_installed = 1;
        }
 
-       if (mbr_partstart_above_chs(part) && !netbsd_mbr_installed) {
+       if (mbr_partstart_above_chs(part) && netbsd_mbr_installed == 0) {
                msg_display(MSG_installmbr);
                process_menu(MENU_yesno);
                if (yesno) {
@@ -146,6 +141,7 @@
        int fd, cc;
        struct stat st;
        size_t len;
+       mbr_sector_t new_mbr;
 
        fd = open(path, O_RDONLY);
        if (fd < 0)
@@ -156,15 +152,25 @@
                return -1;
        }
 
-       if (mbr->mbr_bootsel.mbrb_magic != native_to_le16(MBR_MAGIC))
-               len = offsetof(mbr_sector_t, mbr_parts);
-       else
-               len = offsetof(mbr_sector_t, mbr_bootsel);
-
-       if (read(fd, mbr, len) != len) {
+       if (read(fd, &new_mbr, sizeof new_mbr) != sizeof new_mbr) {
                close(fd);
                return -1;
        }
+
+       if (mbr->mbr_bootsel.mbrb_magic == native_to_le16(MBR_MAGIC)) {
+               len = offsetof(mbr_sector_t, mbr_bootsel);
+               if (!(mbr->mbr_bootsel.mbrb_flags & BFL_NEWMBR))
+                       /*
+                        * Meaning of keys has changed, force a sensible
+                        * default (old code didn't preseve the answer).
+                        */
+                       mbr->mbr_bootsel.mbrb_defkey = SCAN_ENTER;
+       } else
+               len = offsetof(mbr_sector_t, mbr_parts);
+
+       memcpy(mbr, &new_mbr, len);
+       /* Keep flags from object file - indicate the properties */
+       mbr->mbr_bootsel.mbrb_flags = new_mbr.mbr_bootsel.mbrb_flags;
        mbr->mbr_signature = native_to_le16(MBR_MAGIC);
 
        close(fd);
@@ -615,35 +621,6 @@
        return (pt[bsdpart].mbrp_start >= bcyl * bhead * bsec);
 }
 
-static void
-configure_bootsel(void)
-{
-       struct mbr_partition *parts = &mbr.mbr_parts[0];
-       int i;
-
-       mbs = &mbr.mbr_bootsel;
-       mbs->mbrb_flags = BFL_SELACTIVE;
-
-       /* Setup default labels for partitions, since if not done by user */
-       /* they don't get set and and bootselector doesn't 'appear' when  */
-       /* it's loaded.                                                   */
-       for (i = 0; i < NMBRPART; i++) {
-               if (parts[i].mbrp_typ != 0 && mbs->mbrb_nametab[i][0] == '\0')
-                       snprintf(mbs->mbrb_nametab[i], sizeof(mbs->mbrb_nametab[0]),
-                           "entry %d", i);
-       }
-
-       process_menu(MENU_configbootsel);
-
-       for (i = 0; i < NMBRPART; i++) {
-               if (parts[i].mbrp_typ != 0 &&
-                  parts[i].mbrp_start >= (bcyl * bhead * bsec)) {
-                       mbs->mbrb_flags |= BFL_EXTINT13;
-                       break;
-               }
-       }
-}
-
 char *
 get_bootmodel(void)
 {
diff -r 7f448205ea08 -r 3e53dbe3727a distrib/utils/sysinst/arch/i386/md.h
--- a/distrib/utils/sysinst/arch/i386/md.h      Fri May 16 19:44:23 2003 +0000
+++ b/distrib/utils/sysinst/arch/i386/md.h      Fri May 16 19:48:29 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.h,v 1.37 2003/05/07 19:02:58 dsl Exp $      */
+/*     $NetBSD: md.h,v 1.38 2003/05/16 19:48:29 dsl Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -150,7 +150,6 @@
 #define LIB_COUNT      0
 #define LIB_MOVE       1
  
-extern int defbootselpart, defbootseldisk;
 
 /*
  *  prototypes for MD code.
diff -r 7f448205ea08 -r 3e53dbe3727a distrib/utils/sysinst/arch/i386/menus.md
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/utils/sysinst/arch/i386/menus.md  Fri May 16 19:48:29 2003 +0000
@@ -0,0 +1,197 @@
+/*     $NetBSD: menus.md,v 1.1 2003/05/16 19:48:29 dsl Exp $   */
+
+/*
+ * Copyright 1997 Piermont Information Systems Inc.
+ * All rights reserved.
+ *
+ * Written by Philip A. Nelson for Piermont Information Systems Inc.
+ *
+ * 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.
+ *
+ */
+
+/* Menu definitions for sysinst. i386 version, machine dependent. */
+
+menu getboottype, title MSG_Bootblocks_selection;
+       option MSG_Use_normal_bootblocks, exit, action
+           {boottype = "normal";};
+       option MSG_Use_serial_9600_bootblocks, exit, action
+           {boottype = "serial9600";};
+       option MSG_Use_serial_38400_bootblocks, exit, action
+           {boottype = "serial38400";};
+       option MSG_Use_serial_57600_bootblocks, exit, action
+           {boottype = "serial57600";};
+       option MSG_Use_serial_115200_bootblocks, exit, action
+           {boottype = "serial115200";};
+
+menu wdtype, title MSG_Select_type;
+       display action { msg_display (MSG_wdtype, diskdev); };
+       option "IDE",   exit;
+       option "ESDI",  exit, action
+               { msg_display (MSG_sectforward);
+                 process_menu (MENU_yesno);
+                 if (yesno)
+                       doessf = "sf:";
+               };
+       option "ST506", exit, action
+               { msg_display (MSG_sectforward);
+                 process_menu (MENU_yesno);
+                 if (yesno)
+                       doessf = "sf:";
+               };
+
+
+menu dlgeom, title MSG_Choose_an_option;
+       display action { msg_display (MSG_dlgeom, diskdev, dlcyl, dlhead,
+                               dlsec, disk->dd_cyl, disk->dd_head,
+                               disk->dd_sec);
+                       };
+       option MSG_Use_real_geometry, exit, action {
+                       dlcyl  = disk->dd_cyl;
+                       dlhead = disk->dd_head;
+                       dlsec  = disk->dd_sec;
+               };
+       option MSG_Use_disklabel_geometry, exit, action {
+                       disk->dd_cyl = dlcyl;
+                       disk->dd_head = dlhead;
+                       disk->dd_sec = dlsec;
+               };
+
+menu cyl1024;
+       display action {
+               msg_display(MSG_cyl1024);
+       };
+       option MSG_Reedit_both_MBR_and_label, exit, action
+       {
+               /* XXX UGH */
+               extern int c1024_resp;
+
+               c1024_resp = 1;
+       };
+       option MSG_Reedit_the_label, exit, action
+       {
+               extern int c1024_resp;
+
+               c1024_resp = 2;
+       };
+       option MSG_Use_it_anyway,       exit, action
+       {       
+               extern int c1024_resp;
+
+               c1024_resp = 3;
+       };
+
+menu editfsparts, y=13, exit;
+       display action  {
+                       ask_sizemult(dlcylsize);
+                       msg_display(MSG_fspart, multname);
+                       disp_cur_fspart(-1, 1);
+               };
+       option MSG_Change_a, action { editpart = A;}, sub menu edfspart;
+       option MSG_Change_b, action { editpart = B;}, sub menu edfspart;
+       option MSG_NetBSD_partition_cant_change, action {};
+       option MSG_Whole_disk_cant_change, action {};
+       option MSG_Change_e, action { editpart = E;}, sub menu edfspart;
+       option MSG_Change_f, action { editpart = F;}, sub menu edfspart;
+       option MSG_Change_g, action { editpart = G;}, sub menu edfspart;
+       option MSG_Change_h, action { editpart = H;}, sub menu edfspart;
+       option MSG_Change_i, action { editpart = I;}, sub menu edfspart;
+       option MSG_Change_j, action { editpart = J;}, sub menu edfspart;
+       option MSG_Change_k, action { editpart = K;}, sub menu edfspart;
+       option MSG_Change_l, action { editpart = L;}, sub menu edfspart;
+       option MSG_Change_m, action { editpart = M;}, sub menu edfspart;
+       option MSG_Change_n, action { editpart = N;}, sub menu edfspart;
+       option MSG_Change_o, action { editpart = O;}, sub menu edfspart;
+       option MSG_Change_p, action { editpart = P;}, sub menu edfspart;
+       option MSG_Set_new_allocation_size, action { reask_sizemult(dlcylsize); };
+ 
+
+menu md_distcustom, x=26, y=5, exit, title MSG_Selection_toggles_inclusion;
+       display action { show_cur_distsets (); };
+       option MSG_Kernel_GENERIC,              action { toggle_getit (0); };



Home | Main Index | Thread Index | Old Index