# Mender integration error (No block device) in iMX6 UL

**URL:** <https://hub.mender.io/t/mender-integration-error-no-block-device-in-imx6-ul/1953>\
**Category:** General Discussions\
**Tags:** yocto, nxp, warrior, imx6ul-evk\
**Created:** [May 21, 2020, 12:01pm UTC](https://hub.mender.io/t/mender-integration-error-no-block-device-in-imx6-ul/1953 "2020-05-21T12:01:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![danie](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/danie/32/620_2.png) [@danie](https://hub.mender.io/u/danie)\
**Post date:** [May 21, 2020, 12:01pm UTC](https://hub.mender.io/t/mender-integration-error-no-block-device-in-imx6-ul/1953/1 "2020-05-21T12:01:19Z")

</div>

Hi,

I’m trying to integrate Mender with [iMX6UL EVK](https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/i-mx6ultralite-evaluation-kit:MCIMX6UL-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](https://github.com/danie007/imx6/blob/master/imx_build_warrior19052020.txt)

And my `local.conf` is as follows,

```auto
# 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`

```auto
require recipes-bsp/u-boot/u-boot-mender.inc
RPROVIDES_${PN} += "u-boot"

```

1. `u-boot-fslc_2019.07.bbappend`

```auto
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.

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [May 25, 2020, 8:03am UTC](https://hub.mender.io/t/mender-integration-error-no-block-device-in-imx6-ul/1953/2 "2020-05-25T08:03:02Z")

</div>

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

```auto
MENDER_STORAGE_DEVICE = "/dev/mmcblk1"

```

Above should result in e.g:

```auto
mender_uboot_boot=mmc 1:1

setenv mender_boot_part_name /dev/mmcblk1p3

```

But in your log it says:

```auto
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):

```auto
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`):

```auto
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](https://docs.mender.io/2.3/devices/yocto-project/bootloader-support/u-boot/manual-u-boot-integration)

---

<div class="post-metadata">

**Author:** ![danie](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/danie/32/620_2.png) [@danie](https://hub.mender.io/u/danie)\
**Post date:** [May 25, 2020, 8:40am UTC](https://hub.mender.io/t/mender-integration-error-no-block-device-in-imx6-ul/1953/3 "2020-05-25T08:40:25Z")

</div>

> [@mirzak](#):
>
> misalignment on what is running on the device and what is specified in the local configuration

It’s **fixed** with a clean build and the reference log is at: [https://github.com/danie007/imx6/blob/master/imx\_build\_warrior25052020.txt](https://github.com/danie007/imx6/blob/master/imx_build_warrior25052020.txt)

> [@mirzak](#):
>
> ```auto
> mender_uboot_boot=mmc 1:1
> 
> setenv mender_boot_part_name /dev/mmcblk1p3
> 
> ```

Now, **it’s been verified**.

> [@mirzak](#):
>
> `load mmc 1:2 ${kernel_addr_r} /boot/zImage;`

produces the same error as earlier, [https://github.com/danie007/imx6/blob/0576bbbcdd05d215cae7c84ab4f38223878ca85c/imx\_build\_warrior25052020.txt#L116](https://github.com/danie007/imx6/blob/0576bbbcdd05d215cae7c84ab4f38223878ca85c/imx_build_warrior25052020.txt#L116) and it is to be noted that `kernel_addr_t` returns `NULL`

```auto
=> echo ${kernel _addr_r}

=> 

```

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

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [May 25, 2020, 8:54am UTC](https://hub.mender.io/t/mender-integration-error-no-block-device-in-imx6-ul/1953/4 "2020-05-25T08:54:01Z")

</div>

> [@danie](#):
>
> it is to be noted that `kernel_addr_t` returns `NULL`

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

---

<div class="post-metadata">

**Author:** ![danie](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/danie/32/620_2.png) [@danie](https://hub.mender.io/u/danie)\
**Post date:** [May 25, 2020, 9:11am UTC](https://hub.mender.io/t/mender-integration-error-no-block-device-in-imx6-ul/1953/5 "2020-05-25T09:11:34Z")

</div>

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

```auto
=> 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

```

> [@mirzak](#):
>
> loadaddr

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

---

<div class="post-metadata">

**Author:** ![danie](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/danie/32/620_2.png) [@danie](https://hub.mender.io/u/danie)\
**Post date:** [May 26, 2020, 9:54am UTC](https://hub.mender.io/t/mender-integration-error-no-block-device-in-imx6-ul/1953/6 "2020-05-26T09:54:51Z")

</div>

> [@mirzak](#):
>
> This then need to resolved to have a valid value. Probably it should be the same as `loadaddr`

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

> [@danie](#):
>
> `=> setenv kernel_addr_r 0x82000000`

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

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [May 26, 2020, 2:15pm UTC](https://hub.mender.io/t/mender-integration-error-no-block-device-in-imx6-ul/1953/7 "2020-05-26T14:15:07Z")

</div>

Hi @danie, take a look at the MENDER\_ UBOOT\_PRE\_SETUP\_COMMANDS.

We have to make a similar change for the [Variscite boards here](https://github.com/mendersoftware/meta-mender-community/blob/82ea06bbf0b4172c6c8c9c699950b1573379ba10/meta-mender-variscite/recipes-bsp/u-boot/u-boot-variscite-mender-common.inc#L56).

Drew

---

<div class="post-metadata">

**Author:** ![danie](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/danie/32/620_2.png) [@danie](https://hub.mender.io/u/danie)\
**Post date:** [May 27, 2020, 9:04am UTC](https://hub.mender.io/t/mender-integration-error-no-block-device-in-imx6-ul/1953/8 "2020-05-27T09:04:16Z")

</div>

Thanks @drewmoseley for the reply!

> [@drewmoseley](#):
>
> UBOOT\_PRE\_SETUP\_COMMANDS

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

```auto
    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`)

```auto
+ 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`??

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [May 27, 2020, 4:02pm UTC](https://hub.mender.io/t/mender-integration-error-no-block-device-in-imx6-ul/1953/9 "2020-05-27T16:02:53Z")

</div>

I’m not sure but you may need to quote the ‘$’ characters on clear\_tmp\_arg and bootcmd\_arg.

---

<div class="post-metadata">

**Author:** ![danie](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/danie/32/620_2.png) [@danie](https://hub.mender.io/u/danie)\
**Post date:** [May 28, 2020, 12:43pm UTC](https://hub.mender.io/t/mender-integration-error-no-block-device-in-imx6-ul/1953/10 "2020-05-28T12:43:42Z")

</div>

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

```auto
    MENDER_UBOOT_PRE_SETUP_COMMANDS = "setenv kernel_addr_r \${loadaddr}"

```

Thanks @drewmoseley for your time.
