2.6.4. Packaging

Packaging is not always particularly relevant within the extensible SDK. However, if you examine how build output gets into the final image on the target device, it is important to understand packaging because the contents of the image are expressed in terms of packages and not recipes.

During the do_package task, files installed during the do_install task are split into one main package, which is almost always named the same as the recipe, and into several other packages. This separation exists because not all of those installed files are useful in every image. For example, you probably do not need any of the documentation installed in a production image. Consequently, for each recipe the documentation files are separated into a -doc package. Recipes that package software containing optional modules or plugins might undergo additional package splitting as well.

After building a recipe, you can see where files have gone by looking in the oe-workdir/packages-split directory, which contains a subdirectory for each package. Apart from some advanced cases, the PACKAGES and FILES variables controls splitting. The PACKAGES variable lists all of the packages to be produced, while the FILES variable specifies which files to include in each package by using an override to specify the package. For example, FILES_${PN} specifies the files to go into the main package (i.e. the main package has the same name as the recipe and ${PN} evaluates to the recipe name). The order of the PACKAGES value is significant. For each installed file, the first package whose FILES value matches the file is the package into which the file goes. Defaults exist for both the PACKAGES and FILES variables. Consequently, you might find you do not even need to set these variables in your recipe unless the software the recipe is building installs files into non-standard locations.