I thought I would share my semi-annual activity of how I update our hacked Series 2 TiVO to install the latest and greatest TiVO software. By hacked, I mean our TiVO Series 2 DVR is already capable of running custom software and scripts without fear of the TiVO kernel panicking and forcing the device to erase/re-format both TiVO partitions. I may put up a post on how I did the initial hack but for now I will talk just about the process I and others who have a similar “Monte” chainload configuration must complete everytime a new TiVO software is pushed out to our TiVOs.
First off, unless you have a script running as a cron job or some other kind of daemon process running in the background, you won’t know a software update has been pushed until you go and check.
Step 1 – Verifying if you have a TiVO update waiting to be installed and determining the update version
Using the TiVO menu
1.) Press your TiVO button and get to the Settings menu–>Network submenu
2.) Under the Network submenu, you will see a bunch of information regarding your current wireless/wired TiVO network connection (SSID, MAC, IP address, etc.).
3.) Under Status, if you see “Pending Restart” then your TiVO has already received the latest TiVO software update and your TiVO will automatically reboot at approximately 2:00 A.M. every day to try and install the software update.
Since your TiVO is already hacked (Monte or killinitrd kernel method), your system boot parameter – updgradesoftware is set to false and this is why your TiVO will not install the software update until you do it manually or set this variable to true (not recommended).
Now that we are sure the TiVO has the latest software update we need to get the version number of the software that is waiting to be installed. You can check this 2 ways:
Get the upgrade version # – Using TiVO Web Plus web server (if you have this installed and setup)
1.) Open a web browser and type the IP address of your TiVOÂ e.g. http://<your assigned TiVO IP address>:<port number TWP is listening on e.g. 8080 or 8079>
2.) Click on System—>MFS and you will be presented with a list of TiVO files and directories.
3.) Click on SwSystem and you should see 2 entries listed as shown below:

If your TiVO system has a new software version waiting to be installed, the file size and date/time will be different than the file size and date/time listed as ACTIVE. NOTE: You will need to write down (copy and paste into a text file) the Name of the newly downloaded software for manual install later in this process so do that now.
Get the upgrade version # – via Telnet:
1.) Open a Telnet session on your PC that is connected on the same LAN as your TiVO. Connect to the TiVO’s IP address and you will be presented with a “<tivo:> |” prompt.
2.) Type the following command to retrieve and display the newly-downloaded TiVO software version number:
“echo mls / SwSystem | tivosh” generates the following output:

3.) Again, if you have a newly download TiVO software, the Date/Time and Size values will be different than the TiVO software image that is ACTIVE. In the TWP and Telnet sessions above, the ACTIVE and downloaded TiVO software are the same as no update was pushed to my TiVO at the time of this post. In your case, make a note of the Name of the newly downloaded TiVO software as you will type this in when running the installSw.itcl script later in these instructions.
Step 2 – Kicking off the TiVO software update
Now that we have the version number of the TiVO software update we want to install, we must login to our TiVO’s via Telnet or via a serial port connection to run the installSw.itcl script.
1.) Login to your TiVO and go to the following directory to edit and run the installSw.itcl script:
cd /tvbin
2.) Make sure your active TiVO partition has its file/directory permissions set to read-write by issuing the following command:
mount -o remount,rw /
3.) Now, you will need to edit the installSw.itcl script to have it abort after it has finished installing the TiVO software update. This is a critical step and not doing this properly could undo your TiVO hacks or worse completely hose your TiVO requiring a complete restore of your TiVO image and pulling the hard drive.
4.) Find the line as shown below and change it to the following:
<Line 91>
>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â # Say goodbye
> Â Â Â Â Â Â Â Â Â Â Â Â Â putlog “Attempting reboot…”
>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â reboot
change to:
>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â # Say goodbye
>Â Â Â Â Â Â Â Â Â Â Â putlog “Aborting reboot, do as you must…”
> Â Â Â Â Â Â Â Â Â Â exit 1
5.) Save and exit out of editing installSw.itcl
Start the TiVO software upgrade…
1.) Before installing the upgrade software, get the root and the boot partition number that your TiVO is currently using with the following command:
<Current boot partition number> bootpage -b /dev/hda
This will return either 6 or 3. After the upgrade, installSw.itcl will change this automatically to 3 or 6 at the end of the script. The boot partition e.g. hda3 or hda6 is where you will dd in the killinitrd kernel file (vmlinux.px) later in this tutorial and is critical to the Monte process so be aware of this and check what number TiVO is configured to boot from BEFORE rebooting.
<Current root partition number> bootpage -p /dev/hda
This will return either 7 or 4. The root partition is where you will copying over your TiVO hack files after the upgrade below has finished.
2.) Now that we have configured the installSw.itcl script to abort after installing the upgrade, type the following command to start the upgrade process:
/tvbin/installSw.itcl <Name/version number you obtained in step 2 of – Method 2 – Getting the newly downloaded TiVO software version number via Telnet above>
3.) The install process will begin and takes about 5-10 minutes to complete. Do not attempt to interrupt the install process or accidentally trip on the TiVO power cord. When the upgrade is finished you will see the following:

