Yocto imx8mmevk eMMC u-boot problem

Hello all,

I have an imx8mmevk board, and I want to generate an image with Yocto containing Mender,
So I did follow the demo mender from this website: Mender-demo

The image core-image-base was built successfully, and now I have the choice to flash the image in an SDCARD or in the eMMC flash,

  1. SDCARD was flashed correctly with dd , and the system boots correctly
  2. For the eMMC I’m using uuu (Universal Update Utiliy) of NXP to flash it, I’m fimilar with this tool and I always flash the eMMC, but to flash the eMMC I need to give the bootloader alone and the image img too,

the question is when I’m giving it the u-boot-imx and the sdimg it fails,
And I think the problem is that the sdimg is already containing a BOOT partition
I have an idea with MENDER_BOOT_PART_SIZE_MB = “0”

Is my idea is correct or there is an other solution ?

I think you are on the right track, and the problem is probably that the sdimg contains the bootloader binary as well.

To disable this you would need to override this variable (set it to an empty string), which will disable the logic to embedded the U-Boot binary in to the sdimg file.

1 Like

This is not working , I made it an empty string and I rebuilt core-image-base
And I flashed the emmc of the board with :
imx-boot-imx8mmevk-sd.bin-flash_evk as bootloader
and core-image-base-imx8mmevk-20191111091630.sdimg as the image
but when booting the board it stuck at u-boot , I think because it’s not the right bootloader it dont know that the emmc is splitted as 4 partitions
I changed the MENDER_STORAGE_DEVICE_imx8mmevk = “/dev/mmcblk1” to 0
and still not booting
I think the problem is with the bootloader
How can I generate a mender u-boot separatly ,
help plesae

Please any solutioon ??

It would be helpful if you can share the serial console output, which should provide more details about what is going wrong

U-Boot SPL 2018.03-imx_v2018.03_4.14.98_2.0.0_ga+g87a19df (Nov 15 2019 - 12:39:)
power_bd71837_init
DDRINFO: start lpddr4 ddr init
DRAM PHY training for 3000MTS
check ddr4_pmu_train_imem code
check ddr4_pmu_train_imem code pass
check ddr4_pmu_train_dmem code
check ddr4_pmu_train_dmem code pass
Training PASS
DRAM PHY training for 400MTS
check ddr4_pmu_train_imem code
check ddr4_pmu_train_imem code pass
check ddr4_pmu_train_dmem code
check ddr4_pmu_train_dmem code pass
Training PASS
DRAM PHY training for 100MTS
check ddr4_pmu_train_imem code
check ddr4_pmu_train_imem code pass
check ddr4_pmu_train_dmem code
check ddr4_pmu_train_dmem code pass
Training PASS
DRAM PHY training for 3000MTS
check ddr4_pmu_train_imem code
check ddr4_pmu_train_imem code pass
check ddr4_pmu_train_dmem code
check ddr4_pmu_train_dmem code pass
Training PASS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Trying to boot from MMC2

U-Boot 2018.03-imx_v2018.03_4.14.98_2.0.0_ga+g87a19df (Nov 15 2019 - 12:39:59 +)

CPU: Freescale i.MX8MMQ rev1.0 1800 MHz (running at 1200 MHz)
CPU: Commercial temperature grade (0C to 95C) at 43C
Reset cause: POR
Model: FSL i.MX8MM EVK board
DRAM: 2 GiB
TCPC: Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C1 0x52]
Power supply on USB2
TCPC: Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C1 0x50]
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC… *** Warning - bad CRC, using default environment

Failed (-5)
No panel detected: default to MIPI2HDMI
adv7535_init: Can’t find device id=0x3d, on bus 1
Display: MIPI2HDMI (1920x1080)
Video: 1920x1080x24
In: serial
Out: serial
Err: serial

BuildInfo:

  • ATF 1cb68fa
  • U-Boot 2018.03-imx_v2018.03_4.14.98_2.0.0_ga+g87a19df

switch to partitions #0, OK
mmc1(part 0) is current device
flash target is MMC:1
Net:
Warning: ethernet@30be0000 using MAC address from ROM
eth0: ethernet@30be0000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc1(part 0) is current device
** Unable to read file boot.scr **
Saving Environment to MMC… Writing to redundant MMC(1)… OK
Card did not respond to voltage select!
** Bad device mmc 0 **
Booting from net …
ethernet@30be0000 Waiting for PHY auto negotiation to complete… TIMEOUT!
Could not initialize PHY ethernet@30be0000
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
.
.
.

The Uboot doesn’t seem to recognize the MMC device #1: “Bad device MMC1”
My guess is that is the SDCard and there is not one inserted. That is the default if you follow the instructions you linked above. You may be able to change the settings in your local.conf for MENDER_STORAGE_DEVICE* to point at mmcblk0 instead but that’s just a guess. https://github.com/mendersoftware/meta-mender-community/blob/sumo/meta-mender-imx/templates/local.conf.append

Drew

I made everything , pointing to mmcblk0
But here’s the output of some mmc info:

u-boot=> mmc list
FSL_SDHC: 0
FSL_SDHC: 1 (eMMC)
u-boot=> mmc part

Partition Map for MMC device 1 – Partition Type: DOS

Part Start Sector Num Sectors UUID Type
1 49152 32768 9695e9d0-01 0c Boot
2 81920 425984 9695e9d0-02 83
3 507904 425984 9695e9d0-03 83
4 933888 262144 9695e9d0-04 83
u-boot=> mmc dev
switch to partitions #0, OK
mmc1(part 0) is current device

What should I do now please help,
I need to flash the eMMC

[EDIT1]
I have a guess here: mmc1(part 0) is current device
I think it’s coorectly pointing to mmc1 which is the eMMC but part0, it needs to point to part1 which is the boot

[EDIT2]
I tried to switch to part 1 with:

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

I need to make it permanent, cuz when I try to boot after the edit, it return to part 0

[EDIT3]
I followed the serial output when flashing the eMMC , and this is what is shown at the end:


downloading of 1418832 bytes finished
writing to partition ‘bootloader’
support sparse flash partition for bootloader
Initializing ‘bootloader’
switch to partitions #1, OK
mmc1(part 1) is current device
Writing ‘bootloader’

MMC write: dev # 1, block # 66, count 2772 … 2772 blocks written: OK
Writing ‘bootloader’ DONE!

You see it : mmc1(part 1) is current device
But when I boot it still looking : mmc1(part 0)

Yes, so MMC device 1 is indeed the eMMC. I’ve never worked on this specific board so I can’t add much more. What is the mechanism you are using to write the UBoot?

I’m using iMX8 Mini board
And to flash the eMMC I’m usiing UUU(Universal Update Utility) from NXP official
And in order to flash the eMMC I need to give it two arguments : uboot + .sdimg
And to flash the SD card I only need the sdimg because it’s having the uboot inside.

So for the SDK it’s okay,
The eMMC is flashed but can’t boot, I need to tell the U-boot to boot from dev1 part 1

Please halt U-Boot and share the output of the following:

run mender_setup
print bootargs
print bootcmd

Also can you please share the content of your local.conf file.

Hello,
This is the output :

u-boot=> run mender_setup
u-boot=> print bootargs
bootargs=console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 root=/dev/nfs ip=dhcp nfsroot=:,v3,tcp
u-boot=> print bootcmd
bootcmd=mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else run mender_setup; if run loadimage; then run mmcboot; run mender_try_to_recover; else run mender_try_to_recover; run netboot; fi; fii
u-boot=>

My local.conf : Same as the demo one: (removing the comments)

INHERIT += “rm_work”
MENDER_ARTIFACT_NAME = “release-1”

INHERIT += “mender-full”

DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = “systemd”
DISTRO_FEATURES_BACKFILL_CONSIDERED = “sysvinit”
VIRTUAL-RUNTIME_initscripts = “”
MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"
PREFERRED_PROVIDER_u-boot = “u-boot-imx”
IMAGE_CLASSES += “mender-setup-imx”

MENDER_STORAGE_DEVICE_imx8mmevk = “/dev/mmcblk0” (my machine is imx8mmevk)
MENDER_STORAGE_DEVICE_imx8mqevk = “/dev/mmcblk1”

