Running Linux on Unmodified NES Hardware

DeCrAzYo pulled off a seemingly impossible task: getting Unix running on real, unmodified NES hardware.

Cameron Coward
3 months agoRetro Tech / Gaming

Linux has many advantages, but it is especially well-suited to running on older hardware. There are very lightweight kernels out there that don’t need much power to run — especially if you’re 1337 enough to work entirely in the shell and don’t need a GUI. Have a 30-year-old PC gathering dust? It will run Linux, no problem. But what if you have even less horsepower than that to work with? To dunk on every other operating system out there, DeCrAzYo proved that it is possible to run Linux on unmodified NES hardware.

That is actually a lie — but we’re only passing on DeCrAzYo’s lie. This isn’t really running Linux. Instead, it is running what DeCrAzYo describes as a “Unix-like operating system.” Unfortunately, even Linux needs more resources than an NES has to offer. But this is close enough that we hope you’ll forgive the misdirection.

Specifically, DeCrAzYo chose to run LUnix (Little Unix), which was developed for Commodore 64 computers and received its most recent update (Version 0.21) way back in 2004. LUnix is ideal because it is ridiculously lightweight and built to run on the Commodore 64’s 6502-compatible MOS 6510 processor. The NES’s Ricoh 2A03 processor is also mostly 6502-compatible, so DeCrAzYo concluded it would probably work.

But the NES only has 2KB of RAM (plus another 2KB of VRAM), while the Commodore 64 has a generous 64KB. The Commodore 64 also has the ability to read from disks.

Both of those issues were solvable by using a Japanese Famicom instead of a North American NES. The Famicom had upgrades available to add an additional 32KB of RAM and a rudimentary disk system. There is also a keyboard for the Famicom, which makes navigating a Unix shell much easier.

By utilizing the Famicom’s upgraded memory and disk system, DeCrAzYo was able to modify LUnix to load programs from disk as necessary. DeCrAzYo also had to change the way the Famicom’s disk system works, because it can normally only read data sequentially. With those changes, LUnix boots and the user is able to work within the shell.

In emulation, this worked well. But that was only because DeCrAzYo was able to crank up the run speed by 100 times. In real life and on actual hardware, it is very slow. DeCrAzYo was able to test that on an NES using an Everdrive flash cart. Without a Famicom keyboard available to type commands, however, he just got a blinking cursor in the shell. But he did prove that Linux Unix can run on an NES!

Cameron Coward
Writer for Hackster News. Proud husband and dog dad. Maker and serial hobbyist. Check out my YouTube channel: Serial Hobbyism
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles