PDA

View Full Version : Hacking a 240 S2 - Noob


Killerz298
07-06-2006, 09:35 AM
I am a complete noob and have wanted to hack my tivo for the longest time.

I have a 240 model tivo with 2 160 gb drives and never hacked it. I want to now install tivoweb but don't want to lose all my programs and passes. Is this a possibility and if so how do I go about doing it?

Is there a step by step guide I can follow to accomplish this? Also, what will this hacking mean in terms of future upgrades? Will I need to hack again after an upgrade? Can I prevent an upgrade until I want to deal with it?

cheer
07-06-2006, 10:21 AM
Yes, it's possible. I'm not aware of a step-by-step guide, but I can give you some pointers. First...can you tell me what version of the Tivo software you're running?

Yes, you will need to re-hack after an upgrade -- sort of. If you do it right, you can have it implement the upgrade but not reboot, then re-hack via telnet and reboot yourself.

And yes, you can prevent upgrades until you want to deal with it, but keep in mind that standalone upgrades shouldn't be put off for long -- sooner or later you could end up being unable to get guide data.

Killerz298
07-06-2006, 10:32 AM
I am currently running 7.2.2b-oth-01-2-140

Is my unit going to upgrade to 7.3.1 soon? Should I wait for that to happen before I hack it? Should I NOT upgrade to 7.3.1 yet because of issues with it, I know 7.3.1 was supposed to fix the 7.3 issues but it is unyet known what other issues might be with 7.3.1?

Anyhow, now that you have the SW version what do you think?

cheer
07-06-2006, 01:56 PM
NOTE: this is not a walkthrough or a step-by-step guide. Consider this more of a roadmap. Anyone reading this should do some searches and read up on the various steps -- the best advice I could give any prospective Tivo hacker is to make sure you understand each step. If you don't know what something does, don't type it!

Also, no guarantees or warranties. If you destroy your Tivo with all of your precious recordings of Mama's Family, don't come crying to me.

OK. The following mostly applies to 7.2x -- though from what I've read 7.3 is pretty similar.

The first thing you need to do is break the chain of trust. This is done by replacing the linux kernel on the box with one that still passes the PROM check but doesn't trigger the routines that "undo" changes you make to the filesystem. Simplest way to get such a kernel is to pay $5 for the ptvupgrade Enhanced LBA48 Boot CD, which comes with such kernels (called killhdinitrd'd kernels) already on it.

You'll need to pull the drive out of your Tivo and cable it up to a PC. Depending on how you connect it, the linux device name for the drive should be:
Primary master: /dev/hda
Primary slave: /dev/hdb
Secondary master: /dev/hdc
Secondary slave: /dev/hdd
Double-check when you boot up to see what's found -- it is possible that some PCs may assign things differently. For the remainder of this post I will use "#" to represent the a, b, c, or d (or whatever).

VERY IMPORTANT: NEVER boot up off of a Windows drive with a Tivo drive attached. Windows (esp. XP) will write a signature to the drive, hosing it.

OK. Boot up off of the ptvupgrade CD. The first thing you need to do is figure out what your active boot and root partitions are. Tivos keep two sets -- two boot partitions, and two root partitions. One set is active and one set is a backup. Tivo uses this for software upgrades, etc., so don't assume that what your active set was two months ago is still true.

Anyway, type
bootpage -p /dev/hd#
What you'll see is something like "root=/dev/hda4" or "root=/dev/hda7" as the output. That's telling you which partition number (4 or 7) is the active root. The active boot is always one less, so your active set is always 3 and 4 or 6 and 7. For the remainder of this post I will use "$" to refer to the active boot partition number and "%" to refer to the active root partition number.

First thing we need to do is get the new kernel installed. The kernel is on the CD you booted from, but one of those wacky Linux realities is that just because you booted from the CD doesn't mean you can see it. :) You need to mount it. Create a /cdrom directory ("mkdir /cdrom") and then mount the CD ("mount /dev/hd! /cdrom" where "!" is the drive ID for the CD-ROM drive).

Now go find the kernel. I don't know exactly where it is (I don't have the latest and greatest boot CD) so you will have to poke around in /cdrom for it. Let's pretend for the purposes of discussion that it's in /cdrom/path/to/kernels/7.2.2 and called VMLINUX_.gz. It's gzipped, so we need to unpack it before installing. I use the Tivo drive to do this. Create a directory called /tivo and mount the active root partition ("mkdir /tivo" and "mount /dev/hd#% /tivo"). Create a dummy directory on the Tivo drive ("mkdir /tivo/kerneltemp") and copy the kernel there ("cp /cdrom/path/to/kernels/7.2.2/VMLINUX_.gz /tivo/kerneltemp").

Now you need to unpack it. Change to the /tivo/kerneltemp directory and use gzip (I believe it's "gzip -d VMLINUX_.gz" but that's from memory). You should now have a VMLINUX_ file. That's your new kernel. You have to install it to the active boot partition using dd:dd if=/tivo/kerneltemp/VMLINUX_ of=/dev/hd#$ bs=1024
You've now compromised the chain of trust, and further changes you make will "stick."

