Variscite DART-6UL: U-boot integration succeeds with Yocto Sumo, but fails with Thud

I changed into the said directory, and ran git diff | grep BOOTCOUNT as you’ve mentioned.

This is the output:

+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_BOOTCOUNT_ENV=y

These aren’t C #defines, but entries in a defconfig file. The #defines from your example are missing. So it indeed seems that the actual patching isn’t carried out.

I think this means that you are on a newer version of varisicites uboot than me, as this looks like its now a feature of uboot and no longer needs to be patched. my uboot is 2017 version and i have to manage the patches myself as they wouldn’t apply to my version of uboot directly from mender recipe.

looks like it was added in uboot as a feature in 2018

sorry not sure then, at this point i would normally take a look at the patch files that mender is applying to see if this sheds any light on why the errors are being thrown, maybe @drewmoseley has more ideas?

Thanks for the inputs, for the time being I will try the manual patching.

According to the Board Integration page, Mender has been tested successfully with Thud. Does it mean that U-boot auto-patching is supposed to work with a certain U-boot version?

If so, could downgrading U-boot to a specific commit solve the issue? By looking at the meta-variscite-fslc layer’s repo, I can see that U-boot has been changed a lot of times, seemingly independently from the layer’s other developments.

i think somewhere in the docs it does mention the minimum uboot that auto-patching works with, but i’m casting my memory back a long way now. I have a feeling that in newer versions they changed to chaining uboot and grub so they no longer need to patch uboot as heavily, but i might be wrong on this.

That certainly is the idea but it obviously is tricky and requires testing on each platform. The grub-efi mechanism is even easier, if the base U-Boot for the platform supports EFI boot.

It’s on my list to clean up and get the Variscite boards working on newer branches (hopefully with Grub-EFI) but it will likely be a few weeks before I get to spend any time on it.

Drew

It turned out that the U-boot configuration fails only if I use the eMMC template instead of the SD card template from meta-mender-community/mender-variscite/templates to create my local.conf file. With the SD-card template, the U-boot patching didn’t yield any errors, and I was able to build a working Thud-based SD card image.

In the meantime, I’ve come across a topic on this matter:
How to write DART-6UL image to eMMC

I don’t really understand how the original poster got the eMMC booting to work, but it seems that he may have used a local.conf initially tailored to SD-card booting, with a few changes made to the MENDER_STORAGE_DEVICE and MENDER_STORAGE_TOTAL_SIZE_MB variables to boot from eMMC.

Does this procedure make sense, or am I missing out something?

Yeah, that makes sense. I don’t recall what the differences between the SDCard and eMMC configs are but it should be just a few things.
Drew

does make sense, as i am not using those templates for my dart imx6 with emmc mender build

Hi @miklosj

It has been about a year since I passed through this process and I tried hard. When I gave these two variables (MENDER_STORAGE_DEVICE and MENDER_STORAGE_TOTAL_SIZE_MB) the appropriate values to the board, I managed to run it with eMMC. I cannot remember in detail right now, but I will check what I give these values for you. I was dealing with Mender at my old company and therefore I need to access internal documents. I still have a friend working at my old company and I will ask for the necessary information, but you may have to wait a few days for this.

Emre

Hi again @miklosj
I used these values. Hope it helps.

MENDER_STORAGE_TOTAL_SIZE_MB = “7456”
MENDER_STORAGE_DEVICE = “/dev/mmcblk1”
MENDER_IMAGE_BOOTLOADER_FILE = “u-boot-spl.img”
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET = “2”
MENDER_BOOT_PART_SIZE_MB = “0”

eMMC Settings

MENDER_FEATURES_ENABLE_append = " mender-uboot mender-image-sd "
MENDER_STORAGE_TOTAL_SIZE_MB_imx6ul-var-dart = “7456”
MENDER_STORAGE_DEVICE_imx6ul-var-dart = “/dev/mmcblk1”

PREFERRED_PROVIDER_u-boot = “u-boot-variscite”

