Module Name:    src
Committed By:   martin
Date:           Wed Oct 14 14:37:59 UTC 2020

Modified Files:
        src/usr.sbin/sysinst/arch/evbarm: md.c

Log Message:
Move MBR writing (if any) post disklabel writing, otherwise strange
interactions happen.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/sysinst/arch/evbarm/md.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/arch/evbarm/md.c
diff -u src/usr.sbin/sysinst/arch/evbarm/md.c:1.17 src/usr.sbin/sysinst/arch/evbarm/md.c:1.18
--- src/usr.sbin/sysinst/arch/evbarm/md.c:1.17	Mon Oct 12 16:14:33 2020
+++ src/usr.sbin/sysinst/arch/evbarm/md.c	Wed Oct 14 14:37:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.17 2020/10/12 16:14:33 martin Exp $ */
+/*	$NetBSD: md.c,v 1.18 2020/10/14 14:37:59 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -117,6 +117,13 @@ again:
 			pm->dlsize = ps->size_limit;
 	}
 
+	/*
+	 * If the selected scheme does not need two-stage partitioning
+	 * (like GPT), do not bother to edit the outer partitions.
+	 */
+	if (pm->parts->pscheme->secondary_partitions == NULL ||
+	    pm->parts->pscheme->secondary_scheme == NULL)
+		return true;
 
 	res = edit_outer_parts(pm->parts);
 	if (res == 0)
@@ -164,6 +171,21 @@ md_pre_disklabel(struct install_partitio
     struct disk_partitions *parts)
 {
 
+	/*
+	 * RAW_PART is 2 on evbarm and bad things happen if we
+	 * write the MBR first and then the disklabel - so postpone
+	 * the MBR to md_post_disklabel(), unlike other architecturs.
+	 */
+	return true;
+}
+
+/*
+ * hook called after writing disklabel to new target disk.
+ */
+bool
+md_post_disklabel(struct install_partition_desc *install,
+    struct disk_partitions *parts)
+{
 	if (parts->parent == NULL)
 		return true;	/* no outer partitions */
 
@@ -183,16 +205,6 @@ md_pre_disklabel(struct install_partitio
 }
 
 /*
- * hook called after writing disklabel to new target disk.
- */
-bool
-md_post_disklabel(struct install_partition_desc *install,
-    struct disk_partitions *parts)
-{
-	return true;
-}
-
-/*
  * 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.

Reply via email to