Raspberry Pi 4 Model B

Board description

The Raspberry Pi 4 Model B is the latest addition to the Raspberry Pi family. It is the most powerful board within the Raspberry Pi family.

URL: https://www.raspberrypi.org/products/raspberry-pi-4-model-b/
Wiki: https://elinux.org/RPi_Hub

Test results

Raspberry Pi 3 is one of the official reference devices of Mender and is easy to get started with. This device is continuously tested as part of Mender testing pipelines which assures high quality of the integration.

The Yocto Project releases in the table below have been tested by the Mender community. Please update it if you have tested this integration on other Yocto Project releases:

Yocto Project Build Runtime
warrior (2.7) :test_works: :test_works: 1

1. Disabled GRUB integration for ARM systems which is default in meta-mender/thud. U-Boot is still primary integration method for this platform.

Build Means that the Yocto Project build using this Mender integration completes without errors and outputs images.
Runtime Means that Mender has been verified to work on the board. For U-Boot-based boards, the integration checklist has been verified.

Getting started

Prerequisites

  • A supported Linux distribution and dependencies installed on your workstation/laptop as described in the Yocto Mega Manual

    • NOTE. Instructions depend on which Yocto version you intend to use.
  • Google repo tool installed and in your PATH.

Configuring the build

Setup Yocto environment

Set the Yocto Project branch you are building for:

# set to your branch, make sure it is supported (see table above)
export BRANCH="warrior"  

Create a directory for your mender-raspberrypi setup to live in and clone the
meta information.

mkdir mender-raspberrypi && cd mender-raspberrypi

Initialize repo manifest:

repo init -u https://github.com/mendersoftware/meta-mender-community.git \
           -m meta-mender-raspberrypi/scripts/manifest-raspberrypi.xml \
           -b ${BRANCH}

Fetch layers in manifest:

repo sync

Setup build environment

Initialize the build environment:

source setup-environment raspberrypi

Configure Mender server URL (optional)

This section is not required for a successful build but images that are generated by default are only suitable for usage with the Mender client in Standalone deployments, due to lack of server configuration.

You can edit the conf/local.conf file to provide your Mender server configuration, ensuring the generated images and Mender Artifacts are connecting to the Mender server that you are using. There should already be a commented section in the generated conf/local.conf file and you can simply uncomment the relevant configuration options and assign appropriate values to them.

Build for Hosted Mender:

# To get your tenant token:
#    - log in to https://hosted.mender.io
#    - click your email at the top right and then "My organization"
#    - press the "COPY TO CLIPBOARD"
#    - assign content of clipboard to MENDER_TENANT_TOKEN
#
MENDER_SERVER_URL = "https://hosted.mender.io"
MENDER_TENANT_TOKEN = "<copy token here>"

Build for Mender demo server:

# https://docs.mender.io/getting-started/create-a-test-environment
#
# Update IP address to match the machine running the Mender demo server
MENDER_DEMO_HOST_IP_ADDRESS = "192.168.0.100"

Building the image

You can now proceed with building an image:

MACHINE=raspberrypi4 bitbake core-image-base

Replace core-image-base with your desired image target.

Using the build output

After a successful build, the images and build artifacts are:

  • tmp/deploy/images/raspberrypi4/core-image-base-raspberrypi4.sdimg
  • tmp/deploy/images/raspberrypi4/core-image-base-raspberrypi4.mender

The disk image (with .sdimg suffix) is used to provision the device storage for devices without Mender running already. Please proceed to the official documentation on provisioning a new device for steps to do this.

On the other hand, if you already have Mender running on your device and want to deploy a rootfs update using this build, you should use the Mender Artifact files, which have .mender suffix. You can either deploy this Artifact in managed mode with the Mender server as described in Deploy to physical devices or by using the Mender client only in Standalone deployments.

References

  • The template files that are used by this setup can be found in mender-mender-community

  • The Mender integration layer for Raspberry Pi boards can be found in meta-mender.

  • The official Mender documentation explains how Mender works. This is simply a board-specific complement to the official documentation.

Known issues

Boot firmware files

Raspberry Pi boards have a set of boot firmware files that are located on the vfat boot part, and a selection of these files are:

bootcode.bin  fixup.dat     fixup_cd.dat  fixup_db.dat
fixup_x.dat   start.elf     start_cd.elf  start_db.elf
start_x.elf

Occasionally there will be changes to the Raspberry Pi software stack that requires that these files are update. One example would be a change in the Linux kernel that relies on functional changes in the boot firmware and in this case you need to update the boot firmware together with the Linux kernel to get a functional device.

See this thread where the limitations of the boot firmware files on Raspberry Pi are discussed.

Also check out this workaround, note that it is unsafe to do this because there is no way you can update these files atomically and it is not possible to roll-back in case you install something that does not boot.

Devicetree is not updated

To be able to support update of Linux kernel and devicetree, Mender requires these to be installed in the /boot directory for each rootfs (normally /dev/mmcblk0p2 and /dev/mmcblk0p3). On the other hand, the Raspberry Pi boot firmware requires that the DTB file is in the same partition as the boot firmware (/dev/mmcblk0p1) and the config.txt file. For now Mender will not use the DTB that is delivered with new artifacts and will continue to boot with the original DTB that was populated using the sdimg file.

Problem using ‘dtoverlay=pi3-disable-bt’

pi3-disable-bt disables the Bluetooth device and restores UART0/ttyAMA0 to GPIOs 14 and 15. It is also necessary to disable the system service that initialises the modem so it doesn’t use the UART

There is currently a known issue with above functionality, that is to enable UART0 on PIN 14 and 15.

It is actually not something that is caused by Mender specifically, but Mender requires U-Boot to be present to support robust features such as roll-back. U-Boot is typically not enabled if you do a stock Raspberry Pi and some people are often surprised that the Bluetooth UART stopped working when they integrate meta-mender.

The problem is in U-Boot which does conflicting configuration, and there is a workaround reported here and it has been reported to U-Boot but unclear when/if it will be fixed.


If this post was useful to you, please press like, or leave a thank you note to the contributor who put valuable time into this and made it available to you. It will be much appreciated!

3 Likes