Step 3 – Copy over existing TiVO hack files to new partition
Before rebooting, you will need to copy over all of your TiVO hack files and binaries to ensure that your hacks continue to run properly after restart. In my case, 99% of my hack files are located on /var which is /dev/hda9 in terms of mounted Linux partitions on the TiVO. This partition will remain untouched after reboot so long as you make a small modification to the startup script on the newly installed TiVO partition as described below:
1.) Check what the current TiVO root partition is set to using the command – “bootpage -p /dev/hda”. This will return the full boot string – check what value is contained in the “root=/dev/hda…” parameter of this boot string. Make a temporary directory – mkdir /tmp/tivo<partition number that the TiVO upgrade installed to>
2.) mount /dev/hda<value of root= parameter from command issued above> /tmp/tivo<4 or 7>
3.) cd to new mount directory – cd /tmp/tivo<4 or 7>/etc/rc.d/StageB_PostKickstart
4.) Edit the following file – rc.Sequence_150.CleanupVar.sh.
5.) Go to the following line – 106 and change the MaxVarPercent variable to the following:
MaxVarPercent=90
6.) This will allow you to consume 90% of the /var partition without TiVO going through and deleting/rebuilding the partition during bootup.
7.) Save the file and continue to the next step.
NOTE: If you are keeping your hack binaries on a root partition and not /var, you can copy your hack directory/directories to the /tmp/tivo<4 or 7> now instead of doing the above modification. I stopped keeping my hack binaries on the root TiVO partitions as they took more space than was available.
8.) Modify and copy /sbin/iptables to newly created TiVO boot partition:
echo -e ‘#!/bin/bash\nexit 0′ > iptables
cp /sbin/iptables /tmp/tivo<4 or 7>/sbin
9.) Copy /etc/rc.d/rc.sysinit.author /tmp/tivo<4 or 7>/etc/rc.d:
cp /etc/rc.d/rc.sysinit.author /tmp/tivo<4 or 7>/etc/rc.d
Step 4 – Extract the virgin TiVO kernel for Monte chainload process
So now we need to extract the virgin TiVO kernel from the newly installed TiVO partition. We will use this kernel to chain boot into later on to complete the Monte process. We need to do this process now before we dd in the killinitrd older kernel file that is not compatible with newer hardware add-ons like the TiVO wireless adapter and possibly some TiVO software features. I switched to this Monte process for the fact that I had a TiVO wireless adapter that was incompatible with the older killhdinitrd kernel.
1.) Extract the virgin TiVO kernel:
mkdir /tmp/tivo<4 or 7>/monte
dd if=/dev/hda<3 or 6 depending on output from bootpage -b /dev/hda command> of=/tmp/tivo<4 or 7>/monte/<virgin_kernel.img>
Example screenshot of output:

2.) Initrd the extracted virgin kernel with the following command:
cd /monte
./replace_initrd.mips <virgin_kernel>.img myinitrd.img(this is what is inserted into the virgin kernel) <tivo_version>.px (this is the kernel file that will be loaded during the monte process)
Screenshot of successful killinitrd on virgin kernel:

