Subject: Re: Proposal for new Apple Partition types
To: Bill Studenmund <wrstuden@netbsd.org>
From: Frederick Bruckman <fredb@immanent.net>
List: port-mac68k
Date: 02/07/2002 12:48:05
On Thu, 7 Feb 2002, Bill Studenmund wrote:
> I'd like to make two extentions to this. The first is to add,
> "NetBSD/Mac68k", and change how the /MacPPC and /Mac68k partitions work.
> They would both be "root" partitions, but slot a would, by default, go
> first to the partition named after the port. So you could make a dual-boot
> hard disk, and the macppc part would boot off of the "NetBSD/MacPPC"
> partition, and the mac68k part would boot off of the "NetBSD/Mac68k" one.
Sounds good.
> The second change is to add a valid bzb to these partition types. If one
> is present, we then use the bzbType field to indicate what NetBSD
> partition type to report for the partition. That way we can mark
> partitions as having LFS file systems on them for instance. One of these
> partitions ("NetBSD*") w/o a valid bzb would be reported as having an ffs.
Coincidently, I've developed a patch to do this already, and I was just
thinking about running it by you. I forgot about NetBSD/macppc using the
same disklabel, so I just gave LFS the next free bit, and made it prefer
the "f" slot. The mac just crashed copying a cross-built libc from the
an nfs mounted partition, but you can't blame LFS for that. :-)
I'm also looking at adding the capability to make an LFS partition from
within the installer. That's when I noticed that the disklabel faking is
borked (PR 15528).
Here's the kernel patch I'm running on 1.5AZ/mac68k/ELF:
Index: include/disklabel.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/mac68k/include/disklabel.h,v
retrieving revision 1.6
diff -u -r1.6 disklabel.h
--- include/disklabel.h 1999/01/27 21:03:46 1.6
+++ include/disklabel.h 2002/02/07 18:37:51
@@ -172,5 +172,6 @@
#define BZB_TYPESWAP 3
#define BZB_ROOTFS 0x8000
#define BZB_USRFS 0x4000
+#define BZB_LFS 0x2000
#endif /* _MACHINE_DISKLABEL_H_ */
Index: mac68k/disksubr.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/mac68k/mac68k/disksubr.c,v
retrieving revision 1.39
diff -u -r1.39 disksubr.c
--- mac68k/disksubr.c 2001/11/23 22:31:22 1.39
+++ mac68k/disksubr.c 2002/02/07 18:37:51
@@ -85,6 +85,7 @@
#define SWAP_PART 3
#define HFS_PART 4
#define SCRATCH_PART 5
+#define LFS_PART 6
int fat_types[] = {
MBR_PTYPE_FAT12, MBR_PTYPE_FAT16S,
@@ -159,6 +160,8 @@
type = UFS_PART;
else if (bzb->bzbType == BZB_TYPESWAP)
type = SWAP_PART;
+ else if (bzb->bzbFlags & BZB_LFS)
+ type = LFS_PART;
else
type = SCRATCH_PART;
} else if (strcmp(PART_TYPE_MAC, typestr) == 0)
@@ -215,6 +218,10 @@
setpartition(part + i, &lp->d_partitions[1], FS_SWAP);
if (*maxslot < 1)
*maxslot = 1;
+ } else if (type == LFS_PART) {
+ setpartition(part + i, &lp->d_partitions[5], FS_BSDLFS);
+ if (*maxslot < 5)
+ *maxslot = 5;
} else
printf("disksubr.c: can't do type %d\n", type);
@@ -233,9 +240,10 @@
* next fill in the disklabel with info like this
* next fill in the root, usr, and swap parts.
* then look for anything else and fit it in.
- * A: root
+ * A: Root & Usr
* B: Swap
* C: Whole disk
+ * F: LFS
* G: Usr
*
*
@@ -285,7 +293,10 @@
getNamedType(part, NUM_PARTS, lp, ROOT_PART, -1, &maxslot);
if (getNamedType(part, NUM_PARTS, lp, UFS_PART, 0, &maxslot))
getNamedType(part, NUM_PARTS, lp, UFS_PART, -1, &maxslot);
- getNamedType(part, NUM_PARTS, lp, SWAP_PART, -1, &maxslot);
+ if (getNamedType(part, NUM_PARTS, lp, SWAP_PART, 0, &maxslot))
+ getNamedType(part, NUM_PARTS, lp, SWAP_PART, -1, &maxslot);
+ if (getNamedType(part, NUM_PARTS, lp, LFS_PART, 0, &maxslot))
+ getNamedType(part, NUM_PARTS, lp, LFS_PART, -1, &maxslot);
/* Now get as many of the rest of the partitions as we can */
for (i = 0; i < NUM_PARTS; i++) {
@@ -312,6 +323,9 @@
break;
case SCRATCH_PART:
setpartition(part + i, pp, FS_OTHER);
+ break;
+ case LFS_PART:
+ setpartition(part + i, pp, FS_BSDLFS);
break;
default:
slot = 0;
Also on my wish list would be support for the Apple MSDOS compatible
partitions, but I forgot how to make one under Mac OS, or I threw away
the extension, or something.
Frederick