# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/linux/hotfix-part-mac.patch # Copyright (C) 2025 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- Only put valid and allocated partitions, not Apple_Free parts. diff --git a/block/partitions/mac.c b/block/partitions/mac.c index b02530d98629..305dc999e5c0 100644 --- a/block/partitions/mac.c +++ b/block/partitions/mac.c @@ -96,6 +96,9 @@ int mac_partition(struct parsed_partitions *state) part = (struct mac_partition *) (data + pos%512); if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) break; + if ((be32_to_cpu(part->status) & (MAC_STATUS_VALID | MAC_STATUS_ALLOCATED)) != + (MAC_STATUS_VALID | MAC_STATUS_ALLOCATED)) + continue; put_partition(state, slot, be32_to_cpu(part->start_block) * (secsize/512), be32_to_cpu(part->block_count) * (secsize/512)); diff --git a/block/partitions/mac.h b/block/partitions/mac.h index 0e41c9da7532..10828c5d53d2 100644 --- a/block/partitions/mac.h +++ b/block/partitions/mac.h @@ -30,6 +30,8 @@ struct mac_partition { /* there is more stuff after this that we don't need */ }; +#define MAC_STATUS_VALID 1 /* partition is valid */ +#define MAC_STATUS_ALLOCATED 2 /* partition is allocated */ #define MAC_STATUS_BOOTABLE 8 /* partition is bootable */ #define MAC_DRIVER_MAGIC 0x4552