# Guide to Hacking a SAS2 to run Tivoserver



## falc122727 (Jan 21, 2004)

Thanks to all the great information on this site and DDB, I was able to hack a TCD240080 to get Tivoserver (among other hacks). *All I can say is Tivoserver is awesome!* It's what finally made me make the jump from Series 1 to Series 2 and it was well worth it! To help out anyone else, here's a guide to what I did. It took a lot of reading and some trial and error.

High Level what I did.
1. Waited to get the latest software update (7.3.1)
2. Pulled the drive and hacked for bash
3. Applied Superpatch
4. Configured Tivoserver on a PC

*2.0 Hacking for Bash:*
Here's the 2 guides I used for reference:
ddb: /forum/showthread.php?t=48804
http://www.thewallens.net/tivo/Tivo_unguide.html

2.1 Obtained the the $5 Boot iso from PTV that contains Killhdinitrd kernels. Burned the iso to a bootable CD. Burned another CD with file tivotools.tar from Alphawolfs post at DDB /forum/showpost.php?p=182691. Hooked my Tivo drive to Primary Master and booted with the PTV CD.

2.2. Check what your current "root" is:

bootpage -p /dev/hda (assumes Tivo Drive is Primary Master)

*output will either be hda4 or hda7 - mine was /dev/hda7

2.3. Create mount points
mkdir /cdr
mkdir /mnt7

2.4. Put the tivotools CD you made in the cdrom drive

2.5. Mount the partitions
mount /dev/hdc /cdr 
mount /dev/hda7 /mnt7

2.6. Create Hack Directory called busybox
cd /mnt7
mkdir busybox

2.7. Check that busybox directory was created:
ls l

2.8. Unzip the tivotools.tar from the tools CD
cd /mnt7/busybox
tar -xvf /cdr/tivotools.tar
chmod 755 *

2.9. Swap CDs again
cd /
umount /cdr 
remove Tools CD, put in Boot CD
mount /dev/hdc /cdr

2.10. Copy the kernel from the cd over to the Tivo
cp /cdr/s2_kernels/7.2.2-oth-K1/vmlinux.px.gz /mnt7/var/vmlinux.px.gz

2.11. unzip the kernel 
cd /mnt7/var
gunzip -d -v vmlinux.px.gz

2.12. Put the kernel where it needs to be so
dd if=/mnt7/var/vmlinux.px of=/dev/hda3 (should say 1+1 records in, 1+1 records out)
dd if=/mnt7/var/vmlinux.px of=/dev/hda6 (should say 1+1 records in, 1+1 records out)

2.13. Write new bootpage params to kernel
bootpage -P "root=/dev/hda7 dsscon=true console=2,115200 upgradesoftware=false" -C /dev/hda

check it with:
bootpage -p /dev/hda if done right, it will reflect what you typed above

2.14. Edit IPTABLES
cd /mnt7/sbin
mv iptables iptables.old
echo -e '#!/bin/bash\nexit 0' > iptables
chmod 755 iptables

2.15. Create rc.sysinit.author
cd /mnt7/etc/rc.d
touch rc.sysinit.author
chmod 755 rc.sysinit.author
pico rc.sysinit.author

#!/bin/bash
export PATH=./:.:/utils:/bin:/sbin:/tvbin:/tivobin:/busybox
tnlited 23 /bin/bash -login &
setsid /bin/bash --login -i</dev/ttyS2&>/dev/ttyS2&
tivoftpd&

CTRL-X to exit pico when you are done it will ask to save hit y then hit enter.

2.16. Shut it all down and put the Tivo back together
cd /
umount -f -a -r
halt (system should now say system halted.)

2.17. Power pc down and put the tivo back together

*3.0 Gain batch access and apply superpatch*

3.1. Get latest superpatch from DDB: /forum/showthread.php?t=43325

3.2. Since there is no official superpatch release for 7.3.1, I had to modify it with code from here: ddb: forum/showpost.php?p=259757&postcount=337

