TiVo partition support
PATCH 1/1 TiVo partition support
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
fs/partitions/Kconfig +5 -0
@@ -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
fs/partitions/mac.c +19 -4
@@ -46,11 +46,26 @@ md = (struct mac_driver_desc *)read_dev_sector (bdev,0 , §);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 , §);if (!data)
fs/partitions/mac.h +1 -0
@@ -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 {