Gnif's Updated Guide (The Xebian Way)

From Xbox-Linux

This page is a work in progress, please be patient while I construct this guide.

Table of contents

Xebian-1.1.4 Kernel 2.6 Upgrade Guide

This guide is a complete re-write of the original guide on this website for upgrading your kernel. While the old method would work, it does not follow the Xebian (Debian) kernel package management methodology. This is the first guide I have publically submitted, so please excuse any spelling errors or mistakes (and correct them for me :D).

Package Management

Due to the way that xebian manages its packages, doing a manual install of any application or program under xebian is not recomended. It can break program dependencies, and the apt system will get out of date and may unknowingly overwrite your changes when you update/upgrade packages. This guide was written for these reasons, and to demonstrate the installation of a new kernel patched for the XBOX.

While this guide has been tested with a 2.6 kernel, there is no reason why it should not work for later versions of the kernel, as long as there is a patch for the XBOX.

Required packages

Before we begin, we need to install some basic packages.

  • libncurses5-dev - for kernel menuconfig
  • build-essential - installs gcc, and numerous other essential packages required for building the kernel
  • kernel-package - this is the xebian kernel package management helper, it will build the kernel for us.
  • bzip2 - so we can de-compress the kernel source, and the patch.

Note: I am writing this from memory, need to double check that these are all the required packages

Note: If you have just installed xebian, make sure you run "apt-get update" first!

To install these just run (as root)

# apt-get install libncurses5-dev build-essential kernel-package bzip2

The Kernel

We need to get the kernel source from the apt repository... to locate a candidate, run

# apt-cache search ^linux-source-2.6

you should get a list like so:

linux-source-2.6.16 - Linux kernel source for version 2.6.16 with Debian patches
linux-source-2.6.17 - Linux kernel source for version 2.6.17 with Debian patches

I have two choices, before you go ahead and download the source package, make sure there is a xbox patch for that kernel here: Linux xbox patches (http://sourceforge.net/project/showfiles.php?group_id=54192&package_id=147485)

Note: The 2.6.16 patch can be applied to the 2.6.17 with only one chunk failure that can easily be fixed by hand

At the time of writing, the latest xbox kernel patch is 2.6.16, so to make things easy, lets work with that kernel.

# apt-get install linux-source-2.6.16

Also, download the 2.6.16 patch from the above site.

Note: You can get the stock kernel from kernel.org instead of getting it from apt, the following steps will still work

Decompressing and Patching

The kernel we just downloaded will now be located in /usr/src/ as a compressed file, so we need to decompress it.

# cd /usr/src
# tar -xvjf linux-source-2.6.16.tar.bz2

You should now have a directory "linux-source-2.6.16"

Note: alot of people say to create the symbolic link from /usr/src/linux to this directory, in my experiance with 2.6 kernels it is not required for building under debian or xebian

Before we can patch the kernel, the file we downloaded will be compressed as a gzip file, we need to first decompress it:

# gunzip [INSERT PATH TO FILE]/linux-2.6.16-xbox.patch.gz

now we can patch the kernel

# cd /usr/src/linux-source-2.6.16
# patch -p1 < [INSERT PATH TO FILE]/linux-2.6.16-xbox.patch

Configuring the Kernel

We can save a lot of time by using the old kernel's configuration, this is simple to do:

# cp kernel.config .config
# make oldconfig

You may now be prompted for a stack of settings that were not present in the old kernel, if you are not, don't panic, it still worked.

Each setting has three possible values:

  • y - Compile into the kernel
  • m - Compile as a seperate module
  • n - Do not compile

Things you answer "y" to will compile into the kernel will be faster to load, and save on some overhead, but they increase the size of the kernel, and the requred memory to load the kernel. This option is good for hardware the xbox can not run without like the IDE interface.

Things you answer "m" to will compile as a seperate module (file) that you will need to load manually during boot should you need it. This is good for things like USB devices that can be hotplugged.

Things you answer "n" to will not be included into the kernel.

If you do not know what an option is for, you can type "?" for some help, 90% of the time there will be a "if you are unsure select X", so its pretty hard to go wrong.

Once you have finished setting up the old config, run:

# make menuconfig

Go through EVERY setting, read the help on it to see if you need it or not, if you are not sure, you can compile it as a module and later modprobe it. I personally like to have everything I am going to use built into the kernel as it makes boot time a bit faster.

Note: keyboard and mouse modules have changed names between 2.4 and 2.6. In 2.4 they were called mousedev and keybdev but now are called usbmouse and usbkbd. To make things easier, just compile these modules into the kernel (select "y"), then it wont have to search for them

Building the Kernel

This is the easy part, just run

# make-kpkg kernel-image

Once it has completed, you will have a new .deb file in the /usr/src directory. All we have to do is install it.

# dpkg -i /usr/src/linux-image-2.6.16-XXXXXX.deb

replace XXXXXX with the actual filename.

This will have installed the System.map, and vmlinuz files into the /boot directory.

Testing the Kernel

Now you have the new package installed we have to test it, so fire up vi and open the linuxboot.cfg file

# vi /boot/linuxboot.cfg

Note: if your xbox is softmodded, edit the E:\debian\linuxboot.cf file instead

This file determines where the kernel is, and which one to boot from. To add our kernel, insert the following text at the end.

title v2_6
kernel /boot/vmlinuz-2.6.16-XXXXX
append root=/dev/ide/host0/bus0/target0/lun0/part2 devfs=mount kbd-reset xbox=hdd
xboxfb y

replace XXXXX with the actual version, then save and quit. Now, reboot your Xbox

# reboot

At the Cromwell BIOS prompt, select the v2_6 entry you just added.

If all goes well your xbox should now boot into your new kernel. If not, see the troubleshooting at the end of this article

Comment This didn't work for me with 2.6.16 but google gave this remedy for linuxboot.cfg which worked fine:

title 2.6.16  
kernel /boot/vmlinuz-2.6.16-xbox  
append root=/dev/hda2 devfs=mount kbd-reset xbox=hdd

--Cmackinlay 04:13, 9 Jun 2007 (PDT)

Final Touches

If it works then it is time to make the change a little more permanent.

We have two choices here:

  • update the symlinks in /boot to "vmlinuz" and "System.map" to point to the new kernel.
  • update the /boot/linuxboot.cfg file to use the new kernel as a default.

I prefer the 2nd option since it will allow you to easily boot your old 2.4 kernel should something go wrong.

Fire up vi again:

# vi /boot/linuxboot.cfg

And add the following line:

default v2_6

Then save and quit...

Thats it, it should all be done and working.

Troubleshooting

If it doesn't work... don't get discouraged, I have built countless kernels over the years, and I have only ever configured one that worked exactly right the first time.

Just boot back into your 2.4 kernel and run

# make menuconfig

and double check everything, if you are still stuck, try to google for the answer (use debian as a keyword since xebian is really debain).

From memory the following are critical for a debian system:

  • cramfs - used for the initd image
  • initrd - a compressed mini filesystem that contains the kernel's modules that were not compiled in.
  • ramfs - cant remember if this one is required, but i think its needed for initrd.

If you still cant get it to go, send me your questions and I will try to answer them for you if I can.