2
votes

I am working on ARM V7 architecture based Embedded Board with only 128 MB of flash memory and i want to fit Bootloader Image, Linux Kernel Image as well as root file system inside it, for this my primary target is to reduce the size of the boot loader and Linux Kernel image,

I have done the following optimizations for reducing kernel size,

     1. Deleted all the printk messages from displaying which reduced some memory,
     2. Turning off Sysfs Support decreased the size of the kernel substantially,
     3. Booting without procfs is one more work around i tried, but many pseudo 
        file systems require it.

I want to know all the possible techniques for optimization and reducing the size of the linux kernel. I request to provide any references.

3
The last time I left out sysfs (a long time ago, back in 2.6.25), the Ethernet driver broke; there was an obscure dependency! Reducing the kernel size can be a valid goal, but your reason seems misguided, i.e. the zImage compressed kernel image probably uses only a few percent of the flash.sawdust
@sawdust Next time you find that a driver breaks if you disable SYSFS, please file a bug report. It means the driver is buggy.Ezequiel Garcia

3 Answers

4
votes

Compared to 128 MB of flash, the size of your bootloader and kernel images should be comparatively quite small, and your root filesystem be the biggest part. So why do you focus on reducing the size of your bootloader and kernel, instead of looking at what is probably the biggest part: your root filesystem.

2
votes

Probably you should remove unneeded configs (network, security, unneeded drivers, ...). "CC_OPTIMIZE_FOR_SIZE" should be enabled.

Enable kernel compression (for example: HAVE_KERNEL_BZIP2), ramdisk compression (for example: RD_BZIP2) and initramfs compression (INITRAMFS_COMPRESSION_BZIP2).

0
votes

I would suggest converting your file system to either jffs2 or yffs if you have not already done so.