OrangePi Zero

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

Device description

It’s an open-source single-board computer. It can run Android 4.4, Ubuntu, Debian. It uses the AllWinner H2 SoC, and has 256MB/512MB DDR3 SDRAM(256MB version is Standard version)

URL: http://www.orangepi.org/orangepizero/
Wiki: : http://www.orangepi.org/Docs/mainpage.html

Test results

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
dunfell (3.1) :test_works: :test_works:
zeus (3.0) :test_works: :test_works:
thud (2.6) :test_works: :test_works:1
sumo (2.5) :test_works: :test_works:

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

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

mkdir mender-orangepi && cd mender-orangepi

Initialize repo manifest:

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

Fetch layers in manifest:

repo sync

Setup build environment

Initialize the build environment:

source setup-environment sunxi

Building the image

You can now proceed with building an image:

MACHINE=orange-pi-zero 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/orange-pi-zero/core-image-base-orange-pi-zero.sdimg
  • tmp/deploy/images/orange-pi-zero/core-image-base-orange-pi-zero.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 only in Standalone deployments.

References

  • The Mender integration layer for OrangePi PC Plus and template files can be found in meta-mender-community.

Known issues

  • The default Linux kernel image format ( uImage ) set in meta-sunxi for OrangePi PC Plus does not boot, this might apply to other boards as well. Therefore there is an entry local.conf that changes the Linux kernel image format to zImage

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

Someone tried this project?
It really works with orange pi zero?

@franz.geiser welcome to community. Yes mender should work on OPI zero.

Tested, orange-pi-zero works with the thud version.

Thank you @MarekBelisko.

1 Like

It works well if you bitbake from Ubuntu but i could not do the same from fedora.

1 Like

Tested with warrior, it works from Ubuntu.

1 Like

Tested with dunfell on Ubuntu 18.04, it works.

2 Likes

Hello,
I am facing an error while building the first image (core-image-base) using the “dunfell” branch.
Is this the right place to track this or it is better to use the meta-sunxi github repo?

Down below the error message I am getting:


ERROR: u-boot-1_2020.01-r0 do_patch: Command Error: ‘quilt --quiltrc /yocto-opizero/yocto_mender_workspace/opizero-mender/build/tmp/work/orange_pi_zero-poky-linux-gnueabi/u-boot/1_2020.01-r0/recipe-sysroot-native/etc/quiltrc push’ exited with 0 Output:
Applying patch 0003-Revert-sunxi-psci-avoid-error-address-of-packed-memb.patch
patching file arch/arm/cpu/armv7/sunxi/psci.c
Hunk #1 FAILED at 75.
Hunk #2 FAILED at 90.
Hunk #3 FAILED at 99.
3 out of 3 hunks FAILED – rejects in file arch/arm/cpu/armv7/sunxi/psci.c
Patch 0003-Revert-sunxi-psci-avoid-error-address-of-packed-memb.patch can be reverse-applied
ERROR: Logfile of failure stored in: /yocto-opizero/yocto_mender_workspace/opizero-mender/build/tmp/work/orange_pi_zero-poky-linux-gnueabi/u-boot/1_2020.01-r0/temp/log.do_patch.815528
ERROR: Task (/yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/poky/meta/recipes-bsp/u-boot/u-boot_2020.01.bb:do_patch) failed with exit code ‘1’


Thanks!
RJ

Hi @ipiazza welcome to Mender hub.

The patch that is failing is not one of Mender’s patches so you are probably better off working with the meta-sunxi folks on this. My guess is that that revert is no longer needed because it has likely already been merged into the upstream.

Drew

hello Drew,
thanks for the welcome and the fast answer.
I’ll work with the meta-sunxi team. What’s strange is that I was able to build a core-image-base successfully just with yocto for the dunfell branch. Then, when I tried to integrate mender I started to see that…

I’ll see what the meta-sunxi team says.

Cheers,
~Ivan

Well, depending on the layer priorities, perhaps the Mender patches are being applied before the meta-sunxi patches. In that case it would not be surprising to see patch failures.

