[PATCH] TiVo partition support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While trying to work out a problem with my Series 2 TiVo, I noticed
that recent kernels still don't have support for the modified Mac
partition table the TiVos use.  Below is a lightly tested patch for
2.6.17 (which applies cleanly to 2.6.18 also) that adds the support.

This isn't even remotely original work.  I adapted this from the patch
I found here:

  http://homepage.ntlworld.com/maxwells.daemon/tivo/downloads/tivo-partition-support-1.patch

Pete Zaitcev has an equivalent patch here (which I found after I had
already rebased the above patch):

  http://people.redhat.com/zaitcev/linux/linux-2.6.16-rc5-tivo1.diff

diff -ur linux-2.6.17.orig/fs/partitions/Kconfig linux-2.6.17/fs/partitions/Kconfig
--- linux-2.6.17.orig/fs/partitions/Kconfig	2006-06-17 20:49:35.000000000 -0500
+++ linux-2.6.17/fs/partitions/Kconfig	2006-09-27 13:23:42.000000000 -0500
@@ -104,6 +104,11 @@
 	  Say Y here if you would like to use hard disks under Linux which
 	  were partitioned on a Macintosh.
 
+config TIVO_PARTITION
+	bool "TiVo partition map support" if MAC_PARTITION
+	help
+	  Say Y here if you would like to include support for TiVo partitions.
+
 config MSDOS_PARTITION
 	bool "PC BIOS (MSDOS partition tables) support" if PARTITION_ADVANCED
 	default y
diff -ur linux-2.6.17.orig/fs/partitions/mac.c linux-2.6.17/fs/partitions/mac.c
--- linux-2.6.17.orig/fs/partitions/mac.c	2006-06-17 20:49:35.000000000 -0500
+++ linux-2.6.17/fs/partitions/mac.c	2006-09-27 13:25:21.000000000 -0500
@@ -46,11 +46,26 @@
 	md = (struct mac_driver_desc *) read_dev_sector(bdev, 0, &sect);
 	if (!md)
 		return -1;
-	if (be16_to_cpu(md->signature) != MAC_DRIVER_MAGIC) {
-		put_dev_sector(sect);
-		return 0;
+
+	switch(be16_to_cpu(md->signature)) {
+		case MAC_DRIVER_MAGIC:
+			secsize = be16_to_cpu(md->block_size);
+			break;
+
+#ifdef CONFIG_TIVO_PARTITION
+		case TIVO_DRIVER_MAGIC:
+			/* The TiVo map does not have a valid Mac block 0
+			 * fill in the block size.
+			 */
+			secsize = 512;
+			break;
+#endif
+
+		default:
+			put_dev_sector(sect);
+			return 0;
 	}
-	secsize = be16_to_cpu(md->block_size);
+
 	put_dev_sector(sect);
 	data = read_dev_sector(bdev, secsize/512, &sect);
 	if (!data)
diff -ur linux-2.6.17.orig/fs/partitions/mac.h linux-2.6.17/fs/partitions/mac.h
--- linux-2.6.17.orig/fs/partitions/mac.h	2006-06-17 20:49:35.000000000 -0500
+++ linux-2.6.17/fs/partitions/mac.h	2006-09-27 13:26:30.000000000 -0500
@@ -32,6 +32,7 @@
 #define MAC_STATUS_BOOTABLE	8	/* partition is bootable */
 
 #define MAC_DRIVER_MAGIC	0x4552
+#define TIVO_DRIVER_MAGIC	0x1492
 
 /* Driver descriptor structure, in block 0 */
 struct mac_driver_desc {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux