This is an example of a minimal console image:
recipes-core/images/core-image-small.bb
DESCRIPTION = "Minimal console image."
IMAGE_INSTALL= "\
base-files \
base-passwd \
busybox \
sysvinit \
initscripts \
${ROOTFS_PKGMANAGE_BOOTSTRAP} \
${CORE_IMAGE_EXTRA_INSTALL} \
"
IMAGE_LINGUAS = " "
LICENSE = "MIT"
inherit core-image
IMAGE_ROOTFS_SIZE ?= "8192"
This recipe produces an image of about 6.4MB. If you use poky-tiny by add DISTRO = "poky-tiny"
to your conf/local.conf
the image will be around 4MB.
To build this, you will need to add
INSANCE_SKIP_glibc-locale = "installed-vs-shipped"
You could also use PACKAGE_CLASSES ?= package_ipk
package manager as it is the lightest and remove package-management
feature from your production root file system altogether.
If you choose to have packagegroup-core-boot
in your image, you could use BusyBox's mdev device manager instead of udev by specifying in your conf/local.conf
VIRTUAL-RUNTIME_dev_manager = "mdev"
If you are running root filesystem on a block device, use ext2 instead of ext3 or ext4 without the journal
Configure BusyBox with only the essential applets by providing your own configuration file in bbappend.
Review the glibc configuration, which can be changed via the DISTRO_FEATURES_LIBC
distribution configuration variable. You can find the example in the poky-tiny
distribution.
Consider switching to a ligher C library. Use uclibc
or musl
instead of the standard glibc http://www.etalabs.net/compare_libcs.html
to use musl, in local.conf
TCLIBC = "musl"
add meta-musl
to conf/bblayers.conf