You can run LUnix on an NES — demo shows a Unix-like OS running completely on the NES

The Nintendo Entertainment System gaming console.
(Image credit: Evan-Amos)

We've seen tons of solutions for running NES games on non-NES hardware, but not so much in the way of running non-NES software on the NES itself. But now, you can run Unix on the NES, as seen in a demo done by programmer and tech enthusiast DeCrAzYo. His solution relied on original Nintendo hardware alone and even included software he had to code himself.

The inspiration for this project seems to be hacks that claim to run non-NES code on the NES but do so through devices like the Raspberry Pi, which, to DeCrAzYo, is basically just using the NES as a graphics output. His goal was to run Linux on the NES's processor and within its memory using completely original hardware, which is certainly a much higher bar to clear.

The key problem is that the hardware used for the NES is massively underpowered for running Linux; there's a mere 2KB of RAM to work with, after all. Because of this limitation, DeCrAzYo decided to use a Unix-like operating system rather than an actual Linux distribution. That puts a bit of an asterisk on the whole running-Linux-on-the-NES thing since Unix-like OSes include MacOS and even arguably Windows, but it might just be close enough, and it's not like the programmer had much of a choice.

Of course, no OSes were made to run on the NES, which meant the programmer had to do some coding of his own. However, he started with LUnix or Little Unix, an OS last updated in 2004 and meant to run on the Commodore 64. The NES and the Commodore 64 are pretty different systems, though, with the latter having a whopping 64KB of RAM, a built-in keyboard, and readers for cassettes and disks.

It all works because the two consoles have very similar CPUs based on the 6502, which makes LUnix mostly compatible with the NES. Plus, to get all that keyboard and disk functionality, one just has to use a Famicon (the Japanese version of the NES) with its Disk System and keyboard accessories; the Disk System even comes with an extra 32KB of RAM. The only obstacle was modifying LUnix and writing drivers for the accessories to get it all to work, which was difficult but not impossible for the developer.

The modified version of LUnix could run on the Famicom "pretty full-featured" state, including the ability to run multiple shells and retrieve command history. As for the NES, there are no official keyboard or disk drive accessories, but DeCrAzYo demonstrated it could at least run the LUnix kernel by putting the OS onto an EverDrive-N8 cartridge (which does admittedly put another asterisk on this project).

That doesn't mean it's impossible to use LUnix on the NES. To get around this issue, the developer says, "We could create a cartridge that provides more RAM... wire up a keyboard... and even add a disk drive for good measure." DeCrAzYo opted to use the Famicom for simplicity. Still, any user could conceivably go one step further by grabbing the NES-LUnix OS from the developer's GitHub and hooking up all that hardware the hard way.

Matthew Connatser

Matthew Connatser is a freelancing writer for Tom's Hardware US. He writes articles about CPUs, GPUs, SSDs, and computers in general.

  • bit_user
    First, I've got to say: Linux doesn't belong anywhere near the headline! This is really nothing to do with Linux!
    (Edit: thanks for the update! : )
    It seems to me like a NES or perhaps Famicom should be pretty comparable to computers from the 1960's. So, if you stick to OS technology of that era (and that should include Multics and the original Bell Labs' UNIX), you might have a workable plan.

    What would be more useful is probably to port an OS kernel people might use on microcontrollers to it, though. I have no real sense of what's out there, but I'd imagine there should be something worthwhile.

    Anyway, I think it's just awfully hard to do anything that's general, practical, and useful with even 32 kB of memory. It'd probably always be too much of a toy. The N64 though? Now we're talkin!
    Reply
  • Darkoverlordofdata
    "... decided to use a Unix-like operating system rather than an actual Linux distribution."
    Um, Linux is a Unix-like OS.

    "... Unix-like OSes include MacOS and even arguably Windows"
    No, MacOS *is* Unix, not Unix-like...
    Windows? No not any where like Unix.

    I used to work at MS, I can tell you it was designed to be the Unix Killer.
    Reply
  • brandonjclark
    This is a cool project...

    SourMesen/Mesen2: Multi-system emulator (NES, SNES, GB, PCE, SMS/GG) for Windows, Linux and macOS (github.com)
    Reply
  • bit_user
    Darkoverlordofdata said:
    "... Unix-like OSes include MacOS and even arguably Windows"
    No, MacOS *is* Unix, not Unix-like...
    It has some UNIX roots, but saying it is UNIX is a serious overstatement.
    "Although the BSD portion of OS X is primarily derived from FreeBSD, some changes have been made:
    ...
    In addition, several new features have been added that are specific to the OS X
    ...
    Although the BSD layer of OS X is derived from 4.4BSD, keep in mind that it is not identical to 4.4BSD. Some functionality of 4.4 BSD has not been included in OS X. Some new functionality has been added.
    ...
    Updated: 2013-08-08
    Source: https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/BSD/BSD.html
    Furthermore, the kernel of OS X is famously derived from the Mach microkernel, which is not BSD-related.
    https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/Mach/Mach.html
    So, we can see a definite lineage exists from parts of OS X back to UNIX (via FreeBSD, which has its own complex relationship to the original AT&T UNIX), but you really can't say it is UNIX.
    Reply