TiVo Community
TiVo Community
TiVo Community
Go Back   TiVo Community > Underground Playground > TiVo Upgrade Center
TiVo Community
Reply
Forum Jump
 
Thread Tools
Old 06-20-2014, 04:46 AM   #1
telemark
Registered User
 
Join Date: Nov 2013
Posts: 600
pmtools - partition map toolset

This is the toolset I use to create 32bit Roamio Partition Maps. If there's demand, 64bit and Premiere support could be added.

Usage Examples
Code:
Setup environment:
export PATH="~/pmtools/bin:$PATH"
mkdir sdX
cd sdX

Reorder partition map
--
# splits a partition map into individual records
> pmdice /dev/sdX

ls -tr  | grep -v order.txt > order.txt

# combines individual records into a single map, in the order of the input file.
> pmix order.txt > NEW-PM.bin

New Roamio Map From Scratch
--
Create text file in 4 or 5 column format
(use disk order if offsets are unknown)
[line numbers are for illustration only]

> nl part-list.txt 
     1   MP : Apple_partition_map :                    'Apple' :        63 : 1
     2   MP :                 MFS :       'MFS media region 2' : 537225040 
     3   MP :               Image :              'Bootstrap 1' :         8 
     4   MP :               Image :                 'Kernel 1' :         8 
     5   MP :                Ext2 :                   'Root 1' :         8 
     6   MP :               Image :              'Bootstrap 2' :         8 
     7   MP :               Image :                 'Kernel 2' :         8 
     8   MP :                Ext2 :                   'Root 2' :         8 
     9   MP :                Swap :               'Linux swap' :   1048576 
    10   MP :                Ext2 :                     '/var' :   1572864 
    11   MP :                Ext2 :                   'SQLite' :   6291456 
    12   MP :                 MFS :   'MFS application region' :   1638400 
    13   MP :                 MFS : 'MFS application region 2' :   1638400 
    14   MP :                 MFS :         'MFS media region' : 427358320 

Check size for alignment (size was column 4 in above example)
> cat part-list.txt | cut -d":" -f 4 | divtest  *512 %512  %1024 %4096 %8192 
        N:            *512  %512 %1024 %4096 %8192
       63:           32256     0   512  3584  7680
537225040:    275059220480     0     0     0     0
        8:            4096     0     0     0  4096
        8:            4096     0     0     0  4096
        8:            4096     0     0     0  4096
        8:            4096     0     0     0  4096
        8:            4096     0     0     0  4096
        8:            4096     0     0     0  4096
  1048576:       536870912     0     0     0     0
  1572864:       805306368     0     0     0     0
  6291456:      3221225472     0     0     0     0
  1638400:       838860800     0     0     0     0
  1638400:       838860800     0     0     0     0
427358320:    218807459840     0     0     0     0

Create record files, and propagate autogenerated offset:
> chainexec pcreate part-list.txt
Executing:
pcreate  MP   Apple_partition_map                      'Apple'          63   1 
pcreate  MP                   MFS         'MFS media region 2'   537225040 64
pcreate  MP                 Image                'Bootstrap 1'           8 537225104
pcreate  MP                 Image                   'Kernel 1'           8 537225112
pcreate  MP                  Ext2                     'Root 1'           8 537225120
pcreate  MP                 Image                'Bootstrap 2'           8 537225128
pcreate  MP                 Image                   'Kernel 2'           8 537225136
pcreate  MP                  Ext2                     'Root 2'           8 537225144
pcreate  MP                  Swap                 'Linux swap'     1048576 537225152
pcreate  MP                  Ext2                       '/var'     1572864 538273728
pcreate  MP                  Ext2                     'SQLite'     6291456 539846592
pcreate  MP                   MFS     'MFS application region'     1638400 546138048
pcreate  MP                   MFS   'MFS application region 2'     1638400 547776448
pcreate  MP                   MFS           'MFS media region'   427358320 549414848
Last output: 976773168

