Create custom images

Step 1 - Create folders for recipes

Creating custom images fore us to make our firsts recipes. This recipes are the most important for meta layer so they are stored inside recipes-core folder.

mkdir -p ../meta-golemos/recipes-core/images

Step 2 - Create recipe for base image

Our first recipe will be made for datalogger device. Create file called datalogger-image.bb inside previously created folder. This recipe will be the most basic image for datalogger device. It contain basic utilities for proper behaviour.

touch ../meta-golemos/recipes-core/images/datalogger-image.bb

Inside this recipe you had to place this content.

SUMMARY = "Datalogger production image"
LICENSE = "CLOSED"

IMAGE_INSTALL += " packagegroup-core-boot"
IMAGE_FEATURES += " debug-tweaks"

inherit core-image

CORE_IMAGE_EXTRA_INSTALL += " \
    datalogger-core-packagegroup \
    datalogger-base-packagegroup \
    "

Warning

Here you can find things called package groups. Do not worry in next section you can find how to create such a groups which help to mantain more modularity and better image typing.

They key takeaway from above output is the following line:

inherit core-image

Which tells us that the definition of what actually gets installed is defined in the core-image.bbclass.

Step 3 - Create recipe for extended version of image

The extended image will contain every thing what is in base image but also some packages that are not necessary for basic functionality of datalogger. To create such a image create recipe called datalogger-extended-image.bb.

touch ../meta-golemos/recipes-core/images/datalogger-extended-image.bb

Next place this output inside created recipe.

SUMMARY = "Datalogger extended version of image"
LICENSE = "CLOSED"

inherit core-image
require datalogger-image.bb

CORE_IMAGE_EXTRA_INSTALL += " \
    datalogger-extended-packagegroup \
    "

Note

This recipe contain require datalogger-image.bb which tell to add all instruction contained inside base image recipe.

Step 4 - Create development image

Some packages are under development and sometimes it is not appropriate to place them along side base packages. For that situations development image arose. Create development image by pasting this command.

touch ../meta-golemos/recipes-core/images/datalogger-dev-image.bb

Inside this file place this instructions.

SUMMARY = "Datalogger development image"
LICENSE = "CLOSED"

inherit core-image
require datalogger-image.bb

CORE_IMAGE_EXTRA_INSTALL += " \
    datalogger-dev-packagegroup \
    "

Summary

This steps allow you to create custom images. You can build them by typing

bitbake datalogger<VERSION>-image

After all of this steps your layer structure should look like this.

../meta-golemos
├── conf
│   ├── bblayer.conf.sample
│   ├── conf-notes.txt
│   ├── distro
│   │   └── golemos.conf
│   ├── layer.conf
│   └── local.conf.sample
├── COPYING.MIT
├── README
├── recipes-core
│   └── images
│       ├── datalogger-dev-image.bb
│       ├── datalogger-extended-image.bb
│       └── datalogger-image.bb
└── recipes-example
    └── example
        └── example_0.1.bb