i.MX8M Nano Evk/Kirkstone - Missing uboot.env Error

Hi,

I’m new to Yocto/Mender and I’m working with the imx8mnevk board. I’ve followed the guide (for Zeus), but attempting to get it to work with Kirkstone. I’ve added mender-setup-imx.bbclass, from the Zeus branch, and updated it to the newer syntax. It built without error, but didn’t have any images of use (that I was aware of). Using the Pi before, I added the following:

MENDER_FEATURES_ENABLE:append = "mender-uboot mender-image-sd"
MENDER_FEATURES_DISABLE:append = "mender-grub mender-image-uefi"

I get the following error:

ERROR: core-image-base-1.0-r0 do_image_sdimg: ExecutionError('/home/chance/mender-imx/build/tmp/work/imx8mnevk-poky-linux/core-image-base/1.0-r0/temp/run.do_image_sdimg.1887472', 1, None, None)
ERROR: Logfile of failure stored in: /home/chance/mender-imx/build/tmp/work/imx8mnevk-poky-linux/core-image-base/1.0-r0/temp/log.do_image_sdimg.1887472
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are ['virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-extended/pigz/pigz_2.7.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-devtools/makedevs/makedevs_1.0.1.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb:do_populate_sysroot', '/home/chance/mender-imx/sources/meta-imx/meta-bsp/recipes-fsl/mcore-demos/imx-m7-demos_2.11.1.bb:do_populate_sysroot', '/home/chance/mender-imx/sources/meta-freescale/recipes-bsp/imx-mkimage/imx-boot_1.0.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-devtools/fdisk/gptfdisk_1.0.8.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-devtools/mtools/mtools_4.0.38.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-devtools/dpkg/dpkg_1.21.4.bb:do_populate_sysroot', '/home/chance/mender-imx/sources/poky/meta/recipes-core/glibc/cross-localedef-native_2.35.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-extended/pbzip2/pbzip2_1.1.13.bb:do_populate_sysroot', '/home/chance/mender-imx/sources/poky/meta/recipes-core/meta/wic-tools.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-devtools/apt/apt_2.4.4.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-core/coreutils/coreutils_9.0.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot', '/home/chance/mender-imx/sources/meta-imx/meta-bsp/recipes-bsp/u-boot/u-boot-imx_2022.04.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-devtools/dosfstools/dosfstools_4.2.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-support/bmap-tools/bmap-tools_git.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-devtools/opkg-utils/opkg-utils_0.5.0.bb:do_populate_sysroot', '/home/chance/mender-imx/sources/poky/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb:do_populate_sysroot', '/home/chance/mender-imx/sources/poky/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb:do_populate_sysroot', '/home/chance/mender-imx/sources/poky/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/poky/meta/recipes-extended/parted/parted_3.4.bb:do_populate_sysroot', 'virtual:native:/home/chance/mender-imx/sources/meta-mender/meta-mender-core/recipes-mender/mender-artifact/mender-artifact_3.9.0.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: []
| NOTE: Skipping as already exists in sysroot: ['pigz-native', 'makedevs-native', 'e2fsprogs-native', 'imx-m7-demos', 'imx-boot', 'gptfdisk-native', 'mtools-native', 'dpkg-native', 'cross-localedef-native', 'pbzip2-native', 'wic-tools', 'apt-native', 'coreutils-native', 'update-rc.d-native', 'pseudo-native', 'u-boot-imx', 'dosfstools-native', 'bmap-tools-native', 'opkg-utils-native', 'depmodwrapper-cross', 'qemuwrapper-cross', 'ldconfig-native', 'parted-native', 'mender-artifact-native', 'zlib-native', 'shadow-native', 'systemd-systemctl-native', 'attr-native', 'texinfo-dummy-native', 'gettext-minimal-native', 'libtool-native', 'util-linux-native', 'glibc', 'gcc-runtime', 'shared-mime-info-native', 'ncurses-native', 'popt-native', 'xz-native', 'gettext-native', 'perl-native', 'bzip2-native', 'kmod-native', 'qemu-native', 'grub-efi', 'systemd-boot', 'xxhash-native', 'lz4-native', 'gnutls-native', 'db-native', 'libgcrypt-native', 'cmake-native', 'python3-six-native', 'python3-native', 'python3-wheel-native', 'python3-installer-native', 'python3-setuptools-native', 'openssl-native', 'debianutils-native', 'readline-native', 'go-binary-native', 'util-linux-libuuid-native', 'libpcre2-native', 'libcap-ng-native', 'linux-libc-headers', 'libgcc', 'libxml2-native', 'glib-2.0-native', 'itstool-native', 'gdbm-native', 'libcap', 'gnu-efi', 'util-linux', 'nettle-native', 'libidn2-native', 'gmp-native', 'libunistring-native', 'p11-kit-native', 'libcap-native', 'libgpg-error-native', 'curl-native', 'zstd-native', 'libffi-native', 'sqlite3-native', 'libtirpc-native', 'libnsl2-native', 'python3-flit-core-native', 'unzip-native', 'libpcre-native', 'libpam', 'zlib', 'ncurses', 'util-linux-libuuid', 'bash-completion', 'libcap-ng', 'libxcrypt', 'opkg-utils', 'libtasn1-native', 'cracklib', 'flex']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing python function prepare_excluded_directories
| DEBUG: 'IMAGE_ROOTFS_EXCLUDE_PATH' is set but 'respect_exclude_path' variable flag is 0 for this image type, so ignoring it
| DEBUG: Python function prepare_excluded_directories finished
| DEBUG: Executing python function set_image_size
| DEBUG: 272532.000000 = 272532 * 1.000000
| DEBUG: 1982464.000000 = max(272532.000000, 1982464)[1982464.000000] + 0
| DEBUG: 1982464.000000 = int(1982464.000000)
| DEBUG: 1982464 = aligned(1982464)
| DEBUG: returning 1982464
| DEBUG: Python function set_image_size finished
| DEBUG: Executing shell function do_image_sdimg
| + mkdir -p /home/chance/mender-imx/build/tmp/work/imx8mnevk-poky-linux/core-image-base/1.0-r0
| + true
| + install -m 0644 /home/chance/mender-imx/build/tmp/deploy/images/imx8mnevk/uboot.env /home/chance/mender-imx/build/tmp/work/imx8mnevk-poky-linux/core-image-base/1.0-r0/
| install: cannot stat '/home/chance/mender-imx/build/tmp/deploy/images/imx8mnevk/uboot.env': No such file or directory
| + bb_sh_exit_handler
| + ret=1
| + [ 1 != 0 ]
| + echo WARNING: exit code 1 from a shell command.
| + exit 1
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/chance/mender-imx/sources/poky/meta/recipes-core/images/core-image-base.bb:do_image_sdimg) failed with exit code '1'

I just wanted to see if someone with more experience had any thoughts/ideas on where I am going wrong. Thanks!

Hi @chance,

Thanks for reaching out! For getting started with the more generic iMX8-stuff, I would suggest to have a good look at the contributed board integrations in [meta-mender-community[(meta-mender-community/meta-mender-nxp at kirkstone · mendersoftware/meta-mender-community · GitHub). You might need minor additions to your local.conf that reflect the board specifics, which probably includes the location of the u-boot environment. Starting out with a zeus setup and forwarding is probably problematic. Is this specific board supported there?

Plus, pinging @texierp as our iMX8 mastermind. :+1:

Greetz,
Josef

2 Likes

Hi @chance

Do you mean that you have followed this guide ?

2 Likes

Hi,

Thanks for the replies! I was able to build and boot cleanly (using UUU and uefiimg) and the board is now showing up as a pending device. There was some issues with the variable names that were appended to local.conf, such as MENDER_STORAGE_DEVICE_imx8mnevk needing to be just MENDER_STORAGE_DEVICE.

The only Mender Feature change was:
MENDER_FEATURES_DISABLE:append = " mender-grub"

I instead used:
UBOOT_CONFIG = "sd"

@TheYoctoJester this specific board is not supported there, but there are some other that use the processor that I’ll take a look at, as I want to better understand how it works.

@texierp That is the guide I followed.

Thanks,
Chance

Hey @chance,

Thats great, congratulations! Two minor things:
MENDER_STORAGE_DEVICE instead of MENDER_STORAGE_DEVICE_imx8mnevk might work for you, but would break other boards. According to the new syntax, it should be MENDER_STORAGE_DEVICE:imx8mnevk according to the new override syntax - assuming that your MACHINE is imx8mnevk

The other one: can you provide the final required settings for the board to work? Then we can put those into meta-mender-community for helping the next users.:+1:

Greetz,
Josef

Ahh that make sense. I caught some of the old syntax when bringing over meta-mender-imx (from zeus branch), but I’m realizing I need to read up on the new syntax more. Perhaps that is related to some of the other issues I was seeing when attempting to add in the other Mender features. I’ll check/update and try again.

Here is my current local.conf (with less comments):

MACHINE ??= 'imx8mnevk'
DISTRO ?= 'fsl-imx-xwayland'
PACKAGE_CLASSES ?= 'package_rpm'
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"

# Appended fragment from meta-mender-community/templates

INHERIT += "rm_work"

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

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

MENDER_STORAGE_TOTAL_SIZE_MB = "4096"
MENDER_BOOT_PART_SIZE_MB = "64"
# MENDER_DATA_PART_SIZE_MB = "1024"
# MENDER_STORAGE_DEVICE = "/dev/mmcblk0"
# MENDER_BOOT_PART = "${MENDER_STORAGE_DEVICE_BASE}1"
# MENDER_DATA_PART = "${MENDER_STORAGE_DEVICE_BASE}4"
# MENDER_ROOTFS_PART_A = "${MENDER_STORAGE_DEVICE_BASE}2"
# MENDER_ROOTFS_PART_B = "${MENDER_STORAGE_DEVICE_BASE}3"

# Appended fragment from meta-mender-community/meta-mender-imx/templates
IMAGE_CLASSES += "mender-setup-imx"

# Manually Added
#MENDER_FEATURES_ENABLE:append = " mender-uboot"
MENDER_FEATURES_DISABLE:append = " mender-grub"
IMAGE_FSTYPES:append = " sdimg"
UBOOT_CONFIG = "sd"
ARTIFACTIMG_FSTYPE = "ext4"
MENDER_STORAGE_DEVICE = "/dev/mmcblk2"

Let me know if you need anything else!

If It helps @chance, you can use the following script to add new override syntax to existing bitbake metadata.

[0] - convert-overrides.py « contrib « scripts - poky - Poky Build Tool and Metadata

1 Like

Thanks @texierp!

Hi @chance,

thanks, the local.conf looks pretty nice already. So did you actually need to bring over meta-mender-imx? What parts of it are really in use? Plus, which layers? If there is no secret sauce involved, or you are able to build for one time without, can you maybe also dump the layer “manifest” thing that bitbake gives you upon startup?

I’m just trying to collect all the necessary information for being able to reproduce the build :slight_smile:

Greetz,
Josef

Hi @TheYoctoJester,

Here are the steps I followed:

  1. Followed the existing guide but using Kirkstone.

  2. Copied meta-mender-imx (Zeus branch) into mender-imx/sourcesmeta-mender-community (Kirkstone) and fixed remove/append/prepend syntax.

  3. Copied mender-setup-imx.bbclass (Zeus branch) into mender-imx/sources/poky/meta/classes and fixed append/remove syntax.

  4. Modified local.conf.

I don’t think a lot of meta-mender-imx was used as it was using the old syntax for board specific variables (*_imx8mnevk). I’m realizing I had a bit of luck with it working.

Fixing the syntax for the board specific variables in mender-setup-imx.bbclass and it no longer worked at start up, with the following error:


switch to partitions #0, OK
mmc2(part 0) is current device
flash target is MMC:2
Net:   eth0: ethernet@30be0000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot:  0 
starting USB...
Bus usb@32e40000: Port not available.
USB is stopped. Please issue 'usb start' first.
MMC: no card present
switch to partitions #0, OK
mmc2(part 0) is current device
Scanning mmc 2:1...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
MMC: no card present
Scanning disk mmc@30b50000.blk...
Disk mmc@30b50000.blk not ready
Scanning disk mmc@30b60000.blk...
Found 5 disks
Unable to open OP-TEE session (err=-5)
mm_communicate failed!
Error: Cannot initialize UEFI sub-system, r = 3
Running BSP bootcmd ...
switch to partitions #0, OK
mmc2(part 0) is current device
Failed to load 'boot.scr'
Failed to load 'Image'
Booting from net ...
ethernet@30be0000 Waiting for PHY auto negotiation to complete...

Here’s the output from Bitbake at the start of the build:

Build Configuration:
BB_VERSION           = "2.0.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "imx8mnevk"
DISTRO               = "fsl-imx-xwayland"
DISTRO_VERSION       = "5.15-kirkstone"
TUNE_FEATURES        = "aarch64 armv8a crc crypto"
TARGET_FPU           = ""
meta                 
meta-poky            = "HEAD:27de52e402ae000dfa502d52908cd6e6aef923ec"
meta-oe              
meta-multimedia      
meta-python          = "HEAD:5357c7a40eaf8d1bcf7ff58edbba8e9527e40c7d"
meta-freescale       = "HEAD:2fb1ce365338126aad365012ebb913b3e4a9f1be"
meta-freescale-3rdparty = "HEAD:de0eb1408150d77f9cce97c559f9a5a3c71e5d6c"
meta-freescale-distro = "HEAD:fc15f5003043da23212596be7366ae2547c308ad"
meta-bsp             
meta-sdk             
meta-ml              
meta-v2x             = "HEAD:5bc708f56575a878da17f2148e959c95d06cf8db"
meta-nxp-demo-experience = "HEAD:8fade3993b832ecd823771644f2a7b731f8f4527"
meta-chromium        = "HEAD:d25d8ee98a656b2534d0eec6138ef264529fab4f"
meta-clang           = "HEAD:85d956d95401479ca666139e31f662f60c156d5f"
meta-gnome           
meta-networking      
meta-filesystems     = "HEAD:5357c7a40eaf8d1bcf7ff58edbba8e9527e40c7d"
meta-qt6             = "HEAD:b2894aad5c1aaa85f2f5c7b94391b7c51c39e555"
meta-virtualization  = "HEAD:973c8d0964c6f40338857efe5b8009b2f647d485"
meta-mender-imx      = "HEAD:79ad554631c6bf1ada83e3a9a64df963e81fd94e"
meta-mender-core     
meta-mender-demo     = "HEAD:4dae33cedb677e2d801a1abd7da674360ad69de8"

Hi @chance,

that layer stack really looks strange, and quite bloated. Have you tried starting with something just like

meta                 
meta-poky
meta-oe
meta-python
meta-freescale
meta-freescale-3rdparty
meta-freescale-distro
meta-mender-core     
meta-mender-demo

and see where you end up? From what I see in meta-mender-community/meta-mender-nxp this should get you pretty close already. If at all, then look at the patches that the BoundaryDevices imx8 stuff needs on top.

Greetz,
Josef