3.) Copy over old the killhdinitrd kernel file to your TiVO – download here.
4.) Now we will dd in the older killhdinitrd kernel to the TiVO boot partition:
dd if=/<path to where you keep killhdinitrd kernel> of=/dev/hda<result from bootpage -b /dev/hda>
You should see the following output:
4096+0 records in
4096+0 records out
5.) Copy over TivoWebPlus and any other programs you have currently install on the TiVO root partition (in my case, I only have TiVOWebPlus on my root partition)
6.) Unplug your TiVO adapter if you have one before issuing the reboot command. Unmount the temporarily mounted partition:
cd /
umount -f -a
Copy over the existing monte script to the new tivo partition:
cp /etc/rc.d/rc.sysinit.monte /tmp/tivo<4 or 7>
Content of my monte boot script:
############################################################################################
#!/bin/bash
# bogus rc.sysinit, checks for monte
export PATH=/sbin:/bin:/tivobin:/tvbin:.:/:/etc/rc.d
export TERM=xterm
export PS1=’\h:\w$ ‘
#enable this next line if you’re paranoid
#/bin/bash</dev/ttyS2&>/dev/ttyS2&
bootparm=`/sbin/bootpage -p /dev/hda`
if [ "$chainloaded" != "true" ]; then
echo “sp=\”$sp\” must be first pass, trying to run monte”
#/sbin/bootpage -P “root=$root console=2,115200 dsscon=true upgradesoftware=false
/sbin/insmod -f /monte/kmonte.o
/monte/monte /monte/932b_initrd.px “$bootparm chainloaded=true”
else
echo “sp=\”$sp\” must be second pass”
#/sbin/bootpage -P “root=$root console=2,115200 dsscon=true upgradesoftware=false
exec /etc/rc.d/rc.sysinit.real
fi
#######################################################################################
7.) Now let’s reboot and watch the boot process closely for any errors. If you have been issuing these commands so far via Telnet, plug in your trusty null modem cable to the serial port on the back of your TiVO NOW.
Issue reboot command from TiVO prompt: >reboot
8.) You will see the following startup messages as the TiVO boots up and unpacks/installs the TiVO software upgrade:
##############################################################################
>
>
Running boot Stage F_ApplicationLaunch scripts
Starting Services.
PCI: 00:0d.2 PCI cache line size set incorrectly (0 bytes) by BIOS/FW, correcting to 32
Initializing streamRestartMutex
Scanning for phase4 repair scripts
Running boot Stage G_PostApplication scripts
bash: no job control in this shell
(none):/var/tmp$ SIOCSIFADDR: No such device
eth0: unknown interface: No such device
SIOCSIFBRDADDR: No such device
eth0: unknown interface: No such device
SIOCSIFNETMASK: No such device
SIOCADDRT: Network is unreachable
Checking For Authoring Permissions…
Scanning for configuration files
rc.sysinit is complete
##################################
9.)Now that we know the TiVO is booting properly, we need to configure the monte process as follows:
Mount the root partition for read-write access:
mount -o remount,rw /
Edit the /etc/rc.d/rc.sysinit.monte
vi /etc/rc.d/rc.sysinit.monte
Change the following line to the directory where you are keeping the killinitrd kernel file:
/sbin/insmod -f /monte/kmonte.o
/monte/monte /monte/932b_initrd.px <replace this with the name of the name of the killinitrd kernel file>Â “$bootparm chainloaded=true”
10.) Copy the /etc/rc.d/rc.sysinit to /etc/rc.d/rc.sysinit.real
11.) Rename your /etc/rc.d/rc.sysinit.monte to rc.sysinit
12.) Reboot the system
Copy of my monte files that you can copy to your /monte directory – here
Step 5 – Final steps/cleanup
Now that we have a working “Monte’d” system, go ahead and plugin the TiVO wireless adapter and watch for any kernel panics/errors while you have your serial cable connected to the TiVO. If you modified the /sbin/iptables file in Step 3 above, everything should be fine. I forgot to modify this file with a Monte’d system and while I did not get a kernel panic, I was unable to connect to my TiVo box via telnet, ftp, etc. – weird and frustrating error (connection attempts would just hang with no output)!
1.) Copy over the following script to remove CSO encryption of your TiVO recordings here. NOTE: My script has been modified to not do a 30 second skip and is configured to patch the latest 9.3.2b tivoapp version. Run this script using the following command from your TiVo prompt (make sure tivoapppatches.tcl is located in the same directory that you are running tvapppatch.tcl):
./tvapppatch.tcl
Output:

2.) Reboot your TiVO and at the command prompt, type “ciphercheck.tcl” you should see the following:

3.) Delete the /tvbin/tivoapp.foo backup and YOU ARE DONE!
2
.) Reboot your TiVo and run ciphercheck from the command line – you should see the following:
John Technology Projects