What does bitbake-layers show-layers return?

Drew

below the output of bitbake-layers show-layers:
NOTE: Starting bitbake server…
layer path priority
==========================================================================
meta /yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/poky/meta 5
meta-poky /yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/poky/meta-poky 5
meta-yocto-bsp /yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/poky/meta-yocto-bsp 5
meta-oe /yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/meta-openembedded/meta-oe 6
meta-sunxi /yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/meta-sunxi 10
meta-python /yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/meta-openembedded/meta-python 7
meta-networking /yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/meta-openembedded/meta-networking 5
meta-multimedia /yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/meta-openembedded/meta-multimedia 6
meta-tensorflow-lite /yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/meta-tensorflow-lite 6
meta-mender-core /yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/meta-mender/meta-mender-core 6
meta-mender-demo /yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/meta-mender/meta-mender-demo 10
meta-mender-sunxi /yocto-opizero/yocto_mender_workspace/opizero-mender/build/…/sources/meta-mender-community/meta-mender-sunxi 11


Shall I set a different priority of those layers to build the meta-sunxi before the mender ones?

Thanks!
RJ

It’s certainly worth a try.

The ultimate fix may be to create sunxi-specific versions of the Mender patches that would be stored in meta-mender-sunxi since it is already of lower priority.

Drew

@ipiazza I’m meta-sunxi co-maintainer and I took patch from meta-mendr-community to meta-sunxi and post PR to meta-mender-community last week: meta-mender-sunxi: u-boot: Drop patch by nandra · Pull Request #222 · mendersoftware/meta-mender-community · GitHub but no response yet ;). @mirzak ping.

Patch was taken because logically it fix booting for opi-zero so it should be in meta-sunxi.
Thanks;

@MarekBelisko thanks so much for the reply! While waiting for the pull request to be merged I updated my local repository with the change you suggested and I am now re-building.
I’ll update you once done!
Have a nice one :wink:

@MarekBelisko I didn’t realize you were part of meta-sunxi; that’s great.

@ipiazza will you post a comment in the PR with your test results?

Drew

1 Like

Yes for sure! I’ll put a comment to the PR, though I am still facing issues even if somewhere else this time :frowning:
The patch stuff is sorted but I get an error at do_image_sunxi_sdimg.
Here the output of the bitbake command.
I tried setting the variable MENDER_STORAGE_TOTAL_SIZE_MB to “2048” and “2000” but it failed anyway.

Thanks!
RJ

Error is this:

mkfs.vfat: Label can be no longer than 11 characters

as workaround you can set:
BOOTDD_VOLUME_ID = "boot" in local.conf and it should work then. Seems some recent change in poky dunfell introduce this issue.

Cool, thanks!
I successfully built the image. Thanks for the help!
I will comment the PR adding my data points.

Cheers,
RJ

Hi again folks!
I am here with another boot issue I am seeking for help to solve: Wrong Image Format for bootm command.
Last time I successfully ended up the core-image-base build but I didn’t the image immediately.
Today I did and I am getting the following:

## === UART screen output ===
U-Boot SPL 2020.01-g303f8fe (Jan 06 2020 - 20:56:31 +0000)
DRAM: 512 MiB
Trying to boot from MMC1


U-Boot 2020.01-g303f8fe (Jan 06 2020 - 20:56:31 +0000) Allwinner Technology

CPU:   Allwinner H3 (SUN8I 1680)
Model: Xunlong Orange Pi Zero
DRAM:  512 MiB
MMC:   mmc@1c0f000: 0, mmc@1c10000: 1
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   phy interface0
eth0: ethernet@1c30000
starting USB...
Bus usb@1c1a000: USB EHCI 1.00
Bus usb@1c1a400: USB OHCI 1.0
Bus usb@1c1b000: USB EHCI 1.00
Bus usb@1c1b400: USB OHCI 1.0
scanning bus usb@1c1a000 for devices... 1 USB Device(s) found
scanning bus usb@1c1a400 for devices... 1 USB Device(s) found
scanning bus usb@1c1b000 for devices... 1 USB Device(s) found
scanning bus usb@1c1b400 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
714 bytes read in 2 ms (348.6 KiB/s)
\#\# Executing script at 43100000
Wrong Image Format for bootm command
ERROR: can't get kernel image!
SCRIPT FAILED: continuing...

