Apart from hardware design considerations (such as running the Linux kernel from a NOR flash and execute in place (XIP) to avoid loading the image to memory), the first step in kernel size optimization is to review the kernel configuration and remove all superfluous features.
We can show a summary of kernel and module sizes by using the ksum.py script. Change to the directory of a compiled Linux kernel source, as explained previously in Chapter 2, The BSP Layer, and execute the script from the Linux kernel root directory:
$ cd /opt/yocto/linux-wandboard $ /opt/yocto/fsl-community-bsp/sources/poky/scripts/tiny/ksum.py Collecting object files recursively from /opt/yocto/linux-wandboard... Collecting object files [DONE] Totals: ...