Set up a Yocto Image for Raspberry

Set up a Yocto Image for Raspberry

October 9, 2020
TeamViewer IoT Documentation

The Yocto Project enables the creation of custom Linux-based systems for embedded devices.

The TeamViewer IoT Agent will run on Yocto Linux devices given minimum requirements and configurations are met.
This article is an example how to build Yocto Image with TeamViewer IoT Agent for Raspberry using the layer provided in GitHub.

For more information visit Information see https://github.com/teamviewer/meta-teamviewer-iot-agent.

When using ssh with the built image, the username is “root” and the password is “raspberry”.

What you will need

Make sure that you have prepared the following points:

  • The edge device is set up with a TeamViewer IoT Agent.
  • The edge device is connected to the internet.
  • Your PC is set up with the TeamViewer Client.
  • Your login credentials for the edge device (user name, and password).
  • Installed dependencies (based on operating system of Raspberry). For more information see Required Packages for the Build Host.

Setup

  1. On your PC open the TeamViewer Client and log in.
  2. On the left side open the Computers & Contacts tab.
  3. Double-click the device.
    The Control Window opens and the connection will be established.
  4. In the Control Window on the top open the Remote Terminal tab.
  5. Type in your user password and press enter.
  6. Clone the poky project’s zeus branch. In the terminal type in the following command and press return.
git clone --branch=zeus git://git.yoctoproject.org/poky.git && cd poky
  1. Clone the Raspberry and the TeamViewer IoT Agent meta-packages. In the terminal type in the following commands and press return:
git clone --branch=zeus git://git.yoctoproject.org/meta-raspberrypi
git clone --branch=zeus https://github.com/teamviewer/meta-teamviewer-iot-agent
  1. Configure the environment. In the terminal type in the following command and press return.
source oe-init-build-env
  1. Add layers to bitbake. In the terminal type in the following commands and press return:
bitbake-layers add-layer ../meta-raspberrypi
bitbake-layers add-layer ../meta-teamviewer-iot-agent
  1. Change the target machine on the configuration file and set init manager to systemd. In the terminal type in the following commands and press return:
echo 'MACHINE = "raspberrypi3"' >> conf/local.conf
echo 'DL_DIR = "${TOPDIR}/downloads"'   >> conf/local.conf
echo 'CONNECTIVITY_CHECK_URIS = "https://www.google.com/"' >> conf/local.conf
echo '#Set Systemd to Init Manager' >> conf/local.conf
echo 'DISTRO_FEATURES_append = " systemd"' >> conf/local.conf
echo 'DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"' >> conf/local.conf
echo 'VIRTUAL-RUNTIME_init_manager = "systemd"' >> conf/local.co
  1. Append ssh and TeamViewer IoT Agent layer. In the terminal type in the following commands and press return. Type in user name and password when prompted.
echo '#Append TeamViewer IoT agent layer' >> conf/local.conf
echo 'IMAGE_INSTALL_append += " teamviewer-iot-agent"' >> conf/local.conf
echo 'IMAGE_ROOTFS_EXTRA_SPACE ?= "50000"' >> conf/local.conf
echo 'CORE_IMAGE_EXTRA_INSTALL += "openssh"' >> conf/local.conf
echo 'INHERIT += "extrausers"' >> conf/local.conf
echo 'EXTRA_USERS_PARAMS = "usermod -P raspberry root;"' >> conf/local.conf
  1. Optional: Install Xvfb server (see Set up the Remote Screen via X11) on the edge device to be able to use X11 features. In the terminal type in the following command and press return. Type in user name and password when prompted.
echo '#X11' >> conf/local.conf
echo 'DISTRO_FEATURES_append += " X11"' >> conf/local.conf
  1. Optional: Enable Edge Management on the edge device. In the terminal type in the following commands and press return. Type in user name and password when prompted.
git clone --branch=zeus git://git.openembedded.org/meta-openembedded ../meta-openembedded
git clone --branch=zeus git://git.yoctoproject.org/meta-virtualization ../meta-virtualization
sed -i '$d' conf/bblayers.conf
echo '  ${TOPDIR}/../meta-openembedded/meta-oe ' >> conf/bblayers.conf
echo '  ${TOPDIR}/../meta-openembedded/meta-multimedia ' >> conf/bblayers.conf
echo '  ${TOPDIR}/../meta-openembedded/meta-networking ' >> conf/bblayers.conf
echo '  ${TOPDIR}/../meta-openembedded/meta-python ' >> conf/bblayers.conf
echo '  ${TOPDIR}/../meta-openembedded/meta-filesystems ' >> conf/bblayers.conf
echo '  ${TOPDIR}/../meta-virtualization ' >> conf/bblayers.conf
echo '  "' >> conf/bblayers.conf
bitbake-layers show-layers
echo '#Docker layer for supporting Edge services' >> conf/local.conf
echo 'DISTRO_FEATURES_append += " virtualization"' >> conf/local.conf
echo 'IMAGE_ROOTFS_EXTRA_SPACE = "400000"' >> conf/local.conf
  1. Start the build type. In the terminal type in the following command and press return. Type in user name and password when prompted.
bitbake core-image-minimal

You can find target image tmp/deploy/images/raspberrypi3/ here with core-image-minimal-raspberrypi3 prefix. In case of failure or new bash (terminal) creation, after all steps executed you need to go to project’s directory and start again from step 8 Configure Environment.

Related posts

Want more? Exclusive deals, the latest news: Our Newsletter!