Device 0: unknown device
_sun8i_emac_eth_init: Timeout
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/01-02-42-27-b5-83-44
ethernet@1c30000 Waiting for PHY auto negotiation to complete... 
## === End of UART screen output ===

I tried to use the same workaround for the OrangePi Plus by setting the kernel image to zImage but it didn’t help.
Down below the details of my bblayers.conf and local.conf with stripped out comments.

## === bblayers.conf ===
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
  ${TOPDIR}/../sources/poky/meta \
  ${TOPDIR}/../sources/poky/meta-poky \
  ${TOPDIR}/../sources/poky/meta-yocto-bsp \
  ${TOPDIR}/../sources/meta-openembedded/meta-oe \
  ${TOPDIR}/../sources/meta-openembedded/meta-python \
  ${TOPDIR}/../sources/meta-openembedded/meta-networking \
  ${TOPDIR}/../sources/meta-openembedded/meta-multimedia \
  ${TOPDIR}/../sources/meta-tensorflow-lite \
  ${TOPDIR}/../sources/meta-sunxi \
  ${TOPDIR}/../sources/meta-mender/meta-mender-core \
  ${TOPDIR}/../sources/meta-mender/meta-mender-demo \
  ${TOPDIR}/../sources/meta-mender-community/meta-mender-sunxi \
"
## === End of bblayers.conf ===
## === local.conf ===
DISTRO ?= "poky"
PACKAGE_CLASSES ?= "package_ipk"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
    STOPTASKS,${TMPDIR},1G,100K \
    STOPTASKS,${DL_DIR},1G,100K \
    STOPTASKS,${SSTATE_DIR},1G,100K \
    STOPTASKS,/tmp,100M,100K \
    ABORT,${TMPDIR},100M,1K \
    ABORT,${DL_DIR},100M,1K \
    ABORT,${SSTATE_DIR},100M,1K \
    ABORT,/tmp,10M,1K"
PACKAGECONFIG_append_pn-qemu-system-native = " sdl"
CONF_VERSION = "1"
MENDER_ARTIFACT_NAME = "release-1"
INHERIT += "mender-full"
DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
MACHINE ?= "orange-pi-zero"
IMAGE_INSTALL_append = " kernel-image kernel-devicetree"
KERNEL_IMAGETYPE ?= "zImage"
IMAGE_BOOT_FILES = "boot.scr"
MENDER_IMAGE_BOOTLOADER_FILE="u-boot-sunxi-with-spl.bin"
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET="16"
MENDER_STORAGE_DEVICE_nanopi-m1-plus = "/dev/mmcblk1"
MENDER_UBOOT_STORAGE_DEVICE_nanopi-m1-plus = "0"
MENDER_STORAGE_TOTAL_SIZE_MB = "2048"
BOOTDD_VOLUME_ID = "opi0-boot"
MENDER_FEATURES_ENABLE_append = " mender-uboot mender-image-sd"
MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"
CONF_VERSION = "1"
DEFAULTTUNE = "cortexa7hf-neon-vfpv4"
BB_NUMBER_THREADS = "32"
PARALLEL_MAKE = "-j 32"
CORE_IMAGE_EXTRA_INSTALL += "xradio dropbear htop opencv python3-opencv python3 python3-tensorflow-lite python3-pillow"
## === End of local.conf ===

the repo has been updated to the latest available and I ran again the MACHINE=orange-pi-zero bitbake core-image-minimal, both with core-image-minimal and core-image-base but the result doesn’t change.

Any help sorting it out will be greatly appreciated.

Thanks!