How to compile a 2.6.x kernel for use with Compaq Evo T20 in LTSP 5

The point of this howto is to help you avoid some of the gotchas I had to overcome. This is not a fully detailed explanation on how to compile kernels or an introduction to what an Evo T20 is. I merely intend to share my experiences with "insiders" who already know what the problem is about and just wanna some pointers on potential problems along the way on compiling a kernel for use with the Evos.

Now let's get our hands dirty. Smile

There're two ways for compiling a kernel into the LTSP-tree:

a.) Do everything yourself.
b.) Use the Debian kernel-management packages to build a .deb kernel package and install it into the LTSP chroot environment.

I chose the former (and will document that one here too), because experimenting with kernels requires a lot of compilation, test, compilation, ... cycles and using the Debian-way of kernel-management has some unnecessary steps that I wanted to spare for rapid testing. Of course the choice is fully up to you, but do not ask me for help on the Debian-way ... instead search Google for the keywords compile debian kernel package.

Let's see what I've done ...

1. ) Download and unpack the latest kernel source.

This was v2.6.21.3 at the time of writing, so I'll use that one in my examples.

  wget 'http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.3.tar.bz2'
  tar xjf linux-2.6.21.3.tar.bz2

2.) Get the ltsp_kernel_kit bundle:

  wget 'http://ltsp.mirrors.tds.net/pub/ltsp/utils/ltsp_kernel_kit_4.2u3.tgz'
  tar xzf ltsp_kernel_kit_4.2u3.tgz

This version will do just fine.

3.) Edit Makefile of kernel source.

If you're using Ubuntu 6.x (or 7.x), then by default you've gcc 4.x installed. This GCC version does not work well with a number of kernel compilations (at least I had a number of problems with various kernel versions), so we should change it to use gcc-3.3 (actually I did not try to compile 2.6.21.3 with gcc 4.x, but all my previous attempts to use gcc-4.x for previous kernel versions failed with some error). For this you've to install gcc-3.3:
  apt-get install gcc-3.3

Then edit the Makefile at the top level of the linux source tree (vi linux-2.6.21.3/Makefile) and change "gcc" to "gcc-3.3" in the following lines:
  HOSTCC       = gcc-3.3
and
  CC              = $(CROSS_COMPILE)gcc-3.3

4.) Configure the kernel as you like.

  cd linux-2.6.21.3
  make mrproper
  make menuconfig

In the "Processor type and features / Processor family" I chose "GeodeGX1" since this is the chip in the Evo T20. I've gone through the whole configuration (all options) and left away everything that seemed to be unnecessary. In case I had doubts I've put the given option into a module.

Watch out that you compile the following into the kernel (where I mean _NOT_ as a module):
  • Networking / Networking options / Packet socket (this is a must!)
  • File Systems / Second extended fs support
  • File Systems / Ext3 journalling file system support
  • File Systems / Network File Systems / NFS file system support (this is a must!)
