Create custom package groups

Custom packages groups allow to create sets of packages which are meant to go with specific version of an image. This allow for more modularity of a layer structure.

Step 1 - Create folder for package groups recipes

This recipes are also stored inside recipes-core folder as image recipes.

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

Step 2 - Create recipes for each package group

The modularity of package groups can be the real power. You can divide packages into sets and this sets can be responsible for different versions of the system.

Note

In this part of step by step guide, only package groups will be created for datalogger image. To create package groups for other images, simply clone steps with different names.

Core package group

This package group will be foundation of datalogger image. It will contain packages that are required for system to boot and also some of drivers for internal devices.

To create package group simply create recipe in packagegroups folder.

touch ../meta-golemos/recipes-core/packagegroups/datalogger-core-packagegroup.bb

Inside this recipe place following output.

DESCRIPTION = "Datalogger core application packagegroup"
SUMMARY = "Datalogger packagegroup - core system apps"

PACKAGE_ARCH = "${MACHINE_ARCH}"

inherit packagegroup

RDEPENDS_${PN} = " \
    systemd \
    linux-firmware-rpidistro-bcm43430 \
    "

Note

The most importatnt line in this instruction is inherit packagegroup which take instructions from packagegroup.bbclass.

Base package group

Base means that all of packages are necessary for proper functionality of datalogger system. Without them the device will boot but it will do nothing.

Create base package group in one command.

touch ../meta-golemos/recipes-core/packagegroups/datalogger-base-packagegroup.bb

This package group will have a lot of packages, so it will be better to divide them into parts as well. Inside base package group recipe place this instructions.

DESCRIPTION = "Datalogger base application packagegroup"
SUMMARY = "Datalogger packagegroup - base system apps"

PACKAGE_ARCH = "${MACHINE_ARCH}"

inherit packagegroup

PACKAGES = " \
    datalogger-base-packagegroup \
    datalogger-base-buildtools \
    datalogger-base-python \
    datalogger-base-connectivity \
"

RDEPENDS_${PN} = " \
    datalogger-base-buildtools \
    datalogger-base-python \
    datalogger-base-connectivity \
"

SUMMARY_datalogger-base-buildtools = "Build utilities"
RDEPENDS_datalogger-base-buildtools = " \
    autoconf \
    automake \
    binutils \
    binutils-symlinks \
    cpp \
    cpp-symlinks \
    gcc \
    gcc-symlinks \
    g++ \
    g++-symlinks \
    gettext \
    make \
    libstdc++ \
    libtool \
    pkgconfig \
"

RDEPENDS_datalogger-base-buildtools-dev += " \
    libstdc++-dev \
"

SUMMARY_datalogger-base-python = "Python packages"
RDEPENDS_datalogger-base-python = " \
    python3 \
    libpython3 \
    python3-core \
    python3-flask \
    python3-gunicorn \
    python3-pip \
    python3-requests \
    python3-spidev \
    python3-wheel \
    python3-venv \
"

RDEPENDS_datalogger-base-python-dev += " \
    python3-dev \
"

SUMMARY_datalogger-base-connectivity = "Connectivity utilities"
RDEPENDS_datalogger-base-connectivity = " \
    curl \
    dropbear \
    hostapd \
    kea \
    nginx \
    rpi-gpio \
    rpio \
    wpa-supplicant \
"

Tip

Despite the fact that base package group is divided into smaller package groups, it is still treated as one package groups. You can also divide other package groups if you want.

Extended package group

Packages that are not required to boot the system, nor to basic datalogger functionality, are placed inside extended package group. To create it write one command.

touch ../meta-golemos/recipes-core/packagegroups/datalogger-extended-packagegroup.bb

To fill this file paste this content in.

DESCRIPTION = "Datalogger extended application packagegroup"
SUMMARY = "Datalogger packagegroup - extended"

PACKAGE_ARCH = "${MACHINE_ARCH}"

inherit packagegroup

RDEPENDS_${PN} = " \
    vim \
    git \
"

Development package group

Last but not least there are packages that are currently under development and have not made into base or extended version of system yet.

Create them by pasting this command.

touch ../meta-golemos/recipes-core/packagegroups/datalogger-dev-packagegroup.bb

Inside this file write content shown below.

DESCRIPTION = "Datalogger test application packagegroup"
SUMMARY = "Datalogger packagegroup - tools/testapps"

PACKAGE_ARCH = "${MACHINE_ARCH}"

inherit packagegroup

RDEPENDS_${PN} = " \
"

Summary

That were all of steps to create custom package groups. At the end your layer structure should look like this one.

../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
│   └── packagegroups
│       ├── datalogger-base-packagegroup.bb
│       ├── datalogger-core-packagegroup.bb
│       ├── datalogger-dev-packagegroup.bb
│       └── datalogger-extended-packagegroup.bb
└── recipes-example
    └── example
        └── example_0.1.bb

Note

All previous sections were about how to prepare your custom layer to future development. With custom distribution or images you can drasticly automate proces of building custom Linux images for embedded systems. In next sections you can find how to configure wireless network or hotspot.