KernelCompiling

Recompiling the Linux-kernel for the Xbox

Special thanks to all the normal Linux kernel guys (without them, there'd be no Linux), the Xbox Linux kernel developers, then the IRC guys- maxx_22, dmp, bendy24, FluFF, Ubernoob, and El_Platto- thx for all the help and testing.

Corrected and updated to be accurate as of 13/02/2004 by CRC (from IRC of course).
Also updated by Zepman as of 01-may-2004 (Sorry, CRC... but this almost 'needs' to be updated).

Requirements

The kernel 2.4.24 with the latest CVS tree is currently needed if you want to use the video on an Xbox 1.4 or 1.5.
[WWW] Xbox-Scene has a good version detection how-to if you don't know what type of Xbox you have.

Current Video Status

TV Encoder Chip

Mode

NTSC

PAL

Conexant (v1.0-1.3 mainboards)

Composite

Working

Working

S-Video

Working

HDTV

Working

RGB SCART

Working

VGA

Working

Focus (v1.4-1.5 mainboards)

Composite

Working

Working

S-Video

Working

HDTV

Working

RGB SCART

Working

VGA

Unknown

If you test this on something that is listed as Unknown, please visit us on IRC and inform CRC or dmp of your findings.

Overview

The actual steps

Obtain the kernel source

[WWW] http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.26.tar.gz
(note: gzip is not the best version available to users with slower internet connections. Go to kernel.org for the smaller .bz2 version.)
To do this under Xbox Linux, the download-utility called 'wget' is a good choice.

Go to /usr/src by typing:
cd /usr/src

Now, download the kernel by typing:
wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.26.tar.gz 

Extract the source

tar zxvf linux-2.4.26.tar.gz
ln -s linux-2.4.26 linux

NOTE: The last step is for compatibility. Some programs automatically look in /usr/src/linux for the source code of the kernel.

Obtain the CVS code

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

NOTE: Sometimes, CVS may not work properly - if you get a non-working copy, a known working copy can be downloaded [WWW] here.
Warning: This information may be outdated.

NOTE2: If you want to use my kernel config, which is more stripped down than the default, and should be suitable for most people, you can download [WWW] my .config and save it as .config in /usr/src/linux-2.4.26
Warning: This information may be outdated.

You might want to checkout a stable tagged version of the kernel. This will give you an older snapshot of the CVS. Only do this if you want to use it for historical reasons. Most people will want to skip this bit. To do this for the kernel 2.4.25 do this:
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/xbox-linux checkout
Warning: This information may be outdated.

CVS Patching

You need to copy the CVS code over to the kernel directory. If you're asked to overwrite, confirm.
cp -rf kernel/* linux-2.4.26

Now get to the linux-2.4.26 directory.
cd linux-2.4.26

Use the xbox config file

There are two ways you can do this.

1) The easy way: Type cp kernel.config .config

or

2) enter make menuconfig and load the kernel.config file in the menu.

Note for Xebian 1.0.2-users

Somehow, the kernel seems broken when compiled with Xebian 1.0.2. It is still a bit unknown why this happens, but it is fixable. (Thanks to dmp and gimli for this fix)

cp Makefile /tmp
sed '/gcc/s//gcc-3.2/g' /tmp/Makefile > Makefile

Now the kernel will be compiled with GCC 3.2 instead of GCC 2.95. Remember, this is a workaround.

Check for New Options

Sometimes the developers introduce new options in the kernel or drivers. To keep your current config file settings and get a chance to configure any newly introduced options do a:

make oldconfig

If there are any new options you will be prompted to make a selection. If not, you'll see lots of "stuff" scroll by, and then you'll be back to the shell prompt. Either way, your "old" selections will still be intact, and any new features will be configured.

Kernel Compiling

Here's the actual compiling. Make sure you don't get errors. If you do, ask our good friends at #xbox-linux for help.

make dep
make bzImage
make modules
make modules_install

Post-Install stuff

Now, you need to copy the kernel somewhere. The kernel is located within the kernel directory under arch/i386/boot/bzImage. Remember to keep your old kernel and the ability to boot to it.

For users booting Xebian from CD

Using Xebian and booting off e:\, I extracted the coresponding boot CD, replaced vmlinuz with bzImage, and converted the directory back into an ISO. From Linux, the command mkisofs -r -J -udf -o foo.iso /bar will create an ISO named foo.iso out of the contents of /bar.

For font-hack/MechAssault-exploit Xebian users

Copying anything to /boot won't help you. The kernel is saved directly on the FATX partition (E:, in a directory called 'debian'). So we need to mount the FATX-partition, make a backup of the old kernel and overwrite the existing one with the one you compiled. Sounds easy? It is.

Mounting E:\ :
mkdir /mnt/e
mount /dev/hda50 /mnt/e

Making a backup of the old kernel:
cp /mnt/e/debian/vmlinuz /mnt/e/debian/vmlinuz.old

Copying the kernel you compiled over the old kernel:
cp /usr/src/linux-2.4.26/arch/i386/boot/bzImage /mnt/e/debian/vmlinuz

Making sure everything is saved and secured:
sync;sync
umount /mnt/e

Now reboot and your freshly compiled kernel should load up. If anything goes wrong, you can restore the old kernel with Emergency Linux.

For other distributions

This is partially disto-dependant. It may differ greatly.

Fixing the Alsa sound drivers to run on 2.4.26

Check out the AlsaCompile wiki page.

last edited 2004-05-26 15:27:30 by a80-126-147-222