[TiVo Software Home] [Programs] [Partition Support] [Teletext] --- On this page: [Installation] [C Library] [Other Libraries]

TiVo Cross-Compiler and Libraries[new]

This cross-compiler allows you to compile programs on your PC to run on a Series 1 TiVo.

I have built a TiVo PowerPC cross-compiler for both Microsoft Windows (with the Cygwin Unix-style enviroment) and Linux host systems. The cross-compiler build script and patches are based on Mike Baker's tivo-build-xcompiler, but I made some improvements, updated it to work with Cygwin and newer versions of gcc as host compiler, and fixing a number of bugs (notably the libc "Illegal Instruction" error).

I have also built some libraries that might help you porting software. See my main page for more TiVo software.

Cross-Compiler Installation

The following pre-built cross-compiler and C library should be installed under /usr/local/tivo. It won't work if you put it elsewhere (that's a gcc "feature").

It might help to put /usr/local/tivo/bin in your PATH (not essential - it will work fine if executed directly as /usr/local/tivo/bin/gcc). If you put it at the beginning of your PATH, then the TiVo version of gcc etc will take precidence (which is fine as long as you don't forget it's there and get confused when you try to build a program with the native compiler). Otherwise put it at the end of the PATH and run it as powerpc-TiVo-linux-gcc.

The following pre-built cross-compilers come with the TiVo-2.5.x-linux-2.1 headers. It probably won't make any difference, but if you have TiVo version 3.0, you may want to update the headers to TiVo_3.0_linux_2.1. Rather than downloading that entire source distribution, you can unpack just these header files after installing the cross-compiler.

Windows and Cygwin

This was built on Cygwin 1.5.18-1 with GCC 3.4.4-1. It should work with most later Cygwin versions (and probably some earlier). If not, you can build your own. If you don't have Cygwin installed, then it can be installed with the setup program, which can be downloaded from the Cygwin site.

Download the binaries (8 MB download) and untar from the Cygwin root, /. For example, if you downloaded the tar file to C:\Downloaded\usr.local.powerpc-tivo-cygwin-3.tar.bz2, then it can be installed with

cd /
tar jxf /cygdrive/c/Downloaded/usr.local.powerpc-tivo-cygwin-3.tar.bz2

Linux

This was built on Scientific Linux 3.0.5 (a RedHat Enterprise Linux 3 clone) with GCC 3.2.3-52. It may work with other versions of Linux if they have libc.so.6. Otherwise build your own. Download the binaries (8 MB download) and untar from the root directory, /. Eg.
cd /
tar jxf ~/usr.local.powerpc-tivo-linux-sl3-3.tar.bz2

Build Scripts

These scripts and patches allow you to build your own PowerPC cross-compiler and C Library for the Series 1 TiVo. It works on either Cygwin or Linux with the native GCC installed. (As well as the above platforms, I have also tested the build script on Red Hat Fedora Core 2.) The build script requires the toolchain and Linux 2.1 headers that can be downloaded from TiVo. See Readme file for details.

You can download build script and patches or view the Readme file and patch file separately.

C Library

The full C Library should be installed on your TiVo. It is not required if your program does not use any of the NSS lookup functions discussed below, and is not linked against any of the other libc shared libraries. Otherwise TiVo's standard /lib/libc.so can be used. Note that the NSS functions are provided by shared libraries even if you link statically (-static).

Download the C shared libraries' tar file and copy it to your TiVo. It should be installed under the /var/hack directory.

cd /var/hack
gzip -dc tivo-libs-3.tgz | cpio -iduH tar
If you have installed tar on your TiVo (eg. from mbm's downloads, or my my newer version), then it's even simpler
cd /var/hack
tar zxf tivo-libs-3.tgz
That will place it in /var/hack/lib.

Once installed on the TiVo, add /var/hack/bin to your PATH (assuming you intend to install programs there) and /var/hack/lib to your LD_LIBRARY_PATH, ie.

export PATH=/var/hack/bin:$PATH
export LD_LIBRARY_PATH=/var/hack/lib
It should also work without the LD_LIBRARY_PATH setting if you install it in /lib. However that would overwrite the TiVo's standard libc.so, which I was loath to do.

Fixes

This version of the C Library includes a fix to the infamous "Illegal Instruction" error, which occurred whenever a program tried to execute any of the lookup functions implemented via the C Library's Name Service Switch (NSS) scheme (passwd, group, hosts, protocols, services, etc). This bug is present in both the TiVo 2.5.5 standard libc and in other rebuilt libraries (such as from tivoutils). I'd be interested to know whether it was also present in later TiVo PowerPC software versions (3.0+). Previously it has been necessary to disable calls to those routines (eg. with libtivohack, which provides dummy, largely non-functional, replacements that at least don't crash), but that is no longer necessary with my fix.

With this fix, the lookups behave as normal. I have tested all of the routines that libtivohack replaced, and they now work as expected. Host names are found in /etc/hosts or by a DNS lookup (assuming the DNS servers are defined in /etc/resolv.conf and accessible); user and group account information is found in /etc/passwd and /etc/group respectively; and so on.

The fix was very simple: for some unaccountable reason, nss_lookup_function's body (in libc/nss/nsswitch.c) had been removed in TiVo's official TiVo-2.5.x-toolchain.tar.gz. Without this, a random function pointer was returned, so when this was executed, it's not surprising that an Illegal Instruction ensued. I restored the missing code.

Some examples of how the fix works can be found on this forum posting.

Libraries

Required by some programs...
  1. ncurses 5.4
The following libraries are kept here in case they are useful. However they have not been rebuilt or tested with the latest compiler. That shouldn't be a problem, but you may prefer to rebuild them yourself.
  1. libosd 0.4.1
    Requires the FreeType library and headers on the build machine and FreeType shared library on the TiVo (see below).
  2. FreeType 2.1.10
  3. termcap compatibility 1.2.3 library

[TiVo Software Home] [Programs] [Partition Support] [Teletext] --- On this page: [Top] [Installation] [C Library] [Other Libraries]

HTML 3.2 Checked... Best viewed with ANY browser! http://homepage.ntlworld.com/maxwells.daemon/tivo/compiler.html last modified 2nd July 2006 by
Tim <maxwells_daemon@ntlworld.com>