Mender is not creating partitions in iMX6 UL

Hi all,

I’m building Yocto project with mender for iMX6UL EVK. It fails to load with the following error:

[ TIME ] Timed out waiting for device /dev/mmcblk1p4.
[DEPEND] Dependency failed for /data.
[DEPEND] Dependency failed for Local File Systems.

and it goes into emergency mode, the disk partition reveals there’s no partition 4

~ # fdisk -l
Disk /dev/mmcblk1: 7416 MB, 7776239616 bytes, 15187968 sectors
237312 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk1p1 *  64,0,1      437,2,24          8192      56023      47832 23.3M  c Win95 FAT32 (LBA)
/dev/mmcblk1p2    448,0,1     1023,3,32        57344    9705881    9648538 4711M 83 Linux

My local.conf file 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"

INHERIT += "mender-full"
MENDER_FEATURES_DISABLE_append = " mender-growfs-data"
MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"

MENDER_STORAGE_DEVICE_imx6ulevk = "/dev/mmcblk1"

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"

Basically, I’ve 3 questions:

  1. Does mender create the required partitions?
  2. If not, do we need to create them manually or is there any steps to be followed
  3. How to check the mender integration on iMX6UL EVK?

It should create the data partition automatically. You could try setting the MENDER_DATA_PART_SIZE_MB variable explicit in your local.conf in case the default is not working for some reason.

meta-mender should build an image with all the partitions in place. But you how have to use these images to provision your device. The image suffix should be .sdimg in your case.

1 Like

Hey @mirzak,

Thanks for bringing this to my attention, but my current local.conf won’t produce .sdimg file and also I’ve disabled the .uefiimg so I’m using the default core-image-base-imx6ulevk-20200515082827.wic.gz to boot up my system.

NOTE: Earlier I included the following in my local.conf

MENDER_FEATURES_ENABLE_append = " mender-uboot mender-image-sd"

and tried the .sdimg but it doesn’t boot up at all

This is something that needs to be resolved then. Because the sdimg contains the appropriate partitions not the wic.gz

1 Like

Thanks for pointing me in the right direction. However when I try booting with .sdimg it doesn’t boot up.

The starting address of / in .wic image is 8192 as shown below:

$sudo fdisk -l | grep sd
Disk /dev/sdc: 7.2 GiB, 7776239616 bytes, 15187968 sectors
/dev/sdc1  *     8192   56023   47832 23.4M  c W95 FAT32 (LBA)
/dev/sdc2       57344 9705881 9648538  4.6G 83 Linux

The .sdimg contains all the four partitions as mentioned in Mender partition configuration however the starting address now changed to 49152.

$sudo fdisk -l | grep sd
/dev/sdc1  *       49152    81919   32768   16M  c W95 FAT32 (LBA)
/dev/sdc2          81920  7487487 7405568  3.5G 83 Linux
/dev/sdc3        7487488 14893055 7405568  3.5G 83 Linux
/dev/sdc4       14893056 15155199  262144  128M 83 Linux

I thought the problem is changed address can you help me figuring this out. Thanks in advance.

Can you please share the .wks source that is used to build your wic file?

Start should not matter much. What I suspect is that you have an embedded bootloader in the wic and not in the .sdimg.

Then you need to specific the following variables (with similar information that you will find in the .wks file):

https://docs.mender.io/2.3/artifacts/yocto-project/variables#mender_image_bootloader_bootsector_offset
https://docs.mender.io/2.3/artifacts/yocto-project/variables#mender_image_bootloader_file

There are lots of .wks files in the directory, as below:

~/warrior_yocto/mender_build/tmp/work/imx6ulevk-fslc-linux-gnueabi/core-image-base/1.0-r0/mender-uefiimg.wks
~/warrior_yocto/mender_build/tmp/work/imx6ulevk-fslc-linux-gnueabi/core-image-base/1.0-r0/imx-uboot-spl-bootpart.wks
~/warrior_yocto/mender_build/tmp/work/imx6ulevk-fslc-linux-gnueabi/core-image-base/1.0-r0/mender-sdimg.wks
~/warrior_yocto/sources/poky/meta/recipes-core/ovmf/ovmf/ovmf-shell-image.wks
~/warrior_yocto/sources/poky/scripts/lib/wic/canned-wks/mkefidisk.wks
~/warrior_yocto/sources/poky/scripts/lib/wic/canned-wks/directdisk-multi-rootfs.wks
~/warrior_yocto/sources/poky/scripts/lib/wic/canned-wks/directdisk.wks
~/warrior_yocto/sources/poky/scripts/lib/wic/canned-wks/mkhybridiso.wks
~/warrior_yocto/sources/poky/scripts/lib/wic/canned-wks/directdisk-bootloader-config.wks
~/warrior_yocto/sources/poky/scripts/lib/wic/canned-wks/qemux86-directdisk.wks
~/warrior_yocto/sources/poky/scripts/lib/wic/canned-wks/sdimage-bootpart.wks
~/warrior_yocto/sources/poky/scripts/lib/wic/canned-wks/systemd-bootdisk.wks
~/warrior_yocto/sources/poky/scripts/lib/wic/canned-wks/directdisk-gpt.wks
~/warrior_yocto/sources/poky/meta-selftest/recipes-test/images/wic-image-minimal.wks
~/warrior_yocto/sources/poky/meta-selftest/wic/wictestdisk.wks
~/warrior_yocto/sources/poky/meta-yocto-bsp/wic/mpc8315e-rdb.wks
~/warrior_yocto/sources/poky/meta-yocto-bsp/wic/beaglebone-yocto.wks
~/warrior_yocto/sources/poky/meta-yocto-bsp/wic/edgerouter.wks
~/warrior_yocto/sources/poky/meta-yocto-bsp/wic/genericx86.wks
~/warrior_yocto/sources/meta-freescale/wic/imx-uboot.wks

And I’m sharing the contents of ~/warrior_yocto/sources/meta-freescale/wic/imx-uboot.wks as I thought it would be the appropriate one:

# short-description: Create SD card image with a boot partition
# long-description:
# Create an image that can be written onto a SD card using dd for use
# with i.MX SoC family
# It uses u-boot
#
# The disk layout used is:
#  - --------- --------------
# | | u-boot  |    rootfs    |
#  - --------- --------------
# ^ ^         ^              ^
# | |         |              |
# 0 1kiB    4MiB + rootfs + IMAGE_EXTRA_SPACE (default 10MiB)
#
part u-boot --source rawcopy --sourceparams="file=u-boot.imx" --ondisk mmcblk --no-table --align 1
part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 4096

bootloader --ptable msdos

Kindly walk me through the next step if this is the one, or specify the file name so that I could share that with you.

I do not know which one you are using as this is something that is probably set in your MACHINE configuration.

But the one you pasted would translate to:

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

The file pointed in machine.conf (imx6ulevk.conf) is as follows ~/warrior_yocto/mender_build/tmp/work/imx6ulevk-fslc-linux-gnueabi/core-image-base/1.0-r0/imx-uboot-spl-bootpart.wks, sorry for the previous one.

# short-description: Create SD card image with a boot partition
# long-description:
# Create an image that can be written onto a SD card using dd for use
# with i.MX SoC family.
# It uses SPL and u-boot
#
# The disk layout used is:
#  - ----- --------- -------------- --------------
# | | SPL | u-boot  |    boot      |    rootfs    |
#  - ----- --------- -------------- --------------
# ^ ^     ^         ^              ^
# | |     |         |              |
# 0 1kiB  69kiB   4MiB          16MiB + rootfs + IMAGE_EXTRA_SPACE (default 10MiB)
#
part SPL --source rawcopy --sourceparams="file=SPL" --ondisk mmcblk --no-table --align 1
part u-boot --source rawcopy --sourceparams="file=u-boot.img" --ondisk mmcblk --no-table --align 69
part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 4096 --size 16
part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 4096

bootloader --ptable msdos

Hi @mirzak,

I’ve added the following lines in the local.conf

MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET = "2"
MENDER_IMAGE_BOOTLOADER_FILE = "SPL"

and now board is looping in,

U-Boot SPL 2019.07+fslc+gca0ab15271 (May 15 2020 - 08:46:04 +0000)
Trying to boot from MMC1
mmc_load_image_raw_sector: mmc block read error
spl_load_image_ext: ext4fs mount err - 0

Can you help me in this?