Apply patch provided by Izumi Tsutsui in PR 55382: make ext2 partitions
show up in the outer (MBR) partition table, needed for example on Cobalt where firmware boots from that partition.
This commit is contained in:
parent
8e2247ea41
commit
a23a20c65a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bsddisklabel.c,v 1.44 2020/09/28 18:13:25 martin Exp $ */
|
||||
/* $NetBSD: bsddisklabel.c,v 1.45 2020/09/29 15:29:17 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -76,7 +76,7 @@ default_parts_init[] =
|
|||
#endif
|
||||
#ifdef PART_BOOT_TYPE
|
||||
.fs_type = PART_BOOT_TYPE,
|
||||
#if PART_BOOT_TYPE == FS_MSDOS
|
||||
#if (PART_BOOT_TYPE == FS_MSDOS) || (PART_BOOT_TYPE == FS_EX2FS)
|
||||
.flags = PUIFLAG_ADD_OUTER,
|
||||
#endif
|
||||
#endif
|
||||
|
@ -100,7 +100,7 @@ default_parts_init[] =
|
|||
#endif
|
||||
#ifdef PART_BOOT1_TYPE
|
||||
.fs_type = PART_BOOT1_TYPE,
|
||||
#if PART_BOOT1_TYPE == FS_MSDOS
|
||||
#if (PART_BOOT1_TYPE == FS_MSDOS) || (PART_BOOT1_TYPE == FS_EX2FS)
|
||||
.flags = PUIFLAG_ADD_OUTER,
|
||||
#endif
|
||||
#endif
|
||||
|
@ -119,7 +119,7 @@ default_parts_init[] =
|
|||
#endif
|
||||
#ifdef PART_BOOT2_TYPE
|
||||
.fs_type = PART_BOOT2_TYPE,
|
||||
#if PART_BOOT2_TYPE == FS_MSDOS
|
||||
#if (PART_BOOT2_TYPE == FS_MSDOS) || (PART_BOOT2_TYPE == FS_EX2FS)
|
||||
.flags = PUIFLAG_ADD_OUTER,
|
||||
#endif
|
||||
#endif
|
||||
|
@ -974,7 +974,8 @@ fill_defaults(struct partition_usage_set *wanted, struct disk_partitions *parts,
|
|||
wanted->infos[i].type = pt->generic_ptype;
|
||||
}
|
||||
if (wanted->parts->parent != NULL &&
|
||||
wanted->infos[i].fs_type == FS_MSDOS)
|
||||
(wanted->infos[i].fs_type == FS_MSDOS ||
|
||||
wanted->infos[i].fs_type == FS_EX2FS))
|
||||
wanted->infos[i].flags |=
|
||||
PUIFLG_ADD_INNER|PUIFLAG_ADD_OUTER;
|
||||
|
||||
|
@ -1021,8 +1022,8 @@ fill_defaults(struct partition_usage_set *wanted, struct disk_partitions *parts,
|
|||
* empty disk. Merge the partitions in target range that are already
|
||||
* there (match with wanted) or are there additionaly.
|
||||
* The only thing outside of target range that we care for
|
||||
* are FAT partitions and a potential swap partition - we assume one
|
||||
* is enough.
|
||||
* are FAT partitions, EXT2FS partitions, and a potential
|
||||
* swap partition - we assume one is enough.
|
||||
*/
|
||||
size_t num = wanted->num;
|
||||
if (parts->parent) {
|
||||
|
@ -1033,7 +1034,8 @@ fill_defaults(struct partition_usage_set *wanted, struct disk_partitions *parts,
|
|||
parts->parent, pno, &info))
|
||||
continue;
|
||||
if (info.nat_type->generic_ptype != PT_swap &&
|
||||
info.fs_type != FS_MSDOS)
|
||||
info.fs_type != FS_MSDOS &&
|
||||
info.fs_type != FS_EX2FS)
|
||||
continue;
|
||||
merge_part_with_wanted(parts->parent, pno, &info,
|
||||
wanted, num, true);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: disklabel.c,v 1.38 2020/09/28 18:40:23 martin Exp $ */
|
||||
/* $NetBSD: disklabel.c,v 1.39 2020/09/29 15:29:17 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2018 The NetBSD Foundation, Inc.
|
||||
|
@ -582,6 +582,9 @@ dl_init_types(void)
|
|||
pt = PT_root; break;
|
||||
case FS_SWAP: pt = PT_swap; break;
|
||||
case FS_MSDOS: pt = PT_FAT; break;
|
||||
case FS_EX2FS: pt = PT_EXT2; break;
|
||||
case FS_SYSVBFS:
|
||||
pt = PT_SYSVBFS; break;
|
||||
default: pt = PT_unknown; break;
|
||||
}
|
||||
dl_types[i].generic_ptype = pt;
|
||||
|
@ -707,6 +710,9 @@ disklabel_get_generic_type(enum part_type pt)
|
|||
case PT_FAT:
|
||||
case PT_EFI_SYSTEM:
|
||||
nt = FS_MSDOS; break;
|
||||
case PT_EXT2: nt = FS_EX2FS; break;
|
||||
case PT_SYSVBFS:
|
||||
nt = FS_SYSVBFS; break;
|
||||
default: nt = FS_UNUSED; break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mbr.c,v 1.32 2020/04/22 23:43:12 joerg Exp $ */
|
||||
/* $NetBSD: mbr.c,v 1.33 2020/09/29 15:29:17 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -1117,6 +1117,8 @@ mbr_map_part_type(unsigned int t)
|
|||
return PT_FAT;
|
||||
case MBR_PTYPE_EFI:
|
||||
return PT_EFI_SYSTEM;
|
||||
case MBR_PTYPE_LNXEXT2:
|
||||
return PT_EXT2;
|
||||
case MBR_PTYPE_NETBSD:
|
||||
return PT_root;
|
||||
}
|
||||
|
@ -1279,6 +1281,8 @@ mbr_get_generic_part_type(enum part_type pt)
|
|||
return mbr_get_gen_type_desc(MBR_PTYPE_NETBSD);
|
||||
case PT_FAT:
|
||||
return mbr_get_gen_type_desc(MBR_PTYPE_FAT32L);
|
||||
case PT_EXT2:
|
||||
return mbr_get_gen_type_desc(MBR_PTYPE_LNXEXT2);
|
||||
case PT_EFI_SYSTEM:
|
||||
return mbr_get_gen_type_desc(MBR_PTYPE_EFI);
|
||||
default:
|
||||
|
@ -1386,6 +1390,9 @@ mbr_do_get_part_info(const struct disk_partitions *arg, part_id id,
|
|||
case MBR_PTYPE_EFI:
|
||||
info->fs_type = FS_MSDOS;
|
||||
break;
|
||||
case MBR_PTYPE_LNXEXT2:
|
||||
info->fs_type = FS_EX2FS;
|
||||
break;
|
||||
case MBR_PTYPE_XENIX_ROOT:
|
||||
case MBR_PTYPE_XENIX_USR:
|
||||
info->fs_type = FS_SYSV;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: partitions.h,v 1.15 2020/01/27 21:21:22 martin Exp $ */
|
||||
/* $NetBSD: partitions.h,v 1.16 2020/09/29 15:29:17 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2018 The NetBSD Foundation, Inc.
|
||||
|
@ -91,6 +91,8 @@ enum part_type {
|
|||
PT_root, /* the NetBSD / partition (bootable) */
|
||||
PT_swap, /* the NetBSD swap partition */
|
||||
PT_FAT, /* boot partition (e.g. for u-boot) */
|
||||
PT_EXT2, /* boot partition (for Linux appliances) */
|
||||
PT_SYSVBFS, /* boot partition (for some SYSV machines) */
|
||||
PT_EFI_SYSTEM, /* (U)EFI boot partition */
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue