NXP i.MX8MPlus Yocto Mender integration fails to boot

Hi everyone,

I’m building Yocto project with mender for i.MX8M Plus, using yocto scarthgap lf-6.6.36. I generated a core-image-minimal-imx8mp-lpddr4-evk.wic.zst, but the booting process failes to load with the following error:

[  OK  ] Finished Virtual Console Setup.
[  *** ] (2 of 4) A start job is running for…ave OS Random Seed (4s / 9min 59s)
[  OK  ] Finished Load/Save OS Random Seed.
[   13.791163] platform sound-bt-sco: deferred probe pending
[  *** ] (3 of 3) A start job is running for /dev/mmcblk0p4 (55s / 1min 30s)
[   60.410460] imx-sdma 30bd0000.dma-controller: Direct firmware load for imx/sdma/sdma-imx7d.bin failed with error -2
[   ***] (2 of 3) A start job is running for /dev/mmcblk0p1 (59s / 1min 30s)
[ TIME ] Timed out waiting for device /dev/mmcblk0p1.
[DEPEND] Dependency failed for File System Check on /dev/mmcblk0p1.
[DEPEND] Dependency failed for /uboot.
[DEPEND] Dependency failed for Local File Systems.
[ TIME ] Timed out waiting for device /dev/mmcblk0p4.
[DEPEND] Dependency failed for /data.
[DEPEND] Dependency failed for File System Check on /dev/mmcblk0p4.
[  OK  ] Stopped Dispatch Password Requests to Console Directory Watch.
[  OK  ] Stopped Forward Password Requests to Wall Directory Watch.
[  OK  ] Reached target Timer Units.
[  OK  ] Closed Syslog Socket.

And it enters emergency mode. These are the boot partition details:

sh-5.2# fdisk -l
Disk /dev/mmcblk2: 29 GB, 31356616704 bytes, 61243392 sectors
478464 cylinders, 4 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk2p1 *  128,0,1     1023,3,32        16384     186775     170392 83.1M  c Win95 FAT32 (LBA)
/dev/mmcblk2p2    1023,3,32   1023,3,32       196608   19813169   19616562 9578M 83 Linux
Disk /dev/mmcblk2boot0: 4 MB, 4194304 bytes, 8192 sectors
128 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Disk /dev/mmcblk2boot0 doesn't contain a valid partition table
Disk /dev/mmcblk2boot1: 4 MB, 4194304 bytes, 8192 sectors
128 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Disk /dev/mmcblk2boot1 doesn't contain a valid partition table
Disk /dev/mmcblk1: 30 GB, 31719424000 bytes, 61952000 sectors
484000 cylinders, 4 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk1p1 *  128,0,1     1023,3,32        16384     186775     170392 83.1M  c Win95 FAT32 (LBA)
/dev/mmcblk1p2    1023,3,32   1023,3,32       196608   19813169   19616562 9578M 83 Linux
sh-5.2#


sh-5.2# cat /etc/fstab
# stock fstab - you probably want to override this with a machine specific one

/dev/root            /                    auto       defaults              1  1
proc                 /proc                proc       defaults              0  0
devpts               /dev/pts             devpts     mode=0620,ptmxmode=0666,gid=5      0  0
tmpfs                /run                 tmpfs      mode=0755,nodev,nosuid,strictatime 0  0
tmpfs                /var/volatile        tmpfs      defaults              0  0

# uncomment this if your device has a SD/MMC/Transflash slot
#/dev/mmcblk0p1       /media/card          auto       defaults,sync,noauto  0  0

# Where the U-Boot environment resides; for devices with SD card support ONLY!
/dev/mmcblk0p1       /uboot               auto       defaults,sync         0  2
/dev/mmcblk0p4       /data                auto       defaults              0  2
sh-5.2#

sh-5.2# ls /uboot/ -l
total 0
sh-5.2# ls /data/ -l
total 8
drwxr-xr-x    2 root     root          4096 Jan  1 01:29 mender
drwxr-xr-x    2 root     root          4096 Mar  9  2018 u-boot
sh-5.2#

I checked the integration checklist:

sh-5.2# systemctl is-active mender-authd
inactive
sh-5.2# systemctl is-enabled mender-authd
enabled
sh-5.2# systemctl is-active mender-updated
inactive
sh-5.2# systemctl is-enabled mender-updated
enabled
sh-5.2#

I tried to generate a .sdimg image but it failes to boot, nothing happens while booting. At first it didn’t build because of the “couldn’t find uboot.env” error. I fixed it using u-boot-imx-initial-env-sd instead of uboot.env.

I cannot start mender-authd as a service.

sh-5.2# systemctl start mender-authd
You are in emergency mode. After logging in, type "journalctl -xPress Enter for maintenance
(or press Control-D to continue):

Also, it fails to start the client

