PDA

View Full Version : Installing Debian on a Series2 DirecTivo



alldeadhomiez
12-31-2002, 12:20 AM
DISCLAIMER:

Note: These instructions have not been tested start to finish. Bugs may
exist. No warranty, no support, and don't PM me with questions unless
you've discovered something really, really cool. GL

INTRODUCTION:

Debian GNU/Linux has a simple, robust package management system called
"apt" (automated package tool). It greatly speeds and simplifies the
process of acquiring binary packages to enhance one's development /
exploration environment. For instance, if a developer needs a copy of
"gcc" in a pinch, he can simply type "apt-get install gcc" and let the
package manager do the dirty work of satisfying dependencies and
downloading/unpacking/installing packages.

If you do not understand how this feature could improve your life, you are
reading the wrong thread and should not post anything here.

REQUIREMENTS:

dpkg-extract (included)
required-pkgs.txt (included)
sources.list (included)
hacks (included)
dpkg installed on your PC
"tar" installed on the Tivo (from /devbin-s2 on the Jonnydeath CD)
"tivoftpd" installed on the Tivo (also from the Jonnydeath CD)
All of the Debian MIPS packages from required-pkgs.txt (grab it from a
Debian mirror under /debian/pool)

INSTRUCTIONS:

1) Download the files you don't have. Pick a version of Debian to
install. Personally I prefer "testing" but you can also pick from
"stable" or "unstable."

2) Rig up the BASH_ENV hack on the tivo. Find a way to get a bunch of
free space on the tivo drive. What I did was mfsrestore (but NOT
expand) a 40GB image onto an 80GB drive.

3) Once the BASH_ENV hack is working, make an ext2 fs where the bash
hack put the romfs. In my case this was hda14 but YMMV.

4) Copy the included hacks file to the root of the new partition.

5) Boot the tivo and ensure that you get a shell. The system should
stop booting at this point and be waiting for your input. If not,
figure out why.

6) Copy the original tivo root to a subdirectory in your new partition.
The new partition should be under /mnt so don't include /mnt in the copy
(duh). For example: mkdir -p /mnt/tivoroot/mnt ; cp -a /tvbin /dev
[...] /mnt/tivoroot/.

7) Create a big temp directory somewhere on your PC. Create a MIPS
Debian root under that directory. Use dpkg-extract to extract all of
the required (essential) MIPS Debian packages to the new root. Copy
sources.list into /etc/apt in the new MIPS root.

8) Tar up the debian root and extract it to /mnt/ on the tivo. Make
sure you know where to find a version of chroot that will run with the
libs in /lib on the original tivo root.

9) On the tivo, chroot to /mnt and start setting up the Essential
packages. dpkg --configure -a should do the job.

10) Refine the system. Change /hacks to auto-chroot into /mnt on
startup if you wish. Add more packages if you wish. Find a way to get
/proc mounted in the right place(s). Copy the tivo modules to
/lib/modules/ ... / on the debian partition and set up scripts (or use
the rcscripts) to start networking.

11) To start the tivo software from within the debian chroot, chroot
/tivoroot /etc/rc.d/rc.sysinit .

12) apt-get update ; apt-get upgrade

NOTES:

Be very careful if you choose to use pdisk to create a legitimate partition
for your ext2 filesystem - MAKE BACKUPS of the first several (32? 64?)
blocks of your drive. The version of pdisk I used corrupted the Tivo
signature and kept the unit from booting.

Is there a way to get mfsrestore to leave a specified amount of space free
on the drive for your Debian partition, during the expansion phase? I have
not looked too hard but I didn't notice a way either.

You should do the dpkg-extract operation as a normal user on your PC. If
you do it as root, you run the risk of potentially corrupting your PC's
package database and maybe even having to reinstall the OS. Don't forget
to chown -R root the entire Debian tree at some point, to avoid weird
ownership issues.

This hack, of course, allows you to replace tnlited and tivoftpd with sshd
(which affords real access control).

I recommend against setting a valid default route, because the tivo will
attempt to phone home over the internet. Instead, set the http_proxy
environment variable to something sensible (a local junkbuster proxy
maybe?) prior to running apt-get.