Thank you very much for sharing this!

I could generate an .sdimg with the settings you’ve listed. I booted the DART-6UL from an sd card, then copied the eMMC .sdimg onto the eMMC, by running
dd if=core-image-base-imx6ul-var-dart.sdimg of=/dev/mmcblk1 status=progress conv=fdatasync

When I boot from the eMMC, U-boot itself starts successfully (I can interact with it), but it fails when it comes to mounting the filesystem and gets stuck there. Judging from the boot environment variables, the Mender patch seems to be applied, so I guess I must be missing some minor setting now.

The log output:

U-Boot SPL 2017.03-mx6ul+ga7869c2cde (Aug 14 2020 - 09:11:41)

Part number: VSM-6UL-706B
Assembly: AS1812142595
Date of production: 2019 Feb 18
DART-6UL configuration: eMMC WiFi
Trying to boot from MMC1
MMC Boot Device: mmc1 (eMMC)


U-Boot 2017.03-mx6ul+ga7869c2cde (Aug 14 2020 - 09:11:41 +0000)

CPU:   Freescale i.MX6ULL rev1.1 900 MHz (running at 396 MHz)
CPU:   Commercial temperature grade (0C to 95C) at 48C
Reset cause: POR
Board: Variscite DART-6UL
I2C:   ready
DRAM:  512 MiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
*** Warning - bad CRC, using default environment

Display: VAR-WVGA-LCD (800x480)
Video: 800x480x24
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Error: could not access storage.
In:    serial
Out:   serial
Err:   serial
switch to partitions #0, OK
mmc1(part 0) is current device
eMMC:  7.3 GiB
Net:   got MAC0 address from fuse: f8:dc:7a:26:f6:9c
FEC0 [PRIME], usb_ether
Error: usb_ether address not set.

Normal Boot
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc1(part 0) is current device
switch to partitions #0, OK
mmc1(part 0) is current device
** File not found /uEnv.txt **
## Error: "loadbootscript" not defined
## Error: "loadimage" not defined
## Error: "netboot" not defined

U-boot environment variables:

baudrate=115200
board_name=MX6UL_VAR_DART
boot_dev=emmc
boot_fdt=try
bootcmd=run ramsize_check; mmc dev ${mmcdev};mmc dev ${mmcdev}; if mmc rescan; then if run loadbootenv; then run importbootenv; fi; if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi
bootdelay=1
bootenv=uEnv.txt
console=ttymxc0
ethact=FEC0
ethaddr=f8:dc:7a:26:f6:9c
ethprime=FEC0
fdt_addr=0x83000000
fdt_file=undefined
fdt_high=0xffffffff
findfdt=if test $fdt_file = undefined; then if test $boot_dev = sd; then if test $som_storage = emmc || test $som_storage = none; then if test $soc_type = imx6ull; then setenv fdt_file imx6ull-var-dart-sd_emmc.dtb; else setenv fdt_file imx6ul-var-dart-sd_emmc.dtb; fi; fi; if test $som_storage = nand; then if test $soc_type = imx6ull; then setenv fdt_file imx6ull-var-dart-sd_nand.dtb; else setenv fdt_file imx6ul-var-dart-sd_nand.dtb; fi; fi; fi; if test $boot_dev = emmc; then if test $wifi = yes; then if test $soc_type = imx6ull; then if test $som_rev = 5G; then setenv fdt_file imx6ull-var-dart-5g-emmc_wifi.dtb; else setenv fdt_file imx6ull-var-dart-emmc_wifi.dtb; fi; else if test $som_rev = 5G; then setenv fdt_file imx6ul-var-dart-5g-emmc_wifi.dtb; else setenv fdt_file imx6ul-var-dart-emmc_wifi.dtb; fi; fi; else if test $soc_type = imx6ull; then setenv fdt_file imx6ull-var-dart-sd_emmc.dtb; else setenv fdt_file imx6ul-var-dart-sd_emmc.dtb; fi; fi; fi; if test $boot_dev = nand; then if test $wifi = yes; then if test $soc_type = imx6ull; then if test $som_rev = 5G; then setenv fdt_file imx6ull-var-dart-5g-nand_wifi.dtb; else setenv fdt_file imx6ull-var-dart-nand_wifi.dtb; fi; else if test $som_rev = 5G; then setenv fdt_file imx6ul-var-dart-5g-nand_wifi.dtb; else setenv fdt_file imx6ul-var-dart-nand_wifi.dtb; fi; fi; else if test $soc_type = imx6ull; then setenv fdt_file imx6ull-var-dart-sd_nand.dtb; else setenv fdt_file imx6ul-var-dart-sd_nand.dtb; fi; fi; fi; if test $fdt_file = undefined; then echo WARNING: Could not determine dtb to use; fi; fi;
image=zImage
importbootenv=echo Importing bootenv from mmc ...; env import -t ${loadaddr} ${filesize}
initrd_high=0xffffffff
loadaddr=0x82000000
loadbootenv=load mmc ${mmcdev}:${mender_boot_part} ${loadaddr} ${bootdir}/${bootenv}
mmcautodetect=yes
mmcblk=1
mmcdev=1
optargs=setenv bootargs ${bootargs} ${kernelargs};
panel=VAR-WVGA-LCD
ramsize_check=if test $sdram_size -lt 256; then setenv cma_size cma=32MB; setenv fdt_addr 0x84000000; setenv loadaddr 0x84600000; else if test $sdram_size -lt 512; then setenv cma_size cma=64MB; fi; fi;
script=boot.scr
sdram_size=512
soc_type=imx6ull
som_rev=2.4G
som_storage=emmc
splashdisable=setenv splashfile; setenv splashimage
splashenable=setenv splashfile /boot/splash.bmp; setenv splashimage 0x83100000
splashfile=/boot/splash.bmp
splashimage=0x83100000
splashsource=emmc
splashsourceauto=yes
usbnet_devaddr=f8:dc:7a:00:00:02
usbnet_hostaddr=f8:dc:7a:00:00:01
wifi=yes

My current local.conf:

MACHINE ??= 'imx6ul-var-dart'
DISTRO ?= 'fslc-framebuffer'
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-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
CONF_VERSION = "1"

DL_DIR ?= "${BSPDIR}/downloads/"
ACCEPT_FSL_EULA = "1"

# This really saves a lot of disk space!
INHERIT += "rm_work"

MENDER_ARTIFACT_NAME = "emmc_test_1"

INHERIT += "mender-full"

DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""

MENDER_SERVER_URL = "https://hosted.mender.io"
MENDER_TENANT_TOKEN = "<my token>"

# Remove unneded vfat boot partition
IMAGE_BOOT_FILES = ""
MENDER_BOOT_PART_SIZE_MB = "0"

# Set up eMMC storage
MENDER_STORAGE_TOTAL_SIZE_MB = "7456"
MENDER_STORAGE_TOTAL_SIZE_MB_imx6ul-var-dart = "7456"
MENDER_STORAGE_DEVICE = "/dev/mmcblk1"
MENDER_STORAGE_DEVICE_imx6ul_var_dart = "/dev/mmcblk1"
MENDER_IMAGE_BOOTLOADER_FILE = "u-boot-spl.img"
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET = "2"

# Standard partition alignment from upstream wks file
#MENDER_PARTITION_ALIGNMENT = "4194304"

# Cleanup image types generated
IMAGE_FSTYPES_remove = "tar.gz wic.gz wic.bmap multiubi mender.bmap"

# Disable uefi, enable U-boot and .sdimg generation
MENDER_FEATURES_ENABLE_append = " mender-uboot mender-image-sd"
MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"

# Make sure that we use the Variscite-supplied u-boot for patching!
PREFERRED_PROVIDER_u-boot = "u-boot-variscite"

I don’t apply any custom U-boot .bbappends, and the automatic u-boot configuration is enabled. I can also mount and see the contents of eMMC card partitions, so I assume that dd itself ran without problems.

Could you point out what I am still missing?

From the U-Boot prompt, what do the following commands show?

U-Boot> mmc list
U-Boot> mmc dev “number of your eMMC device”
U-Boot> mmc part

They show the following:

=> mmc list
FSL_SDHC: 0 (SD)
FSL_SDHC: 1 (eMMC)

=> mmc dev 1
switch to partitions #0, OK
mmc1(part 0) is current device

=> mmc part

Partition Map for MMC device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     49152           7471104         e796306e-01     83
  2     7520256         7471104         e796306e-02     83
  3     14991360        262144          e796306e-03     83

Hmm. Looks like you might need something like the following:

MENDER_STORAGE_DEVICE_imx6ul-var-dart = “/dev/mmcblk0”
MENDER_UBOOT_STORAGE_DEVICE_imx6ul-var-dart = “1”

The following is what I use for my Variscite DART_MX6:

MENDER_STORAGE_DEVICE = “/dev/mmcblk1”
MENDER_IMAGE_BOOTLOADER_FILE = “u-boot.imx”
MENDER_UBOOT_STORAGE_DEVICE = “1”
MENDER_UBOOT_STORAGE_INTERFACE = “mmc”
MENDER_STORAGE_TOTAL_SIZE_MB = “3608”
MENDER_DATA_PART_SIZE_MB = “768”
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET = “2”
MENDER_BOOT_PART_SIZE_MB = “0”

I have tried building an image with your settings (except for MENDER_STORAGE_TOTAL_SIZE_MB, as my device is different). First, bitbake was complaining because it couldn’t find u-boot.imx. To overcome that, I applied your solution from this thread - a bbappend file to the u-boot recipe:

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

}

After that, I could generate an image. Unfortunately, it still doesn’t boot, and gets stuck at the same point as in the previous case:

U-Boot SPL 2017.03-mx6ul+ga7869c2cde (Aug 17 2020 - 07:41:25)

Part number: VSM-6UL-706B
Assembly: AS1812142595
Date of production: 2019 Feb 18
DART-6UL configuration: eMMC WiFi
Trying to boot from MMC1
MMC Boot Device: mmc1 (eMMC)


U-Boot 2017.03-mx6ul+ga7869c2cde (Aug 17 2020 - 07:41:25 +0000)

CPU:   Freescale i.MX6ULL rev1.1 900 MHz (running at 396 MHz)
CPU:   Commercial temperature grade (0C to 95C) at 48C
Reset cause: POR
Board: Variscite DART-6UL
I2C:   ready
DRAM:  512 MiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
*** Warning - bad CRC, using default environment

Display: VAR-WVGA-LCD (800x480)
Video: 800x480x24
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Error: could not access storage.
In:    serial
Out:   serial
Err:   serial
switch to partitions #0, OK
mmc1(part 0) is current device
eMMC:  7.3 GiB
Net:   got MAC0 address from fuse: f8:dc:7a:26:f6:9c
FEC0 [PRIME], usb_ether
Error: usb_ether address not set.

Normal Boot
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc1(part 0) is current device
switch to partitions #0, OK
mmc1(part 0) is current device

This is my custom distro.conf file. Maybe it works for you

