Linux/4004: booting Linux on Intel 4004 for fun, art, and no profit

238 pointsposted 6 hours ago
by dmitrygr

34 Comments

jesprenj

4 hours ago

> But for the one I'll have hanging in my office, I have loftier goals. With swap enabled, the kernel sources can actually be built right on-device. It will take some number of years. The partition where the kernel lives is /dev/pvd2 and is mounted under /boot. The device can build its own kernel from source, copy it to /boot/vmlinux, and reboot into it. If power is interrupted, thanks to ext4, it will reboot, recover the filesystem damage from the journal, and restart the compilation process. That is my plan, at least.

whartung

2 hours ago

I have two visions of this.

One, it reminds me of that "worlds longest song" or somesuch thing, where they play a note every 10 years.

The other is just a picture of someone, asleep at their desk, a pile of calendars with days checked off tossed to the side, random unwashed mugs and such all dimly lit by a desk lamp and see the `$ make linux` finally return to an new, unassuming `$` prompt. Like Neo in the Matrix.

dmitrygr

an hour ago

I like the second version!

Pet_Ant

3 hours ago

I wonder of you can calculate when it will finish by counting the instructions and then pin the date it will finish and stream the completion.

dmitrygr

an hour ago

Yes. I have an emulator of this board (it is in the downloads too) which is much faster than the real thing. It shows how much realtime is needed to get to the current state. Doing a build in it will answer the question unequivocally.

teaearlgraycold

29 minutes ago

I’d assume you’d have at least a few bit flips occur in the process.

alnwlsn

4 hours ago

Wow this was not a cheap project! Thanks Ebay collectors.

Also probably the only time I'd have gone for an LCD over a VFD. If you're running a multi-year long compile, it'll probably be burned in to hell by the end.

molticrystal

2 hours ago

I love giving the AVR example when people ask if something can run on an underpowered machine, now I have a new example to link.

Considering the frequencies and wattage I wonder how RF it spits out and what is detectable and decodable on the waterfall of a SDR.

By the way still reading through it, but at the time of this comment I see the word "soubroutine" which is probably a misspelling.

dmitrygr

an hour ago

Fixed the typo. Thanks

eqvinox

5 hours ago

oof. amazing.

…you can see in the high PC bits what's currently executing!

P.S.: Still loads the kernel faster than a virtual ISO on a server's shitty IPMI over the internet ;D

dmitrygr

an hour ago

While it boots, you can look at LEDs and map them to kernel function easily by running “nm” on vmlinux.

Also, when in user space, you can tell between the main binary (way below 0x01000000) and shared libraries (loaded high near 0x77000000)

eulgro

5 hours ago

The video took 9 days to film. 4 hours per emulated second.

Also I wonder why he's using Windows 95?

danirod

4 hours ago

Sorry for the nitpick, but the laptop in the video looks like Windows 2000

dmitrygr

an hour ago

Windows 2000

For the video, i wanted a laptop with a real serial port (no usb). This one fit the bill and was $20 on eBay. Windows 2000 is the prettiest windows IMHO, so that’s what I installed for the demo video.

garganzol

28 minutes ago

The proof of the Turing Completeness Theorem in action. Beautiful. Boot time is ~5 days.

Pet_Ant

2 hours ago

In the "Why MIPS?" section:

> some have shitty addressing modes necessitating that they would be slow (RISCV)

What is wrong with the RISC-V addressing modes?

Rohansi

2 hours ago

Probably nothing unless you want to emulate it on severely underpowered hardware.

blueflow

5 hours ago

At first i was like "I'm pretty sure this is bullshit or some cheat used" but then i was like "Oh, its dimitry."

Impressive work, as always.

adrian_b

4 hours ago

Very impressive work, but most of the work has been necessary because Intel 4004 was not really the first microprocessor, this was just BS propaganda used by Intel to push back by one year the date of the launch of the first microprocessor, to 1971.

The first true (civilian) microprocessor was Intel 8008, in 1972.

Intel 8008 was a monolithic implementation, i.e. in a single PMOS integrated circuit, of the processor of Datapoint 2200, therefore it deserves the name "microprocessor".

The processor of Datapoint 2200 had an ugly architecture, but there is no doubt that it was a general-purpose CPU and traces of its ISA remain present in the latest Intel and AMD CPUs.

On the other hand, the set of chips that included Intel 4004 was not intended for the implementation of a general-purpose computer, but it was intended just for the implementation of a classic desktop calculator, not even a programmable desktop calculator.

This is the reason for the many quirks of Intel 4004, e.g. the lack of instructions for the logic operations, and many others that have increased the amount of work required for implementing a MIPS emulator suitable for running Linux.

Even if Intel 4004 was intended for a restricted application, after Intel has offered to sell it to anyone, there have been many who have succeeded to use it in various creative ways for implementing microcontrollers for the automation of diverse industrial processes, saving some money or some space over a TTL implementation.

In the early days of the electronics industry it was very normal to find ways to use integrated circuits for purposes very different from those for which the circuits had been designed. Such applications do not make Intel 4004 a true microcontroller or microprocessor. Very soon many other companies, and later also Intel, have begun to produce true microcontrollers, designed for this purpose, either 4-bit or 8-bit MCUs, then Intel 4004 has no longer been used for new designs.

klelatti

13 minutes ago

Your argument is that because the 4004 was built to power a calculator that disqualifies it as a microprocessor? Independent of the actual nature of the 4004 itself and its potential applications beyond its first intended use? Can’t see how that makes sense at all.

dboreham

22 minutes ago

Glad to see someone besides me posting this whenever 4004 history-rewriting comes up.

MarkusWandel

3 hours ago

No kidding about unusual uses of ICs. Not related to microprocessors, but I have an old analog triple conversion HF receiver (Eddystone EC958/3 for what it's worth) that uses a TTL IC in an analog circuit! I'd have to look at the schematic again, I think it's a multi-stage counter, but basically what it uses it for is to generate a comb shaped spectrum, one "spike" of which can then be picked up by an analog circuit and locked to, to generate precisely spaced tuning steps for the high stability tuning.

dmitrygr

12 minutes ago

The naming and propaganda wouldn’t matter. I just wanted something lower-end for sure than a 6510 and an AVR. 4004 is that

cdchn

3 minutes ago

Is this the oldest piece of hardware that's ever run Linux, I'm left wondering?

artyom

an hour ago

I didn't know the guy but he clearly knows what he's doing, it's unbelievably entertaining to read the details of achieving an impossible task with the most underpowered tool possible.

ssrc

5 hours ago

I mean, it's fun and interesting bullshit that cheats a lot. I'm sure that you could emulate a MIPS using a one-bit processor like the MC14500[0] with enough supporting hardware, real or virtual. Looking forward to it, Dimitry.

[0] https://en.wikipedia.org/wiki/Motorola_MC14500B

alnwlsn

4 hours ago

We need this for the Usagi Electric vacuum tube computer.

dmitrygr

an hour ago

I’ll work on setting a new lower record every ten years or so. My guess at the next three steps: one bit controller, transistors only, vacuum tubes.

hilbert42

3 hours ago

Mission impossible — do it with Windows!

dmitrygr

an hour ago

Windows ran on a similar MIPS machine (Microsoft jazz). The issue is emulating scsi. I think I’d need a lot more rom space to do that. Scam is messy and hard.

The alternative is to find the Windows MIPS DDK and build a paravirtualized disk driver for it like I did for Linux. That would make it more doable.