For some time now, I have tried to turn my Xbox into something useful. The Xebian projects makes it possible to install Linux on the Xbox, which opens many doors to new applications. I have turned my Xbox into a multipurpose multimedia playing device using Xebian 1.0.1 and Freevo 1.4. These projects make the transition relatively easy, however, there were several issues to be tackled before it could be called useful. After a lot of Googling and experimenting I worked out how to do it and decided to write it down here.
Support for the xbox remote control is one of the problem areas of the xbox-linux project in my opinion. The driver suffers from several bugs, making the remote behave badly. First off, the driver seems in a constant battle for control with the xpad driver. Changing the load order can help here, but using the xpad driver and the usb-xboxir driver at the same time often results in erratic behaviour. Furthermore, the driver suffers from jittery behaviour with at times unwanted repeated keystrokes or no action at all. Finally, the userland tool to map keys of the remote is largely undocumented and buggy. All this has been so since the beginning of the project and although remedies are known, the developers seem not to be inclined to update the driver. At the time of writing, the last maintenance entry in the code states 2002_09_02.
There are two reasons for patching the usb-xboxir driver:
Remove the annoying jittery behaviour
Remap the keys of the remote to your liking
First download the CVS code for the xbox-linux kernel:
cd /root/
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/xbox-linux login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/xbox-linux co kernel
Next, download the Autorepeat
patchfrom Bjorn Danielsson. The original patch can be found here.
Now apply the patch:
cd kernel/drivers/usb/
patch < path/to/xboxir-autorepeat.patch
Before starting the compilation however, you
have to adapt the key mapping in the usb-xboxir.h file. You can
either do it manually or use the small patch
I wrote that gives reasonable settings for use with Freevo. While
still in the kernel/drivers/usb/ sudirectory, apply it with:
patch < path/to/xboxir-keymap.patch
Next, compile the module:
gcc -D__KERNEL__ -DMODULE -I/root/kernel/include/ -O3 -c usb-xboxir.c
You should not get any errors or warnings
during compilation. After compilations, copy the module to a seperate
directory:
mkdir /root/freevostuff
cp usb-xboxir.o /root/freevostuff
You can now load it with the following
commands:
rmmod usb-xboxir
insmod -f /root/freevostuff/usb-xboxir.o
It will complain some about versioning
differences and tainting the kernel, but it will probably work all
the same. At least it did for me ;-)
It seems the xpad and the usb-xboxir modules have conflicts when both are loaded at the same time. Unloading the xpad module will help. If you don't need the xpad device, leave it unloaded. If you really need it, you might be helped with using a simple:
rmmod xpad; modprobe xpad
Your results may vary.
In Xebian 1.0.1, xdm is started at boot time. If you are going to use the xbox as a standalone settop box with freevo, this behaviour is unwanted. Disable xdm in the following way:
update-rd.d -f xdm remove
Next, we want a default screen resolution of
800x600 with 24 bits color depth.
Edit /etc/X11/XF86Config-4 and make sure that the following lines are in the section “Screen”:
DefaultDepth 24
and:
SubSection "Display"
Depth 24
Modes "800x600"
EndSubSection
Installing Freevo is not a trivial thing for the xbox. Luckily, a special version of Freevo is available for the xbox from the xbox-linux multimedia project. I used Freevo 1.4 for the Xbox.
After downloading, install it:
cd /usr/local/
tar -zxvf path/to/xboxfreevo.tar.gz
The files will now be installed in
/usr/local/freevo/.
Make sure the following lines are in freevo.conf:
display = x11
geometry = 800x600
Tune the settings file local_conf.py to your
needs. If you want a quick start, you can use my configuration file
as a base. Note however, that I removed some extra configuration
plugins that I found completely unnecessary. I like to do all my
network-drive mounting myself, thank you!
Actually, you should now have a working configuration. You can test it easily by doing:
cd /ussr/local/freevo/
X &
./freevo
Play around a bit to see if it works to your
liking. If not, tune the configuration a bit more.
Starting your freevo from a ssh connection every time is a bit clunky and tends to raise eyebrows with people blind to the finer points of linux hacking, eg. 99% of the world. Time to make everything work at boot time. There are several ways to do this. The way I describe here is not very secure at all and is not recommended for your average system. However, if you do not use your xbox as a public server, it is probably ok.
First edit /root/.xinitrc to contain (only) the following lines:
xset -dpms s off &
/usr/local/freevo/freevo
Add the startx command to /root/.profile:
echo startx >> /root/.profile
Next, create a file called
/root/freevostuff/freevostart with the following lines:
/sbin/rmmod xpad
/sbin/rmmod usb-xboxir
/sbin/insmod -f /root/freevostuff/usb-xboxir.o
su - root
Make the file executable:
chmod 777 /root/freevostuff/freevostart
Finally, make a symbolic link in the
/etc/rc2.d/ directory (make room first):
mv /etc/rc2.d/S99rmnologin /etc/rc2.d/S98rmnologin
ln -s /root/freevostuff/freevostart /etc/rc2.d/S99freevostart
At the next reboot, X and freevo should start
completely automatically.
Playing with initialization scripts is always a bit dangerous. A small mistake, and the sshd daemon may not load up, effectively shutting you out. Not to worry, it has happened to me too and is easily remedied. I installed my Xebian in the game partition. The example here is for this situation. First boot the xbox using the Xebian CD you installed the system with. Then create 2 mountpoints:
mkdir /root/game
mkdir /root/mnt
Then mount the game partition and after that
the rootfs filesystem:
mount -t fatx /dev/hda50 /root/game
mount -t loop /root/game/debian/rootfs /root/mnt
Your root file system is now available under
/root/mnt/. Make changes to correct the problem, unmount and reboot!
This site is sponsored by OpenBizz. OpenBizz is a dutch company helping small and medium sized businesses switch to Linux.