Running Linux on the Xbox
Having a modded Xbox with either a modified Microsoft BIOS or the Xbox Linux BIOS means you can start the Linux installation—but how do you interact with the installer? The Xbox does have USB connectivity; all controllers, memory units and the Xbox Live headset are standard USB 1.1 devices, but with different connectors. By attaching an adapter, you can connect any USB keyboard, mouse, webcam, printer or scanner that is supported by the PC version of Linux. These adapters are sold on the Internet for about $10-$15 US, but it also is possible to build your own with little effort. All you need is an Xbox controller extension cable, which has the connector to plug in to the Xbox on one side, as well as a USB female connector. Both cables contain four wires in different colors; simply cut both cables and reconnect the wires to create a USB-female-to-Xbox-male adapter cable.
The slot for the memory unit on your controller is another USB port, so you also can solder the USB female connector there.
If you plan to buy a USB keyboard and mouse for the Xbox, try to get a keyboard with a USB or PS/2 mouse connector built in. This way, you need only one Xbox-to-USB adapter. Macintosh keyboards have proven to work very well—and they don't have Windows keys, either.
With a modded Xbox, a keyboard and a mouse, you now can choose either to build Xbox Linux yourself or to take one of our prebuilt installations. At the moment, Xbox Linux offers three main distributions: Mandrake, Debian and the Xbox Linux Live System. The latter is a version of Linux without X but with Trolltech's Qtopia. It does not install into the hard disk, and it can be controlled with an Xbox controller. It is supposed to give newbies an impression of the possibilities available with Linux. Mandrake and Debian are full distributions that install into the hard disk. Mandrake 9.0 is available now, and 9.1 will be available soon. Both are based on the PC versions of Mandrake Linux and are 100% compatible with them and their RPM packages. They contain GNOME, KDE and many popular applications. The Xbox version of Debian can be booted into X from CD, but it also can be installed to hard disk. Debian has smaller release cycles and is updated more often, therefore it is used by most developers.
All those who don't want to use the prebuilt distributions but want to do everything themselves, and those who want to know how it works, should have a look at the Xbox Linux bootloaders, the kernel and the XFree patches.
As pointed out earlier, Xbox Linux can be booted either through the Xbox Linux Clean BIOS or from an unsigned .xbe file that pretends to be a game and starts Linux on a modified Microsoft BIOS. Both these applications are based on the same bootloader code, which loads the kernel and initial RAM disk from CD/DVD or hard disk, reserves 4MB of RAM for video and passes 60MB to the Linux kernel. Details about the kernel and initrd filenames and locations are read from the file linuxboot.cfg, which must reside in the same directory as the .xbe file in the case of the Microsoft BIOS. In the case of the Clean BIOS, the user can choose from where to read it.
In order for a Linux kernel to work on the Xbox, only one byte has to be changed—but for a perfectly adapted kernel, you need more changes. The Xbox has a severe bug in its PCI chipset that makes the machine crash when Linux tries to enumerate the PCI devices at boot time. By narrowing the region of PCI device numbers that are checked, this crash can be avoided. Another issue is the timer frequency: the Xbox system timer is off by about 6%, making music play too fast and making the kernel report the CPU clock frequency incorrectly.
The shutdown and reboot sequence is handled differently on the Xbox, but by adding some code to the kernel, it is able to reset and shut down the machine properly. Because copy restrictions often have been circumvented on other gaming consoles by inserting a legitimate game first and quickly replacing it with a copy, the Xbox, by default, reboots if you press the Eject button. Software can avoid this by replying to a request sent by the PIC16L chip that says not to reboot. Another patch in the kernel takes care of this. Yet some other code patches the report of the DVD drive, which pretends not to support video DVDs, although it does. On the Xbox Linux site, you can download patches for some well-known kernel versions that include all these modifications, plus support for the Xbox hard disk partitioning scheme and the Xbox hard disk filesystem (FATX). The modified files also are available in the Xbox Linux CVS. You have to enable the option for Xbox support in the kernel configuration.
Xbox Linux runs well in VESA framebuffer mode; that is, the bootloader sets up a fixed graphics mode and Linux inherits it, always writing into video memory but never accessing the actual video hardware. Alternatively, a patched version of the rivafb accelerated framebuffer driver is available, which allows changing the console video mode at runtime. In any case, you have to enable a framebuffer driver in the kernel configuration, because Xbox Linux does not support text mode yet.
With a minimal patch for the ALSA sound system, again available from the Xbox Linux CVS, the Xbox sound hardware can work with the i810 driver. The binary-only network driver for the NVIDIA nForce card, which you can download from the NVIDIA web site, works on the Xbox without any modification. An SMBus driver is needed if you want to enable the eject fix or to access the 256 bytes of EEPROM on the motherboard. You can use either the i2c-xbox module in the Xbox Linux CVS or the amd-756 module from the lm_sensors project. Both work equally well.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- The Ubuntu Conspiracy
- A First Look at IBM's New Linux Servers
- Vigilante Malware
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- Libreboot on an X60, Part I: the Setup
- System Status as SMS Text Messages
- Vagrant Simplified
- Bluetooth Hacks
- Dealing with Boundary Issues
- Linux and the Internet of Things