Can you run Linux on the Intel 4004, the first commercially produced microprocessor, released to the world in 1971? Well, Dmitry Grinberg, the genius engineer who got Linux to run on all kinds of incredibly underpowered hardware, sought to answer this very important question. In short, yes, you can run Linux on the 4004, but much as with other extremely limited and barebones chips, you have to get… Creative. Very creative.
Of course, Linux cannot and will not boot on a 4004 directly. There is no C compiler targeting the 4004, nor could one be created due to the limitations of the architecture. The amount of ROM and RAM that is addressable is also simply too low. So, same as before, I would have to resort to emulation. My initial goal was to fit into 4KB of code, as that is what an unmodified unassisted 4004 can address. 4KB of code is not much at all to emulate a complete system. After studying the options, it became clear that MIPS R3000 would be the winner here. Every other architecture I considered would be harder to emulate in some way. Some architectures had arbitrarily-shifted operands all the time (ARM), some have shitty addressing modes necessitating that they would be slow (RISCV), some would need more than 4KB to even decode instructions (x86), and some were just too complex to emulate in so little space (PPC). … so … MIPS again… OK!
↫ Dmitry Grinberg
This is just one very small aspect of this massive undertaking, and the article and videos accompanying his success are incredibly detailed and definitely not for the faint of heart. The amount of skill, knowledge, creativity, and persistence on display here is stunning, and many of us can only dream of being able to do stuff like this. I absolutely love it.
Of course, the Linux kernel had to be slimmed down considerably, as a lot of stuff currently in the kernel are of absolutely no use on such an old system. Boot time is measured in days, still, but it helped a lot. Grinberg also turned the whole setup into what is effectively an art piece you can hang on the wall, where you can have it run and, well, do things – not much, of course, but he did include a small program that draws mandelbrot set on the VFD and serial port, which is a neat trick.
He plans on offering the whole thing as a kit, but a lot of it depends on getting enough of the old chips to offer a complete, ready-to-assemble kit in the first place.
Why?
Because it’s there.
Good point,
Quite frankly, this is a stunning accomplishment of back porting. The 4004 was the beginning of the micro age and this is a fitting tribute.
This is fun. Some lovely little details like Linux’s timing loop clocking the emulated machine at a whopping 0 bogomips, and uptime thinking the machine had been up about a minute despite spending over a day running the command. This is the sort of insanity I love to see.
You have a usable Linux (or Linux like) for the Intel 16 bit architecture: https://github.com/ghaerr/elks with Doom.
Now if you could get it to run on a bipolar transistor, that would be something. Seriously though, it is quite an accomplishment.
Drunkula,
I was about to suggest these old computers incorporate something like dnsfs and pingfs. After all, a lot of data can be held in round trip packets to make up for the lack capacity in early computers.
https://mamchenkov.net/wordpress/2019/09/23/dnsfs-and-pingfs/
…but some back of the napkin math showed this wouldn’t work because the 4004 would not be able to keep up with it’s own ping/pong traffic much less being able to do additional work at the same time, haha.