Mattias Backman
Mattias Backman

Reputation: 957

Yocto minimal image with package management

I am trying to build the smallest possible linux image using the Yocto project. I would also like to have package management on the target to be able to add to and update parts of the running system.

I can enable the package management by adding this to my conf/local.conf:

EXTRA_IMAGE_FEATURES = "package-management"

Using rpm, that pulls in the smartpm package manager which is based on python which in turn makes the image to large. So I tried to use ipk packages but that still depends on python.

Does anyone have a good idea how to include package management in Yocto with the least possible overhead?

Upvotes: 1

Views: 9864

Answers (2)

Kanji Viroja
Kanji Viroja

Reputation: 493

I can suggest you few things, which may help you to optimize size of rootfs:

  • Optimize as much as possible linux kernel binary and removed unnecessary packages (filesystem,device driver,networking etc).

    $ bitbake -c menuconfig virtual/kernel //configure as per your requirement
    $ bitbake -c savedefconfig virtual/kernel //savedefconfig
    $ bitbake -f virtual/kernel
    
  • Configure Busybox and removed unused things:

    $ bitbake -c menuconfig busybox
    
  • Remove those Distro features if not in use (and check more also): graphics [x11], sound [alsa], touchscreen [touchscreen], Multimedia. Change apply in conf/local.conf file. Example: DISTRO_FEATURES_remove = "x11 alsa touchscreen bluetooth opengl wayland "

  • Choose proper system init manager: systemd or sysvinit
  • Removed Unused Packages from the image. Example PACKAGE_EXCLUDE = "perl5 sqlite3 udev-hwdb bluez3 bluez4"
  • For small embedded device preferred PACKAGE_CLASSES = "package_ipk" and it is well optimized for small systems.

Upvotes: 7

Mattias Backman
Mattias Backman

Reputation: 957

Looks like this is the best I can do.

PACKAGE_CLASSES = "package_ipk"

Then edit the recipe for opkg-utils to not depend on python. Will of course break the python utils, though.

Upvotes: 1

Related Questions