TiVo Community
TiVo Community
TiVo Community
Go Back   TiVo Community > Underground Playground > Developers Corner
TiVo Community
Reply
Forum Jump
 
Thread Tools
Old 05-10-2014, 03:30 PM   #1
telemark
Registered User
 
Join Date: Nov 2013
Posts: 1,474
pmdmp - [agnostic] partition map dump

I wrote this for myself but felt others might need this as well. The goal was to read as many formats as possible, prevent human error, and getting something working asap so we can get to the more interesting stuff.

Hypothetically can handle:
Roamio or Premiere
32bit or 64bit fields
Little or Big Endian
Device or Files or Pipes
MBR skip over
YMMV

Copyright 2014, binary license granted for personal, non-commercial use. Commercial use or redistribution, please request a license.


Last edited by telemark; 05-10-2014 at 04:08 PM.
telemark is offline   Reply With Quote
Old 05-10-2014, 03:31 PM   #2
telemark
Registered User
 
Join Date: Nov 2013
Posts: 1,474
Version beta2:
Linux 64bit static linked
Mac OS X 32bit

MD5 (linux/pmdmp) = babafe85b3e5d2a28e4e9b7ffdbd00f7
MD5 (mac/pmdmp) = 541afaa07d0105875b52de64323ea36b

Code:
Usage examples:
  > pmdmp ~/HD.backup
  > zcat sdb1.gz | pmdmp
  Linux> pmdmp /dev/sdb
  Mac> pmdmp /dev/rdisk1

  1 (0200) : MP : Apple_partition_map :                       Apple :         63 @          1
  2 (0400) : MP :               Image :                 Bootstrap 1 :          8 @  537225104
  3 (0600) : MP :               Image :                    Kernel 1 :          8 @  537225112
  4 (0800) : MP :                Ext2 :                      Root 1 :          8 @  537225120
  5 (0A00) : MP :               Image :                 Bootstrap 2 :          8 @  537225128
  6 (0C00) : MP :               Image :                    Kernel 2 :          8 @  537225136
  7 (0E00) : MP :                Ext2 :                      Root 2 :          8 @  537225144
  8 (1000) : MP :                Swap :                  Linux swap :    1048576 @  537225152
  9 (1200) : MP :                Ext2 :                        /var :    1572864 @  538273728
 10 (1400) : MP :                 MFS :      MFS application region :    1638400 @  546138048
 11 (1600) : MP :                 MFS :            MFS media region :  427358320 @  549414848
 12 (1800) : MP :                 MFS :    MFS application region 2 :    1638400 @  547776448
 13 (1A00) : MP :                 MFS :          MFS media region 2 :  537225040 @         64
 14 (1C00) : MP :                Ext2 :                      SQLite :    6291456 @  539846592

  1 (0200) : MP : Apple_partition_map :                       Apple :          1 +         63 =         64
 13 (1A00) : MP :                 MFS :          MFS media region 2 :         64 +  537225040 =  537225104
  2 (0400) : MP :               Image :                 Bootstrap 1 :  537225104 +          8 =  537225112
  3 (0600) : MP :               Image :                    Kernel 1 :  537225112 +          8 =  537225120
  4 (0800) : MP :                Ext2 :                      Root 1 :  537225120 +          8 =  537225128
  5 (0A00) : MP :               Image :                 Bootstrap 2 :  537225128 +          8 =  537225136
  6 (0C00) : MP :               Image :                    Kernel 2 :  537225136 +          8 =  537225144
  7 (0E00) : MP :                Ext2 :                      Root 2 :  537225144 +          8 =  537225152
  8 (1000) : MP :                Swap :                  Linux swap :  537225152 +    1048576 =  538273728
  9 (1200) : MP :                Ext2 :                        /var :  538273728 +    1572864 =  539846592
 14 (1C00) : MP :                Ext2 :                      SQLite :  539846592 +    6291456 =  546138048
 10 (1400) : MP :                 MFS :      MFS application region :  546138048 +    1638400 =  547776448
 12 (1800) : MP :                 MFS :    MFS application region 2 :  547776448 +    1638400 =  549414848
 11 (1600) : MP :                 MFS :            MFS media region :  549414848 +  427358320 =  976773168
Output notes:
PM or MP or NP is the literal field contents but tells you whether it's in 32/64 or LSB/MSB format.

There is a sanity procedure which checks if partitions are adjacent, if you're seeing exclamation marks (!) then there was discontinuity detected. If you're seeing this it's probably a math bug in this program, please report it so it can be fixed.

Change log:
2014-05-10: beta2 - Added code for hypothetical 'PN' (64bit Premiere). None were found on stock drives. Unknown if in wild. Remains untested as such.
2014-05-10: beta1 - Initial public release.


Last edited by telemark; 05-10-2014 at 09:55 PM.
telemark is offline   Reply With Quote
Old 05-06-2015, 07:43 AM   #3
telemark
Registered User
 
Join Date: Nov 2013
Posts: 1,474
Version beta3:
Linux 64bit static linked

Change log:
2015-05-06: beta3
Additional output format, which generates arguments for losetup.
(so that partition devices can be created)

Code:
> ./pmdmp-static /dev/sdX
Output:
losetup -f /dev/sdX --sizelimit 512
losetup -f /dev/sdX --offset 512 --sizelimit 32256 	# 1 Apple
losetup -f /dev/sdX --offset 176040132608 --sizelimit 512 	# 2 Bootstrap 1
losetup -f /dev/sdX --offset 176040133120 --sizelimit 8388608 	# 3 Kernel 1
losetup -f /dev/sdX --offset 176048521728 --sizelimit 268435456 	# 4 Root 1
losetup -f /dev/sdX --offset 176316957184 --sizelimit 512 	# 5 Bootstrap 2
losetup -f /dev/sdX --offset 176316957696 --sizelimit 8388608 	# 6 Kernel 2
losetup -f /dev/sdX --offset 176325346304 --sizelimit 268435456 	# 7 Root 2
losetup -f /dev/sdX --offset 176593781760 --sizelimit 134217728 	# 8 Linux swap
losetup -f /dev/sdX --offset 176727999488 --sizelimit 536870912 	# 9 /var
losetup -f /dev/sdX --offset 180486095872 --sizelimit 838860800 	# 10 MFS application region
losetup -f /dev/sdX --offset 182163817472 --sizelimit 137909115904 	# 11 MFS media region
losetup -f /dev/sdX --offset 181324956672 --sizelimit 838860800 	# 12 MFS application region 2
losetup -f /dev/sdX --offset 32768 --sizelimit 176040099840 	# 13 MFS media region 2
losetup -f /dev/sdX --offset 177264870400 --sizelimit 3221225472 	# 14 SQLite


Last edited by telemark; 06-18-2015 at 12:53 PM.
telemark is offline   Reply With Quote
Reply
Forum Jump







Thread Tools


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Advertisements





TiVo Community
Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
vBulletin Skins by: Relivo Media


(C) 2015 DBNet - All Rights Reserved. No information may be posted elsewhere without written permission.
TiVoŽ is a registered trademark of TiVo Inc. This site is not owned or operated by TiVo Inc.
All times are GMT -5. The time now is 07:04 PM.
Page generated in 0.12097597 seconds (31.11% PHP - 68.89% MySQL) with 18 queries