Can Linux run on Nintendo’s ancient NES game console? Someone decided to try
Inspired by the age-old question, "Can it run Linux?", an intrepid YouTuber called DeCrAzYo successfully managed to get a "Unix-like" operating system up and running on that classic 1980s Nintendo games console, the NES. There was no cheating involved either. He didn't take any shortcuts by modifying the console's internal components or by sneaking a Raspberry Pi into the mix.
His goal was to have the operating system's code executed directly via the NES processor using no more hardware than a typical game cartridge would offer, and that's exactly what he managed.
Pivot!
Initially, DeCrAzYo hoped to get Linux running on the console, but the NES's limitations forced him to pivot towards Unix instead. He searched for a "Unix-like" system for his project, ultimately settling on Little Unix, a portable operating system initially developed for the Commodore 64. Despite being discontinued twenty years ago, the ancient OS turned out to be the perfect choice for this particular project. Well, mostly.
The NES and Commodore 64 share some architectural similarities, but their differences also present considerable challenges, especially regarding memory. Little Unix was designed to be loaded into RAM and consumes about 12KB, which is more than the NES's capacity.
DeCrAzYo's workaround was to use a Japanese Famicom, which is functionally identical to the NES but has commercially available accessories. The Famicom Disk System added an extra 32KB of RAM, a dedicated interrupt timer, and access to a floppy disk that could store 64KB per side.
Porting Unix to the Famicom Disk System required the creation of a new memory map and system initialization code. Additional modifications were also needed to take into account the system's hardware constraints, including writing drivers for the keyboard and console display.
Watch the video below to see how the project unfolded.
The source code of Little Unix is available here for those interested in contributing to its development.