[EDIT1]
I made the ```
MENDER_IMAGE_BOOTLOADER_FILE to empty string as you told me

Also can you share the output of

run mender_setup
printenv

as well. That way I will get everything :slight_smile:

Though I think your configuration needs to be,

MENDER_STORAGE_DEVICE_imx8mmevk = “/dev/mmcblk1”

I will create the image with mmcblk1 now , and I will give you the output,
Reminder: I’m still setting the MENDER_IMAGE_BOOTLOADER_FILE to empty file

Here’s the output :

u-boot=> run mender_setup
Saving Environment to MMC… Writing to redundant MMC(1)… OK
u-boot=> printenv
altbootcmd=run mender_altbootcmd; run bootcmd
baudrate=115200
boot_fdt=try
bootargs=
bootcmd=mmc dev {mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else run mender_setup; if run loadimage; then run mmcboot; run mender_try_to_recover; else runi bootcmd_mfg=run mfgtool_args;if iminfo {initrd_addr}; then if test {tee} = yes; then bootm {tee_addr} {initrd_addr} {fdt_addr}; else booti {loadaddr} {initrd_addr} {fdt_addr}; f; bootcount=1 bootdelay=2 bootlimit=1 bootscript=echo Running bootscript from mmc ...; source console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 emmc_dev=1 ethaddr=00:04:9f:05:fa:dc ethprime=FEC fastboot_dev=mmc1 fdt_addr=0x43000000 fdt_file=boot/fsl-imx8mm-evk.dtb fdt_high=0xffffffffffffffff fdtcontroladdr=bc906500 image=boot/Image initrd_addr=0x43800000 initrd_high=0xffffffffffffffff jh_clk= jh_mmcboot=mw 0x303d0518 0xff; setenv fdt_file fsl-imx8mm-evk-root.dtb;setenv jh_clk clk_ignore_unused; if run loadimage; then run mmcboot; else run jh_netboot; fi; jh_netboot=mw 0x303d0518 0xff; setenv fdt_file fsl-imx8mm-evk-root.dtb; setenv jh_clk clk_ignore_unused; run netboot; kboot=booti loadaddr=0x40480000 loadbootscript=fatload mmc {mmcdev}:{mmcpart} {loadaddr} {script}; loadfdt=ext4load {mender_uboot_root} {fdt_addr} {fdt_file}
loadimage=ext4load {mender_uboot_root} {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_part 2; setenv mender_boot_part_hex 2; fi; setep
mender_boot_kernel_type=booti
mender_boot_part=2
mender_boot_part_hex=2
mender_boot_part_name=/dev/mmcblk1p2
mender_check_saveenv_canary=1
mender_dtb_name=fsl-imx8mm-evk-inmate.dtb
mender_kernel_name=Image
mender_kernel_root=/dev/mmcblk1p2
mender_kernel_root_name=/dev/mmcblk1p2
mender_saveenv_canary=1
mender_setup=if test “{mender_saveenv_canary}" != "1"; then setenv mender_saveenv_canary 1; saveenv; fi; if test "{mender_pre_setup_commands}” != “”; then run mender_pre_setup_commandi
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 mender_uboot_root=mmc 0:2 mender_uboot_root_name=/dev/mmcblk1p2 mfgtool_args=setenv bootargs console={console},{baudrate} rdinit=/linuxrc clk_ignore_unused mmcargs=setenv bootargs {jh_clk} console={console} root={mender_kernel_root}
mmcautodetect=yes
mmcboot=echo Booting from mmc …; run mmcargs; if test {boot_fdt} = yes || test {boot_fdt} = try; then if run loadfdt; then booti {loadaddr} - {fdt_addr}; else echo WARN: Cannot lo;
mmcdev=1
mmcpart=1
mmcroot=/dev/mmcblk2p2 rootwait rw
netargs=setenv bootargs {jh_clk} console={console} root=/dev/nfs 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} {loadaddr} {image}; if test ${boot_fdt} = ;
script=boot.scr
sd_dev=0
soc_type=imx8mm
upgrade_available=0

Environment size: 4121/4091 bytes

Can you test running:

ext4load mmc 0:2 {loadaddr} {image}
ext4load mmc 1:2 {loadaddr} {image}

And let me know which of these work?

Also what does the following produce,

bitbake <image> -e | grep ^MENDER_UBOOT_STORAGE_DEVICE

u-boot=> ext4load mmc 0:2 {loadaddr} {image}
Card did not respond to voltage select!
** Bad device mmc 0 **

u-boot=> ext4load mmc 1:2 {loadaddr} {image}
ext4load - load binary file from a Ext4 filesystem

Usage:
ext4load [<dev[:part]> [addr [filename [bytes [pos]]]]]
- load binary file ‘filename’ from ‘dev’ on ‘interface’
to address ‘addr’ from ext4 filesystem

bitbake core-image-minimal -e | grep ^MENDER_UBOOT_STORAGE_DEVICE
MENDER_UBOOT_STORAGE_DEVICE=""
MENDER_UBOOT_STORAGE_DEVICE_DEFAULT=""
MENDER_UBOOT_STORAGE_DEVICE_DEFAULT_mender-ubi=“dummy”

Sorry it should have been,

ext4load mmc 0:2 ${loadaddr} ${image}
ext4load mmc 1:2 ${loadaddr} ${image}