How to use task-base

In OpenEmbedded we had long discussions how to get minimal images few times, there were developers which worked on getting smallest possible working ones — one of them was Matthias Hentges which essential-to-boot image was 3.5M jffs2 and had everything needed to use WiFi on Sharp Zaurus SL-C1000 (akita).

Finally Richard Purdie added task-base into OpenEmbedded repository as new idea to generate rootfs images. First version was far from perfect but show a way. We improved it a lot since then so now it support:

  • Linux 2.4/2.6
  • power management systems: APM, ACPI
  • wireless connectivity: Bluetooth, Wifi, Irda
  • USB host and gadget (gadget only under 2.6 because 2.4 lack any)
  • keyboards
  • touchscreens
  • screen in machines which have them
  • PCI, PCMCIA/CF bus
  • internal storage for models with microdrives or hard disks (‘ext2’ feature)
  • NFS for nfsroot installations
  • IPSec

Any new features are easy to add.

Why switch from task-bootstrap to task-base is required now for all target devices and distributions? Reason is simple — this allow much better integration of them and leverage possibility of forgetting something. For example in past one of our distributions supported WPA ‘out of box’ but there were problems with some methods of encryption — it was fixed by update with few extra kernel modules added. Now imagine that you have to change this thing for all distributions and have to check which of them support wireless with WPA capable drivers — nightmare… Instead of it you change task-base recipe and every distro will get this update for free.

Another bonus which distro/machine maintainers get with task-base is simplify of configurations. There is no need to specify all tools again and again, thinking which parts of rootfs should be specified in machine config and which in distribution one. Instead of it only features of target and distro has to be defined and task-base will handle rest of it.

Example

Few months ago I was working on creating new distribution called celinux-test for CELF. Main target of it was omap5912osk developer board. I decided to use task-base from beginning.

Cleaning machine and distro config

omap5912osk.conf was long because this board has modular kernel so lot of modules need to be present in rootfs. I started from definition of MACHINE_FEATURES and switch to task-base:

MACHINE_FEATURES = "kernel26 pcmcia usbhost"
MACHINE_TASK_PROVIDER = "task-base"

Then I build bootstrap-image and compared amount of packages installed with a list from older rootfs. Some tools were lacking so I checked them and added proper features to celinux-test distribution config:

DISTRO_FEATURES = "nfs pcmcia usbhost"

Rebuild of task-base and bootstrap-image gave me rootfs which contained nearly same set of packages as old image. New one got some additional pcmcia modules, usbutils but every needed utils present in older images were present.

Extra stuff

Cleaning of configs allow to remove all BOOTSTRAP_* variables. But how to add some packages into rootfs without them? There is solution — MACHINE_EXTRA_RDEPENDS/MACHINE_EXTRA_RRECOMMENDS and same for distros: DISTRO_EXTRA_RDEPENDS/DISTRO_EXTRA_RRECOMMENDS. Everything from them will get added into task-base dependencies.