I.MX8M SoM Yocto U-Boot fw_printenv fw_setenv

I am using the Yocto ( Kirkstone ) meta-solidrun-arm-imx8 layer to successfully build for the I.MX8M Plus SoM.

I need to access and set the U-Boot environment from Linux user space and so I need the fw_printenv and fw_setenv binaries.

For other boards, I am able to do that with the following recipe. However, when I try here I get the following error:

| *** Can’t find default configuration “arch/…/configs/imx8mp_solidrun_defconfig”!

How can I get fw_printenv and fw_setenv with meta-solidrun-arm-imx8? Thanks.

require u-boot-sensonix-common.inc

SUMMARY = "U-Boot bootloader fw_printenv/setenv utilities"
DEPENDS = "mtd-utils bison-native"

EXTRA_OEMAKE_class-target = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
EXTRA_OEMAKE_class-cross = 'ARCH=${TARGET_ARCH} CC="${CC} ${CFLAGS} ${LDFLAGS}" STRIP=true V=1'

inherit uboot-config

do_compile () {
    oe_runmake ${UBOOT_MACHINE}
    oe_runmake envtools
}

do_install () {
    install -d ${D}${base_sbindir}
    install -d ${D}${sysconfdir}
    install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_printenv
    install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv

    #install -m 0644 ${S}/tools/env/fw_env.config ${D}${sysconfdir}/fw_env.config
	echo -e "/boot/uboot.env        0x0000          0x4000" > ${D}${sysconfdir}/fw_env.config
}

do_install_class-cross () {
    install -d ${D}${bindir_cross}
    install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_printenv
    install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_setenv
}

SYSROOT_PREPROCESS_FUNCS_class-cross = "uboot_fw_utils_cross"
uboot_fw_utils_cross() {
    sysroot_stage_dir ${D}${bindir_cross} ${SYSROOT_DESTDIR}${bindir_cross}
}

PROVIDES += "u-boot-fw-utils"
RPROVIDES_${PN} += "u-boot-fw-utils"

PACKAGE_ARCH = "${MACHINE_ARCH}"
BBCLASSEXTEND = "cross"
inherit fsl-u-boot-localversion

LICENSE = "GPLv2+"

LIC_FILES_CHKSUM = "file://Licenses/gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263"

UBOOT_SRC ?= "git://source.codeaurora.org/external/imx/uboot-imx.git;protocol=https"

SRCBRANCH = "lf_v2021.04"

SRC_URI = "${UBOOT_SRC};branch=${SRCBRANCH} \

"

SRCREV = "1c0116f3da250c5a52858c53efb8b38c0963f477"

S = "${WORKDIR}/git"

PV_append = "+imx"

LOCALVERSION = "+imx"

Those utilities are provided by the libubootenv recipe now. There is no defconfig because we use the default imx8mp kernel config and then append it from an additional config from our meta-layer.

Thank you - that worked.

1 Like