Mender integration error (No block device) in iMX6 UL

Hi,

I’m trying to integrate Mender with iMX6UL EVK and got errors (mmc not found) along the way. The versions I’m currently trying are,

  • Yocto - Warrior from https://source.codeaurora.org/external/imx/imx-manifest/tree/?h=imx-linux-warrior
  • Mender - 2.3.1 from https://github.com/mendersoftware/meta-mender/tree/warrior

NOTE: Error log - https://github.com/danie007/imx6/blob/master/imx_build_warrior19052020.txt

And my local.conf is as follows,

# IP of local server
MENDER_DEMO_HOST_IP_ADDRESS = "192.168.1.6"

MENDER_STORAGE_DEVICE = "/dev/mmcblk1"
# MENDER_STORAGE_TOTAL_SIZE_MB = "7416"

MENDER_ARTIFACT_NAME = "release-1"

MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET = "2"
MENDER_IMAGE_BOOTLOADER_FILE = "u-boot.imx"

INHERIT += "mender-full"
MENDER_FEATURES_ENABLE_append = " mender-uboot mender-image-sd"

MENDER_FEATURES_DISABLE_append = " mender-growfs-data"
MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"

MACHINE ??= 'imx6ulevk'
DISTRO ?= 'fslc-xwayland'
PACKAGE_CLASSES ?= 'package_rpm'
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"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
CONF_VERSION = "1"

DL_DIR ?= "/home/ux/.yocto/warrior/downloads/"
ACCEPT_FSL_EULA = "1"

The file changes are,

  1. u-boot-fslc_2019.07.bb
require recipes-bsp/u-boot/u-boot-mender.inc
RPROVIDES_${PN} += "u-boot"
  1. u-boot-fslc_2019.07.bbappend
do_compile_append() {
    if [ -n "${UBOOT_CONFIG}" ]
    then
        unset i j
        for config in ${UBOOT_MACHINE}; do
            i=$(expr $i + 1);
            for type in ${UBOOT_CONFIG}; do
                j=$(expr $j + 1);
                if [ $j -eq $i ]
                then
                    dd if="${B}/${config}/SPL" of="${B}/${config}/u-boot-${type}.imx"
                    dd if="${B}/${config}/u-boot.img" of="${B}/${config}/u-boot-${type}.imx" obs=1K seek=68
                fi
            done
            unset  j
        done
        unset  i
    else
        dd if="${B}/SPL" of="${B}/u-boot.imx"
        dd if="${B}/u-boot.img" of="${B}/u-boot.imx" obs=1K seek=68
    fi

}



do_deploy_append () {
    if [ -n "${UBOOT_CONFIG}" ]
    then
        for config in ${UBOOT_MACHINE}; do
            i=$(expr $i + 1);
            for type in ${UBOOT_CONFIG}; do
                j=$(expr $j + 1);
                if [ $j -eq $i ]
                then
                    install -d ${DEPLOYDIR}
                    install -m 644 ${B}/${config}/u-boot-${type}.imx ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.imx
                    cd ${DEPLOYDIR}
                    ln -sf u-boot-${type}-${PV}-${PR}.imx u-boot-${type}.imx
                    ln -sf u-boot-${type}-${PV}-${PR}.imx u-boot.imx
                fi
            done
            unset  j
        done
        unset  i
    else
        install -d ${DEPLOYDIR}
        install -m 644 ${B}/u-boot.imx ${DEPLOYDIR}/u-boot-${PV}-${PR}.imx
        cd ${DEPLOYDIR}
        rm -f u-boot*.imx
        ln -sf u-boot-${PV}-${PR}.imx u-boot.imx

   fi

}

It would be grateful if you could,

  • Guide me with your build versions and patches so that I’ll try the tested version
  • Provide some steps to start with
  • Warn me about the pitfalls

Looking forward for helping hands, thanks in advance.

Hm, it does not seem that the interface number is correct in U-Boot compared to what you set in your local.conf:

MENDER_STORAGE_DEVICE = "/dev/mmcblk1"

Above should result in e.g:

mender_uboot_boot=mmc 1:1

setenv mender_boot_part_name /dev/mmcblk1p3

But in your log it says:

mender_uboot_boot=mmc 0:1
setenv mender_boot_part_name /dev/mmcblk0p3

So there is some misalignment on what is running on the device and what is specified in the local configuration which I would investigate.

To break it down a bit the following should work as a first step (if you halt U-Boot):

run mender_setup; 
load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; 
load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name};

Above should resolve to (based on what you have in your local.conf):

load mmc 1:2 ${fdt_addr_r} /boot/imx6ul-14x14-evk-emmc.dtb; 
load mmc 1:2 ${kernel_addr_r} /boot/zImage;

But it might be worth looking in to doing a manual integration

It’s fixed with a clean build and the reference log is at: https://github.com/danie007/imx6/blob/master/imx_build_warrior25052020.txt

Now, it’s been verified.

produces the same error as earlier, https://github.com/danie007/imx6/blob/0576bbbcdd05d215cae7c84ab4f38223878ca85c/imx_build_warrior25052020.txt#L116 and it is to be noted that kernel_addr_t returns NULL

=> echo ${kernel _addr_r}

=> 

Thanks for your reply and we’re already following the manual integration steps and continue looking into that.

This then need to resolved to have a valid value. Probably it should be the same as loadaddr

Thanks for the reply. I got it resolved by entering the following commands in the u-boot prompt,

=> setenv kernel_addr_r 0x82000000
=> saveenv
=> run mender_setup; load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name};
=> bootd

In our case loadaddr is 0x82000000 and I got it from the normal u-boot environment.

Currently I’m setting the value of kernel_addr_r in the uboot prompt as given here:

Can you give a solution to include this in runtime in Yocto project?

Hi @danie, take a look at the MENDER_ UBOOT_PRE_SETUP_COMMANDS.

We have to make a similar change for the Variscite boards here.

Drew

Thanks @drewmoseley for the reply!

I found this at sources/meta-mender/meta-mender-core/recipes-bsp/u-boot/u-boot-common.inc and so added the following here:

    MENDER_UBOOT_PRE_SETUP_COMMANDS = " \
        setenv kernel_addr_r \${loadaddr}; \
        setenv clear_tmp ${clear_tmp_arg}; \
        setenv bootcmd ${bootcmd_arg}; \
    "

But when I try to build with this conf, I encounter the following error: (do_provide_mender_defines.16112: MENDER_UBOOT_PRE_SETUP_COMMANDS: not found)

+ MENDER_UBOOT_PRE_SETUP_COMMANDS =          setenv kernel_addr_r ${loadaddr};         setenv clear_tmp setenv board_name; setenv board_rev; setenv boot_count; setenv bootargs; setenv fdtcontroladdr; setenv fileaddr; setenv filesize;         setenv bootcmd run clear_tmp; setenv bootcount 0; run mender_setup; setenv bootargs root=${mender_kernel_root} ${bootargs}; if test "${fdt_addr_r}" != ""; then load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; fi; load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name}; ${mender_boot_kernel_type} ${kernel_addr_r} - ${fdt_addr_r}; run mender_try_to_recover;     
/home/ux/warrior_yocto/mender_build/tmp/work/imx6ulevk-fslc-linux-gnueabi/u-boot-fslc/v2019.07+gitAUTOINC+ca0ab15271-r0/temp/run.do_provide_mender_defines.16112: 194: /home/ux/warrior_yocto/mender_build/tmp/work/imx6ulevk-fslc-linux-gnueabi/u-boot-fslc/v2019.07+gitAUTOINC+ca0ab15271-r0/temp/run.do_provide_mender_defines.16112: MENDER_UBOOT_PRE_SETUP_COMMANDS: not found
+ bb_exit_handler
+ ret=127
+ echo WARNING: exit code 127 from a shell command.
WARNING: exit code 127 from a shell command.
+ exit 127
ERROR: Function failed: do_provide_mender_defines (log file is located at /home/ux/warrior_yocto/mender_build/tmp/work/imx6ulevk-fslc-linux-gnueabi/u-boot-fslc/v2019.07+gitAUTOINC+ca0ab15271-r0/temp/log.do_provide_mender_defines.16112)

Can you bit be more specific on adding UBOOT_PRE_SETUP_COMMANDS??

I’m not sure but you may need to quote the ‘$’ characters on clear_tmp_arg and bootcmd_arg.

I got it resolved. It is a problem with MENDER_UBOOT_PRE_SETUP_COMMANDS so I changed the variable as following, (omitting the unnecessary)

    MENDER_UBOOT_PRE_SETUP_COMMANDS = "setenv kernel_addr_r \${loadaddr}"

Thanks @drewmoseley for your time.

1 Like