Blog

A Tale of Running Modern Linux on Hardware from 1997

I have been interested in retro hardware for a long time. I don’t remember where the idea first came to me but I’ve always been interested in finding out how modern Linux behaves on bare metal old hardware, because quemu lies and is very inaccurate replicating the intricacies of x86 retro hardware. Modern Linux being anything 5.x or better.

So for a few years I have been hunting for a 486 level hardware, 486DX that is not 486SX. Although MATH FPU can be emulated by the kernel using CONFIG_MATH_EMULATION but there is still some issues with the SX variant.

Where I live people use a lot of OLD industrial equipment so finding anything that has an ISA slot is next to impossible as they are always in very high demand.

Frix

My initial experience with modern linux on 486 started with the FRIX Project, there were a couple of issues with it. The first one being that it was based on ao486 which is a 486 based core running on an FPGA and that poses a few problems. The HDL implementation is not perfect, it lacks a lot of IO options and has no expansion options. Moreover it requires patching the kernel a fair bit to boot any modern Linux distro. Its much slower than any real 486 in practice. But at that time it was better than nothing, however I could not go any further in terms of actually running meaningful Linux distros.

It’s All About The Pentiums

Late December 2021, I had to visit the local computer market to get some keyboard RMA’d but that trip ended up being more fruitful than anticipated. I came back with an actual Pentium system.

Here are the final specs after some upgrades:

  • CPU: Pentium 100MHZ
  • Memory: 256MB of PC133 SDRAM
  • Motherboard: Zida 5SVA
  • IDE:
    • DVD RW
    • SD-IDE Adapter
  • Gotek Floppy Emulator

If you are interested in seeing a full build log I did end up posting it on YouTube.

Socket 7 Inverse Sleeper Retro PC Build Featuring a Pentium 100MHz

The Modern Linux Experience

My aim was not only to test if any 5.x kernel would work but to find a distro that would work out of the box. In doing so i wanted to understand what parts on a modern linux distro cause issues and what works.

A lot of what i am going to talk about is specific to my hardware and people my have different experience than my own, I know for a fact that the chipset and BIOS on my system are not the best.

Before we being going down the list I wanted to clarify a few terms which are going to be important. Mostly in the Linux world, but also otherwise, whenever we talk about 32bit binaries compiled against x86 target we have four main categories:

  • i386: Intel i386/80386 was introduced by Intel in 1985. It was a a 32-bit microprocessor. As the original implementation of 32-bit extensions of 8086 architecture, the 8086 Instruction set, Programming model, Binary encodings are still the common denominator for all 32-bit x86 processors. The set of processors compatible with 80386 is collectively termed as x86 or i386 architecture. Packages that are compiled for i386 architecture, are compatible with i386, i486, i586 & i686 architectures.
  • i486: Intel i486 was released in 1989. It was a was a higher performance follow up on the Intel 80386 processor. i486 was originally released with an on chip FPU, but there was a i486SX variant that had the FPU disabled. Over the 386, the 486 offered the following new instructions: XADD, BSWAP, CMPXCHG, INVD, WBINVD, INVLPG. Packages that are compiled for i486 architecture, are compatible with i486, i586 & i686 architectures.
  • i586: Intel i586 was released in 1993. It was brand named Pentium. Also called P5, meant to be the 5th generation of x86 micro-architecture. In addition to the standard 486 instructions, it offered the following new instructions: CPUID, CMPXCHG8B, RDTSC, RDMSR, WRMSR, RSM. Packages that are compiled for i586 architecture, are compatible with i586 & i686 architectures. This is what my hardware is based around and this is the level I will be targeting.
  • i686: Intel i686 was released in 1995. It was brand named Pentium Pro. Also called P6, meant to be the 6th generation of x86 micro-architecture. In addition to the standard i586, it offers the following new instructions: FCMOV, FCOMI/FCOMIP/FUCOMI/FUCOMIP, RDPMC, UD2.
  • Bonus Instructions: i586 can have MMX and i686 can have a mix of MMX, SSE, SSE2, SSE3, FXSAVE, FXRSTOR & PAE and possibly more.

