One of the reasons you would want to create a customized image is that you often require a different set of packages than those used in existing images. When using the Yocto Project, it's possible to use a sort of package list, to make it easier for the end user to add new packages and to keep the image recipe as simple as possible. This section will guide your through how to use a customized package list using the Yocto Project.
First, you need to add a new BitBake file (.bb
) named packagegroup-packt-iot.bb
:
$ mkdir recipes-core/images/packagegroups $ touch packagegroup-packt-iot.bb
A typical package list will look something like this:
$ cat packagegroup-packt-iot.bb DESCRIPTION = "Package list for packt-iot-image" LICENSE = "MIT" inherit packagegroup RDEPENDS_${PN} += " pkg1 pkg2 pkg3 "
When our customized package list is in place, we can transfer packages added through IMAGE_INSTALL
. This will make the package group look like the following:
$ cat packagegroup-packt-iot.bb DESCRIPTION = "Package list for packt-iot-image" LICENSE = "MIT" inherit packagegroup RDEPENDS_${PN} += " rpi-gpio nodejs gpio-packt webserver-packt "
Finally, we need to ensure that our new package list is used; for this example, it will be done by replacing the content in IMAGE_INSTALL
with the package group recipe, like this:
# Base this image on rpi-basic-image include recipes-core/images/rpi-basic-image.bb SPLASH = "psplash-raspberrypi" IMAGE_FEATURES += "ssh-server-dropbear splash" IMAGE_INSTALL_append = " packagegroup-packt-iot"
The Yocto Project documentation contains the following information about IMAGE_INSTALL
:
"Using IMAGE_INSTALL with the += operator from the /conf/local.conf file or from within an image recipe is not recommended as it can cause ordering issues. Since core-image.bbclass sets IMAGE_INSTALL to a default value using the ?= operator, using a += operation against IMAGE_INSTALL will result in unexpected behavior when used in conf/local.conf. Furthermore, the same operation from within an image recipe may or may not succeed depending on the specific situation. In both these cases, the behavior is contrary to how most users expect the += operator to work."
For more details, visit
http://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#var-IMAGE_INSTALL.
18.188.168.28