Installing Debian on Your Unmodded Xbox

by dave

So you have your Xbox, you're bored of the games that you have, you fancy a challenge, so why not install GNU/Linux on it?

Everyone has heard things on the web about the efforts to make various distributions run on the Xbox and of course there are many horror stories of people making their Xboxes into nice door stops.

However, installing Linux is surprisingly easy provided you know what you are doing.

Back in 19:4 Live_wire showed us how to install Edgar Hucek's Xbox Debian (Xebian) on a modded Xbox.

Since then there have been many advances in what you can do with your Xbox and many more distributions have appeared, including Gentoox (a Gentoo clone), Slothbox (a Slackware clone), plus a release of Mandrake and SUSE.

Ed's is the most mature and one of the better maintained.  All the distributions and information on them, along with more detailed technical documents are available from the Xbox Linux Project website over at xbox-linux.sf.net.

The SourceForge project page (www.sourceforge.net/projects/xbox-linux) hosts all the files needed in this little how-to.

A word of warning:  Some things can and will go wrong.  The author doesn't take any responsibility if Bad Things happen when installing Linux on your Xbox.  If in doubt, don't try it.

Before you start you should have the following things at hand, otherwise you will end up having to go to the store halfway through the operation.  An approximate equipment list follows (some parts are optional):

  • An unmodified Xbox.
  • A USB keyboard.
  • A USB memory device (i.e., a memory stick or USB Zip drive).
  • A USB mouse (optional).
  • A USB hub (optional).
  • The game James Bond 007: Agent Under Fire for Xbox.
  • A computer running Linux (kernel 2.4.20 or 2.4.21 with source and development tools).
  • A network (in some form).
  • A relatively high-speed Internet connection.
  • Patience.

Presuming that you have already read Live_wire's article you should have a working USB adapter.

If not, go away and make one then come back.  Once you have a USB adapter made, plug in a USB memory stick.  The Xbox will detect it in the Dashboard and it will show up under memory.  The Xbox will want to format it, so make sure you don't have anything important saved to it that you want to keep.

All programs running on the Xbox have to be digitally signed by Microsoft.  This means that it is very hard to run code that you are not supposed to.

However, workarounds have been found.  There are bugs in certain games which allow non-signed code to be executed.

On a very basic level, this is done by crashing the Xbox whilst loading a game, then getting it to load Linux instead.  This can be done in both MechAssault and James Bond 007: Agent Under Fire.  What follows is how to do it with James Bond 007: Agent Under Fire.

There are quite a few ways to get the 007 hack onto the Xbox.  The one I will describe uses a Linux workstation.

This method does not require you to open the Xbox up but does require you spend a little money on a USB memory stick.  You can pick these things up for around £20 in most computer stores (probably cheaper online).  Make sure that the stick is supported by the Linux usb-storage.o driver.

For this you will need a Linux PC with all the standard development tools (gcc, make, and everything else you need to build the kernel).  You will also need the source to the Linux 2.4.21 kernel.  I presume at this point that you know what you are doing and have compiled the kernel before (if not, go and compile a few to practice then come back).

Okay, now we need to patch the kernel with support for the FATX file system.  This is what the Xbox uses to format its hard drive and also its memory cards.  I will show two ways of patching the kernel and it depends on how lazy you are as to which you pick.

The first way is to use CVS.  You need to get some of the current pre-patched sources from the Xbox Linux Project CVS site such as the Linux 2.4.21 kernel source.  This requires that you have CVS installed.

Assuming you have it installed, create a directory (say /usr/src/tmp) and execute this command in there:

$ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/xbox-linux/kernel

This might take a while but eventually you'll have downloaded the needed kernel source files to the directory.

An ls will show you have one directory named kernel.

This folder contains the Xbox specific files for the kernel.  All you need to do now is copy the (Xbox specific) files across to the actual kernel source tree, replacing as you go.  Assuming that the source was unzipped to /usr/src/linux and the CVS files are in /usr/src/tmp we execute this command:

