A 2.4 kernel for SuSE Linux 5.3: DMA, SATA and 2 GB of RAM on a 1998 distribution

A 2.4 kernel for SuSE Linux 5.3: DMA, SATA and 2 GB of RAM on a 1998 distribution

🌐 Leer en español

During the installation formatting took 16 minutes and copying two hours: SuSE Linux 5.3’s kernel 2.0.35 drives the disk in PIO mode, one sector at a time. And on any PC from the last fifteen years it would not even see the disk, because it is SATA. What if we gave it a newer kernel, without touching the rest of the system?

SuSE Linux 5.3 with KDE 1.0 on a SATA disk and 2 GB of RAM, running Linux 2.4.37.11-retro
SuSE Linux 5.3 with KDE 1.0 on a SATA disk and 2 GB of RAM, running Linux 2.4.37.11-retro

We picked Linux 2.4.37.11, the last of the 2.4 series (2011): it still runs the 1998 programs as they are (libc5 included) and it already has what 2.0 lacks: DMA on almost every IDE chipset, libata for SATA and AHCI, USB keyboards and mice, and high memory to use GBs of RAM. Everything is on GitHub: suse-retro-kernel.

The 1998 compiler is not enough

First stumble: SuSE 5.3’s gcc is version 2.7.2.1, and Linux 2.4 itself asks for at least gcc 2.95.3 (“gcc 2.7.2.3 is no longer a supported kernel compiler”). Today’s gcc does not work either: it is far too new for twenty-year-old code.

The answer was a compiler from the in-between years: Debian sarge (2005), with gcc 3.3.5, in an unprivileged chroot inside a Debian 13 virtual machine. One detail cost a round trip: it had to be entered with setarch i686, or the configure scripts see the machine’s 64-bit kernel and build for x86_64.

SuSE 5.3's gcc 2.7.2.1, the minimum Linux 2.4 asks for, and Debian sarge's gcc 3.3.5
SuSE 5.3's gcc 2.7.2.1, the minimum Linux 2.4 asks for, and Debian sarge's gcc 3.3.5

The configuration

Built for 486 (it boots on anything from a 1994 PC to a 2015 one), with the essentials built in so it boots anywhere:

Built in What for
IDE with automatic DMA (PIIX, VIA, AMD, SiS, ALi, Promise, HPT…) goodbye PIO
libata: AHCI, PIIX/ICH, VIA, SiS, NVIDIA, Promise, SiI SATA disks and burners
ide-scsi and sg burning CDs with cdrecord
ext2, ext3, iso9660, UDF, VFAT filesystems
NE2000, RTL8139, e100, e1000, PCnet, tulip, 3c59x network
USB keyboard, mouse and storage PCs without a PS/2 port
a.out, SysV IPC, HIGHMEM 4 GB old binaries, ADABAS D and GBs of RAM

Everything else as modules: OSS sound, AppleTalk, IPX, more network and SCSI cards, I2C and TV cards… 541 modules, all compiled, without a single unresolved symbol. With 12 cores the whole kernel takes 45 seconds.

One patch of our own: the 2.4 AHCI driver only knows a list of chips up to Intel’s ICH9. We added what 2.6 does: recognise any AHCI controller by its PCI class (01.06.01).

The build: 541 modules, none failed, zero unresolved symbols
The build: 541 modules, none failed, zero unresolved symbols

Two kernels on one system

Second stumble: SuSE 5.3’s modutils (version 2.1.85, from the 2.0 days) cannot load 2.4 modules. That needs modutils 2.4.27… which had to be built on SuSE 5.3 itself, and there a 1998 bug showed up: bash 1.14 segfaults on unset MAIL, which modern configure scripts do. Running it with a clean environment (env -) solved it.

To let both kernels live together we wrote a dispatcher: /sbin/insmod, modprobe, lsmod and friends point to a three-line script that checks uname -r and calls either the 2.0 or the 2.4 modutils. With SuSE’s kernel nothing changes (not even kerneld); with 2.4 the kernel loads modules by itself when needed.

k_retro24 installed while kernel 2.0.35 runs: the dispatcher and the original modutils
k_retro24 installed while kernel 2.0.35 runs: the dispatcher and the original modutils

The RPM and the YaST CD

It all goes into one RPM, k_retro24 (SuSE called its kernel packages k_), which works with the 1998 rpm 2.4.12:

  1. Installs the kernel in /boot and the modules in /lib/modules/2.4.37.11-retro.
  2. Installs modutils 2.4.27 and the dispatcher; SuSE’s modutils move to /lib/modutils-2.0.
  3. Adds a linux24 entry to LILO without changing the default: the system still boots 2.0.35, and typing linux24 at the prompt is enough.
  4. rpm -e k_retro24 undoes everything.
