Skip to content

# Package management

In case you need additional software packages, that are not preinstalled on the Kontron Electronics hardware you have two choices on how to get them running. You can either ...

1. ... setup the full Yocto-based build environment and rebuild the image with the needed package included,
2. ... or you can use package-files that only need to be installed on the already running hardware.

To obtain a package-file for the software you need, that is compatible with the Kontron Electronics BSP, you can create a package from within the Yocto build environment by using `bitbake`.

To build a recipe use:

    bitbake <recipe-name>

To list all available recipes run:

    bitbake -s

A single recipe can create multiple packages, such as -dev, -dbg or such. After the build recreate the package index by running:

    bitbake package-index

In case that a certain package is not available through an existing recipe (check at oe-Index), please contact Kontron Electronics for help.

## Install the package manager

In general the package manager `dpkg` and `apt-get` is already installed on the Kontron Electronics hardware. It is included in the Kontron images in Yocto by default.

## Set up a local package server

If you have the Yocto environment installed on your development computer and you want to be able to directly fetch the created packages located in `tmp/deploy/deb` in your build directory by your target, you can set up a webserver like Apache, that exports this directory via http.

For a very simple setup you can use the in webserver module in python3:

    cd build-stm32mp/tmp/deploy/deb
    python3 -m http.server 8000

This starts a simple webserver in the current working directory located on port 8000

## Using the package manager 'dpkg' and 'apt-get'

### Configuration file sources.list

To change the apt-get settings and to add/remove package repositories, please edit the file /etc/apt/sources.list

    nano /etc/apt/sources.list

Info

Yocto generates the sources.list file automatically with the appropriate repositories for your image. Which server URL is used is determined by the Yocto variable `PACKAGE_FEED_URIS`. Set this variable in local.conf or any other appropriate place.

For example: `PACKAGE_FEED_URIS = "http://192.168.1.240:8000/"`

### Examples

Install the package 'tree' from the remote server:

    apt-get update
    apt-get install tree