OK, so while you're here, best to get telnet and ftp going -- with that done you can do everything else remotely. Tivo actually comes with a telnet daemon, but you need to add an ftp daemon. Grab another CD and go find a copy of AlphaWolf's All-In-One utilities. (You can find 'em on the other forum.) Un-rar them (but don't then un-tar them) and burn the tivotools.tar to a CD. Unmount your CD-ROM ("umount /cdrom") and swap discs. Mount the CD-ROM (same command as before). Create a directory on the Tivo to hold them (I use /busybox (so in this case actually /tivo/busybox) but you can use whatever you like) and copy tivotools.tar there. Change to that directory (again, in my case /tivo/busybox) and untar the tools.

Now you need to create a file to make the telnet and ftp daemons launch at boot. The file most of us use is called rc.sysinit.author, and it gets put in /etc/rc.d on the active root. (Remember, since we mounted the active root on /tivo, for now this would look to us like /tivo/etc/rc.d). Create a plain text file (don't use notepad -- use a Linux/Unix editor like vi or something) called rc.sysinit.author in /etc/rc.d. It should end up looking something like this (in this block only, the "#" and "!" are really "#" and "!"):
#!/bin/bash

export TIVO_ROOT=
export MFS_DEVICE=/dev/hda10
export PATH=./:.:/bin:/sbin:/tvbin:/busybox

tnlited 23 /bin/bash -login &
tivoftpd
That's a bare minimum to set up your path and launch telnet and ftp daemons. Save the file. VERY IMPORTANT: you need to make the file executable:chmod 755 /tivo/etc/rc.d/rc.sysinit.author

OK. Two more things. First, the Tivo comes with a built-in firewall. We need to disable it. Change to /tivo/sbin. In /sbin (or /tivo/sbin) there's a file called iptables. Rename it to iptables.backup. Then do the following:echo -e '#!/bin/bash\nexit 0' > iptablesImportant: that's a 0, not an o or O. Then make iptables executable ("chmod 755 iptables").

Last thing. You need to modify your bootpage to enable console logging and block updates -- this will let you make your upgrades in a controlled fashion. Do this with bootpage:bootpage -P "root=/dev/hda% dsscon=true console=2,115200 upgradesoftware=false" -C /dev/hd#
Shut down, pull the drive, put it back in the Tivo, and boot. You should be good to go now, and can install other hacks at your leisure.

(Others feel free to correct any mistakes...)

cheer
07-06-2006, 01:57 PM
Is my unit going to upgrade to 7.3.1 soon? Should I wait for that to happen before I hack it? Should I NOT upgrade to 7.3.1 yet because of issues with it, I know 7.3.1 was supposed to fix the 7.3 issues but it is unyet known what other issues might be with 7.3.1?
You can wait if you like -- shouldn't make a big difference.

Killerz298
07-06-2006, 02:34 PM
Can anyone else add to this, or make other suggestions so we can get a complete step by step on what to do? Remeber it is a 240 model upgraded 2 drive tivo and I want to keep recordings and passes intact.

Thanks

MungoJerrie
07-06-2006, 03:49 PM
This is it; cheer pretty much gave you the step-by-step you asked for. And having read many of his posts (mostly on the other site), he's spot on as usual...what's the old adage, don't look a gift horse in the mouth!!!

Killerz298
07-06-2006, 04:38 PM
This is it; cheer pretty much gave you the step-by-step you asked for. And having read many of his posts (mostly on the other site), he's spot on as usual...what's the old adage, don't look a gift horse in the mouth!!!
Yes I am grateful, but he said it WASN'T a step by step. So I just wanted to make sure. Don't want to frack up my recordings as I don't have enough extra HD space to back them up :p

cheer
07-06-2006, 04:48 PM
What I meant was, this wasn't a walkthrough or a guide. Do lots of searching here (and on the other forum) to make sure you understand what I'm talking about.

Finally...if you can't afford to lost your recordings, you should make a backup and hack the backup. One error -- either in my instructions or in your implementation -- can wipe your recordings out.

Killerz298
07-06-2006, 06:53 PM
What I meant was, this wasn't a walkthrough or a guide. Do lots of searching here (and on the other forum) to make sure you understand what I'm talking about.

Finally...if you can't afford to lost your recordings, you should make a backup and hack the backup. One error -- either in my instructions or in your implementation -- can wipe your recordings out.
Yeah I don't think I have enough room to do a backup... I will have to check it out.

cheer
07-06-2006, 07:47 PM
Yeah I don't think I have enough room to do a backup... I will have to check it out.
Unlikely you have room on a partition somewhere...you can't use NTFS to write your backup to, and FAT32 tops out at 4GB (actually under Linux I think it's 2GB) per file. You'd really need a spare drive to backup to.