Linux 2.4 on SuSE 5.3: kmod loads appletalk and ipx by itself and the disk runs with DMA
Linux 2.4 on SuSE 5.3: kmod loads appletalk and ipx by itself and the disk runs with DMA
KDE 1.0 with our VESA driver on Linux 2.4: the vm86 BIOS calls still work
KDE 1.0 with our VESA driver on Linux 2.4: the vm86 BIOS calls still work

And, as with the VESA driver, an add-on CD that YaST 0.97 accepts as an installation medium: it only carries k_retro24, in its own series kret.

YaST finds the kret series on the add-on CD
YaST finds the kret series on the add-on CD
k_retro24 marked, with its description
k_retro24 marked, with its description
«Totally installed: 1»: YaST adds the linux24 entry to LILO
«Totally installed: 1»: YaST adds the linux24 entry to LILO

The real test: SATA and 2 GB of RAM

For PCs where the normal installation fails we have a restorer: a CD that copies an already installed SuSE 5.3 onto a disk without going through YaST. Its version 2 has a second option, restaura24, which boots the new kernel. We tried it on a virtual machine with 2 GB of RAM and the disk on a SATA AHCI controller, like a modern PC.

The v2 restorer menu: restaura (2.0.35) and restaura24 (Linux 2.4)
The v2 restorer menu: restaura (2.0.35) and restaura24 (Linux 2.4)
The restorer on Linux 2.4: it finds the CD and the SATA disk, /dev/sda
The restorer on Linux 2.4: it finds the CD and the SATA disk, /dev/sda
Restoring the partitions: with DMA, about three and a half minutes
Restoring the partitions: with DMA, about three and a half minutes
Done: on a SATA disk, LILO only gets linux24
Done: on a SATA disk, LILO only gets linux24

With the version 1 restorer (kernel 2.0, PIO) copying the system took over half an hour; with DMA, three and a half minutes. And since Linux 2.0 cannot see SATA disks, in that case the restorer leaves only the 2.4 entry in LILO.

Booting from the SATA disk: IDE already running with DMA
Booting from the SATA disk: IDE already running with DMA
Welcome to S.u.S.E. Linux 5.3 — Kernel 2.4.37.11-retro
Welcome to S.u.S.E. Linux 5.3 — Kernel 2.4.37.11-retro
2 GB of RAM, the /dev/sda disk and the AHCI controller at 1.5 Gbps
2 GB of RAM, the /dev/sda disk and the AHCI controller at 1.5 Gbps
KDE 1.0 on the SATA disk
KDE 1.0 on the SATA disk

Errors and tricks

  1. gcc 2.7.2.1 cannot build Linux 2.4: a Debian sarge chroot with gcc 3.3.5, entered with setarch i686.
  2. modutils 2.1.85 cannot load 2.4 modules: modutils 2.4.27 side by side, with a dispatcher on uname -r.
  3. bash 1.14 crashes on unset MAIL: run configure with env -.
  4. The 2.4 AHCI driver only knows chips up to ICH9: a patch to match it by PCI class.
  5. /etc/conf.modules is deprecated for modutils 2.4: the RPM renames it to /etc/modules.conf and leaves a link with the old name for SuSE’s modutils.
  6. A rare panic with 2 GB: in about 19 boots of the CD, three times the kernel stopped early with “Bad pmd in pte_alloc … Failed to allocate buffer hash table”. A reboot boots normally and we could not reproduce it on demand (16 boots in a row without a failure), so the cause is still open. LILO carries nopentium as a precaution, but it is not proven to be the cure.
  7. AppleTalk is off: SuSE’s modules.conf has alias net-pf-5 off; change it for netatalk.
  8. The restorer on SATA: it needs the restaura24 option; the normal one (2.0.35) cannot see the disk.

Downloads

At github.com/madgusmx/suse-retro-kernel: the k_retro24-2.4.37.11-2 RPM, the YaST add-on CD, the patch, the configuration and the build scripts, and the Linux and modutils sources as signed by kernel.org. It is organised by release: SuSE 6.x and 7.x come next.

What came before

Did you have this CD or the magazine? Tell us in the Telegram group: Telegram group

This post is also on our social media:

YouTube

Enjoyed it? Follow us on social media

We post new things every week: don't miss them.

YouTubeFacebookXInstagramTelegram