Let’s Distro Hop
  • Mageia Linux 8 (i586): I started with this because it had worked previously for my Via C3 based system as IIRC its a mix of i586 and i686 instructions but that’s a story for another time.
    However it had other issues on the Pentium. Mageia does not have a “light” installer, even on the Via C3 I had to upgrade to 1Gig of RAM to get it working. So with the limited 256MB of memory on the Pentium it did not work at all.
    However since the actual memory footprint on an installed system is quiet reasonable I decided to take a shot, install it on a VM and move the disk over to the Pentium.
    But unluckily there was some issue with the IDE driver, this is a pattern that will repeat. So after the Kernel loaded and dracut started it wasn’t able to find the partition UUID and brought down the system with a Kernel panic.
    So much for Mageia, moving on.

  • Alpine Linux 13.x (i586): The Alpine Linux story starts with a positive note. Alpine has a low enough memory footprint that it was able to boot live using the Boot Disk. Not only boot but install fully using the live environment.
    However… that lasted for a very short time. A reboot and boot from the hard drive resulted in a single line on a black screen “Press Any Key To Reboot”. At this point I have to guess that the bootloader isn’t very happy with the onboard IDE controller.
    Alright then. I plugged the drive into another system and fired up qemu, removed SYSLINUX and installed GRUB. But alas it was the same story. GRUB2 detects the partition layout but fails to load the filesystem on the Pentium, but works fine under qemu.
    In case you are interested in watching the install progress, I uploaded it to Youtube. So much for Alpine, moving on.
Installing Alpine Linux 3.15 on Pentium 100Mhz | Real Time Full
  • AOSC OS/Retro (i486): I wasn’t aware of this distro at all. I don’t know how i came to learn about it but its a very recent discovery. On paper it sounds good, after all its compiled against the i486 target and is designed to run on a 486 based system so surely it should run on a Pentium… Right? … Right? Well… Okay, lets not get ahead of ourselves.
    The good news is that the distro boots just fine and is more than usable in the live environment. The installation proceeds without any hiccups and what do you know! After the installation it boots fine from the hard drive. HA! and that’s SystemD booting on a Pentium i586 hardware!
    Well I can login and type uname -a…and it hard locks.
    Reset and try again, and this behavior is very reproducible. You have just enough time after boot to login and type in one command before the system hard locks and there is no segfault, crash log or kernel panic output at all.
    Surprisingly enough, this was booting using SYSLINUX by default, same as Alpine but i guess they used an old enough release or compiled it with the correct driver options.
    Well, atleast we got somewhere. So long AOSC OS/Retro, you tried your best.

  • ArchLinux32 (i486): Arch Linux killed off 32bit support a while ago but a group of folks have been maintaining it under the ArchLinux32 name. The project has two release targets i686 and i486. Since my hardware was an i586 I used the i486 release target which was from 2021 but still good enough. It worked fine under qemu so i gave it a go and copied it over the image to an sdcard. But Grub still wasn’t happy with the IDE controller and the results were similar to booting Alpin with Grub. Installing SYSLINUX was actually much better as it allowed me to load the kernel and initrd and boot from it…But this time the kernel couldn’t populate /dev/sda1 (or any other drive letter) and failed to mount rootfs and crashes.
    Back to square one, on to the next.

  • TinyCore Linux (i486): I’ve known about this distro for a while but never really cared for it. It has a dedicated community and is very actively maintained. Buts its not a traditional distro, however having tried out all the others and failing so far, this was a good choice as any.
    I was interested in it because it not only lists its minimum CPU requirement of a i486DX, but it is also the only distro that boots without modification on the Frix project. So it seems the kernel configs and compiler arguments they used were bare minimum to generate a x86 bootable image.
    It booted fine on the Pentium from its live medium, the GUI comes up as well, albeit a tad bit stuttery but given that I’m expecting modern X11 to run at just 100MHz it’s acceptable. The UI was otherwise usable. It installs fine on the main hard drive using the available GUI installer.
    And…IT FREAKING WORKS. SYSLINUX loaded fine, followed by the kernel, ramdisk and all the services and the GUI came up as well. Its extremely stable to use, I installed a few apps and they were all working fine. So looks like there is still some hope to get Modern Linux booting on a hardware from 1997.
    And here’s a video of all of it in action:

Tiny Core Linux install on Pentium 100Mhz | Real Time Full

Honorable Mentions:
  • Gentoo (i486): Gentoo maintains a vast number of supported architectures and they are able to do this because of the fact that installing gentoo basically means recompiling everything from scratch and in doing so you can select your own compiler flags. This ensures that the binaries are compatible with your setup. However in the spirit of not having to compile an entire distro’s worth of code on a 100Mhz CPU with only 256MB of memory or the alternative of having to stick the boot SD Card on a vm just to add or update packages, I didn’t give it go.
    But luckily someone had already done the work and setup detailed instruction to try it out: https://github.com/yeokm1/gentoo-on-486.
  • Distro Builders (Buildroot/Yocto etc): Theoretically it is a trivial job to write device support config/meta-package for them and get modern linux booting on old hardware. But I always considered this as a last resort because I really wanted an easily mutable Linux Distro rather than going the embedded linux route.
Missed Opportunities

I just wanted to list a few distros that would’ve been a great fit for this retro hardware but unfortunately they either do not have a 32bit build or are built for a minimum of i686 support.

  • Debian: Targets a minimum of i686.
  • Manjaro: No 32bit support.
  • Xbuntu/Lubuntu: Targets i686

Closing Out

