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 4 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
zeus (3.0) :test_works: :test_works: 1
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="zeus"  

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>"

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 (upload it under Releases in the server UI) or by using the Mender client standalone mode.

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

See Updating Raspberry Pi boot firmware files using Yocto Project and Mender.

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

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!

4 Likes

2 posts were split to a new topic: Wayland not displaying an image on Raspberry Pi 4 (Yocto)

I tried this and got Rpi4 B and got system which is not booting. I think this is yocto problem but I am bery new to this:
Here are build messages:

 Parsing recipes: 100% |#####################################################################################################################################| Time: 0:02:10
Parsing of 2367 .bb files complete (0 cached, 2367 parsed). 3501 targets, 123 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.44.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-18.04"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "raspberrypi4"
DISTRO               = "poky"
DISTRO_VERSION       = "3.0.4"
TUNE_FEATURES        = "arm vfp cortexa7 neon vfpv4 thumb callconvention-hard"
TARGET_FPU           = "hard"
meta                 
meta-poky            
meta-yocto-bsp       = "HEAD:d88d62c20d7d8da85f02edb170dae0280624ad7e"
meta-oe              
meta-python          
meta-networking      
meta-multimedia      = "HEAD:2b5dd1eb81cd08bc065bc76125f2856e9383e98b"
meta-raspberrypi     = "HEAD:0e05098853eea77032bff9cf81955679edd2f35d"
meta-mender-core     
meta-mender-raspberrypi 
meta-mender-demo     = "HEAD:c6c580303f4149a912437fcc81ebeb107cdb5d43"

NOTE: Fetching uninative binary shim from http://downloads.yoctoproject.org/releases/uninative/2.9/x86_64-nativesdk-libc.tar.xz;sha256sum=d07916b95c419c81541a19c8ef0ed8cbd78ae18437ff28a4c8a60ef40518e423
Initialising tasks: 100% |##################################################################################################################################| Time: 0:00:09
Sstate summary: Wanted 1318 Found 0 Missed 1318 Current 0 (0% match, 0% complete)
NOTE: Executing Tasks
NOTE: Setscene tasks completed
WARNING: u-boot-1_2020.01-r0 do_provide_mender_defines: Found more than one dtb specified in KERNEL_DEVICETREE (          bcm2708-rpi-zero-w.dtb     bcm2708-rpi-b.dtb     bcm2708-rpi-b-plus.dtb     bcm2709-rpi-2-b.dtb     bcm2710-rpi-3-b.dtb     bcm2710-rpi-3-b-plus.dtb     bcm2711-rpi-4-b.dtb     bcm2708-rpi-cm.dtb     bcm2710-rpi-cm3.dtb               overlays/at86rf233.dtbo     overlays/disable-bt.dtbo     overlays/dwc2.dtbo     overlays/gpio-key.dtbo     overlays/hifiberry-amp.dtbo     overlays/hifiberry-dac.dtbo     overlays/hifiberry-dacplus.dtbo     overlays/hifiberry-digi.dtbo     overlays/i2c-rtc.dtbo     overlays/iqaudio-dac.dtbo     overlays/iqaudio-dacplus.dtbo     overlays/miniuart-bt.dtbo     overlays/mcp2515-can0.dtbo     overlays/pi3-disable-bt.dtbo     overlays/pi3-miniuart-bt.dtbo     overlays/pitft22.dtbo     overlays/pitft28-resistive.dtbo     overlays/pitft35-resistive.dtbo     overlays/pps-gpio.dtbo     overlays/rpi-ft5406.dtbo     overlays/rpi-poe.dtbo     overlays/vc4-kms-v3d.dtbo     overlays/vc4-fkms-v3d.dtbo     overlays/w1-gpio-pullup.dtbo     overlays/w1-gpio.dtbo          ). Only one should be specified. Choosing the last one: bcm2710-rpi-cm3.dtb. Set KERNEL_DEVICETREE to the desired dtb file to silence this warning.
WARNING: mender-client-2.3.0-r0 do_compile: You are building with the mender-demo layer, which is not intended for production use
WARNING: mender-client-2.3.0-r0 do_compile: You are building with the default server certificate, which is not intended for production use
NOTE: Tasks Summary: Attempted 4567 tasks of which 1 didn't need to be rerun and all succeeded.

Summary: There were 3 WARNING messages shown.

On the serial console I see repeated messages:

Partition: 0
lba: 49152 oem: 'mkfs.fat' volume: '  V       ^ '
rsc 4 fat-sectors 80 c-count 20431 c-size 4 r-dir 1 r-sec 32
Read config.txt bytes    36219 hnd 0x00000097 hash '59ad8ccae9ec30f4'
recover4.elf not found (6)
recovery.elf not found (6)
Read start4.elf bytes  2776132 hnd 0x00000733 hash '02b61d4a1274a453'
Read fixup4.dat bytes     6195 hnd 0x000000ad hash 'eb639eac03f0e496'
0x00d03114 0x00000000 0x00000000
start4.elf: is not compatible
This board requires newer software
Get the latest software from https://www.raspberrypi.org/downloads/
ERROR: 00000044
Boot mode: USB-MSD (04) order f

Tried with MACHINE=raspberrypi4-64, the same outcome

On what hardware are you trying to run this? It seems to have issue in the very early boot stage (part of the RPi firmware boot)

This is Raspberry Pi 4 model B 8GB.

I think the issue is the boot script. It might be trying to load wrong or non-existing kernel.

After I re-named this file (boot.scr) I was able to get into U-boot interactive prompt via UART
and the attached monitor.

Enabling UART kernel output for model 4 B is different from previous models,
it is not sufficient to change config.txt The full procedure is here

I also found that sometimes I have to send few chars from host computer at the moment when
board is powered up. It is weird.

All stock images boot, minimal buildroot image boots, yocto example without mender does.
Mender downloadable image boots.

Mender compiled image (mender-convert, mender with buildroot, mender with yocto) do not.

Mender-convert image allows serial interactive u-boot if boot.scr is renamed.