Sun Oct 2 10:21:36 2022 UTC ()
PR install/57025: revert bogus rev 1.9 which was only papering over
a bug in the adoption of the MBR handling code and fix the original
conversion bug instead:
 - run fdisk to install the MBR bootcode on the raw disk partition
 - run installboot against the NetBSD root partition (not the raw partition).


(martin)
diff -r1.15 -r1.16 src/usr.sbin/sysinst/arch/landisk/md.c

cvs diff -r1.15 -r1.16 src/usr.sbin/sysinst/arch/landisk/md.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/arch/landisk/md.c 2022/01/29 16:01:19 1.15
+++ src/usr.sbin/sysinst/arch/landisk/md.c 2022/10/02 10:21:36 1.16
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md.c,v 1.15 2022/01/29 16:01:19 martin Exp $ */ 1/* $NetBSD: md.c,v 1.16 2022/10/02 10:21:36 martin Exp $ */
2 2
3/* 3/*
4 * Copyright 1997,2002 Piermont Information Systems Inc. 4 * Copyright 1997,2002 Piermont Information Systems Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Based on code written by Philip A. Nelson for Piermont Information 7 * Based on code written by Philip A. Nelson for Piermont Information
8 * Systems Inc. 8 * Systems Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -120,27 +120,29 @@ md_pre_disklabel(struct install_partitio @@ -120,27 +120,29 @@ md_pre_disklabel(struct install_partitio
120 struct disk_partitions *parts) 120 struct disk_partitions *parts)
121{ 121{
122 122
123 if (parts->parent == NULL) 123 if (parts->parent == NULL)
124 return true; /* no outer partitions */ 124 return true; /* no outer partitions */
125 125
126 parts = parts->parent; 126 parts = parts->parent;
127 127
128 msg_display_subst(MSG_dofdisk, 3, parts->disk, 128 msg_display_subst(MSG_dofdisk, 3, parts->disk,
129 msg_string(parts->pscheme->name), 129 msg_string(parts->pscheme->name),
130 msg_string(parts->pscheme->short_name)); 130 msg_string(parts->pscheme->short_name));
131 131
132 /* write edited "MBR" onto disk. */ 132 /* write edited "MBR" onto disk. */
133 if (!parts->pscheme->write_to_disk(parts)) { 133 if (!parts->pscheme->write_to_disk(parts) ||
 134 run_program(RUN_SILENT | RUN_ERROR_OK,
 135 "/sbin/fdisk -f -i -c /usr/mdec/mbr %s", parts->disk)) {
134 msg_display(MSG_wmbrfail); 136 msg_display(MSG_wmbrfail);
135 process_menu(MENU_ok, NULL); 137 process_menu(MENU_ok, NULL);
136 return false; 138 return false;
137 } 139 }
138 return true; 140 return true;
139} 141}
140 142
141/* 143/*
142 * hook called after writing disklabel to new target disk. 144 * hook called after writing disklabel to new target disk.
143 */ 145 */
144bool 146bool
145md_post_disklabel(struct install_partition_desc *install, 147md_post_disklabel(struct install_partition_desc *install,
146 struct disk_partitions *parts) 148 struct disk_partitions *parts)
@@ -156,27 +158,27 @@ md_post_disklabel(struct install_partiti @@ -156,27 +158,27 @@ md_post_disklabel(struct install_partiti
156 * On the landisk, we use this opportunity to install the boot blocks. 158 * On the landisk, we use this opportunity to install the boot blocks.
157 */ 159 */
158int 160int
159md_post_newfs(struct install_partition_desc *install) 161md_post_newfs(struct install_partition_desc *install)
160{ 162{
161 char *bootxx; 163 char *bootxx;
162 int error; 164 int error;
163 165
164 msg_fmt_display(MSG_dobootblks, "%s", pm->diskdev); 166 msg_fmt_display(MSG_dobootblks, "%s", pm->diskdev);
165 cp_to_target("/usr/mdec/boot", "/boot"); 167 cp_to_target("/usr/mdec/boot", "/boot");
166 bootxx = bootxx_name(install); 168 bootxx = bootxx_name(install);
167 if (bootxx != NULL) { 169 if (bootxx != NULL) {
168 error = run_program(RUN_DISPLAY, 170 error = run_program(RUN_DISPLAY,
169 "/usr/sbin/installboot -v /dev/r%sd %s", pm->diskdev, bootxx); 171 "/usr/sbin/installboot -v /dev/r%sa %s", pm->diskdev, bootxx);
170 free(bootxx); 172 free(bootxx);
171 } else 173 } else
172 error = -1; 174 error = -1;
173 175
174 if (error != 0) 176 if (error != 0)
175 process_menu(MENU_ok, 177 process_menu(MENU_ok,
176 __UNCONST("Warning: disk is probably not bootable")); 178 __UNCONST("Warning: disk is probably not bootable"));
177 179
178 return 0; 180 return 0;
179} 181}
180 182
181int 183int
182md_post_extract(struct install_partition_desc *install, bool upgrade) 184md_post_extract(struct install_partition_desc *install, bool upgrade)