Module Name: src Committed By: msaitoh Date: Wed May 12 06:53:56 UTC 2021
Modified Files: src/usr.sbin/sysinst [netbsd-9]: label.c mbr.c src/usr.sbin/sysinst/arch/evbarm [netbsd-9]: md.c Log Message: Pull up following revision(s) (requested by martin in ticket #1271): usr.sbin/sysinst/mbr.c: revision 1.39 usr.sbin/sysinst/label.c: revision 1.33 usr.sbin/sysinst/arch/evbarm/md.c: revision 1.21 For FS_MSDOS report the MBR type as fs_sub_type. Keep MSDOS partition size and subtype consistent - some u-boot are picky. Do not allow editing of start/size/fs-type for partitions that are already carved in stone (e.g. defined in an outer MBR while we are editing the inner disklabel). To generate a diff of this commit: cvs rdiff -u -r1.10.2.6 -r1.10.2.7 src/usr.sbin/sysinst/label.c cvs rdiff -u -r1.19.2.8 -r1.19.2.9 src/usr.sbin/sysinst/mbr.c cvs rdiff -u -r1.8.2.6 -r1.8.2.7 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/label.c diff -u src/usr.sbin/sysinst/label.c:1.10.2.6 src/usr.sbin/sysinst/label.c:1.10.2.7 --- src/usr.sbin/sysinst/label.c:1.10.2.6 Thu Oct 15 19:36:51 2020 +++ src/usr.sbin/sysinst/label.c Wed May 12 06:53:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: label.c,v 1.10.2.6 2020/10/15 19:36:51 bouyer Exp $ */ +/* $NetBSD: label.c,v 1.10.2.7 2021/05/12 06:53:55 msaitoh Exp $ */ /* * Copyright 1997 Jonathan Stone @@ -36,7 +36,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: label.c,v 1.10.2.6 2020/10/15 19:36:51 bouyer Exp $"); +__RCSID("$NetBSD: label.c,v 1.10.2.7 2021/05/12 06:53:55 msaitoh Exp $"); #endif #include <sys/types.h> @@ -1070,9 +1070,23 @@ update_edit_ptn_menu(menudesc *m, void * edit->pset->parts, edit->id, attr_no)) continue; } + /* + * Do not allow editing of size/start/type when partition + * is defined in some outer partition table already + */ + if ((edit->pset->infos[edit->index].flags & PUIFLG_IS_OUTER) + && (m->opts[i].opt_action == edit_fs_type + || m->opts[i].opt_action == edit_fs_start + || m->opts[i].opt_action == edit_fs_size)) + continue; /* Ok: we want this one */ m->opts[i].opt_flags &= ~OPT_IGNORE; } + + /* Avoid starting at a (now) disabled menu item */ + while (m->cursel >= 0 && m->cursel < m->numopts + && (m->opts[m->cursel].opt_flags & OPT_IGNORE)) + m->cursel++; } static void @@ -1123,7 +1137,10 @@ draw_edit_ptn_line(menudesc *m, int opt, if (m->opts[opt].opt_flags & OPT_IGNORE && (opt != 3 || edit->info.fs_type == FS_UNUSED) - && m->opts[opt].opt_action != edit_ptn_custom_type) { + && m->opts[opt].opt_action != edit_ptn_custom_type + && m->opts[opt].opt_action != edit_fs_type + && m->opts[opt].opt_action != edit_fs_start + && m->opts[opt].opt_action != edit_fs_size) { wprintw(m->mw, "%*s -", col_width, ""); return; } Index: src/usr.sbin/sysinst/mbr.c diff -u src/usr.sbin/sysinst/mbr.c:1.19.2.8 src/usr.sbin/sysinst/mbr.c:1.19.2.9 --- src/usr.sbin/sysinst/mbr.c:1.19.2.8 Wed Nov 4 13:27:08 2020 +++ src/usr.sbin/sysinst/mbr.c Wed May 12 06:53:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mbr.c,v 1.19.2.8 2020/11/04 13:27:08 sborrill Exp $ */ +/* $NetBSD: mbr.c,v 1.19.2.9 2021/05/12 06:53:55 msaitoh Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1401,6 +1401,7 @@ mbr_do_get_part_info(const struct disk_p case MBR_PTYPE_SPEEDSTOR_16S: case MBR_PTYPE_EFI: info->fs_type = FS_MSDOS; + info->fs_sub_type = mp->mbrp_type; break; case MBR_PTYPE_LNXEXT2: info->fs_type = FS_EX2FS; Index: src/usr.sbin/sysinst/arch/evbarm/md.c diff -u src/usr.sbin/sysinst/arch/evbarm/md.c:1.8.2.6 src/usr.sbin/sysinst/arch/evbarm/md.c:1.8.2.7 --- src/usr.sbin/sysinst/arch/evbarm/md.c:1.8.2.6 Sun Nov 29 11:36:46 2020 +++ src/usr.sbin/sysinst/arch/evbarm/md.c Wed May 12 06:53:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8.2.6 2020/11/29 11:36:46 martin Exp $ */ +/* $NetBSD: md.c,v 1.8.2.7 2021/05/12 06:53:55 msaitoh Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -337,10 +337,12 @@ bool md_parts_use_wholedisk(struct disk_partitions *parts) { struct disk_part_info boot_part = { - .size = boardtype == BOARD_TYPE_NORMAL ? + .size = boardtype == BOARD_TYPE_NORMAL ? PART_BOOT_LARGE/parts->bytes_per_sector : PART_BOOT/parts->bytes_per_sector, - .fs_type = PART_BOOT_TYPE, .fs_sub_type = MBR_PTYPE_FAT16L, + .fs_type = PART_BOOT_TYPE, + .fs_sub_type = boardtype == BOARD_TYPE_NORMAL ? + MBR_PTYPE_FAT32L : MBR_PTYPE_FAT16L, }; return parts_use_wholedisk(parts, 1, &boot_part); @@ -372,15 +374,15 @@ evbarm_part_defaults(struct pm_devs *my_ { size_t i; - if (boardtype != BOARD_TYPE_NORMAL) - return; - for (i = 0; i < num_usage_infos; i++) { if (infos[i].fs_type == PART_BOOT_TYPE && infos[i].mount[0] != 0 && strcmp(infos[i].mount, PART_BOOT_MOUNT) == 0) { - infos[i].size = PART_BOOT_LARGE / - my_pm->parts->bytes_per_sector; + infos[i].size = boardtype == BOARD_TYPE_NORMAL ? + PART_BOOT_LARGE/my_pm->parts->bytes_per_sector : + PART_BOOT/my_pm->parts->bytes_per_sector; + infos[i].fs_version = boardtype == BOARD_TYPE_NORMAL ? + MBR_PTYPE_FAT32L : MBR_PTYPE_FAT16L; return; } }