Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

Is it possible to run Linux on Arduino? If yes, what steps and limitations need to be considered? If not, what are the limitations that prevent this?

share|improve this question
    
Honestly, i was just about to ask this! –  TheDoctor Feb 11 at 23:46
1  
    
Use a RPi instead. –  Annonomus Person Feb 19 at 3:11
add comment

3 Answers

Linux is a very complex operating system, but it may be able to fit on an arduino. things to consider:

  • There is no current AVR port of the source code
  • You would have no graphics, instead access the terminal over UART.
  • The filesystem driver would have to be rewritten to access internal flash or an external SD card
  • It would be extremely slow! the AtMega328 would run at 16mHz, or about 20mHz max (overclocked). Most linux machines run at a minimum of 400mHz, and more with graphics.
  • You would probably need some extra ram, probably a good idea to use an AtMega2650 (the one in the mega) which has 16x the ram of the Uno. You could also use a Due (6x as fast as the Uno, more ram)
  • You may have to write special USB drivers for OTG (on the due) or MAX3421EE (Mega ADK, USB host shield)

In short, it would take a lot of time and effort, and probably would be too slo for everyday use. If you really want Arduino Linux, check out the Yún.

share|improve this answer
    
You would not "probably" need extra ram, you do need extra ram. Linux requires 1 MB+ ram. Also, the lack of a MMU would mean you'd have to figure out how to emulate one (or run ucLinux). Realistically, at best, you'd wind up emulating a more capable processor in the atmega, which would be an order of magnitude slower then native code. Even the arduino due doesn't have anywhere near the required ram. –  Connor Wolf Mar 27 at 3:09
    
Also, the ATmega328P has 2 KB SRAM, and the ATmega2560P only has 8 KB. That is only 4X the ram, not 16x. –  Connor Wolf Mar 27 at 3:09
add comment

It just doesn't have enough RAM. You'd also need to teach it to boot from flash memory, which would involve rewriting the bootloader.

You can instead use an Arduino Yun or a PCDuino; while not "standard" Arduinos these support Arduino shields and run Linux.

Or there's always the Raspberry Pi.

share|improve this answer
    
Why do you say Yun is not "standard" Arduino? I agree it may not be the most common, but it is an Arduino indeed. –  jfpoilpret Feb 12 at 6:02
    
@jfpoilpret Most Arduinos are atmega boards which run compiled C++ via avr-gcc and have a USB handling chip. They come in various shapes/sizes/powers, but they're essentially the same (Mega aside). It seemed pretty obvious that the OP was talking about these and not the Yun/etc, hence the distinction. –  Manishearth Feb 12 at 6:07
    
There's also the soon-to-be-released Arduino Tre, at least I'm hoping it's soon ;-) –  Chris O Feb 12 at 14:03
add comment

The short answer is no.

Basically, you would need LOTS more ram then even the biggest ATmega has natively.

It is theoretically possible to add external hardware, and program the ATmega to emulate a more powerful CPU, and run linux on that. However, on a plain arduino, it is not possible.

It would be much more realistic to run linux on a Arduino Due, which is basically a AT91SAM3X8E CPU. However, you'd still need to add some additional SRAM and storage.

There are things like the Arduino Yun, but that is really a entirely separate linux module on the same PCB as a ATmega32U4, so I don't know if you can really count it as an arduino.


Possibly relevant: What does it take to run embedded linux?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.