Module Name:src
Committed By: martin
Date: Mon Aug 21 11:05:54 UTC 2023
Modified Files:
src/usr.sbin/sysinst/arch/luna68k [netbsd-10]: md.c md.h
Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #331):
usr.sbin/sysinst/arch/luna68k/md.c: revision 1.11
usr.sbin/sysinst/arch/luna68k/md.h: revision 1.7
PR 55058: force the boot partition to sd0d, so our root partitions becomes
sd0a again.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.2.1 src/usr.sbin/sysinst/arch/luna68k/md.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/usr.sbin/sysinst/arch/luna68k/md.h
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/luna68k/md.c
diff -u src/usr.sbin/sysinst/arch/luna68k/md.c:1.10 src/usr.sbin/sysinst/arch/luna68k/md.c:1.10.2.1
--- src/usr.sbin/sysinst/arch/luna68k/md.c:1.10 Sat Jan 29 16:01:19 2022
+++ src/usr.sbin/sysinst/arch/luna68k/md.c Mon Aug 21 11:05:54 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.10 2022/01/29 16:01:19 martin Exp $ */
+/* $NetBSD: md.c,v 1.10.2.1 2023/08/21 11:05:54 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -117,6 +117,23 @@ md_make_bsd_partitions(struct install_pa
return make_bsd_partitions(install);
}
+static part_id
+find_boot_part(struct install_partition_desc *install)
+{
+ for (size_t i = 0; i < install->num; i++) {
+ if (install->infos[i].fs_type != PART_BOOT_TYPE)
+ continue;
+ if (install->infos[i].fs_version != PART_BOOT_SUBT)
+ continue;
+ if (install->infos[i].size < (PART_BOOT/512))
+ continue;
+ if (install->infos[i].cur_start > 0)
+ continue;
+ return i;
+ }
+ return NO_PART;
+}
+
/*
* any additional partition validation
*/
@@ -128,14 +145,12 @@ md_check_partitions(struct install_parti
* Make sure that a boot partition (old 4.3BSD UFS) is prepared
* properly for our native bootloader.
*/
- if (install->num < 1 || install->infos[0].fs_type != PART_BOOT_TYPE ||
- install->infos[0].fs_version != PART_BOOT_SUBT ||
- !(install->infos[0].instflags & PUIINST_NEWFS)) {
- msg_display(MSG_nobootpartdisklabel);
- process_menu(MENU_ok, NULL);
- return false;
- }
- return true;
+ if (find_boot_part(install) != NO_PART)
+ return true;
+
+ msg_display(MSG_nobootpartdisklabel);
+ process_menu(MENU_ok, NULL);
+ return false;
}
/*
@@ -187,16 +202,19 @@ int
md_post_newfs(struct install_partition_desc *install)
{
char rdisk[STRSIZE], disk[STRSIZE];
+ part_id boot_part = find_boot_part(install);
- if (install->num < 1)
+ if (boot_part == NO_PART)
return 1;
- if (!install->infos[0].parts->pscheme->get_part_device(
- install->infos[0].parts, install->infos[0].cur_part_id,
+ if (!install->infos[boot_part].parts->pscheme->get_part_device(
+ install->infos[boot_part].parts,
+ install->infos[boot_part].cur_part_id,
rdisk, sizeof rdisk, NULL, raw_dev_name, true, true))
return 1;
- if (!install->infos[0].parts->pscheme->get_part_device(
- install->infos[0].parts, install->infos[0].cur_part_id,
+ if (!install->infos[boot_part].parts->pscheme->get_part_device(
+ install->infos[boot_part].parts,
+ install->infos[boot_part].cur_part_id,
disk, sizeof disk, NULL, plain_name, true, true))
return 1;
@@ -240,12 +258,14 @@ md_update(struct install_partition_desc
struct stat sb;
bool hasboot = false;
char disk[STRSIZE];
+ part_id boot_part = find_boot_part(install);
- if (install->num < 1)
+ if (boot_part == NO_PART)
return 0;
- if (!install->infos[0].parts->pscheme->get_part_device(
- install->infos[0].parts, install->infos[0].cur_part_id,
+ if (!install->infos[boot_part].parts->pscheme->get_part_device(
+ install->infos[boot_part].parts,
+ install->infos[boot_part].cur_part_id,
disk, sizeof disk, NULL, plain_name, true, true))
return 0;
@@ -288,4 +308,3 @@ md_gpt_post_write(struct disk_partitions
return true;
}
#endif
-
Index: src/usr.sbin/sysinst/arch/luna68k/md.h
diff -u src/usr.sbin/sysinst/arch/luna68k/md.h:1.6 src/usr.sbin/sysinst/arch/luna68k/md.h:1.6.2.1
--- src/usr.sbin/sysinst/arch/luna68k/md.h:1.6 Fri Jun 17 16:09:47 2022
+++ src/usr.sbin/sysinst/arch/luna68k/md.h Mon Aug 21 11:05:54 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: md.h,v 1.6 2022/06/17 16:09:47 tsutsui Exp $ */
+/* $NetBSD: md.h,v 1.6.2.1 2023/08/21 11:05:54 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -64,3 +64,15 @@
* the hand-edited disklabel will NOT be written by MI code.
*/
#define DISKLABEL_CMD "disklabel -w -r"
+
+/*
+ * Our boot partition is FFSv1, so it will be reported as PT_root
+ * and might take up disklabel slot 0 (partition 'a'), which we would
+ * like to avoid and make it use 'd' instead.
+ * Only allow PT_root partitions for slots before RAW_PART if they
+ * start past the boot partition size.
+ */
+#define