rootfs_ipkg class

The rootf_ipk class us used to create a root filesystem for the target device from a set of .ipkg packages. The end result is a directory containing all the files that need to be included in the root filesystem of the target device.

This class is normally not used directly, but instead used from the image class which creates images from a set of package (typically .ipkg) files.

Summary of actions performed by the rootfs_ipkg class:

  1. Erase any existing root filesystem image by deleting the entire contents of ${IMAGE_ROOTFS};

  2. Creates the device node directory, ${IMAGE_ROOTFS}/dev;

  3. Determines which packages to install in order to provide the locales that have been requested;

  4. Configures ipkg to allow it to be used locally to install into the root filesystem ${IMAGE_ROOTFS};

  5. Installs locale related .ipkg packages;

  6. Installs the list of requested .ipkg packages, ${IPKG_INSTALL};

  7. Creates ipkg's arch.conf as ${IMAGE_ROOTFS}/etc/ipkg/arch.conf;

  8. Runs any preinst and postinst scripts that were specified by the installed .ipkg packages;

  9. Creates the system configuration directory ${IMAGE_ROOTFS}/${sysconfdir} (that is the /etc directory on the target);

  10. Runs and custom post-processing commands, as described by ${ROOTFS_POSTPROCESS_COMMAND};

  11. Verifies that all the ipkg's were installed correctly and reports an error if they were not;

  12. Makes available a set of functions which may be used by callers of the class: zap_root_password, create_etc_timestamp and remove_init_link;

  13. Adds the rootfs task to run after the install task "addtask rootfs before do_build and do_install".

The following variables may be used to control some of the behaviour of this class:


The list of packages which will be installed into the root filesystem. This needs to be set in order for this class to perform any useful work.

Default: empty


Defines additional commands to run after processing of the root filesystem. Could be used to change roots password, remove parts of the install kernel such as the zImage kernel image or to edit the ipkg configuration for example.

Default: empty


Defines the list of architectures that are support by the target platform. This is used to configure the arch settings for ipkg on the target system.

Default: "all any noarch ${TARGET_ARCH} ${PACKAGE_EXTRA_ARCHS} ${MACHINE}"


Specifies which locales should be installed. This is often set to "" to indicate that no locales will be installed.

Default: "de-de fr-fr en-gb"


A list of dependencies, this is appended to DEPENDS. This is typically used to ensure that any commands that are called by ROOTFS_POSTPROCESS_COMMAND are actually built by the system prior to being called.

Default: empty


The name of the build. This is either set by the distro configuration (for released versions) or set to a date stamp which is autogenerated by bitbake.

Default: 'date +%Y%m%d%H%M'


The path to the root of the filesystem image. You can use this when you need to explicitly refer to the root filesystem directory.

Default: IMAGE_ROOTFS = "${TMPDIR}/rootfs"


The base deploy dir. Used to find the directory containing the ipkg files.

Default: DEPLOY_DIR = "${TMPDIR}/deploy"


The directory in which to search for the ipkg files that are to be installed in the root filesystem.

Default: DEPLOY_DIR_IPK = "${DEPLOY_DIR}/ipk"

Note that the entire process is run under the control of fakeroot in order to handle device files, uids and gids. The ROOTFS_POSTPROCESS_COMMAND is useful due to the fact that it runs within the same fakeroot instance as the rest of this class.

The class also provides a function real_do_rootfs which is executed without fakeroot and therefore can be used from other classes, such as image class, that are already running under the control of fakeroot.