Specify the ordering for the map [line numered for illustration]
> nl order.txt 
     1  0
     2  Apple
     3  Bootstrap_1
     4  Kernel_1
     5  Root_1
     6  Bootstrap_2
     7  Kernel_2
     8  Root_2
     9  Linux_swap
    10  _var
    11  MFS_application_region
    12  MFS_media_region
    13  MFS_application_region_2
    14  MFS_media_region_2
    15  SQLite

Mix the records together to form new map
> pmix order.txt > NEW-PM.bin

Write new map (and block0) to disk
> dd if=NEW-PM.bin of=/dev/sdb bs=512 count=15

Overwrite bootpage params:
> echo -ne "root=/dev/sda4\x0" > 4.patch
> hexdump -C 4.patch
> bpatch 0.bin 4.patch

(re)Set guid:
> random16 > 304.patch
> hexdump -C 304.patch
> bpatch 0.bin 304.patch
Languages used:
perl, C++, bash

Copyright 2014 by telemark of tivocommunitiy.com
License granted under GPL 3 or later.
Attached Files
File Type: zip pmtools.zip (9.8 KB, 10 views)

Last edited by telemark : 06-20-2014 at 10:23 PM.
telemark is offline   Reply With Quote
Old 06-20-2014, 06:42 PM   #2
nooneuknow
TiVo User Since 2007
 
Join Date: Feb 2011
Location: Cox Cable Market, NV
Posts: 2,659
Quote:
Originally Posted by telemark View Post
> dd if=NEW-PM.bin of=/dev/sdb bs=512 count=15
Wouldn't this ideally be 16 so 512*16=8096, instead of 512*15=7680?

Or, is this one of those 0 counts as 1 things?

It's my understanding that ggieseke's DVRBARS does 8192 at a time, and that also seems to be the minimum chunk size TiVo writes to media partitions with.

Thanks for all your time and effort, as well as doing it for free.
__________________
Cisco tuning adapters should never be used inline (using the TA coax OUT port) to connect a TiVo, if MoCA is in use. Use a splitter w/PoE filter on leg to TA, use other leg for the TiVo. Enjoy!
nooneuknow is offline   Reply With Quote
Old 06-20-2014, 07:16 PM   #3
telemark
Registered User
 
Join Date: Nov 2013
Posts: 600
That's a good point.

That partition map is 14 partitions, and 14 blocks long. The block0 is 1 block long. Together makes 15. So you need to copy and there only is 15 (or 14 skipping the block0) of good data.

A partition map can go up to at least 16 though, so it's more proper and safer to zero out the later records.

One way is to zero out the Partition Map+Block0, before copying the new map over.
dd if=/dev/zero of=/dev/sdX count=17

Or you can add Zero-ed records to the end, until you get to 16 records in the map. (17 if you're including a Block0)

Last edited by telemark : 06-20-2014 at 08:15 PM.
telemark is offline   Reply With Quote
Old 06-20-2014, 08:54 PM   #4
nooneuknow
TiVo User Since 2007
 
Join Date: Feb 2011
Location: Cox Cable Market, NV
Posts: 2,659
Quote:
Originally Posted by telemark View Post
That's a good point.

That partition map is 14 partitions, and 14 blocks long. The block0 is 1 block long. Together makes 15. So you need to copy and there only is 15 (or 14 skipping the block0) of good data.

A partition map can go up to at least 16 though, so it's more proper and safer to zero out the later records.

One way is to zero out the Partition Map+Block0, before copying the new map over.
dd if=/dev/zero of=/dev/sdX count=17

Or you can add Zero-ed records to the end, until you get to 16 records in the map. (17 if you're including a Block0)
Ok, I get it now (I think, which can be dangerous).
__________________
Cisco tuning adapters should never be used inline (using the TA coax OUT port) to connect a TiVo, if MoCA is in use. Use a splitter w/PoE filter on leg to TA, use other leg for the TiVo. Enjoy!
nooneuknow 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

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

Advertisements

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

(C) 2013 Magenium Solutions - 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 10:39 PM.
OUR NETWORK: MyOpenRouter | TechLore | SansaCommunity | RoboCommunity | MediaSmart Home | Explore3DTV | Dijit Community | DVR Playground |