Subject: sysinstall changes
To: None <tech-install@netbsd.org>
From: None <rvb@sicily.odyssey.cs.cmu.edu>
List: tech-install
Date: 09/17/1998 17:58:03
I once took a stab at making a better more acurate sysinst.  The patches
are against a 0914 tree.  I've not rebuilt it in a month or so and
there are a few merge conflicts.  Try it you make like it.  These are
x86 changes only

? SYSI
? AA
? patch01.gz
? arch/i386/menus.def
? arch/i386/msg.def
? arch/i386/msg_defs.h
? arch/i386/msg_defs.c
? arch/i386/menu_defs.h
? arch/i386/menu_defs.c
? arch/i386/sysinst
Index: defs.h
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/defs.h,v
retrieving revision 1.30
diff -u -r1.30 defs.h
--- defs.h	1998/06/22 12:18:52	1.30
+++ defs.h	1998/09/17 19:27:50
@@ -81,11 +81,13 @@
 
 EXTERN char rel[SSTRSIZE] INIT(REL);
 EXTERN char machine[SSTRSIZE] INIT(MACH);
+EXTERN int tflag INIT(0);
 
 EXTERN int yesno;
 EXTERN int ignorerror;
 EXTERN int layoutkind;
 EXTERN int sizemult INIT(1);
+EXTERN int sizround INIT(1);
 EXTERN char *multname; 
 EXTERN char *doingwhat;
 
Index: main.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/main.c,v
retrieving revision 1.9
diff -u -r1.9 main.c
--- main.c	1998/06/20 13:05:49	1.9
+++ main.c	1998/09/17 19:27:50
@@ -72,11 +72,14 @@
 	}
 
 	/* argv processing */
