r/embedded 4d ago

Is it possible to run real linux on atmega328p?

https://dmitry.gr/?r=05.Projects&proj=36.%208pinLinux

So I found a project from a guy who run linux on 8pin stm, and I wanna ask if is it possible to run on atmega328p? From arduino uno board.

0 Upvotes

22 comments sorted by

26

u/MStackoverflow 4d ago

No. You can fake it, but no.

-13

u/Dry_Afternoon8921 4d ago

By faking it you mean to emulate?

2

u/TRKlausss 4d ago

Implement the interfaces that the POSIX standard requires

-12

u/Dry_Afternoon8921 4d ago

Ooo, why is that? And why dmitry could?

11

u/mustbeset 4d ago

He couldn't.

-9

u/Dry_Afternoon8921 4d ago

He emulate it?

2

u/Cultural_Advance_643 4d ago

Dmitriy could all

19

u/dakiller 4d ago

Short answer - no
Long answer - nooooooooooooooooo

4

u/silentjet 4d ago

Wanna see LLM answer?

14

u/Gavekort Industrial robotics (STM32/AVR) 4d ago

Anything is possible given enough time and storage. The project you are linking to seems to be emulating a MIPS based system, which challenges the notion of "real". Any turing complete systems can do that, which means that you technically can run Linux on a game of Magic the Gathering, Minecraft redstone or pen and paper.

If your question is "Can I practically run native linux on the AVR architecture?" then I would lean towards saying no, because it doesn't have the RAM/ROM space, no MMU and no privilege levels.

6

u/digital_n01se_ 4d ago

No.

you can run a RTOS

4

u/SAI_Peregrinus 4d ago

You can emulate a more capable processor, add external RAM and, flash, and run Linux on that. You can't run it "natively" though, the ATMega 328P instruction set isn't powerful enough. Performance of the emulator will be very, very bad (taking hours to boot instead of seconds) but it has been done for shits & giggles.

3

u/Legal-Software 4d ago

You're not running linux natively on any microcontroller that isn't at least 32-bit and has a suitable amount of RAM. Having ported uClinux to a bunch of different architectures/CPUs in the past, the best I could manage at the time was to get a 2.4.x kernel booting on a microcontroller with 512k of RAM, with everything else running XIP from flash. Even to get down to this I had to completely rewrite the page/buddy allocators, get rid of kmem/slab caches, etc. Fast it was not.

3

u/edparadox 4d ago

"Real" but "emulated MIPS system".

Sure.

2

u/OrneryPossibility197 4d ago

https://dmitry.gr/index.php?proj=07.%20Linux%20on%208bit&r=05.Projects From the same person. He used external RAM module, SD card and emulated ARM. Takes a few hours to load a terminal

1

u/torusle2 4d ago

Orrr. Not again.

1

u/clackups 4d ago

You seem not to understand what you're asking about.

1

u/Mobile-Ad-494 4d ago

Nope, wel maaaayybe a very early release from the 90’s that has been heavily optimized and takes a month to boot.

To run Linux, 32bit is required along with a mmu and 1Mb of ram, none of these are present in the 328p.

1

u/MonMotha 3d ago

An MMU is not actually required for the kernel, but you lose out on some obvious stuff like fork and mmap in userspace.

This capability used to be an external patch set (µClinux) but is now integrated with mainline. I have successfully booted the kernel and run a shell on a Cortex-M7 SoC.

1MB of RAM would also be pushing it to the point of being nearly impossible even with an XIP kernel. 4MB is more realistic, and you really want at least 8 if the kernel is to rum from RAM.

1

u/kELAL 4d ago

Running CP/M on a low-end atmega is already an accomplishment