Update 2007-10-14: use IMAGE_INSTALL in image recipe
Update 2007-10-22: a few corrections, added full path for include and comments
Update 2010-06-07: use recipes instead of packages directory
As more and more OpenMoko developers are coming on-line, it is becoming obvious that my previous post (http://bec-systems.com/web/content/view/59/9/) about adding packages to OpenEmbedded could use some improvements. This post suggested using the DISTRO_EXTRA_RDEPENDS variable, which was intended to only be used in distro.conf files. A better approach is to create a custom image recipe that includes the packages you want. This article covers how to create a custom image recipe.
What are the problems with the DISTRO_EXTRA_RDEPENDS approach?
As detailed by Marcin Juszkiewicz in his blog post “Why using of DISTRO/MACHINE variables in local.conf is wrong“, and from discussions with OE developers, the following issues surfaced:
- You have to remember to rebuild task-base every time you update the DISTRO_EXTRA_RDEPENDS variable.
- The image is no longer angstrom-console-image or whatever you have extended, so when asking for support, other developers do not realize exactly what you are building. If it is a custom image, then that is obvious by the image name.
- Changing DISTRO_EXTRA_RDEPENDS in local.conf requires that you bitbake reparse the entire recipe tree (which takes minutes). Changing a custom image recipe only requires one file to be reparsed.
Creating a custom image file
Creating a custom image file is quite easy, and works much better than modifying DISTRO_EXTRA_RDEPENDS in your local.conf file. A custom image is created by simply copying or including an image file closest to what we want to use, and then adding additional packages to IMAGE_INSTALL variable. In the following example, we require angstrom-console-image.bb and extend it with a few lines:
require recipes/images/console-image.bb IMAGE_INSTALL += "\ xset xserver-kdrive-fbdev xinit \ kernel \ kernel-module-mmc-block \ kernel-module-mmc-core \ kernel-module-pxamci \ kernel-module-ac97-bus \ " export IMAGE_BASENAME = "my-custom-image"
Note, this method requires your custom image file to be in the same location as the original image recipe. If you use a bbcollections overlay, then you may want to copy the original recipe.
Note the use of a full path specified in the require statement. This allows you to have your custom image recipe in a bbcollections overlay, and bitbake will still find the required recipe in the main OE tree.
Thats it! With the many advantages to this method, there is no reason not to create your own image recipes — it works better.