3.3. Open the latest superpatch in wordpad and open the .diff in wordpad. Carefully cut and paste based on the plus and minus lines in the .diff file. I saved it in wordpad as superpatch-67all-NutKase-1.4.txt. You then have to convert it from DOS to Unix and save as a tcl (superpatch-67all-NutKase-1.4.tcl). I found a great little online tool here to convert Dos to Unix.

3.4. FTP the modified superpatch file to the /var directory. Chmod 755 and run it with ./superpatch-67all-NutKase-1.4.tcl

*4.0 Setup Tivoserver.* There is nothing more to do to your Tivo.
Great post here

4.1 get the files: tivoserver.exe and cygwin1.dll

4.2 Create directories c:\TivSer, c:\cygwin\tmp, and c:\tmp
Put the 2 files in c:\TivSer.

4.3 click on tivoserver.exe. A Dos window will blink.
It just created a folder C:\Documents and Settings\Your_Username_Here\Application Data\.tivoserver\

4.4 Go into the folder and edit the file settings.cfg in wordpad. Change the line: VIDEO_DIR=C:\Documents and Settings\Dre\Application Data/video/ to the target where you have Video that you want served to your Tivo.

4.5 Convert the edited settings.cfg from Dos to Unix with the utility I mentioned above.

4.6 Go back to c:\TivSer and click on tivoserver again. The Dos window will remain open now and show status.

4.7 Your Tivo will now show Tivosever in Now Playing.

4.8 Click on one of the files, give it few minutes to build up a buffer, and start viewing!


----------



## RoundBoy (Feb 10, 2005)

Hmm .. I followed these instructions pretty well, substituting my particular drive mappings, etc with what was there..

... and I power up to a reboot cycle on the 'powering up' grey screen.

I recovered by mfsrestore 'ing my original backup back on .. but before I did I tried to find a log entry or something that pointed to what the problem was... but nothing under /var or any other normal place...

I was using the exact same kernel image from the same cd you had ... the commands were entered identically in rc.sysint.author, etc ... 

Should I be able to run the binaries from tivotools while the drive is attached and booted into the linux cd ? I can run vi, etc .. but I can't run uptime, tivoftpd, etc ....

thoughts ?


----------



## Gunnyman (Jul 10, 2003)

no
those are mips compiled binaries and will run only on the tivo.
if you substituted drive mappings did you leave the bootpage commands referencing hda?
They need to.


----------



## rpdre1 (Feb 20, 2005)

read through the replies at this ddb thread:

/forum/showthread.php?t=50480


----------



## Gunnyman (Jul 10, 2003)

is that the one I responded in with the same thing? 

Yup


----------



## RoundBoy (Feb 10, 2005)

wait... running :

bootpage -p /dev/hdb

returns : /dev/hdb7 (my tivo drive is on primary slave)

in my understanding from reading the linked threads in the first post, I needed to:

dd if=/dev/hdb7 of=/dev/hdb6 

The threads differ on if I should do both '3' and '6' rather then just one or the other.


----------



## RoundBoy (Feb 10, 2005)

oh wait ... I see what was meant ..

it *should* be /dev/hda in the bootpage line, because _thats what it would be on the tivo_

that would be the only place i make it hda instead of what it appears as in my linux cd boot system ?

Would an invalid bootpage call cause a reboot loop ?


----------



## rpdre1 (Feb 20, 2005)

yea thats what gunny was trying to tell you in his post. 


yes it would make your tivo reboot.


----------



## RoundBoy (Feb 10, 2005)

done and done..

Superpatched as well.. The instructions are confusing, because 7.2.2b-oth* i don't need to edit any options.

now whats next 

EDIT: Doh ... can't transfer between patched tivo and my 'stock' box ... guess i need to do it to both


----------



## ashram (Jul 8, 2004)

i must be blind and am missing something. i tried this 4 times, and each time i get an endless reboot....
i get to the "almost there" screen then it reboots.