An old version of this file is in the zip. Ignore it.

Thanks to mbm for providing inspiration and moral support.

REFERENCES:

BASH_ENV hack: http://www.tivocommunity.com/tivo-vb/showthread.php?threadid=90268

Possible PROM no-sigcheck hack: http://www.tivocommunity.com/tivo-vb/showthread.php?threadid=80274&pagenumber=2

hwac
12-31-2002, 08:08 AM
What No Install Wizard ? ;)

Shao
12-31-2002, 08:13 AM
I was kinda hoping for RH, but good job none the less.

Can we run mame on it yet?

Weez
12-31-2002, 08:16 AM
Cost of Series 2 Tivo: $199
Time ripping it apart: 46 hours
Time installing debian: 18 hours
Thanking mbm: Priceless

embeem
12-31-2002, 10:48 PM
-

emu
03-08-2004, 09:17 PM
^Bump^

LMAO

How did I miss this thread, it's "Priceless"

:P

alldeadhomiez
03-08-2004, 11:30 PM
Now that the thread has resurfaced, I may as well post a few updates after a year of running in this configuration:

First, patch your kernel (http://www.pvrhax0r.com/forum/showthread.php?threadid=30) to avoid intermittent errors when working on your TiVo.

Second, I've attached an updated version of these tools. I threw together a script called create_root.sh which tries to automate the first part of the process: fetching and expanding the packages into a "root" archive which can be transferred to the TiVo. Read notes.txt for a few brief caveats I encountered during the "dpkg --configure -a" stage. The new tools will build a setup for MIPS/PPC, stable or unstable. The only configuration that has worked for me on a TiVo is MIPS/stable. MIPS/unstable is no longer compatible with the older 2.4.4 and 2.4.18 kernels, and I think the S1 PPC kernels are too old to run either branch.

fearlessrogue
03-09-2004, 11:31 AM
So before I do anything else I need to cross compile a patched kernel? Are the general instruction above still the suggested route to get debian running?

This is going to be fun! Ugh

johnd01
03-09-2004, 08:28 PM
Now that the thread has resurfaced, I may as well post a few updates after a year of running in this configuration:


I like Debian but what are the advantages of running it rather than some other kernel on my HDVR2s?
Does is support LBA48?
Will it make transferring recording request easier?
It will make TIVO more of a network server rather than a dedicated A/V unit.

fearlessrogue
03-09-2004, 09:02 PM
The biggest reason I want debian on my tivo is so that I can run a samba server on a rather secure platform (that is debian linux on non x86 hardware). The reason not to run a stock kernel is that it does not use FPU registers correctly. I am not a programmer of significant abilites so I will trust alldeadhomiez who by all indications is.

It should be rather easy to make the kernel lba 48 with the patches that seem to be on this forum.

Debian would allow a ton of options that normal linux would not... A ton.

fearlessrogue
03-11-2004, 04:18 PM
I have been thinking a bunch and was wondering if it would it be possible to:

1. Restore with the option for a massive swap (say 60 gig).
2. By hand repartition so that all but the last 127 MB is unpartitioned, and have the last 127 be swap.
3. Perform monte as per normal.
4. Copy off to a seperate drive the partition that gets monted too.
***** I have been able to get a functional tivo after setp 5******
5. Repartition so that the unpartitioned space of that whatever partition was monted too would be many gigs.
6. Extract the debian root that would be built for the older method of getting debian to the new partition.
7. Copy back in the tivo files to the monted partition.
8. Setup up debian.

For that matter it would probally be best to do the dpkg extraction via a knoppix disk so that you do not risk a install...

alldeadhomiez
03-11-2004, 08:12 PM
For that matter it would probally be best to do the dpkg extraction via a knoppix disk so that you do not risk a install...

Just run dpkg-extract as a non-root user.

If you boot Knoppix you will still need a big, writable filesystem to store a 200MB Debian root. Although maybe you'll have a big enough ramdisk.

I am attaching the reimaging scripts I use to illustrate one possible way to repartition the drive to accomodate Debian. You will need to provide a bunch of support files (you'll see). This runs with a stock kernel and no reboots.

fearlessrogue
03-12-2004, 01:31 AM
Just run dpkg-extract as a non-root user.

If you boot Knoppix you will still need a big, writable filesystem to store a 200MB Debian root. Although maybe you'll have a big enough ramdisk.

I am attaching the reimaging scripts I use to illustrate one possible way to repartition the drive to accomodate Debian. You will need to provide a bunch of support files (you'll see). This runs with a stock kernel and no reboots.

Thanks a ton for all the work you have done.

Is there any reason that the approoach that I suggested above would not work?

Forgive me but what is the usage of the script? Am I correct in the assumption that it is to be used while booted into a Sleeper iso like enviroment (I have no clue what that is based on, forgive the ignorant).

sublime
03-12-2004, 03:09 AM
I have been trying to get GKrellM server installed on my HDVR2

http://dealdatabase.com/forum/showthread.php?t=32213

Could one of you with Debian (and apt) working, install a copy of "gkrellmd" and provide me with the gkrellmd application ? Greatly appreciated!


Edit: DUH! Im going to check out the repositories and see if I can help myself

Edit:

tivo:/var/hack/gkrellm$ ./gkrellmd
./gkrellmd: /lib/libc.so.6: version `GLIBC_2.3' not found (required by ./gkrellmd)
./gkrellmd: /lib/libc.so.6: version `GLIBC_2.3' not found (required by /usr/lib/libglib-2.0.so.0)

---

Looks like the gkrellmd from Debian is compiled with too new a glibc. Ugh, Replacing /lib/libc.so.6 with the version off the debian site killed the box

Edit: I compiled my own version of gkrellmd against glib1.2 and got the glib1.2 stuff from the Debian repository. Making progress. Sorry to have this post in the Debian thread. I would delete it if I could, but it only lets me edit. So may as well show my progress...

Edit: YES!!!! I got it to work. I will post instructions on my thread.

alldeadhomiez
03-13-2004, 01:19 PM
Thanks a ton for all the work you have done.

Is there any reason that the approoach that I suggested above would not work?

I posted that script because it pretty much implements the steps that you posted. The only major difference is that the script assumes that the TiVo root filesystem has already been archived, so it doesn't need to be manually extracted from the backup image during installation.

The image this script is used to install was designed to install 3.1.1b, and then optionally perform an immediate in-place upgrade via slices on the first boot. Thus, it was not important to allow the user flexibility with regard to the MFS image and the TiVo root filesystem tarball. Your needs may vary.


Forgive me but what is the usage of the script? Am I correct in the assumption that it is to be used while booted into a Sleeper iso like enviroment (I have no clue what that is based on, forgive the ignorant).

It is usable from a standard Linux installation or from an "ISO" environment. As I said though, it is only an illustration of the concept as none of the support files were included.

scottym
06-25-2004, 05:40 PM
I have an HDVR2 with a 200 GB drive installed as my B-drive (it was on-sale). I haven't done an LBA48 patch so approximately 72.3 GB is stranded capacity. I'm also trying to avoid having to backup my recordings.

It seems like this stranded capacity would be a good place to install Debian. Does anyone have any suggestions on how I can reclaim this space for Debian?

Do I need to get LBA48 up and running first, or, preferably can i load debian install while tethered to my pc and then tweak the bootloader to recognize the new space when i boot in TiVo.

Thanks,
Scott

alldeadhomiez
06-25-2004, 05:45 PM
I have an HDVR2 with a 200 GB drive installed as my B-drive (it was on-sale). I haven't done an LBA48 patch so approximately 72.3 GB is stranded capacity. I'm also trying to avoid having to backup my recordings.

It seems like this stranded capacity would be a good place to install Debian. Does anyone have any suggestions on how I can reclaim this space for Debian?

Do I need to get LBA48 up and running first, or, preferably can i load debian install while tethered to my pc and then tweak the bootloader to recognize the new space when i boot in TiVo.

Use pdisk to allocate a partition (I reclaim hda1) and then install an LBA48 kernel.

scottym
07-07-2004, 10:32 PM
Please forgive my stupid question. Is this hack applicable to 4.0? I understand it was developed for 3.1.1b however 4.0 also uses the 2.4-18 kernel. Is the FPU patch necessary for 4.0?

I'm assuming this script is meant to be run on a Linux system other than my TiVo after I locate the support files--is this a good assumption?

Thanks,
Scott


Just run dpkg-extract as a non-root user.

If you boot Knoppix you will still need a big, writable filesystem to store a 200MB Debian root. Although maybe you'll have a big enough ramdisk.

I am attaching the reimaging scripts I use to illustrate one possible way to repartition the drive to accomodate Debian. You will need to provide a bunch of support files (you'll see). This runs with a stock kernel and no reboots.

alldeadhomiez
07-07-2004, 10:42 PM
Please forgive my stupid question. Is this hack applicable to 4.0? I understand it was developed for 3.1.1b however 4.0 also uses the 2.4-18 kernel. Is the FPU patch necessary for 4.0?

I'm assuming this script is meant to be run on a Linux system other than my TiVo after I locate the support files--is this a good assumption?

The TiVo software version is irrelevant. The only facility that Debian needs is the kernel. The FPU patch is not absolutely necessary (I ran for almost a year without it) but you might see intermittent problems with Perl and other programs if it's missing.

You will need a normal, internet connected Linux (or maybe Cygwin?) box to run the script that fetches and expands the packages.

scottym
07-08-2004, 01:08 AM
This will open the door for all kinds of cool things if I can get it working.

I'm trying to understand the install.sh script which uses mfstool restore to create a large swap partition. I'm having trouble understanding where to find the rc.conf file. Is rc.conf part of a archive that I need to download? Know where I should be looking for this archive? Thanks, in advance, for any help locating these files!

Scott


The TiVo software version is irrelevant. The only facility that Debian needs is the kernel. The FPU patch is not absolutely necessary (I ran for almost a year without it) but you might see intermittent problems with Perl and other programs if it's missing.

You will need a normal, internet connected Linux (or maybe Cygwin?) box to run the script that fetches and expands the packages.

alldeadhomiez
07-08-2004, 09:26 AM
This will open the door for all kinds of cool things if I can get it working.

I'm trying to understand the install.sh script which uses mfstool restore to create a large swap partition. I'm having trouble understanding where to find the rc.conf file. Is rc.conf part of a archive that I need to download? Know where I should be looking for this archive? Thanks, in advance, for any help locating these files!

install.sh was pulled from my imaging setup, which is not posted anywhere. The section of rc.conf used by the install script looks like:


#
# INSTALLATION OPTIONS
#

# use "bash_env" to exploit a virgin prom, and "prom" to use a modded prom
install_compromise="bash_env"

# drive to install on
install_disk="/dev/hdc"

# size of the Debian root
install_rootsize="1024"

# size of the swap space, hda8
install_swapsize="256"

# size of the tivo /var
install_varsize="256"

# slices to install on first boot (now REQUIRED)
install_sw="slice-4.0"

# user package directory
install_userpkg="pkg"

# try to avoid clobbering mfs, to attempt an OS upgrade
# YES causes everything except mfs to be wiped out and reconstructed
# NO causes EVERYTHING including mfs to be reimaged
install_noclobber_mfs="NO"

# comment this line when you're done editing.
install_stopnow="You must edit rc.conf before you can install."

Some of these options may not be supported by the version of install.sh that you have.

The idea is that a minimal, empty MFS image is written to the drive (optional), then the drive is repartitioned, configuration options and slices are copied to the main root, and the kernel and bootpage are set up. When the system boots, hda1 is the root filesystem, and hda4 or hda7 is mounted on /tivo (see embeem's post). Using a few other tricks and programs, it is able to smoothly handle TiVo software upgrades/downgrades and do some other neat stuff.

fearlessrogue
07-27-2004, 04:12 AM
In order to use the script you provided must one have slices availible or can it work with just the information from a mfsrestore?