I'm not sure about ext2 and ext3 (did not try without them), but the "Packet socket" and "NFS support" are absolutely required. The thin client won't boot if these are not compiled into the kernel (modules won't do it). This a little bit strange, because during boot the /scripts/nfs script tries to load eg. the af_packet (the internal module name of the "Packet socket" option) module before it calls ipconfig to bring up the eth0 network interface. However if you compile af_packet as a module, then ipconfig will result in an error (something about "Address family not supported by protocol"). And if you compile the NFS client support into a module, then the nfs mount will fail and you'll get a warning about the missing kernel-level support for NFS (this one was quite obvious, but I had some headaches with the ipconfig+af_packet problem Smile ).

Of course you should carefully think about all options that you change. You should really know what you're doing here. There might be options that seem superfluous, but are required by some other kernel options or by some software or hardware that you wanna use with you thin client.

Eg. I've disabled "High Memory Support" in "Processor type and features" since our Evos have only 64MB RAM and I wanted to remove all features from the kernel that the Evo does not support (to increase stability, reduce kernel size and increase performance). I've also disabled here the "Build a relocatable kernel" option since I do not have any use for it and the "EXPERIMENTAL" tag on this option means it might screw things up. In case of an old hardware (such as the Evo T20) new, experimental features might brake something so better leave them out if not explicitly needed for the task. Of course you can disable SMP support too since most probably you'll never have more CPUs (or cores) in the Evo. Laughing out loud

In the "Device Drivers" section you can sort out a lot of things, but think it through what you'll need and what not. Eg. if you wanna use USB pendrives with the Evo, then you'll both need USB Mass Storage support and MSDOS+VFAT file system support.

One thing to remember is the network driver. The Evo has a 10/100MBit, Natsemi DP83815 NIC (you can find this in the "Device Drivers / Network device support / Ethernet (10 or 100 Mbit) / EISA, VLB, PCI and onboard controllers / National Semiconductor DP8381x serier PCI Ethernet support" option. This should be compiled as a module (or you can put it into the kernel too, but this will raise an error message during the boot process, because it'll try to load the network driver explicitly as a module and it'll be not found since it's in the kernel).

Another gotcha with the Evos is an annoying (and repeated never endingly) debug message displayed on the console by the above mentioned natsemi network driver. I've found a small workaround for this by patching the "linux-2.6.21.3/drivers/net/natsemi.c". For details see my post on this. I should note here that I did not really know what I was doing while I created the patch. Smile I just looked at the source (and at the source of a couple of other network drivers) and found that the code in the given line seems to be flawed and changing it the way I did fixed the appearance of the debug messages. I've used the Evos with this patch now for months and no problems so far. So eventually I might have not screwed up anything important with my patch. Wink

Going over to the "File Systems" section: you should keep "Kernel automounter" support, "Filesystem in use space (FUSE)" support, NFS3 (as already mentioned compiled into the kernel) client support and all various file systems that you might wanna to use (eg. MSDOS and VFAT for USB sticks, etc.). I also used to keep ext2 and ext3, but that might not be necessary since the client itself uses tmpfs and NFS all the time. If you figure out how to access the local flash disk, then you might need ext2 or ext3 indeed ... and you should post here a comment, because I'm interested in that one too. Wink You might also need cramfs (Compressed ROM file system) support too. I'm not sure about this, but I think cramfs was used for initrd or initramfs sometime in the past. From looking at the kernel help it seems now that initramfs has nothing to do with cramfs anymore ... but it won't hurt to have it in the kernel either. Btw. you'll also need "Initial RAM filesystem and RAM disk (initramfs/initrd) support" for booting the Evos with an initramfs (which is the "official" way). Of course you can dig up all options you might ever use and compile all of them into the kernel ... this way you would not need an initramfs at all.

5.) Compile kernel and modules, install modules

After you're finished with kernel configuration, you just have to compile it.

  make
  make modules_install

The latter will install the modules into the /lib/modules directory of your LTSP server. This is used by the ltsp_kernel_kit and once you've your kernel in the LTSP-tree, you can remove the modules from here.

6.) Use ltsp_kernel_kit

Edit the config.in of ltsp_kernel_kit:
  cd ../ltsp_kernel_kit
  vi config.in

Specify the locations of the various directories. Most probably you'll only have to edit the location of the kernel source directory.

Now you'll have to get the initramfs from an official LTSP-5 kernel, replace the contents of the ltsp_kernel_kit/initramfs with the LTSP-5 initramfs, purge the modules directory (it'll be filled with your new modules by the build_initramfs script) and build the new initramfs.

This can be done somehow like this (assuming we start from the ltsp_kernel_kit directory):
  rm -r initramfs/*
  cp /opt/ltsp/i386/boot/initrd.img-2.6.20-15-386 ./initramfs/initrd.img-2.6.20-15-386.gz
  cd initramfs
  gunzip initrd.img-2.6.20-15-386.gz
  cpio --extract < initrd.img-2.6.20-15-386
  rm initrd.img-2.6.20-15-386
  rm -r lib/modules/2.6.20-15-386
  cd ..

And now build the new initramfs:
  ./build_initramfs

This will copy the new modules to the LTSP /opt/ltsp/i386/lib/modules directory, it'll create the new initramfs and copy the new kernel+initramfs to the tftp directory (/var/lib/tftpboot/ltsp/i386) and it'll also create a kernel for pxe booting.

Sometimes it happens that the kernel image in the tftp directory is not world-readable and thus clients get "Permission denied" on tftp get requests (eg. it happened with kernel v2.6.21.1). You should check the permissions of the kernel and initramfs files before you try to boot you Evo with LTSP.


P.S: the first thing I discovered with the new kernel was that it automatically loaded the pcspkr (PC speaker) module and the thin client started to "beep" while I was using a shell on the console. Actually this is rather annoying so I instantly removed it. Smile

P.S.2: please, leave a comment if you find bugs/typos in my howto or if you've suggestions on how to make it better.

AttachmentSize
config-2.6.21.3-evo-t2038.45 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I've attached the kernel

I've attached the kernel config that I use for the Evo T20.

Thanks for the config, i'd

Thanks for the config, i'd tried to compile my own but i kept getting errors when the evo tried to bring up the network.

Re: Thanks for the config

Does this mean you had problems using my config or your previous tries (with your own config) did not succeed?

Thanks for the config

Sorry for the delay...
I was having problems with my own config yours worked perfectly, only thing is i cant get USB drives to work.

Re: Thanks for the config

I had no problem making USB drives work on the Evo T20. The only problem I had was making USB drives work with LTSP. But that's a quite different story.