Skip to contentSkip to conversation

block: partitions: mac: record Apple partition names

PATCH New Tim Douglas 1 participant 1 message Nov 18 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: partitions: mac: record Apple partition names

Early root=PARTLABEL= lookup fails on Apple Partition Map disks because the on-disk names are absent from the kernel's partition metadata. Copy the name from each entry and append a NUL terminator so that names that fill the 32-byte field can be used.

Tested on an arm64 QEMU guest with Linux v7.4-rc3 and no initramfs. Before the patch, boot failed with PARTLABEL and succeeded with the device path for the same partition. With the patch, boot succeeded with both a short name and a 32-byte name. Boot with root=PARTLABEL=6200-Linux was also verified on a Performa 6200CD using a kernel with local platform support.

AI assistance was used to investigate early root lookup and draft the change.

---
 block/partitions/mac.c | 6 ++++++
 1 file changed, 6 insertions(+)
block/partitions/mac.c +6 -0
index f372392af..da170a65d 100644
@@ -100,6 +100,12 @@ int mac_partition(struct parsed_partitions *state)
 			(sector_t)be32_to_cpu(part->start_block) * (secsize/512),
 			(sector_t)be32_to_cpu(part->block_count) * (secsize/512));
 
+		/* Expose the APM name for early root=PARTLABEL lookup. */
+		memcpy(state->parts[slot].info.volname, part->name,
+		       sizeof(part->name));
+		state->parts[slot].info.volname[sizeof(part->name)] = '\0';
+		state->parts[slot].has_info = true;
+
 		if (!strncasecmp(part->type, "Linux_RAID", 10))
 			state->parts[slot].flags = ADDPART_FLAG_RAID;
 #ifdef CONFIG_PPC_PMAC

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3

Signature · 1 line
2.39.5