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).
This commit is contained in:
msaitoh 2021-05-12 06:53:55 +00:00
parent 802b943a17
commit aa6dc00e6e
3 changed files with 32 additions and 12 deletions

View File

@ -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_pm, struct part_usage_info *infos,
{
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;
}
}

View File

@ -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 *arg)
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, void *arg)
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;
}

View File

@ -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_partitions *arg, part_id id,
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;