[Gentoo] Old kernels

Just for fun:

uname on a 2.2 kernel

We’ve got ebuilds for really old stuff in our tree: linux-headers-2.0.40.ebuild, vanilla-sources-2.0.40-r1.ebuild, linux-headers-2.2.26.ebuild, vanilla-sources-2.2.26-r1.ebuild. So I decided to see whether they actually worked. The good news is, 2.2 was really easy to get up and running. Here’s the steps I followed in an attempt to get 2.0 working, but they also work great for 2.2:

  • Install from stage3 normally.
  • Set LT_KERNEL_VERSION=”2.0.0″ in make.conf and rebuild glibc. This changes the minimum ABI that glibc will run programs on. If you only want 2.2 compatibility, feel free to change that value to “2.2.0”.
  • Next, rebuild all apps with ’emerge -e world’. You can check app ABI’s with ‘file’ or ‘eu-readelf -n’. If you use ‘file’, it will show ‘for GNU/Linux 2.0.0’. If you use eu-readelf, it will show ‘OS: Linux, ABI: 2.0.0’ once things are built properly.
  • ‘echo “=sys-kernel/linux-headers-2.2* -*” >> /etc/portage/package.keywords’,
    then ’emerge =linux-headers-2.2* =vanilla-sources-2.2*’.
  • Install gcc 2.95; gcc 3.4 cannot compile a 2.2 kernel. This will require that you change your profile to a gcc2 profile. ‘cd /etc; rm make.profile; ln -s ../usr/portage/profiles/default-linux/x86/gcc2 make.profile’ The emerge of 2.95 will switch to it automatically, but remember to run ‘source /etc/profile’ before compiling the kernel.
  • Install sys-devel/bin86. It’s needed to build a 2.2 kernel.
  • Configure and compile the 2.2 kernel. It’s just like a 2.4 kernel: ‘make menuconfig; make dep; make bzImage modules modules_install’, then install the bzImage to /boot/ and set up grub.conf as usual.
  • Switch back to a gcc-3 compiler using gcc-config. Only use 2.95 for the kernel, because a lot of newer apps fail to compile with it.
  • Emerge sys-fs/static-dev since devfs wasn’t really working well, unless you want to apply the devfs patch. ‘echo “sys-fs/static-dev ~x86” >> /etc/portage/package.keywords’. You should be able to leave sys-fs/udev installed, because our startup scripts autodetect what you’re capable of.

Unfortunately glibc 2.3.4 won’t compile against linux-headers-2.0.40, so it will require some more work to drop back to a 2.0 kernel. Maybe glibc 2.2.5 will work.