-	while ((ch = getopt(argc, argv, "r:")) != -1)
+	while ((ch = getopt(argc, argv, "r:t")) != -1)
 		switch(ch) {
 		case 'r':
 			/* Release name other than compiled in release. */
 			strncpy(rel, optarg, SSTRSIZE);
+			break;
+		case 't':
+			tflag = 1;
 			break;
 		case '?':
 		default:
Index: mbr.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/mbr.c,v
retrieving revision 1.8
diff -u -r1.8 mbr.c
--- mbr.c	1998/07/21 14:53:36	1.8
+++ mbr.c	1998/09/17 19:27:51
@@ -99,7 +99,7 @@
 check_geom()
 {
 
-	return bcyl <= 1024 && bsec < 64 && bcyl > 0 && bhead > 0 && bsec > 0;
+	return bcyl <= 16*1024 && bsec < 64 && bcyl > 0 && bhead > 0 && bsec > 0;
 }
 
 /*
@@ -131,8 +131,10 @@
 disp_cur_geom()
 {
 
-	msg_display_add(MSG_realgeom, dlcyl, dlhead, dlsec);
-	msg_display_add(MSG_biosgeom, bcyl, bhead, bsec);
+	msg_display_add(MSG_geom, "BIOS ", bcyl, bhead, bsec);
+	msg_display_add(MSG_geom, "label", dlcyl, dlhead, dlsec);
+	msg_display_add(MSG_geom, "disk ",
+			disk->geom[0], disk->geom[1], disk->geom[2]);
 }
 
 
@@ -320,7 +322,7 @@
 		start = 0, stop = 4;
 	else
 		start = disp, stop = disp+1;
-	msg_display_add(MSG_part_head, multname, multname, multname);
+	msg_display_add(MSG_part_head, multname, sizemult, sizround, multname, multname, multname);
 	for (i = start; i < stop; i++) {
 		if (sel == i)
 			msg_standout();
Index: menus.mi.eng
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/menus.mi.eng,v
retrieving revision 1.19
diff -u -r1.19 menus.mi.eng
--- menus.mi.eng	1998/02/09 07:03:38	1.19
+++ menus.mi.eng	1998/09/17 19:27:53
@@ -142,14 +142,27 @@
 menu sizechoice, title  "  Choose your size specifier";
 	option "Megabytes", exit, action 
 		{ sizemult = MEG / sectorsize;
+		  sizround = dlcylsize;
+		  multname = msg_string(MSG_megname);
+		};
+	option "Megabytes rounded to BIOS cylinders", exit, action 
+		{ sizemult = MEG / sectorsize;
+		  sizround = bcylsize;
 		  multname = msg_string(MSG_megname);
 		};
 	option "Cylinders", exit, action 
 		{ sizemult = dlcylsize; 
+		  sizround = dlcylsize;
+		  multname = msg_string(MSG_cylname);
+		};
+	option "Cylinders rounded to BIOS cylinders", exit, action 
+		{ sizemult = dlcylsize; 
+		  sizround = bcylsize;
 		  multname = msg_string(MSG_cylname);
 		};
 	option "Sectors", exit, action 
 		{ sizemult = 1; 
+		  sizround = 1;
 		  multname = msg_string(MSG_secname);
 		};
 
@@ -168,10 +181,14 @@
 	};
 	option "FS kind", sub menu  selfskind;
 	option "Offset/size", action  
-		{	char buf[40]; int start, size;
-			msg_prompt_add (MSG_offset, NULL, buf, 40);
+		{	char buf[40];
+			int start = bsdlabel[editpart][D_OFFSET];
+			int size = bsdlabel[editpart][D_SIZE];
+			snprintf(buf, 40, "%d %s {== %d sectors}", start/sizemult, multname, start);
+			msg_prompt_add (MSG_offset, buf, buf, 40);
 			start = NUMSEC(atoi(buf),sizemult,dlcylsize);
-			msg_prompt_add (MSG_size, NULL, buf, 40);
+			snprintf(buf, 40, "%d %s {== %d sectors}", size/sizemult, multname, size);
+			msg_prompt_add (MSG_size, buf, buf, 40);
 			size = NUMSEC(atoi(buf),sizemult,dlcylsize);
 			if (size == -1)
 				size = dlsize - start;
Index: msg.mi.eng
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/msg.mi.eng,v
retrieving revision 1.28
diff -u -r1.28 msg.mi.eng
--- msg.mi.eng	1998/06/02 14:14:46	1.28
+++ msg.mi.eng	1998/09/17 19:27:55
@@ -57,7 +57,7 @@
 This menu-driven tool is designed to help you install NetBSD to a hard
 disk, or upgrade an existing NetBSD system, with a minimum of work.
 In the following menus, you may change the current selection by
-either typing the reference letter (a, b, c, ...).  Arrow keys may also work.
+typing the reference letter (a, b, c, ...).  Arrow keys should also work.
 You activate the current selection from the menu by typing the enter key.
 
 If you booted from a floppy, you may now remove the disk.
@@ -214,13 +214,13 @@
 }
 
 message sizechoice
-{You have elected to choose your partition sizes.  You need to specify
+{You have elected to set your partition sizes.  You need to specify
 the units of size you will use for your choices.  Choosing megabytes
 will make partition sizes close to your choice, but keep partitions
 to an integral number of cylinders.   Choosing sectors will allow you
-to most acurately specify the sizes, but remember, it is most efficient
-to choose partition sizes that are exact multiples of your cylinder
-size, which is %d sectors.
+to most acurately specify the sizes.
+
+Your cylinder size is %d sectors (%d tracks x %d sectors per track).
 }
 
 message fspart
Index: run.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/run.c,v
retrieving revision 1.6
diff -u -r1.6 run.c
--- run.c	1998/08/10 02:23:45	1.6
+++ run.c	1998/09/17 19:27:55
@@ -152,9 +152,19 @@
 va_prog_cmdstr(char *cmd, va_list ap)
 {
 	static char command[STRSIZE];
+	char *cp = command;
 
+<<<<<<< run.c
+	bzero(command, STRSIZE);
+	if (tflag) {
+		strncpy(command, "echo true ", 10);
+		cp += 10;
+	}
+	(void)vsnprintf(cp, STRSIZE, cmd, ap);
+=======
 	memset(command, 0, STRSIZE);
 	(void)vsnprintf(command, STRSIZE, cmd, ap);
+>>>>>>> 1.6
 	return (command);
 }
   
Index: util.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/util.c,v
retrieving revision 1.31
diff -u -r1.31 util.c
--- util.c	1998/08/10 02:23:45	1.31
+++ util.c	1998/09/17 19:27:56
@@ -127,7 +127,7 @@
 {
 
 	if (!asked) {
-		msg_display(MSG_sizechoice, dlcylsize);
+		msg_display(MSG_sizechoice, dlcylsize, dlhead, dlsec);
 		process_menu(MENU_sizechoice);
 	}
 	asked = 1;
Index: arch/i386/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/i386/md.c,v
retrieving revision 1.15
diff -u -r1.15 md.c
--- md.c	1998/05/15 15:12:31	1.15
+++ md.c	1998/09/17 19:27:56
@@ -74,7 +74,9 @@
 		disktype = "ST506";
 		/* Check against disk geometry. */
 		if (disk->geom[0] != dlcyl || disk->geom[1] != dlhead
-		    || disk->geom[2] != dlsec)
+		    || disk->geom[2] != dlsec ||
+		    disk->geom[0] != bcyl || disk->geom[1] != bhead
+		    || disk->geom[2] != bsec)
 			process_menu (MENU_dlgeom);
 	} else {
 		disktype = "SCSI";
@@ -154,7 +156,7 @@
 	int part;
 	int maxpart = getmaxpartitions();
 	int remain;
-	char isize[20];
+	char isize[40];
 
 editlab:
 	/* Ask for layout type -- standard or special */
@@ -237,10 +239,19 @@
 		i = NUMSEC(20+2*rammb, MEG/sectorsize, dlcylsize) + partstart;
 		partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
 				   dlcylsize) - partstart;
