Follow these instructions at your own risk. They work perfectly on my RaQ4, but I can't guarantee they'll work on your Cobalt. I cannot be held responsible for your machine.
I don't always check this page for comments, so please, leave your comments & then
contact me using my
contact page so I know to come by & respond. You should also check on my
updates before starting, this is where I note new versions of my patches & whatnot.
These instructions assume that you've already upgraded your ROM to at least 2.10.3 from the
Cobalt ROM Sourceforge Project. I'm using
cobalt-2.10.3-ext3-1M. It's probably a good idea to have an NFS boot server handy or be able to set one up pretty quick.
Installing Debian 3.1 Sarge on a Cobalt RaQ4 shows you how to set that up. If something isn't right with the kernel & it doesn't boot, you'll want to be able to boot from the network to fix any issues.
Before I get started, I'd like to thank
Jim Tuttle for his
Ubuntu Dapper on Qube3 HOWTO. His instructions on compiling the Linux kernel on Cobalt were flawless. I'd also like to thank
Jeff Walters for his work in keeping up with the newer kernels & giving us a way to use them on these machines. And also to
Tim Hockin, a former Cobalt engineer who has continued hacking the Cobalt kernel long after Sun backed out.
1) Preparation
You'll need root privileges for almost every command in here, and since we're all good admins & don't login to the machine as root, we'll need to switch to UID 0. There are also a few packages that we'll need to compile our kernel. Grab them all with apt-get.
user@host:~$ sudo su -
host:~# apt-get install build-essential bzip2 \
kernel-package gcc libncurses5 libncurses5-dev \
bin86 gawk ncurses-dev initramfs-tools
2) Download Linux source
Now we need to get the latest kernel source from
kernel.org. The repository can be found here:
http://www.kernel.org/pub/linux/kernel/. Go there & get whichever version you want. They come in all different flavors, but this HOWTO assumes that you're downloading the bzip2 archive. The one I used is
linux-2.6.24.3.tar.bz2. If you get anything different, certain parts of this HOWTO will change of course.
host:~# cd /usr/src
host:/usr/src# wget 'http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.24.3.tar.bz2'
3) Unpack Source & Prepare Environment
Unpack your source archive
host:/usr/src# tar -jxvf linux-2.6.24.3.tar.bz2
I wanted to rename the source directory so I'd know that it's the patched source (we'll be patching it in a moment).
host:/usr/src# mv linux-2.6.24.3 linux-2.6.24.3-cobalt3-tw
Create a link to the source directory for building the kernel & change into it.
host:/usr/src# ln -s linux-2.6.24.3-cobalt3-tw linux
host:/usr/src# cd linux
4) Download & Apply Patch
I originally got my patch from
Jeff Walters at
http://gentoo.404ster.com/projects.php?action=view&id=4. I had to make some more changes to the kernel source to make his patch work with linux-2.6.22.6, so I have a different patch. I will be submitting the patch to Jeff Walters for review & possible inclusion on his site. For now, feel free to get it from me. You can find it here:
linux-2.6.24.3-cobalt3-tw.patch
host:/usr/src/linux# wget 'http://cobalt.tjwiley.com/kernel/2.6.24.3-cobalt3-tw/linux-2.6.24.3-cobalt3-tw.patch'
host:/usr/src/linux# patch -p1 < linux-2.6.24.3-cobalt3-tw.patch
5) Copy Config File
I've got a working config file for the 2.6.24.3 kernel. It has the cobalt options, netfilter as well as support for a few devices that I have. It's definitely a good starting point. You can find it here:
linux-2.6.24.3-cobalt3-tw.config
NOTE: This config is for Cobalt Gen III machines. If you have a GEN V machine (XTR, etc.), you'll want to make sure that you remove Cobalt Gen III support & add Cobalt Gen V support when you make menuconfig.
host:/usr/src/linux# wget 'http://cobalt.tjwiley.com/kernel/2.6.24.3-cobalt3-tw/linux-2.6.24.3-cobalt3-tw.config'
host:/usr/src/linux# cp linux-2.6.24.3-cobalt3-tw.config .config
6) Add Optional Trailing Version Information
Use your favorite text editor to open Makefile. I prefer vi, so that's what I'll use.
host:/usr/src/linux# vi Makefile
At the top, you will find the variables which build the full version information. Find the variable EXTRAVERSION & add anything to the end that you'd like. Whatever you add here will show up with `uname -r` when running the new kernel. This step is completely optional. Don't feel like you have to do it. Mine looks like this.
EXTRAVERSION = .3-cobalt3-tw
7) Prepare to Compile Kernel
During the oldconfig step, you may be asked a series of questions regarding support for different options. Most components can be built statically (included in the kernel) or as a module (can be loaded & unloaded on the fly). This step will also add options that have been added since your previous config to the new one. The menuconfig step will give you a set of menus that will allow you to browse through the different categories of options as well as add or remove them.
host:/usr/src/linux# make oldconfig
host:/usr/src/linux# make menuconfig
host:/usr/src/linux# make-kpkg clean
8) Compile Kernel
In the command below, change --revision to anything you want. This will show up in the debian package name. I usually go with the date & my revision number. Since this is the first try on 2007.03.02, we'll use '2007.03.02-1'.
host:/usr/src/linux# make-kpkg --initrd --revision='2007.03.02-1' kernel_image kernel_headers modules_image
9) Install Kernel Packages You Just Built
The installer will ask you if you want to abort installation of an initrd kernel image, choose "No".
host:/usr/src/linux# cd /usr/src
host:/usr/src# dpkg -i linux-image-2.6.24.3-cobalt3-tw_2007.03.02-1_i386.deb
host:/usr/src# dpkg -i linux-headers-2.6.24.3-cobalt3-tw_2007.03.02-1_i386.deb
10) Create vmlinux
It should be noted here that I'm pretty sure you don't need to make modules or modules_install as that's done by the linux-image package (when you told make-kpkg to make modules_image). However, I haven't fully tested this, so I've added those to the steps below. Feel free to try leaving them out.
host:/usr/src# cd /usr/src/linux
host:/usr/src/linux# make vmlinux modules modules_install
host:/usr/src/linux# strip vmlinux
host:/usr/src/linux# bzip2 -c vmlinux > /boot/vmlinuz-2.6.24.3-cobalt3-tw.bz2
You're kernel can't be any larger than 1800k when compressed, so you'll want to check it before moving on.
host:/usr/src/linux# du /boot/vmlinuz-2.6.24.3-cobalt3-tw.bz2
1448 vmlinuz-2.6.24.3-cobalt3-tw.bz2
Mine is 1448k, so I'm fine.
If your bzipped kernel is larger than 1800k, you should try removing support for certain options that aren't necessary or build some options as modules.
11) Recreate Bootloader Links
Since the Cobalts don't have a bootloader, they load generic files from the boot partition. So we're going to create links to our new kernel for the boot ROM.
host:/usr/src/linux# cd /boot
host:/boot# rm System.map vmlinux.bz2 initrd.img
host:/boot# ln -s System.map-2.6.24.3-cobalt3-tw System.map
host:/boot# ln -s initrd.img-2.6.24.3-cobalt3-tw initrd.img
host:/boot# ln -s vmlinuz-2.6.24.3-cobalt3-tw.bz2 vmlinux.bz2
12) Reboot
host:/boot# shutdown -r now
When you log back in you should be running your new kernel.
user@host:~$ uname -r
2.6.24.3-cobalt3-tw
Troubleshooting
1). Second stage kernel: Decompressing - done
If your Cobalt hangs or stalls on boot at "Second stage kernel: Decompressing - done" make sure you've compiled, stripped & bzip2 compressed vmlinux properly. Easiest way to do this it to hit the spacebar when you see
Press spacebar to enter ROM mode on your console & then at the prompt type
bfr to boot from ROM. Then repeat steps 10 & 11 above.
Updates
2007.10.21
I've updated my patch for linux-2.6.23.1. Get the
Cobalt patch & config for linux-2.6.23.1 here. Below are the release notes.
Changes in 2007.10.21-1
*) [config] removed Pegasus USB Ethernet support
*) [patch] fixed 15 offset patch hunks
*) [patch] imported cobalt support back into drivers/char/nvram.c
*) [patch] fixed the following 4 patch hunk failures
*) arch/i386/kernel/traps.c (Hunk #2 FAILED at 640)
*) drivers/Kconfig (Hunk #1 FAILED at 84)
*) drivers/Makefile (Hunk #1 FAILED at 69)
*) drivers/char/nvram.c (Hunk #1 FAILED at 48)
2007.11.24
You may notice that my
patch & config for linux-2.6.23.8-cobalt3-tw have references to
linux-2.6.23.1-cobalt-tw. That's because I've linked 2.6.23.8 to 2.6.23.1 because there were no errors or new config features. Below are my latest release notes.
Changes in 2007.11.24-1
*) patched linux-2.6.23.8
*) [patch] changed 2.6.23.{1,8} drivers.char/nvram.c to include cobalt/nvram.h
instead of linux/cobalt-nvram.h. cobalt/nvram.h is a newer version
anyway and there's no reason to have two copies/versions of that file
duplicated in the source.
2008.03.02
I've updated my patch for linux-2.6.24.3. Get the
Cobalt patch & config for linux-2.6.24.3 here. Below are the release notes.
Changes in 2008.03.02-1
*) patched linux-2.6.24.3
*) [config] added ppp_mppe module support
*) [config] enable deprecated pci_find_* API
*) [patch] fixed patch to match new upstream directory structure with regard
to i386/x86_64 in to arch/x86
*) [patch] fixed some hunk offsets