sh-5.2# mender-auth daemon
record_id=1 severity=info time="1970-Jan-01 01:58:38.916505" name="Global" msg="Successfully loaded private key from /var/lib/mender/mender-agent.pem"
record_id=2 severity=error time="1970-Jan-01 01:58:38.923184" name="Global" msg="Failed to start the listen loop"
record_id=3 severity=error time="1970-Jan-01 01:58:38.923329" name="Global" msg="DBus connection error: Failed to get connection to system bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory[org.freedesktop.DBus.Error.FileNotFound]"

I am connected to the internet, if it helps with anything.

This is the local.conf file used to build the image:

MACHINE ??= 'imx8mp-lpddr4-evk'
DISTRO ?= 'fsl-imx-wayland'
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
USER_CLASSES ?= "buildstats"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
    STOPTASKS,${TMPDIR},1G,100K \
    STOPTASKS,${DL_DIR},1G,100K \
    STOPTASKS,${SSTATE_DIR},1G,100K \
    STOPTASKS,/tmp,100M,100K \
    HALT,${TMPDIR},100M,1K \
    HALT,${DL_DIR},100M,1K \
    HALT,${SSTATE_DIR},100M,1K \
    HALT,/tmp,10M,1K"
PACKAGECONFIG:append:pn-qemu-system-native = " sdl"
CONF_VERSION = "2"

DL_DIR ?= "${BSPDIR}/downloads/"
ACCEPT_FSL_EULA = "1"

# Switch to Debian packaging and include package-management in the image
PACKAGE_CLASSES = "package_deb"
EXTRA_IMAGE_FEATURES += "package-management"

MENDER_ARTIFACT_NAME = "release-1"

INHERIT += "mender-full-ubi"
MENDER_FEATURES_DISABLE:append = " mender-image-ubi mender-ubi"
MENDER_UBOOT_AUTO_CONFIGURE = "1"

MENDER_SERVER_URL = "https://hosted.mender.io"
MENDER_TENANT_TOKEN = "token"

This is the bblayers.conf file used to build the image:

LCONF_VERSION = "7"

BBPATH = "${TOPDIR}"
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"

BBFILES ?= ""
BBLAYERS = " \
  ${BSPDIR}/sources/poky/meta \
  ${BSPDIR}/sources/poky/meta-poky \
  \
  ${BSPDIR}/sources/meta-openembedded/meta-oe \
  ${BSPDIR}/sources/meta-openembedded/meta-multimedia \
  ${BSPDIR}/sources/meta-openembedded/meta-python \
  \
  ${BSPDIR}/sources/meta-freescale \
  ${BSPDIR}/sources/meta-freescale-3rdparty \
  ${BSPDIR}/sources/meta-freescale-distro \
"

# i.MX Yocto Project Release layers
BBLAYERS += "${BSPDIR}/sources/meta-imx/meta-imx-bsp"
BBLAYERS += "${BSPDIR}/sources/meta-imx/meta-imx-sdk"
BBLAYERS += "${BSPDIR}/sources/meta-imx/meta-imx-ml"
BBLAYERS += "${BSPDIR}/sources/meta-imx/meta-imx-v2x"
BBLAYERS += "${BSPDIR}/sources/meta-nxp-demo-experience"
BBLAYERS += "${BSPDIR}/sources/meta-nxp-connectivity/meta-nxp-matter-baseline"
BBLAYERS += "${BSPDIR}/sources/meta-nxp-connectivity/meta-nxp-openthread"

BBLAYERS += "${BSPDIR}/sources/meta-arm/meta-arm"
BBLAYERS += "${BSPDIR}/sources/meta-arm/meta-arm-toolchain"
BBLAYERS += "${BSPDIR}/sources/meta-clang"
BBLAYERS += "${BSPDIR}/sources/meta-openembedded/meta-gnome"
BBLAYERS += "${BSPDIR}/sources/meta-openembedded/meta-networking"
BBLAYERS += "${BSPDIR}/sources/meta-openembedded/meta-filesystems"
BBLAYERS += "${BSPDIR}/sources/meta-qt6"
BBLAYERS += "${BSPDIR}/sources/meta-security/meta-parsec"
BBLAYERS += "${BSPDIR}/sources/meta-security/meta-tpm"
BBLAYERS += "${BSPDIR}/sources/meta-virtualization"

BBLAYERS += "${BSPDIR}/sources/meta-mender/meta-mender-core/"

If anyone can take a look and help me understand what I am missing, that will be much appreciated.

Thank you!

Hi @pcarmenp1,

Thanks for reaching out! On a first glance, that build setup looks quite huge, and at the same time missing the parts which tie Mender and NXP together. Have you had a look at meta-mender-nxp already for some inspiration?
You’ll definitely need to figure out the Mender configuration so the generated .sdimg can boot, as the .wic.zst will not have the A/B integration.

Maybe @leon-anavi or @MarekBelisko can share a few pointers, having been the last to touch the NXP stuff?

Greetz,
Josef