Dmitry Grinberg Boots Linux on a Four-Bit Calculator Chip — in Less Than a Week!

This Intel 4004 Linux-capable computer might be slow, but it is art-worthy and can be hung on a wall

James Lewis
2 months agoRetro Tech

Booting Linux on limited hardware platforms has become a badge of honor among embedded engineers. In some cases, the result is practical. In others, it is an achievement of skill. Dmitry Grinberg's latest project fits the latter category. Linux/4004 is a four-bit computer that boots Linux on a microprocessor designed for desktop calculators in the 1970s.

"Doing things more realistically is always slower." — Dimitry Grinberg

The Intel 4004 is a four-bit microprocessor that requires several other chips to make a functional equivalent of a modern processor. Several aspects make directly running an operating system like Linux challenging. For example, the CPU does not support any logical operations (e.g., AND, OR, XOR), nor does the chip have any interrupts. Fortunately, however, a JMP condition checks the status of a specific pin. Also, memory operations are minimal.

Grinberg's approach to running Linux on such a limited machine is similar to a past project. Previously, Grinberg made a business card that emulated an MIPS processor running Linux. For Intel 4004, Grinberg also chose to emulate an MIPS R300 processor.

Implementing only the MIPS R3000 left 400 bytes of the available 4096 bytes of the 4004's code space. Despite this limitation, Grinberg also managed to squeeze in a 190-byte SD Card driver. (This driver might be the world's smallest SD card driver!) Eventually, Grinberg implemented a bank switching method to double the ROM size to a whopping 8192 bytes!

From there, Grinberg added support to Linux/4004 for (modern) SPI-based PSRAM (RAM for the MIPS emulation), a 40x2 VFD character display, and a UART-based serial port. Also, 32 LEDs display the MIPS's Program Counter (PC) — because every project needs blinking LEDs! It updates once every 32 instructions.

The other hardware includes voltage-level translators to interface the vintage chipset with the modern chips. These translators are necessary to ensure that the four-bit microprocessor can communicate with the modern components, such as the SD card and the PSRAM. The primary power supply is USB-C's 5 volts, which get converted to 3.3 volts and -10 volts (for the MCS-04 memory).

At first, Linux's boot time was just over nine days. Grinberg wanted to achieve a boot in less than a week. After optimizing the emulation code and then the Linux kernel, the final boot time got down to an astonishing 4.76 days! But booting is just the start. In one demonstration, Grinberg illustrates Linux/4004's slowness by showing a time-lapse of the nine-day process to display ASCII art on the VFD!

Time Lapse of ASCII Art Demo (📷: Dmitry.GR)

Even though the 1970s-era chips are becoming difficult to find, Grinberg offers a complete bill of materials to build a Linux/4004. If you are interested in a kit, contact Grinberg via the email address on the Linux/4004 project blog post. There, you will find extreme details about the 4004's operation, a history of building the machine, and many tips on how to make one.

James Lewis
Electronics enthusiast, Bald Engineer, and freelance content creator. AddOhms on YouTube. KN6FGY.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles