# Mender not working in iMX6 UL

**URL:** <https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940>\
**Category:** General Discussions\
**Tags:** yocto, nxp, warrior, imx6ul-evk\
**Created:** [May 19, 2020, 8:09am UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940 "2020-05-19T08:09:09Z")\
**Posts on this page:** 14\
**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 19, 2020, 8:09am UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/1 "2020-05-19T08:09:09Z")

</div>

Hey,

I’m building Yocto project from [https://source.codeaurora.org/external/imx/imx-manifest/tree/imx-4.19.35-1.1.0.xml?h=imx-linux-warrior](https://source.codeaurora.org/external/imx/imx-manifest/tree/imx-4.19.35-1.1.0.xml?h=imx-linux-warrior) with mender for iMX 6UL EVK. Here u-boot consists of two parts (`SPL` & `u-boot.img`) and so in `local.conf` I’ve added,

```auto
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET = "2"
MENDER_IMAGE_BOOTLOADER_FILE = "SPL"
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET = "138"
MENDER_IMAGE_BOOTLOADER_FILE = "u-boot.img"

```

Now the **booting is not at all working**.

_NOTE_: If I add only,

```auto
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET = "2"
MENDER_IMAGE_BOOTLOADER_FILE = "SPL"

```

it is looping in the following,

```auto
Trying to boot from MMC1
mmc_load_image_raw_sector: mmc block read error
spl_load_image_ext: ext4fs mount err - 0

```

Any help would much be appreciated.

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [May 19, 2020, 10:01am UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/2 "2020-05-19T10:01:04Z")

</div>

For me on imx6 the full bootloader image to use is u-boot.imx rather than u-boot.img. I don’t think the u-boot.img has the IVT header in it as the img is smaller than the imx.

---

<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 19, 2020, 10:14am UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/3 "2020-05-19T10:14:07Z")

</div>

Hey @dellgreen,

Thanks for the reply.

> [@dellgreen](#):
>
> u-boot.imx

Could you please guide me through creating `.imx` in yocto project! I’m stuck with that.

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [May 19, 2020, 11:32am UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/4 "2020-05-19T11:32:08Z")

</div>

Looking back over a past project I had to add a yocto bbappend file to my uboot recipe which created the imx file manually. Below are the bitbake append functions i added

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

}
```

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [May 19, 2020, 11:39am UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/5 "2020-05-19T11:39:05Z")

</div>

its possible that using just the SPL and the uboot.img could work, but everything i tried failed, which led me to the above solution which comes from the NXP forums.

---

<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 19, 2020, 11:40am UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/6 "2020-05-19T11:40:12Z")

</div>

Thank you. I’ll your solution and let you know the results.

---

<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 19, 2020, 11:55am UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/7 "2020-05-19T11:55:16Z")

</div>

Yes the interface provided by the Mender variables typically only work if there is **one** file related to the bootloader. I think there is a task to improve this but never prioritized :).

What @dellgreen proposed is what I would recommend as well as a workaround or something like this which I did for another platform,

> <https://github.com/mendersoftware/meta-mender-community/blob/warrior/meta-mender-odroid/classes/odroid-sdimg.bbclass>

---

<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 19, 2020, 1:48pm UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/8 "2020-05-19T13:48:09Z")

</div>

Hi,

Your reply was helpful in creating `u-boot.imx` and I’ve created `.imx` file successfully. However, now it doesn’t load kernel. I edited the `local.conf` as,

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

```

The logs are attached for your reference below:

```auto
U-Boot SPL 2019.07+fslc+gca0ab15271 (May 19 2020 - 12:56:29 +0000)
Trying to boot from MMC1
hab fuse not enabled

U-Boot 2019.07+fslc+gca0ab15271 (May 19 2020 - 12:18:57 +0000)

CPU: Freescale i.MX6UL rev1.1 528 MHz (running at 396 MHz)
CPU: Industrial temperature grade (-40C to 105C) at 39C
Reset cause: POR
Model: Freescale i.MX6 UltraLite 14x14 EVK Board
Board: MX6UL 14x14 EVK
DRAM: 512 MiB
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... MMC: no card present
*** Warning - No block device, using default environment

Video: 480x272x24
In: serial
Out: serial
Err: serial
Net:   
Error: ethernet@020b4000 address not set.

Error: ethernet@020b4000 address not set.

Error: ethernet@02188000 address not set.
eth-1: ethernet@020b4000
Error: ethernet@02188000 address not set.
, eth-1: ethernet@02188000
Hit any key to stop autoboot: 0 
Saving Environment to MMC... MMC: no card present
No block device
Failed (1)
MMC: no card present
MMC: no card present
=>

```

Can you help me in this?

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [May 19, 2020, 5:58pm UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/9 "2020-05-19T17:58:36Z")

</div>

Uboot seems to be trying to work with mmc, I’m guessing your are booting from sdcard?

Also does your uboot have vender support for your evaluation board?

---

<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 20, 2020, 5:06am UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/10 "2020-05-20T05:06:21Z")

</div>

> [@dellgreen](#):
>
> I’m guessing your are booting from sdcard

Yes, we’re trying to boot from the SD card using `.sdimg`

> [@dellgreen](#):
>
> uboot have vender support for your evaluation board?

I hope you’re referring to Mender here! iMX 6UL EVK has no support for Mender and we’re currently trying to integrate manually.

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [May 20, 2020, 8:55am UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/11 "2020-05-20T08:55:30Z")

</div>

I’m more distracted as to why your uboot is trying to work with the MMC and failing. as it looks like its dropping you to a uboot shell prompt, I would use the uboot shell to inspect the uboot variables to see what the mender variables are set to for boot device.

[https://www.denx.de/wiki/publish/DULG/to-delete/UBootCmdGroupEnvironment.html](https://www.denx.de/wiki/publish/DULG/to-delete/UBootCmdGroupEnvironment.html)  
[https://docs.mender.io/1.5/devices/partition-layout](https://docs.mender.io/1.5/devices/partition-layout)

---

<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 20, 2020, 12:44pm UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/12 "2020-05-20T12:44:00Z")

</div>

> [@dellgreen](#):
>
> [The U-Boot Documentation — Das U-Boot unknown version documentation](https://www.denx.de/wiki/publish/DULG/to-delete/UBootCmdGroupEnvironment.html)

The environment variables are as follows (and the mender variables are set here),

```auto
U-Boot SPL 2019.07+fslc+gca0ab15271 (May 19 2020 - 12:56:29 +0000)
Trying to boot from MMC1
hab fuse not enabled

U-Boot 2019.07+fslc+gca0ab15271 (May 19 2020 - 12:18:57 +0000)

CPU: Freescale i.MX6UL rev1.1 528 MHz (running at 396 MHz)
CPU: Industrial temperature grade (-40C to 105C) at 39C
Reset cause: POR
Model: Freescale i.MX6 UltraLite 14x14 EVK Board
Board: MX6UL 14x14 EVK
DRAM: 512 MiB
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... MMC: no card present
*** Warning - No block device, using default environment

Video: 480x272x24
In: serial
Out: serial
Err: serial
Net:   
Error: ethernet@020b4000 address not set.

Error: ethernet@020b4000 address not set.

Error: ethernet@02188000 address not set.
eth-1: ethernet@020b4000
Error: ethernet@02188000 address not set.
, eth-1: ethernet@02188000
Hit any key to stop autoboot: 0 
=> 
=> printenv 
altbootcmd=run mender_altbootcmd; run bootcmd
baudrate=115200
board_name=EVK
board_rev=14X14
boot_fdt=try
bootcmd=run mender_setup; setenv bootargs root=${mender_kernel_root} ${bootargs}
; if test "${fdt_addr_r}" != ""; then load ${mender_uboot_root} ${fdt_addr_r} /b
oot/${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
bootcount=1
bootdelay=2
bootlimit=1
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc0
ethprime=eth1
fdt_addr_r=0x83000000
fdt_file=undefined
fdt_high=0xffffffff
fdtcontroladdr=9ef86a30
findfdt=if test $fdt_file = undefined; then if test $board_name = EVK && test $board_rev = 9X9; then setenv fdt_file imx6ul-9x9-evk.dtb; fi;
 if test $board_name = EVK && test $board_rev = 14X14; then setenv fdt_file imx6ul-14x14-evk.dtb; fi; if test $fdt_file = undefined; then ec
ho WARNING: Could not determine dtb to use; fi; fi;
image=zImage
initrd_high=0xffffffff
ip_dyn=yes
loadaddr=0x82000000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; setenv mender_boot_part_hex 3; else setenv mender_boot_pa
rt 2; setenv mender_boot_part_hex 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=bootz
mender_boot_part=2
mender_boot_part_hex=2
mender_check_saveenv_canary=1
mender_dtb_name=imx6ul-14x14-evk-emmc.dtb
mender_kernel_name=zImage
mender_setup=if test "${mender_saveenv_canary}" != "1"; then setenv mender_saveenv_canary 1; saveenv; fi; if test "${mender_pre_setup_comman
ds}" != ""; then run mender_pre_setup_commands; fi; if test "${mender_systemd_machine_id}" != ""; then setenv bootargs systemd.machine_id=${
mender_systemd_machine_id} ${bootargs}; fi; setenv mender_kernel_root /dev/mmcblk0p${mender_boot_part}; if test ${mender_boot_part} = 2; the
n setenv mender_boot_part_name /dev/mmcblk0p2; else setenv mender_boot_part_name /dev/mmcblk0p3; fi; setenv mender_kernel_root_name ${mender
_boot_part_name}; setenv mender_uboot_root mmc 0:${mender_boot_part_hex}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv exp
and_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; setenv expand_bootargs; if test "${mender_post_setup_commands}" != ""
; then run mender_post_setup_commands; fi
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 0:1
mender_uboot_dev=0
mender_uboot_if=mmc
mmcargs=setenv bootargs console=${console},${baudrate} 
mmcautodetect=yes
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loada
ddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcdev=0
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
netargs=setenv bootargs console=${console},${baudrate} ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} 
${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then bootz ${loadaddr} - ${fdt_ad
dr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
script=boot.scr
upgrade_available=0
videomode=video=ctfb:x:480,y:272,depth:24,pclk:108695,le:8,ri:4,up:2,lo:4,hs:41,vs:10,sync:0,vmode:0

Environment size: 3702/131067 bytes
=> 

```

> [@dellgreen](#):
>
> [Partition layout | Mender documentation](https://docs.mender.io/1.5/devices/partition-layout)

The SD card layout is in accordance with mender documentation:

```auto
Disk /dev/sdc: 7.2 GiB, 7776239616 bytes, 15187968 sectors
/dev/sdc1 * 49152 81919 32768 16M c W95 FAT32 (LBA)
/dev/sdc2 81920 950271 868352 424M 83 Linux
/dev/sdc3 950272 1818623 868352 424M 83 Linux
/dev/sdc4 1818624 2080767 262144 128M 83 Linux

```

I’m happy to share more details, if needed. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [May 20, 2020, 4:30pm UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/13 "2020-05-20T16:30:34Z")

</div>

@mirzak any thoughts on this, as its been a while since i hacked on uboot?

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [May 21, 2020, 8:19am UTC](https://hub.mender.io/t/mender-not-working-in-imx6-ul/1940/14 "2020-05-21T08:19:59Z")

</div>

Unfortunately I’m not sure the cause of this, where i would start if by using the uboot mmc command from the uboot shell to start investigating which SDHC device is which, and why its complaining about why it cannot find its uboot environment on your SD card. Its almost as if some part of the uboot configuration is still referencing the emmc. Or there is no uboot environment block in your sdcard image.
