14

What is the minimum amount of RAM required to run Linux kernel on an Embedded device? In Linux-0.11 for 80x86, the minimum RAM required was 2MB to load the kernel data structures and interrupt vectors.

How much is the minimum needed RAM for present Linux-3.18 kernel? Does different architectures like x86 and ARM have different requirements for minimum RAM required for booting? How does one calculates the same?

manav m-n
  • 11,136
  • 23
  • 74
  • 97
  • What are you trying to achieve? Depending on the device you're trying to squeeze Linux onto I'd imagine you might be able to shunt most of it off into (FLASH) ROM. – doynax Jan 14 '15 at 11:37
  • @doynax: i am trying to port linux on an embedded device with limited RAM. The flash is read-only. – manav m-n Jan 14 '15 at 12:00
  • 1
    Your question is too vague. Many Linux kernel features can be omitted if not needed, and consequently reduce the memory footprint. The types of daemons required and the applications will also dictate memory requirements. The processor architecture and instruction set impact memory requirements (e.g. for ARM the kernel can be compiled in Thumb mode, 16-bit, instructions to reduce kernel size). – sawdust Jan 14 '15 at 18:51
  • Not only is it rather subjective; it is also temporal. The values will change over time; no one will care about 3.18 eventually. Also, a minimal configuration may not do what you want. <1MB is definitely possible with some Linux versions and configurations. For instance, you can remove *procfs* and/or *sysfs*, but most Linux user space programs may not work. Minimal might be no network, no sound, no mm, only initramfs and a console driver (maybe). – artless noise Jan 15 '15 at 20:13
  • QEMU + buildroot 2017.02 x86_64 goes down to about 32MiB. Likely anything smaller will require patches / be insane. – Ciro Santilli OurBigBook.com Jun 11 '17 at 14:42

3 Answers3

13

It's possible to shrink it down to ~600 KiB. Check the work done by Tom Zanussi from Intel. Presentation from Tom and Wiki page about the topic.

UPDATE. Tom published interesting statistics about memory use by different subsystems in the kernel. He did research during that time when he was working on the project.

Yet another interesting project is Gray486linux.

0andriy
  • 4,183
  • 1
  • 24
  • 37
  • 1
    I cannot see in either of those links anything to suggest 600KiB. Can you be more specific? Is that kernel image size of run-time RAM footprint? [This presentation](http://elinux.org/images/2/2b/Elce11_hart.pdf) shows stages to decreasing a distribution each increasingly smaller down to 1.6Mb, but at which point it is probably so crippled that it hardly becomes worth it - so it boots then what can you do with it!? – Clifford Jan 14 '15 at 21:36
  • 1.6M is a RAM size of the system, besides kernel you have to have RAM for other stuff, like init and / or shell. So, 600KiB is a RAM footprint of the kernel. But be aware that some stuff you have to compile in into user space programs like TCP/IP, IIRC. – 0andriy Jan 15 '15 at 17:32
  • [Linux on 8-bit uC](http://dmitry.gr/index.php?r=05.Projects&proj=07.%20Linux%20on%208bit) – manav m-n Jan 19 '15 at 07:40
  • 1
    @Manav, yes, I know that one, but it doesn't sound like a production-ready solution :-) – 0andriy Jan 19 '15 at 08:34
4

This site suggests:

A minimal uClinux configuration could be run from 4MB RAM, although the recommendation we are giving to our customers is that they should design in at least 16 MB's worth of RAM.

If you are using SDRAM, the problem would be getting a part any smaller than 16Mb at reasonable volume cost and availability, so maybe it is a non-problem? For SRAM however, that is a large and relatively expensive part.

eLinux.org has a lot of information on embedded kernel size, how to determine it, and how to minimise it.

Clifford
  • 88,407
  • 13
  • 85
  • 165
  • From the above provided link: The size of a bootable uClinux image, with integrated initramfs, worthy of the functionality capable of running from 16 MB of RAM would be in the 2-3 MB ballpark. What is the size of the uClinux kernel when it is uncompressed? – manav m-n Jan 15 '15 at 06:46
2

It depends how you define Linux. If you ask for current operating systems then we are talking about way above 100MByte, better 1000MByte of memory.

If we are talking about "Linux from Scratch" then we are also talking about how much pain you are willing to suffer. In the mid-1990 I build a Linux system by compiling every binary myself and made it run on a 386sx16, 1,5MByte of memory. While it had a 40MByte harddrive it was mostly empty. I compiled my own Kernel 1.0.9, my own libc5, my own base tools, SVGAlib. That system was somewhat useable for using textmode and SVGAlib applications. Increasing the memory to 2MByte did help a lot. And believe me, the system was extremely bare. Today all components need at least twice the memory but then there is also ulibc instead of libc and busybox.

At 8MByte of memory I can create a very basic system today from scratch. At 512MByte of memory you might have a somewhat modern looking but slow desktop system.