i have the tivo hd as the primary master and cd rom as the secondary master
i dl'ed the ptv bootdisk, dled tivotools
bootpage -p /dev/hda shows me hda7
i double checked everything i typed in before going on to the next step....
arg.... why does linux elude me so?

wish there was something like the zipper for standalone series 2!


----------



## RoundBoy (Feb 10, 2005)

if bootpage shows you hda7 , then you need to copy the kernel into /dev/hda6

dd if=/path/to/kernel of=/dev/hda6

As long as that is proper, and your bootpage is set up right, you should at least boot fine .. all the other stuff grants access to bash...


----------



## ashram (Jul 8, 2004)

RoundBoy said:


> if bootpage shows you hda7 , then you need to copy the kernel into /dev/hda6
> 
> dd if=/path/to/kernel of=/dev/hda6
> 
> As long as that is proper, and your bootpage is set up right, you should at least boot fine .. all the other stuff grants access to bash...


tried it now....loading....loading....loading...no luck, same issue.


----------



## MungoJerrie (Mar 30, 2006)

What exact commands are you using? And did you do the iptables trick?


----------



## ashram (Jul 8, 2004)

i printed out the 1st post of this thread, and followed it. i have done the iptables trick.


----------



## cheer (Nov 13, 2005)

What model Tivo?


----------



## ashram (Jul 8, 2004)

tcd140060.

