Hack 31. Copying Unix Binaries to TiVo

   

Hack 31 Copying Unix Binaries to TiVo

figs/beginner.gif figs/hack31.gif

The shell is nothing without its utilities. What's a work environment worth if you can't do anything while you're there?

The default installation of the TiVo OS has a Bash shell and little else in the way of the utilities necessary to do anything of any use. How exciting, after all, is:

 bash-2.02#  echo *  

Beyond the first few minutes, that is. ;-).

While you have your box open and drives mounted on your PC [Hack #29], now's a good time to bring over some of the common utilities most Unix jockeys simply assume to be there.

You are going to need a DOS- or Windows-formatted floppy disk for this one. Steve Jenkins's Newbie TiVo Hacker site offers a complete archive of useful Unix utilities for the Series 1 TiVo (http://tivo.stevejenkins.com/downloads/tbin.tar.gz), including head , tail , rmdir , strace , touch , and, most importantly, ls . Copy the .tar.gz file to the floppy. Don't run this file through any decompression programs, just copy it over as is.

Now, let's make a directory on the TiVo drive into which to put the Unix binaries. While we're at it, we'll make this the home of all our program hacks throughout the rest of this book. There are two partitions that are good candidates: /dev/hdX4 or /dev/hdX7 (these two are effectively the same, one being the backup of the other), and /dev/hdX9 .

As one of /dev/hdX4 and /dev/hdX7 is always in deep sleep while the other is running, this is probably not the best place to keep these files and your future hacks. The next time your TiVo software is upgraded, the active partition is relegated to a backup partition and will no longer be visible to your TiVo. Not to mention that the backup-partition-to-be could very well be wiped clean during a software upgrade. Poof! Any hacking you've done is history. So we'll rule out partitions 4 and 7.

Partition 9, /dev/hdX9 , on the other hand, is always visible to your TiVo and therefore appears to be a clear winner. There is, however, one caveat: if you overfill this partition, TiVo will summarily delete it and recreate it from scratch.

So, there doesn't appear to be any perfect choice. In my opinion, the lesser of two evils is to use /dev/hdX9 . Yes, we're taking the chance that we might overfill the partition and lose our work, but for the remainder of this book, this is the chance we're going to take. If, for some reason, you find that your hacks are gone, at least you'll know why.

As it stands, there is no truly "safe" place to keep hacks on your TiVo, but Mike Baker (a.k.a. "embeem") suggests a more involved method for keeping your hacks persistent. He suggests creating another partition on your TiVo, convincing your TiVo to boot from that partition, and then moving on to TiVo's native partitionsall without TiVo really knowing anything about the initial bootstrap partition. Implementing these changes can be a little tricky, however. If you are interested, you'll find his post on the topic at http://alt.org/forum/index.php?t=msg&th=17.

Assuming you choose to use /dev/hdb9 , create a directory to house hacks, utilities, etc., like so:

 #  mkdir /mnt9/hack  

Insert the floppy disk holding the tivobin.tar.gz file into your floppy drive, mount it, and copy the file over to the /mnt9/hack directory:

 #  mkdir /floppy  #  mount /dev/fd0 /floppy  #  cp /floppy/     tivobin.tar.gz   /mnt9/hack  

While of course you can go ahead and decompress the archive and install the Unix binaries now, let's wait to do so via the TiVo Bash shell itself [Hack #34]. This way, you'll be using real paths, rather than fiddling about with temporary mount points ( /mnt9 et al). There is no reason why you couldn't do that from here. However, by postponing it, you have a better shot at figuring out what is going wrong with your Bash prompt if you can't get it to show up.

Go To

You'll finish up [Hack #34] in just a moment. First, you need to clean up and shut down your PC [Hack #32], return TiVo's drives to where they belong, and get to the Bash prompt [Hack #33] over the serial line.


   
Top


Tivo Hacks. 100 Industrial-strength Tips Tools 2003
Tivo Hacks. 100 Industrial-strength Tips Tools 2003
ISBN: 1597490318
EAN: N/A
Year: 2004
Pages: 164

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net