-		snprintf (isize, 20, "%d", partsize/sizemult);
-		msg_prompt (MSG_askfsroot, isize, isize, 20,
-			    remain/sizemult, multname);
-		partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
+		snprintf (isize, 40, "%d %s {== %d sectors}",
+			  partsize/sizemult, multname, partsize);
+		msg_prompt (MSG_askfsroot, isize, isize, 40,
+			    dlcylsize, remain/sizemult, multname);
+		partsize = atoi(isize);
+		partsize = partsize * sizemult;
+		partsize += partstart;
+		partsize = NUMSEC(1, partsize, dlcylsize);
+		partsize -= partstart;
+		msg_printf_add("Size was rounded to %d %s {== %d x %d == %d sectors}\n",
+				partsize/sizemult, multname, 
+				partsize/dlcylsize, dlcylsize, partsize);
+
 		bsdlabel[A][D_OFFSET] = partstart;
 		bsdlabel[A][D_SIZE] = partsize;
 		bsdlabel[A][D_BSIZE] = 8192;
@@ -254,10 +265,14 @@
 			   MEG/sectorsize, dlcylsize) + partstart;
 		partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
 			   dlcylsize) - partstart - swapadj;
-		snprintf (isize, 20, "%d", partsize/sizemult);
-		msg_prompt_add (MSG_askfsswap, isize, isize, 20,
+		snprintf (isize, 40, "%d %s {== %d sectors}",
+			  partsize/sizemult, multname, partsize);
+		msg_prompt_add (MSG_askfsswap, isize, isize, 40,
 			    remain/sizemult, multname);
 		partsize = NUMSEC(atoi(isize),sizemult, dlcylsize) - swapadj;
+		msg_printf_add("Size was rounded to %d %s {== %d x %d == %d sectors}\n",
+				partsize/sizemult, multname, 
+				partsize/dlcylsize, dlcylsize, partsize);
 		bsdlabel[B][D_OFFSET] = partstart;
 		bsdlabel[B][D_SIZE] = partsize;
 		partstart += partsize;
@@ -269,11 +284,15 @@
 			msg_display (MSG_otherparts);
 		while (remain > 0 && part <= H) {
 			partsize = remain;
-			snprintf (isize, 20, "%d", partsize/sizemult);
-			msg_prompt_add (MSG_askfspart, isize, isize, 20,
+			snprintf (isize, 40, "%d %s {== %d sectors}",
+				  partsize/sizemult, multname, partsize);
+			msg_prompt_add (MSG_askfspart, isize, isize, 40,
 					diskdev, partname[part],
 					remain/sizemult, multname);
 			partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
+			msg_printf_add("Size was rounded to %d %s {== %d x %d == %d sectors}\n",
+				partsize/sizemult, multname, 
+				partsize/dlcylsize, dlcylsize, partsize);
 			if (partsize > 0) {
 				if (remain - partsize < sizemult)
 					partsize = remain;
Index: arch/i386/menus.md.eng
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/i386/menus.md.eng,v
retrieving revision 1.12
diff -u -r1.12 menus.md.eng
--- menus.md.eng	1998/02/23 22:55:09	1.12
+++ menus.md.eng	1998/09/17 19:27:56
@@ -59,20 +59,26 @@
 		};
 
 
-menu dlgeom, title "  Choose an option";
-	display action { msg_display (MSG_dlgeom, diskdev, dlcyl, dlhead,
-				dlsec, disk->geom[0], disk->geom[1],
-				disk->geom[2]);
+menu dlgeom, title "  For new disklabel geometry";
+	display action { msg_display (MSG_dlgeom, diskdev, 
+				dlcyl, dlhead, dlsec,
+				disk->geom[0], disk->geom[1], disk->geom[2],
+				bcyl, bhead, bsec);
 			};
-	option "Use real geometry", exit, action {
+	option "Use current disklabel geometry", exit, action {
+			disk->geom[0] = dlcyl;
+			disk->geom[1] = dlhead;
+			disk->geom[2] = dlsec;
+		};
+	option "Use disk geometry", exit, action {
 			dlcyl  = disk->geom[0];
 			dlhead = disk->geom[1];
 			dlsec  = disk->geom[2];
 		};
-	option "Use disklabel geometry", exit, action {
-			disk->geom[0] = dlcyl;
-			disk->geom[1] = dlhead;
-			disk->geom[2] = dlsec;
+	option "Use BIOS geometry", exit, action {
+			dlcyl  = bcyl;
+			dlhead = bhead;
+			dlsec  = bsec;
 		};
 
 menu nobiosgeom, title  "  Choose an option", y=16;
@@ -105,7 +111,8 @@
 		};
 
 menu editparttable, title  "  Choose your partition", exit;
-	display action  { msg_display (MSG_editparttable);
+	display action  { msg_display (MSG_editparttable, dlcylsize, dlhead, dlsec,
+					bcylsize, bhead, bsec);
 			  disp_cur_part (activepart,-1);
 			};
 	option "Edit partition 0",  sub menu editpart,
@@ -120,23 +127,41 @@
 		action  { reask_sizemult(); }; 
 
 menu editpart, title  "  Select to change";
-	display action { msg_display (MSG_editpart, editpart);
+	display action { msg_display (MSG_editpart, editpart, dlcylsize, bcylsize);
 			   disp_cur_part (activepart,editpart);
 			   msg_printf_add ("\n");
 			};
 	option "Kind", sub menu chooseid;
 	option "Start and size", action 
-		{	char buf[40]; int start, size;
-			msg_prompt_add (MSG_start, NULL, buf, 40);
-			start = NUMSEC(atoi(buf),sizemult,dlcylsize);
+		{	char buf[40]; 
+			int start = part[editpart][START];
+			int size = part[editpart][SIZE];
+
+			snprintf(buf, 40, "%d %s {== %d sectors}", start/sizemult, multname, start);
+			msg_prompt_add (MSG_start, buf, buf, 40);
+			start = NUMSEC(atoi(buf),sizemult,sizround);
 			if (sizemult > 1 && start < bsec)
 				start = bsec;
-			msg_prompt_add (MSG_size, NULL, buf, 40);
-			size = NUMSEC(atoi(buf),sizemult,dlcylsize);
+			msg_printf_add("Start was rounded to %d %s {== %d x %d == %d sectors}\n",
+				start/sizemult, multname, start/sizround, sizround, start);
+
+			snprintf(buf, 40, "%d %s {== %d sectors}", size/sizemult, multname, size);
+			msg_prompt_add (MSG_size, buf, buf, 40);
+			size = atoi(buf);
+			if (size == -1)
+				size = bsize;
+			else
+				size = NUMSEC(size,sizemult,sizround);
+			msg_printf_add("Size was rounded to %d %s {== %d x %d == %d sectors}\n",
+				size/sizemult, multname, size/sizround, sizround, size);
+
 			if (sizemult > 1 && start == bsec)
 				size -= bsec;
-			if (start + size > bsize)
+			if (start + size > bsize) {
 				size = bsize - start;
+			msg_printf_add("Size was truncated to %d %s {== %d x %d == %d sectors}\n",
+				size/sizemult, multname, size/sizround, sizround, size);
+			}
 			if (size < 0) {
 				size = 0;
 				start = 0;
@@ -144,12 +169,18 @@
 			part[editpart][START] = start;
 			part[editpart][SIZE] = size;
 			part[editpart][SET] = 1;
+			msg_prompt_add (MSG_cont, NULL, buf, 40);
 		};
 	option "Set active", action { activepart = editpart; };
 	option "Partition OK", exit;
 
 menu chooseid, title  "  Partition Kind? ";
 	option "NetBSD", 	exit,	action
+	{
+		part[editpart][ID] = 169;
+		part[editpart][SET] = 1;
+	};
+	option "Old NetBSD", 	exit,	action
 	{
 		part[editpart][ID] = 165;
 		part[editpart][SET] = 1;
Index: arch/i386/msg.md.eng
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/i386/msg.md.eng,v
retrieving revision 1.5
diff -u -r1.5 msg.md.eng
--- msg.md.eng	1997/12/15 00:43:59	1.5
+++ msg.md.eng	1998/09/17 19:27:57
@@ -38,6 +38,9 @@
 
 /* MD Message catalog -- english, i386 version */
 
+message cont
+{Type any key to continue}
+
 message fullpart
 {We are now going to install NetBSD on the disk %s.  You may
 choose to install NetBSD on the entire disk or part of the disk.
@@ -53,10 +56,11 @@
 message dlgeom
 {It appears that your disk, %s, has already been labeled with a BSD 
 disklabel and the disklabel reports geometry that is different from
-the the real geometry.  The two geometries are:
+the real geometry and/or BIOS geometry.  The geometries are:
 
-disklabel: %d cylinders, %d heads, %d sectors
-real geom: %d cylinders, %d heads, %d sectors
+	label geom: %d cylinders, %d heads, %d sectors
+	disk  geom: %d cylinders, %d heads, %d sectors
+	BIOS  geom: %d cylinders, %d heads, %d sectors
 }
 
 message nobiosgeom
@@ -92,7 +96,8 @@
 }
 
 message part_head
-{No   Start(%s)   Size(%s)   End(%s)  Kind\n}
+{Allocation size 1 %s = %d sectors; round size %d sectors
+No   Start(%s)   Size(%s)   End(%s)  Kind\n}
 
 message setbiosgeom
 {You will be prompted for the geometry.  Please enter the values you
@@ -104,14 +109,10 @@
 }
 
 message confirmbiosgeom
-{Please verify if the BIOS disk geometry below is correct. The value for
-the number of cylinders may have been truncated to 1024. This is ok as
-long as the other numbers are correct; only 1024 cylinders can be
-specified in the MBR, the rest will be found in a different way by NetBSD.
-
-If you re-enter the values, make sure that the values are correct and
-match those used by other systems on this disk. Values that do not match
-may result in data corruption.
+{Please verify that the BIOS disk geometry below is correct.  If you
+re-enter the values, make sure that the values match those used by
+other OS's on this disk. Values that do not match may result in data
+corruption.
 
 }
 
@@ -120,11 +121,8 @@
 
 }
 
-message realgeom
-{real geom: %d cyl, %d heads, %d sec\n}
-
-message biosgeom
-{BIOS geom: %d cyl, %d heads, %d sec\n}
+message geom
+{	%s geom: %d cylinders, %d heads, %d sec\n}
 
 message reentergeom
 {The values just entered for the geometry are not usable.  Please,
@@ -141,11 +139,14 @@
 }
 
 message editpart
-{Partition %d looks like:\n\n}
+{Partition %d looks like: (cyl = %d sectors; bios cyl = %d sectors)\n\n}
 
 message editparttable
-{Edit your DOS partition table.  The highlighted partition is the currently
-active partition.   The partition table currently looks like:
+
+{Edit your DOS partition table.  Cylinders contain %d sectors (%d tracks
+by %d sectors per track).  BIOS cylinders contain %d sectors (%d tracks
+by %d sectors per track).  The highlighted partition is the currently
+active partition.  The partition table currently looks like:
 
 }
 
@@ -176,7 +177,7 @@
 }
 
 message askfsroot
-{I will be asking for partition information.
+{I will be asking for partition information.  Cylinders contain %d sectors.
 
 First the root partition.  You have %d %s left on your disk.
 Root partition size? }