upgraded hd to a larger one (that's the easy part)


----------



## cheer (Nov 13, 2005)

Check the kernel log. Pull the drive, boot up off of your boot CD, mount /dev/hda9 and look at log/kernel. Alternatively, hook up with a serial cable and capture a boot log. No other way to really troubleshoot this.


----------



## ashram (Jul 8, 2004)

cheer said:


> Check the kernel log. Pull the drive, boot up off of your boot CD, mount /dev/hda9 and look at log/kernel. Alternatively, hook up with a serial cable and capture a boot log. No other way to really troubleshoot this.


looked at it....no clue what i'm looking for...but found

TMK FATAL ERROR: Activity TVBusProxy <106>

if that means anything...no clue how to copy it to floppy or thumbdrive, or i'd post the whole thing here


----------



## MungoJerrie (Mar 30, 2006)

Are you using the 3.1.5 killhdinitrd kernel? I recall something about the 3.1.5 kernel not working correctly on "140" hardware. Go over to DDB and check out: showthread.php?t=46334


----------



## ashram (Jul 8, 2004)

MungoJerrie said:


> Are you using the 3.1.5 killhdinitrd kernel? I recall something about the 3.1.5 kernel not working correctly on "140" hardware. Go over to DDB and check out: showthread.php?t=46334


sounds like you're right... which means i'm dead in the water, as that place tends not to be newbie friendly, and i have no clue what to do....soinds like i'm screwed for now....


----------



## cheer (Nov 13, 2005)

ashram said:


> sounds like you're right... which means i'm dead in the water, as that place tends not to be newbie friendly, and i have no clue what to do....soinds like i'm screwed for now....


The 3.1.5 kernel will indeed work, but DHCP will not. So your choice is to either (A) configure a static IP address or (B) use a 7.x kernel instead.


----------



## rpdre1 (Feb 20, 2005)

the 7.2.2 killhdinitrd kernel (the one that's specifically used in these instructions) DOES support the 140.

if your PTV CD doesn't have the 7.2.2 killhdinitrd kernel, you will have to buy a new PTV cd ($5): http://downloads.ptvupgrade.com/Merchant2/merchant.mvc?Screen=PROD&Product_Code=LBA48DD

you could also monte from 3.1.1c killhdinitrd (will only work if your kernel & boot partition are under the LBA48 barrier, you can check with pdisk -l /dev/hdX) to a custom 7.x kernel with no initrd (there are some posted at ddb)......

if that's too much for you to understand, just buy the $5 CD.


----------



## ashram (Jul 8, 2004)

rpdre1 said:


> the 7.2.2 killhdinitrd kernel (the one that's specifically used in these instructions) DOES support the 140.
> 
> if your PTV CD doesn't have the 7.2.2 killhdinitrd kernel, you will have to buy a new PTV cd ($5): http://downloads.ptvupgrade.com/Merchant2/merchant.mvc?Screen=PROD&Product_Code=LBA48DD
> 
> ...


i already bought the $5 cd last week. that's the one i'm using


----------



## rpdre1 (Feb 20, 2005)

so were you using the 3.1.5 killhdinitrd kernel or the 7.2.2 killhdinitrd kernel?

the 7.2.2 is on the PTV CD @ /s2_kernels/7.2.2-oth-K1/vmlinux.px.gz


----------



## ashram (Jul 8, 2004)

i've been using the 7.2.2...

i may just give up on this.... my dtv tivo is hacked and works fine... this one is determined to torment me...


----------



## MungoJerrie (Mar 30, 2006)

cheer said:


> The 3.1.5 kernel will indeed work, but DHCP will not. So your choice is to either (A) configure a static IP address or (B) use a 7.x kernel instead.


I'm not so sure of that; I know you're a regular at DDB but in that thread, if I read it right, even Jamie references a problem with the 3.1.5 on "140" hardware. At any rate, the OP can try the 3.1.1c killhdinitrd for kicks (especially if he doesn't have a hard drive > 137GB); no LBA48/monte issue to deal with...


----------



## JamieP (Aug 3, 2004)

MungoJerrie said:


> I'm not so sure of that; I know you're a regular at DDB but in that thread, if I read it right, even Jamie references a problem with the 3.1.5 on "140" hardware. ...


Right. To quote the killhdintrd release notes:

```
3.1.5:         Linux version 2.4.20 ([email protected])
               (gcc version 3.0) #22 Fri Feb 20 18:19:25 PST 2004
               MD5: 8d31d9eb8077a0a91a9356d23a4e9fb8
               Supports DTiVo Uma4/Uma6/Phoenix, and all known SA Series2.0
               EXCEPT "140" series
```
Use the 7.2.2-oth-K1 kernel on 140 hardware.

This does not appear to be the problem in this case though. Serial console output, or a full kernel log is the best way to debug this.


----------



## ashram (Jul 8, 2004)

well, i don't have a serial cable... tell me how to get the log to floppy and i'll post it.


----------



## JamieP (Aug 3, 2004)

ashram said:


> well, i don't have a serial cable... tell me how to get the log to floppy and i'll post it.


Something like this should work:


```
mkdir -p /mnt/floppy
mount -t vfat /dev/fd0 /mnt/floppy
```
This mounts your floppy.
Assuming you've already mounted your tivo /var partition on /mnt/tivo/var:

```
cp /mnt/tivo/var/log/kernel.log /mnt/floppy
```

umount the floppy:

```
umount /mnt/floppy
```

eject floppy and reboot.


----------



## ashram (Jul 8, 2004)

here it is, i linked it off my website

http://www.godashram.com/kernel.txt


----------



## JamieP (Aug 3, 2004)

ashram said:


> here it is, i linked it off my website
> 
> http://www.godashram.com/kernel.txt


Symtoms look like you didn't do the iptables fix correctly (2.14 in the original instructions). Check carefully. A common error is to type the letter "o" rather than the numeral "0" in the exit command.


----------



## ashram (Jul 8, 2004)

i'll give it another shot tomorrow then, thanks for the help


----------



## ashram (Jul 8, 2004)

ashram said:


> i'll give it another shot tomorrow then, thanks for the help


well, thanks! it was the iptables, but not the 0, for some reason, the keyboard i was using refused to work and left a 1 instead of a !. switched kb's and it now boots....


----------



## mike32940 (Jan 18, 2003)

Original post didn't mention that you shouldn't include setsid in rc.sysinit.author if your using serial cable to control cable box p- just leave out this line. Leaving the line in place causes Tivo to reboot when changing channels.


----------