32bit general purpose linux is on its way out, irrespective of the architecture. Even my daily driver distro, Fedora, announced that starting with f37 they are killing 32bit support even on Arm and they’ve not had a 32bit x86 release for a long while.

Luckily for the older systems out there, there are communities looking out for them. I know running Modern Linux on an early i586 class hardware makes little sense and on mine if i really do want to run something modern and light, NetBSD works in a pinch.

Although AOSC OS/Retro didn’t quiet work, I am going to follow up on their channels and try and resolve the issues. TinyLinux is fine but its rather limiting and i still prefer the regular rootfs-on-block-storage vibe of most linux distros rather than running straight out of memory.
Alpine linux on the other hand has very little need to improve support on such old hardware and I do not want to needlessly start reporting bugs. I was always designed as a light, non-GNU distro suitable for the cloud and container world.
ArchLinux32 is another great candidate but they seem to be focusing all of their energy on i686 releases and their last i486 release was from mid 2021. But I still consider it a better alternative.
It was a nice experience figuring all of this out and hopefully this helps someone or atleast passes of as an interesting read.
As usual, you can find me hanging out in the twitterverse @sahajsarup.

Project Athena

This project started as an upgrade to my now 3 year old portable workstation. It was a Dell Precision 7720 powered by a Skylake based Intel Xeon E3-1535M v6 aided by a 32GB ECC memory kit. And it was no slouch either, for the time, it was the fastest computer you could buy at the time that would fit in a bagpack, ran off of a battery pack (for 15min on full throttle), and doesn’t cause much ruckus at the airport immigration.

But, that was three years ago and it was time to upgrade. During these three years a LOT changed, mainly Intel drowned in its internal politics and fab mismanagement and meanwhile AMD managed to steal the price-performance-cost crown from right under Intel’s nose, and gave us the blessed Zen Architecture. And this is where Athena’s story starts.

Athena was originally supposed to be, like its predecessor, a portable workstation but with Ryzen at its heart. I was looking at some upcoming workstations powered by the Ryzen 9 4000H mobile processors. Now, living in India I was aware of the massive import taxes that need to be paid and that means any portable workstation dream never get realized. Most OEMs don’t even sell high end portable workstation here for the same reason. So I would usually buy my hardware during Linaro Connect, which meant meeting with folks from the USA, EU and other places every 6 months and this made acquiring expensive hardware a breeze. And this was my plan with Athena as well, but then…

Bum Bum Bummmmmm… Covid-19 strikes, anywhere with a human population suddenly becomes a no fly zone. Now what?

Waiting till March 2021 seems, well, stupid. Doesn’t look like things are going to improve anytime soon. And along with my plans of having a Deep Dish Pizza in Chicago the plans of Athena being a portable workstation went down the drain 🙁

It’s finally September, I’ve just spent weeks iterating on a Yocto build, the build times have been slow and frustrating and it doesn’t look like the world is going to open-up anytime soon. It’s time to get a new workstation. So it’s decided, since I am not spending on the luxury of portability Athena is going to be a humongous, power guzzling, rampant monster with enough memory to put most ultrabook’s storage to shame. And so this is what the final specs ended up being:

  • AMD Ryzen 9 3950x
  • ASUS TUF x570 Motherboard
  • DeepCool Assassin 3 dual 120mm fan heatsink (This is huge in size, make sure to choose your RAM and case accordingly)
  • 128 GB (32×4) RAM
  • SSD (From the old workstation)
    • 500GB NVME WD BLack SN750
    • 1TB WD Blue M.2 Sata
  • Radeon RX580 8G GPU (Previously Owned)
  • Corsair 850RM PSU
  • Corsair 570x Case

Now a few “compromises” were made due to availability:

  • The Asus TUF series wasn’t my first choice, I wanted to go with the WS (Workstation) series.
  • The 570x might be the sexiest case one has ever seen, but its made almost entirely of 4-5mm thick tempered glass which makes it super heavy and a PITA to do small upgrades or changes. I was going for a more traditional 750D case from corsair.
  • I was hoping for ECC memory since AMD supports it in consumer and HEDT processors, but getting a decent 128G kit proved to be so challenging that I never pushed for ECC.

So what does it mean in terms of performance?
Without any extra overclocking here are some meaningful numbers, all tests were done with ccahe clean and with repos synced on the 29th of September:

  • Linux Kernel: aarch64_defconfig cross compile
    • 3 minutes
  • Kodi including ffmpeg
    • 6 minutes
  • Balena-OS*
    • 1 hour
  • AOSP db845-userdebug**
    • 1 hour

With this I leave you all with a voice over commentary of the build log!

Footnotes:
* Balena OS is mostly yocto based but one particular package compilation, rustlang-native, is mostly single threaded and intermediately uses 8 or so cores.

** AOSP build was able to streatch its leg when the java bits were running consuming a maximum for 62 GB of memory.