Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!

Giang Vinh Loc Creates "the World's Worst Linux PC" Using an Arduino UNO R3 and Its ATmega328P

Using Charles Lohr's 400-line RISC-V emulator, this Arduino UNO boots Linux — in a little under 16 hours.

Gareth Halfacree
1 year agoHW101

Vietnamese embedded developer Giang Vinh Loc has taken Linux to new lows, by successfully booting to a console session on an Arduino UNO R3's Microchip ATmega328P eight-bit microcontroller — by having it pretend to be a 32-bit RISC-V processor.

"This is a port of mini-rv32ima (a minimum RISC-V emulator, capable of booting Linux) on ATmega328P (the core of Arduino UNO, a eight-bit AVR microcontroller)," Loc explains of the project. "So basically, this code is for booting Linux on [the] Arduino UNO. Yes you are reading it correctly, Arduino UNO can (theoretically, but not practically) boot Linux."

If you've a spare sixteen or so hours to wait for a login prompt, why not try Linux on your Arduino UNO? (📹: Giang Vinh Loc)

Loc's project builds on the work of Charles Lohr, who wrote mini-rv32ima late last year in just 400 lines of C code — the release of which triggered a race to see who could get it, and the Linux kernel the emulator supports, running on the most resource-constrained hardware. In Loc's case, that was an Arduino UNO R3 — a microcontroller board with an eight-bit 16MHz processor and just 2kB of static RAM (SRAM).

That, then, posed a problem: the Linux kernel may be able to squeeze itself into surprisingly little memory, but not all the way down to 2kB. The solution: convincing the emulator that an SD Card connected over SPI is RAM, vastly increasing the memory available to the kernel.

Performance, as you might expect, is more proof-of-concept than usable: "Complete boot time (from start to shell) is about 15 hours and 44 minutes," Loc admits — though this was later improved through the implementation of an instruction cache and a "lazy write system."

The full project write-up, including source code, is available on Loc's GitHub repository; "If you can run this," he writes, "you probably are running world's worst Linux PC. Enjoy!"

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles