Restoring i486 support to Linux 7.1

Last updated:

Alas, it's finally happened…

After a few unsuccessful attempts, Linus finally merged for Linux Kernel 7.1 a patch from Ingo Molnar to remove support for 486-class x86 processors.

The main reasons behind this are that the 486 doesn't support a few very useful instructions, most particularly cmpxchg8b, which is used to implement 64-bit atomics, and is at the heart of many of the synchronisation primitives used in the kernel. Linux had support for emulating these (on uniprocessor systems), but this greatly complicated some of the code.

In addition, the 486SX variants didn't have a built-in x87 maths coprocessor, and so needed emulation to support floating point. x87 emulation is quite a pain to deal with — particularly due to its somewhat odd design, with a separate register stack, and 80-bit intermediate values — so it's quite understandable that maintaining this isn't much fun.

But for those of us who still want to run modern Linux on our 486, it's all very sad. So, what is needed to reinstate support?

Patches to revert

At the moment, the only patch you need to revert is the original x86/cpu: Remove M486/M486SX/ELAN support patch. At the moment (), it still reverts cleanly, so just run:

git revert 8b793a92d862c89055daa97ffa61a6929cf732f9

…and build your kernel with CONFIG_M486=y.

Unfortunately, as more of the 486 support code gets ripped out, this is likely to get more difficult.

Other useful fixes

There are a few other patches which may be useful for those running on a 486, or similarly old x86 hardware:

x86: checksum: Fix unaligned checksums on < i686
Fix an issue with checksums of non 16-bit aligned memory blocks on pre-Pentium Pro hardware. This doesn't really affect anything other than a failing KUnit test.
x86/boot/e820: Re-enable fallback if e820 table is empty
This patch fixes a regression in 7.0 which caused some bootloaders, such as the LINLD chainloader to boot from DOS, to fail to boot the kernel.

There are almost certainly other useful patches lying around for old hardware. Let me know if you've got any favourites!

The i486 tree

I've put together a git brach with all of the above patches applied here. You can clone it with:

git clone -b i486 https://github.com/sulix/linux.git

I'll try to keep it up-to-date — at least until it gets too tricky — but it's very much as-is and mood-dependent. My 486 has a maths coprocessor, too, so don't expect any testing or fixes of the 486SX version. But there may be some other things to try: I've successfully got the Rust-for-Linux work booting on the 486, so it's likely that some fun things will still come of it.