> #@--------------------------------------------------------------------
> #@TYPE: Distribution
> #@NAME: Robust Edge Distro
> #@DESCRIPTION: The Linux Distribution for Robust Project with Mender.io
> #@MAINTAINER: Emre Karaaslan  <memrekaraaslan@gmail.com>
> #@--------------------------------------------------------------------
> 
> require conf/distro/include/robust-base.inc
> include conf/machine/imx6ul-var-dart-extra.conf
> 
> DISTRO = "robust-distro"
> DISTRO_NAME = "Robust Edge Distro"
> 
> INHERIT += "mender-full"
> 
> # Systemd as a System Manager
> DISTRO_FEATURES_append = "systemd"
> VIRTUAL_RUNTIME_init_manager = "systemd"
> DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
> VIRTUAL_RUNTIME_initscripts = ""
> 
> # Build for Mender production setup (on-prem)
> #
> # https://docs.mender.io/2.2/artifacts/yocto-project/building-for-production
> #
> MENDER_SERVER_URL = "https://mender.robust.com"
> 
> # Mender storage configuration
> #
> # More details on these variables is available at
> #    https://docs.mender.io/devices/yocto-project/partition-configuration#configuring-storage
> #
> # Also, please be sure to check other config files as other
> # layers, config fragments, etc may attempt to set values
> # for specific platforms.  Using "bitbake -e <image-name>"
> # can help determine which files are setting these values
> # in a given configuration.
> 
> MENDER_STORAGE_TOTAL_SIZE_MB = "7456"
> # MENDER_BOOT_PART_SIZE_MB = "16"
> # MENDER_DATA_PART_SIZE_MB = "1024"
> MENDER_STORAGE_DEVICE = "/dev/mmcblk1"
> # MENDER_BOOT_PART = "${MENDER_STORAGE_DEVICE_BASE}1"
> # MENDER_DATA_PART = "${MENDER_STORAGE_DEVICE_BASE}4"
> # MENDER_ROOTFS_PART_A = "${MENDER_STORAGE_DEVICE_BASE}2"
> # MENDER_ROOTFS_PART_B = "${MENDER_STORAGE_DEVICE_BASE}3"
> 
> # This will make sure that our SPL + u-boot.img is embedded in the sdimg at
> # a 1kb offset.
> MENDER_IMAGE_BOOTLOADER_FILE = "u-boot-spl.img"
> MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET = "2"
> 
> # Remove the unneeded VFAT boot partition
> IMAGE_BOOT_FILES = ""
> MENDER_BOOT_PART_SIZE_MB = "0"
> 
> # Standard partition alignment from upstream wks file
> MENDER_PARTITION_ALIGNMENT = "4194304"
> 
> # Cleanup image types generated
> IMAGE_FSTYPES_remove = "tar.gz ext4 wic.gz wic.bmap multiubi mender.bmap"
> 
> 
> MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"
> 
> # eMMC Settings
> MENDER_FEATURES_ENABLE_append = " mender-uboot mender-image-sd "
> MENDER_STORAGE_TOTAL_SIZE_MB_imx6ul-var-dart = "7456"
> MENDER_STORAGE_DEVICE_imx6ul-var-dart = "/dev/mmcblk1"
> 
> PREFERRED_VERSION_pn-mender = "2.%"
> PREFERRED_VERSION_pn-mender-artifact = "3.%"
> PREFERRED_VERSION_pn-mender-artifact-native = "3.%"
> 
> PREFERRED_PROVIDER_u-boot = "u-boot-variscite"
> 
> #LICENSE_FLAGS_WHITELIST = "commercial_mender-binary-delta"
> #FILESEXTRAPATHS_prepend_pn-mender-binary-delta := "/home/hie/mender-binary-delta-1.0.0/:"

I made a fresh start according to DART-6UL’s board integration page. I have set up an initial build environment for SD-card boot (export MEDIA="sdcard"). Then I applied dellgreen’s local.conf settings with the MENDER_STORAGE_TOTAL_SIZE fit for my eMMC, and it worked! I can boot from eMMC and update the system from the Mender backend. I guess there must have been some residual files in my previous build environment that messed up my images.

Thank you very much for your help!

1 Like

Hi,

Sorry, I’m confused. Are we supposed to use export MEDIA=“emmc” so that we can append the settings for emmc?

cat …/sources/meta-mender-hero-secc/templates/local-emmc.conf.append >> conf/local.conf

Yes, that’s the general idea. The difference between emmc and sdcard are minimal but they are important.

Drew

1 Like