$ cp -rf /usr/src/tmp/kernel/* /usr/src/linux/kernel/

Once you've done this, change directory to the real kernel source (e.g. /usr/src/linux) and do a make config, make menuconfig, or make xconfig as usual.  Now you can carry on configuring the kernel.

If you don't like CVS, prefer kernel 2.4.20, or if you find a patch file easier to use, you might be better off using an older patch that is still available from the project page but not recommended.

At the time of writing the file was called: kernel-2_4_20-0_7_0.patch.gz

This is just a normal kernel patch file.  Once you have untar/gzipped your 2.4.20 kernel source file (I assume to /usr/src/linux from now on), copy the patch file to a level above (e.g. /usr/src), then change directory to the source.

Once you're there, execute the following command:

$ zcat ../kernel-2_4_20-0_7_0.patch.gz | patch -p1

This will apply the patch to the kernel.  You should have a list of files scroll up the screen that have been changed by the patch.

Now that your kernel is patched, it's time to configure it.

The first option you need to add is support for the USB memory card (if you already had this, then ignore this section).

The USB storage driver is really just some glue code between the USB and SCSI subsystems.  So, first things first - add SCSI support.  It's your choice if you want to do these as loadable modules or as built-ins.  The SCSI options you want are SCSI Support and SCSI Disk Support.

Exit the SCSI menu and go into the USB Support.  In there you'll need Support for USB, Preliminary USB Device File System, USB Mass Storage Support, and one of the USB Host Controller Devices.  The last is up to you to choose.  If in doubt select all of them as modules and see which one loads.

Now to add the support for FATX.

This is done in the File Systems menu.  The only options that you need to enable are FATX (Xbox) filesystem support, then within Partition Types select Advanced Partition Selection and then Xbox Support.  Now you can exit, saving your changes.  Compile the kernel as you would normally.

Remember to re-run LILO (or whatever bootloader you use) and then reboot with your new kernel.

Now we have a brand new kernel and all the tools that we need to copy the save game file to the memory card.

First - to download the files we want.  On the Xbox Linux Project SourceForge project page there is a file called: 007distro.tar.gz

This file contains everything you need to get Debian onto your Xbox.  (Beware:  This file is quite large, over 200 megs).

Unzipping the file will leave you with two folders.  One is name memcard, the other is called harddisk.  You can ignore the latter for the moment as we don't need it until further on in the process.

In the memcard folder there is an INI file and also a directory called UDATA.  What we are interested in are the contents of the UDATA folder.

In there is a directory called 4541000d.  This is an Xbox game save.  In it is the game that will crash the Xbox and load Linux.  Now you need to copy just this folder to your memory stick.

Mount the drive as usual and copy the directory over.

To check that the copy has gone okay you can load up the Dashboard on your Xbox and in the Memory menu you should be able to see your card and also see that there is a game save on the device.  All that is left for this part now is to copy the save game to the hard drive of your Xbox.

This may take a couple of seconds as the files are relatively large.  In my experience, sometimes the Xbox will say that the game files are corrupted or will try to format the device.  All you have to do is try again.  Remember that the FATX driver is still in its early days and things can (and probably will) still go wrong.

The actual installation is relatively easy.

Plug in your keyboard, but leave your controller in too as you'll need it to control things at first.  Now load James Bond 007: Agent Under Fire.  Wait until you get to the main menu screen.  Select Load Game, then Xbox Hard Drive.  This might take a while but eventually you'll get a kind of chime noise and xromwell (the boot loader) will display some information for you.

At this point it'll tell you the size of your Xbox hard drive.  This will be essential for later but it's very fast so try to spot it and remember it.

After xromwell has done its thing there follows the normal kernel boot process, modules will load, and BusyBox will start up.  You might need to hit Enter a couple of times to get things to start up.

Once you do there will be the normal login prompt.  You can login as root with the password: xbox

Now you need to get the installation files onto the Xbox.  Probably the easiest way to do it is to put it on another computer running a HTTP or FTP daemon, then use GNU Wget to fetch the file from there.

The file you want to be serving is the contents of the hard drive directory from the 007distro.tar.gz file.

You can tar and gzip it to aid transport over the network as BusyBox has those tools at your disposal.  Alternatively, you could use Samba to transfer the file by just mounting the appropriate share on your Samba server.

Before you start the transfer you might want to check the network settings.

By default, the IP address is set to 192.168.0.64/24 with a default gateway at 192.168.0.1.  You can use the usual tools to set them differently or if you're using DHCP, dhclient is available.

You want all of these files in the /media/E/ which is the part of the Xbox hard drive used for game saves.  The partition is about five gigabytes big so unless you've been saving lots of games and/or audio there should be plenty of space for the file.

Now we must replace the linuxboot.cfg file with a version that points to the files we have just copied over, so we execute:

$ cp /media/E/linuxboot.cfg /media/E/UDATA/4541000d/000000000000

If you are running low on space you can delete the dist*.tar.gz file which we downloaded.

Now we can reboot and pull off the 007 trick again to boot into Linux once more.

Now when you boot there should be X Windows running.  Hopefully this will boot and give you a login.

You can plug in your USB mouse now if you like, although you can use the Xbox controller to make the cursor move.  Once you login as root (with password xbox) you will see Window Maker start up, get a terminal, and execute:

$ /sbin/XBOXLinuxInstaller

This will start up a little graphical tool asking you some questions.

These are straightforward, network setting etc., although there is one that can cause some trouble.  That is the choice between installing to the E partition (where the game save files are) or to the spare unpartitioned space on the end of the hard disk.

This is where you have to remember the information that xromwell told you earlier.

The original Xbox had 8.4 gigabyte drives whereas the newer models have 10 gigabyte drives.  Now if you have an old model, you can't install Linux in the unpartitioned space.  You have to install to a loopback file in the E partition.  On the other hand, if you are lucky and have a newer device then the choice is up to you.

Assuming you made your decision, you can wait and let the installer get all of the files copied over and then reboot.  It is possible that the install might not have worked, in which case you can repeat the final part again.

This happened to me a number of times but practice makes perfect.  If there were no errors then you have succeeded in installing Linux on your Xbox.

Congratulate yourself by apt-get update-ing and downloading some new free software.

Shouts: Wilz, Woody, Druga, and miki_.

Return to $2600 Index