Subject: install/8386: Sysinst/mac68k does not update incore label after partitioning disk
To: None <>
From: None <>
List: netbsd-bugs
Date: 09/12/1999 11:51:11
>Number:         8386
>Category:       install
>Synopsis:       Sysinst/mac68k does not update incore label after partitioning disk
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    install-manager (NetBSD system installation bug manager)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 12 11:50:01 1999
>Originator:     Bob Nestor
>Release:        NetBSD-1.4.1
NetBSD pluto 1.4.1 NetBSD 1.4.1 (GENERICSBC) #0: Wed Aug 11 07:03:00 CDT 1999     fredb@corwin.home:/usr/src/sys/arch/mac68k/compile/GENERICSBC mac68k

Since the mac68k port does not support real disklabels the invocation
of the disklabel routine by sysinst was commented out even though the
Apple Disk Partition Map ondisk was updated.  A reboot of the system
would construct a new incore partition table that correctly represents
the newly partitioned disk, but this should be doable without a reboot.
It appears that executing a "disklabel -r <disk>" should do this,
but this causes errors as the routine which constructs the incore
disklabel at boot time is not recalled.  However, if disklabel did
reconstruct the incore disklabel for the mac68k port sysinst would still
fail because it is not invoking disklabel.  This patch fixes the problem
in sysinst/mac68k but does not address the problem in disklabel. When
disklabel is patched for the mac68k port, or when disklabel fully
supports disk labels on the mac68k port sysinst should be fully functional
with this patch.

Build and attempt to run sysinst/mac68k on a disk that didn't previously
have any NetBSD partitions. Sysinst will abort with an error that the
disk doesn't have the required partitions, and a "disklabel <disk>"
will appear to confirm this.  However, rebooting the system and rerunning
disklabel will show that the Apple Disk Partition Map was indeed updated
by the sysinst/mac68k execution.
Apply the following patch to the file src/distrib/utils/sysinst/arch/mac68k/md.h

--- md.h.orig	Sun Sep 12 12:52:42 1999
+++ md.h	Sun Sep 12 13:09:39 1999
@@ -186,12 +186,21 @@
  * If not defined, we assume the port does not support disklabels and  
  * hand-edited disklabel will NOT be written by MI code.
- * The mac68k port doesn't support real disklabels so we don't define the
- * command string.  The Mac Disk Partition Map gets written in the
- * md_pre_disklabel() routine.
- *
- * #define DISKLABEL_CMD
+ * The mac68k port doesn't support real disklabels on disk, instead the
+ * Apple Disk Partition Map is read at boot time and an incore disk label
+ * is constructed from that.  The updated Mac Disk Partition Map gets
+ * written in the md_pre_disklabel() routine which is invoked right before
+ * the disklabel application is invoked with the command defined here.
+ * Normally the disk label wouldn't have been written until the command
+ * defined here was invoked.  What we need to do is then get the ondisk
+ * label transferred into the incore disklabel.  We should be able to do
+ * this with the disklabel routine, but it will require some updates to
+ * re-invoke the Mac-specific readdisklabel routine to refresh the incore
+ * label. Until it is updated we will get an error indicating that the
+ * "disk has no label" when sysinst attempts to write the disk label using
+ * the command defined here.
+#define DISKLABEL_CMD "/sbin/disklabel -r"
 /* Definition of files to retreive from ftp. */
 EXTERN distinfo dist_list[]