All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Pritchard <steve@silug.org>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] TiVo partition support
Date: Wed, 4 Oct 2006 11:15:02 -0500	[thread overview]
Message-ID: <20061004161502.GA14714@osiris.silug.org> (raw)

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 {

                 reply	other threads:[~2006-10-04 16:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061004161502.GA14714@osiris.silug.org \
    --to=steve@silug.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.