04-10-2010 09:54 AM
I've been recompiling the kernel, and have it down to about 2 megs in physical size. I downloaded buildroot, and have the initrd ramdisk down to 1.1 meg, and will be reducing it further.
However, when I boot the kernel, it used 8 megs of ram, down from 8.5 megs of ram. There are no real processes running, I've removed the getty's for tty1, tty2.
I would like for it to run in between 4 to 6 megs of ram total.
Can someone give me some clues as to why it is using so much memory, and how I can reduce that memory footprint?
04-13-2010 01:16 PM
I'm using an initramfs, and it is 1.1 meg, which I can reduce somewhat.
I'm using free to measure the memory usage.
if I boot into 8 meg of ram, there is not enough "free" ram to let me log into the system, I have to boot into more than 8 meg of ram, so I know the usage is that much, and it agrees with the "free" command's response.
After several days of googling, I found that 32 meg is considered a normal size for linux now. Also, I found that if I choose the "SLOB" memory management, the kernel will refuse to finish init during the boot phase, so that is out.
It appears that slightly over 7 meg (assuming 0 initramfs) is about what I can expect to need as a base boot, with no programs running at all.
We are having to investigate adding memory to the system.
04-13-2010 03:12 PM
>I'm using an initramfs, and it is 1.1 meg, which I can reduce somewhat.
Is that 1.1MB compressed, or after decompression?
There's probably still some kruft in the kernel config to remove (unused filesystems, drivers, etc...). I'd look through every single config menu. If you have networking support, make sure IPV6 isn't selected, etc...
Are you optimizing for size "-0s" ? The default is "-O2".
You could build a slimmed-down busybox as well. Using shared libraries may help, if you are not already.
With such limited RAM, could you consider placing the filesystem in flash and not use a ramdisk at all?
04-13-2010 03:38 PM
1.1 meg is after uncomression.
yes, it is reduced. the original kernel size was 4 megabytes, it is now down to 2 megabytes. If I pull out any more, I get unbootable stuff.
I can reduce about 1 meg using the techniques you suggest, but only that. I need about 3 meg reduction, and it does not look like I will get there.