Mender for imx8qxpc0-mek

Hi,
I want to integrate mender on imx8qxpc0-mek board with Yocto.
Is there a tutorial that describes the integration of mender on this platform.
Thank you!

Hi Mahdi,
you can take a look at this page for existing board integrations.

Hi Alan,
Thank you for your reply,
But I don’t see an integration process defined for the imx8qxpc0mek board in this page.

If there is not an already existing integration then you will need to do a custom one. Docs are here.

Also, we do offer services to do custom integrations. More details are here.

Drew

Hi Drew,
Thank you for your reply,
I was inspired by this patch to integrate mender for imx8qxpc0mek :
commit

I built the image for the imx8qxpc0mek knowing that I started from manifest imx-4.14.98-2.3.0.xml (sumo branch) with the addition of meta-mender and meta-mender-community.
The build is OK.
I got the 4 partitions after flashing the .sdimg on the sdcard.
But the board does not boot and enters a loop!

Please, help me !

Here are the logs :

U-Boot 2018.03-4.14.98-2.3.3+gc20c444 (Jul 20 2021 - 11:33:12 +0000)

CPU: Freescale i.MX8QXP revC A35 at 1200 MHz at 30C
Model: Freescale i.MX8QXP MEK
Board: iMX8QXP MEK
Boot: SD1
DRAM: 2.8 GiB
VService: Connection is ok on MU mu@5d230000
TCPC: Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C1 0x50]
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC… Run CMD11 1.8V switch
OK
[pcie_ctrlb_sata_phy_init_rc] LNK DOWN 8600000
In: serial
Out: serial
Err: serial

BuildInfo:

  • SCFW c2c1675e, SECO-FW 268f2c02, IMX-MKIMAGE d7f9440d, ATF bb209a0
  • U-Boot 2018.03-4.14.98-2.3.3+gc20c444

Run CMD11 1.8V switch
switch to partitions #0, OK
mmc1 is current device
flash target is MMC:1
Run CMD11 1.8V switch
Net:
Warning: ethernet@5b040000 using MAC address from ROM
eth0: ethernet@5b040000 [PRIME]
Warning: ethernet@5b050000 (eth1) using random MAC address - fe:94:f5:f8:3a:34
, eth1: ethernet@5b050000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
syntax error
“Synchronous Abort” handler, esr 0x96000007
elr: 00000000800383dc lr : 0000000080038858 (reloc)
elr: 0000000087e833dc lr : 0000000087e83858
x0 : 0000000000000000 x1 : 0000000087e81b9c
x2 : 0000000087eed2b8 x3 : 0000000000000008
x4 : 00000000856754b0 x5 : 0000000085675520
x6 : 0000000000000021 x7 : 0000000087eed1d8
x8 : 00000000856af000 x9 : 0000000000000008
x10: 00000000ffffffd0 x11: 0000000000000006
x12: 000000000001869f x13: 000000000000a434
x14: 000000008565d0ec x15: 0000000000000002
x16: 00000000000040e0 x17: 0000000000000000
x18: 0000000085668da8 x19: 000000008565d130
x20: 0000000000000001 x21: 000000000000000a
x22: 0000000000000001 x23: 0000000000000062
x24: 0000000000000002 x25: 0000000000000001
x26: 0000000087f09000 x27: 0000000087ed3000
x28: 0000000000000020 x29: 000000008565d020

Resetting CPU …

resetting …

No idea, sorry.

As a first troubleshooting step I would recommend you take a look at the BOOTCMD environment variable and then run each of the steps individually to see if anything obviously wrong happens. That’s kind of a tedious activity, especially if you are using distro_bootcmd, but it’s the only thing I can suggest.

This looks like the kernel may be built incorrectly but that’s just a guess.

Drew

Hi Drew,
Thank you for your reply,
Now, the board is booting.
The mender client is started, however, I have errors (Failed to read the current active partition: No match between boot and root partitions) as shown in journalctl logs.
root@imx8qxpc0mek:~# journalctl -u mender -f
– Logs begin at Thu 1970-01-01 02:24:41 UTC. –
Jan 01 02:24:44 imx8qxpc0mek systemd[1]: Started Mender OTA update service.
Jan 01 02:24:50 imx8qxpc0mek mender[3717]: time=“1970-01-01T02:24:50Z” level=info msg=“Configuration file does not exist: /var/lib/mender/mender.conf” module=config
Jan 01 02:24:50 imx8qxpc0mek mender[3717]: time=“1970-01-01T02:24:50Z” level=info msg=“Loaded configuration file: /etc/mender/mender.conf” module=config
Jan 01 02:24:50 imx8qxpc0mek mender[3717]: time=“1970-01-01T02:24:50Z” level=error msg="Failed to read the current active partition: No match between boot and root partitions.: Failed mender_saveenv_n
Jan 01 02:24:50 imx8qxpc0mek mender[3717]: time=“1970-01-01T02:24:50Z” level=info msg="API Gateway certificate (in PEM format): \n-----BEGIN CERTIFICATE-----\nMIIBfTCCASOgAwIBAgIJAJOS76a0qWuZMAoGCCqGt
Jan 01 02:24:50 imx8qxpc0mek mender[3717]: time=“1970-01-01T02:24:50Z” level=info msg=“Issuer: [], Valid from: 2016-12-14 19:52:46 +0000 UTC, Valid to: 2026-12-12 19:52:46 +0000 UTC” module=client
Jan 01 02:24:50 imx8qxpc0mek mender[3717]: time=“1970-01-01T02:24:50Z” level=info msg=“State transition: init [none] → init [none]” module=mender
Jan 01 02:24:50 imx8qxpc0mek mender[3717]: time=“1970-01-01T02:24:50Z” level=info msg=“State transition: init [none] → idle [Idle]” module=mender
Jan 01 02:24:50 imx8qxpc0mek mender[3717]: time=“1970-01-01T02:24:50Z” level=info msg=“State transition: idle [Idle] → authorize-wait [Idle]” module=mender
Jan 01 02:24:50 imx8qxpc0mek mender[3717]: time=“1970-01-01T02:24:50Z” level=info msg=“State transition: authorize-wait [Idle] → authorize [Sync]” module=mender

the content of the bootenv :
altbootcmd=run mender_altbootcmd; run bootcmd
bootlimit=1
bootcount=0
upgrade_available=0
mender_uboot_boot=mmc 1:1
mender_uboot_if=mmc
mender_uboot_dev=1
mender_boot_kernel_type=booti
mender_kernel_name=Image
mender_dtb_name=fsl-imx8qxp-mek-root.dtb
mender_pre_setup_commands=
mender_post_setup_commands=
mender_check_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_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/mmcblk1p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk1p2; else setenv mender_boot_part_name /dev/mmcblk1p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 1:${mender_boot_part_hex}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs “setenv bootargs \”${bootargs}\""; run expand_bootargs; setenv expand_bootargs; if test “${mender_post_setup_commands}” != “”; then run mender_post_setup_commands; fi
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; setenv upgrade_available 0; saveenv; run mender_setup
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
bootcmd=mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if test ${sec_boot} = yes; then if run loadcntr; then run mmcboot; else run netboot; fi; else if run loadimage; then run mmcboot; else run netboot; fi; fi; fi; else booti ${loadaddr} - ${fdt_addr}; fi
bootdelay=3
baudrate=115200
ethprime=eth0
loadaddr=0x80280000
mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc clk_ignore_unused
kboot=booti
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}; fi; else echo “Run fastboot …”; fastboot 0; fi;
initrd_addr=0x83100000
initrd_high=0xffffffffffffffff
emmc_dev=0
sd_dev=1
m4_0_image=m4_0.bin
loadm4image_0=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4_0_image}
m4boot_0=run loadm4image_0; dcache flush; bootaux ${loadaddr} 0
xenhyper_bootargs=console=dtuart dtuart=/serial@5a060000 dom0_mem=2048M dom0_max_vcpus=2 dom0_vcpus_pin=true
xenlinux_bootargs=
xenlinux_console=hvc0 earlycon=xen
xenlinux_addr=0x92000000
dom0fdt_file=fsl-imx8qxp-mek-dom0.dtb
xenboot_common=${get_cmd} ${loadaddr} xen;${get_cmd} ${fdt_addr} ${dom0fdt_file};${get_cmd} ${xenlinux_addr} ${image};fdt addr ${fdt_addr};fdt resize 256;fdt set /chosen/module@0 reg <0x00000000 ${xenlinux_addr} 0x00000000 0x${filesize}>; fdt set /chosen/module@0 bootargs “${bootargs} ${xenlinux_bootargs}”; setenv bootargs ${xenhyper_bootargs};booti ${loadaddr} - ${fdt_addr};
xennetboot=setenv get_cmd dhcp;setenv console ${xenlinux_console};run netargs;run xenboot_common;
xenmmcboot=setenv get_cmd “fatload mmc ${mmcdev}:${mmcpart}”;setenv console ${xenlinux_console};run mmcargs;run xenboot_common;
jh_mmcboot=setenv fdt_file fsl-imx8qxp-mek-root.dtb;setenv boot_os ‘scu_rm dtb ${fdt_addr}; booti ${loadaddr} - ${fdt_addr};’; run mmcboot;
jh_netboot=setenv fdt_file fsl-imx8qxp-mek-root.dtb;setenv boot_os ‘scu_rm dtb ${fdt_addr}; booti ${loadaddr} - ${fdt_addr};’; run netboot;
sec_boot=no
script=boot.scr
image=Image
panel=NULL
console=ttyLP0
fdt_addr=0x83000000
fdt_high=0xffffffffffffffff
cntr_addr=0x98000000
cntr_file=os_cntr_signed.bin
boot_fdt=try
fdt_file=undefined
mmcdev=1
mmcpart=1
mmcautodetect=yes
mmcargs=setenv bootargs console=${console},${baudrate} earlycon root=${mmcroot}
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
bootscript=echo Running bootscript from mmc …; source
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}
auth_os=auth_cntr ${cntr_addr}
boot_os=booti ${loadaddr} - ${fdt_addr};
mmcboot=echo Booting from mmc …; run mmcargs; if test ${sec_boot} = yes; then if run auth_os; then run boot_os; else echo ERR: failed to authenticate; fi; else if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then run boot_os; else echo WARN: Cannot load the DT; fi; else echo wait for boot; fi;fi;
netargs=setenv bootargs console=${console},${baudrate} earlycon 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; if test ${sec_boot} = yes; then ${get_cmd} ${cntr_addr} ${cntr_file}; if run auth_os; then run boot_os; else echo ERR: failed to authenticate; fi; else ${get_cmd} ${loadaddr} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then run boot_os; else echo WARN: Cannot load the DT; fi; else booti; fi;fi;
mender_boot_part=2
mender_boot_part_hex=2
mmcroot=/dev/mmcblk1p3 rootwait rw

OK, glad to hear you are making some progress. I suspect this issue is that the u-boot fw-utils installed inside Linux are not configured properly. The mender-client uses them to read and write the u-boot environment. From the Linux shell prompt, what does the following show?

# fw_printenv | grep mender

Drew

Thank you for your reply,
the fw_printenv | grep mender shows :
altbootcmd=run mender_altbootcmd; run bootcmd
mender_boot_part=2
mender_boot_part_hex=2
mender_uboot_boot=mmc 1:1
mender_uboot_if=mmc
mender_uboot_dev=1
mender_boot_kernel_type=booti
mender_kernel_name=Image
mender_dtb_name=fsl-imx8qxp-mek-root.dtb
mender_pre_setup_commands=
mender_post_setup_commands=
mender_check_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_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/mmcblk1p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk1p2; else setenv mender_boot_part_name /dev/mmcblk1p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 1:${mender_boot_part_hex}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs “setenv bootargs \”${bootargs}\""; run expand_bootargs; setenv expand_bootargs; if test “${mender_post_setup_commands}” != “”; then run mender_post_setup_commands; fi
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; setenv upgrade_available 0; saveenv; run mender_setup
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi

Hmm. That looks correct to me. What do the following show?

From your target board:

lsblk
fdisk -l

and from your build machine

bitbake -e core-image-minimal | grep ^MENDER_

Drew

Knowing that the board boots on the sdcard : mmcblk1p1

root@imx8qxpc0mek:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 29.1G 0 disk
|-mmcblk0p1 179:1 0 128M 0 part
|-mmcblk0p2 179:2 0 152M 0 part
|-mmcblk0p3 179:3 0 152M 0 part
-mmcblk0p4 179:4 0 128M 0 part mmcblk0boot0 179:32 0 8M 1 disk mmcblk0boot1 179:64 0 8M 1 disk mmcblk0rpmb 179:96 0 4M 0 disk mmcblk1 179:128 0 59.5G 0 disk |-mmcblk1p1 179:129 0 128M 0 part /uboot |-mmcblk1p2 179:130 0 152M 0 part / |-mmcblk1p3 179:131 0 152M 0 part -mmcblk1p4 179:132 0 128M 0 part /data

root@imx8qxpc0mek:~# fdisk -l
Disk /dev/mmcblk0: 29.1 GiB, 31272730624 bytes, 61079552 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc37e87b1

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 49152 311295 262144 128M c W95 FAT32 (LBA)
/dev/mmcblk0p2 311296 622591 311296 152M 83 Linux
/dev/mmcblk0p3 622592 933887 311296 152M 83 Linux
/dev/mmcblk0p4 933888 1196031 262144 128M 83 Linux

[ 141.468728] mmcblk0rpmb: error -110 transferring data, sector 0, nr 8, cmd response 0x900, card status 0xb00
[ 141.478588] mmcblk0rpmb: retrying using single block read
[ 147.928072] mmcblk0rpmb: error -110 transferring data, sector 8, nr 8, cmd response 0x900, card status 0xb00
[ 147.937959] mmcblk0rpmb: retrying using single block read
Disk /dev/mmcblk0rpmb: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mmcblk0boot1: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mmcblk0boot0: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mmcblk1: 59.5 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbee39f1d

Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 * 49152 311295 262144 128M c W95 FAT32 (LBA)
/dev/mmcblk1p2 311296 622591 311296 152M 83 Linux
/dev/mmcblk1p3 622592 933887 311296 152M 83 Linux
/dev/mmcblk1p4 933888 1196031 262144 128M 83 Linux

jenkins@8e82833bfd17:~/imx8/build$ bitbake core-image-base | grep ^MENDER_
jenkins@8e82833bfd17:~/imx8/build$

I have nothing for the bitbake as you see it
Mahdi

You missed the “-e” option to bitbake.

Drew

I’m sorry !

jenkins@8e82833bfd17:~/imx8/build$ bitbake -e core-image-base | grep ^MENDER_
MENDER_ARTIFACT_EXTRA_ARGS=""
MENDER_ARTIFACT_NAME=“release-1”
MENDER_ARTIFACT_SIGNING_KEY=""
MENDER_BOOT_PART="/dev/mmcblk1p1"
MENDER_BOOT_PART_DEFAULT="/dev/mmcblk1p1"
MENDER_BOOT_PART_DEFAULT_mender-ubi=""
MENDER_BOOT_PART_FSTYPE=“auto”
MENDER_BOOT_PART_FSTYPE_DEFAULT=“auto”
MENDER_BOOT_PART_MOUNT_LOCATION="/uboot"
MENDER_BOOT_PART_MOUNT_LOCATION_mender-grub_mender-bios="/boot/grub"
MENDER_BOOT_PART_MOUNT_LOCATION_mender-uboot="/uboot"
MENDER_BOOT_PART_SIZE_MB=“128”
MENDER_BOOT_PART_SIZE_MB_DEFAULT=“16”
MENDER_BOOT_PART_SIZE_MB_DEFAULT_mender-ubi=“0”
MENDER_CALC_ROOTFS_SIZE=“155648”
MENDER_DATA_PART="/dev/mmcblk1p4"
MENDER_DATA_PART_DEFAULT="/dev/mmcblk1p4"
MENDER_DATA_PART_DEFAULT_mender-ubi="/dev/mmcblk1p2"
MENDER_DATA_PART_FSTYPE=“auto”
MENDER_DATA_PART_FSTYPE_DEFAULT=“auto”
MENDER_DATA_PART_FSTYPE_DEFAULT_mender-ubi=“ubifs”
MENDER_DATA_PART_SIZE_MB=“128”
MENDER_DATA_PART_SIZE_MB_DEFAULT=“128”
MENDER_DEVICE_TYPE=“imx8qxpc0mek”
MENDER_DEVICE_TYPES_COMPATIBLE=“imx8qxpc0mek”
MENDER_DEVICE_TYPES_COMPATIBLE_DEFAULT=“imx8qxpc0mek”
MENDER_DEVICE_TYPE_DEFAULT=“imx8qxpc0mek”
MENDER_DEVICE_TYPE_DEFAULT_beaglebone-yocto_mender-grub=“imx8qxpc0mek-grub”
MENDER_FEATURES_DISABLE=" mender-grub mender-image-uefi"
MENDER_FEATURES_ENABLE=" mender-image mender-install mender-systemd mender-image-sd mender-uboot"
MENDER_FLASH_MINIMUM_IO_UNIT=“512”
MENDER_GRUB_STORAGE_DEVICE=""
MENDER_GRUB_STORAGE_DEVICE_DEFAULT=""
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET=“64”
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET_DEFAULT=“2”
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET_DEFAULT_mender-grub_mender-bios=“1”
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET_DEFAULT_mender-ubi=“0”
MENDER_IMAGE_BOOTLOADER_FILE=“imx-boot-imx8qxpc0mek-sd.bin”
MENDER_IMAGE_BOOTLOADER_FILE_DEFAULT=""
MENDER_IMAGE_BOOTLOADER_FILE_DEFAULT_mender-grub_mender-bios=“grub-core.img”
MENDER_IMAGE_BOOTLOADER_FILE_DEFAULT_mender-ubi=“u-boot.bin”
MENDER_IMAGE_ROOTFS_MAXSIZE_DEFAULT=“155648”
MENDER_IMAGE_ROOTFS_MAXSIZE_DEFAULT_mender-ubi=""
MENDER_IMAGE_ROOTFS_SIZE_DEFAULT=“155648”
MENDER_IS_ON_MTDID=""
MENDER_MAXIMUM_LEB_COUNT=“1024”
MENDER_MBR_BOOTLOADER_FILE=""
MENDER_MBR_BOOTLOADER_FILE_DEFAULT=""
MENDER_MBR_BOOTLOADER_FILE_DEFAULT_mender-grub_mender-bios=“boot.img”
MENDER_MBR_BOOTLOADER_LENGTH=“446”
MENDER_MTDIDS=""
MENDER_MTDPARTS=""
MENDER_MTD_UBI_DEVICE_NAME=""
MENDER_MTD_UBI_DEVICE_NAME_DEFAULT=""
MENDER_MTD_UBI_DEVICE_NAME_DEFAULT_mender-ubi=“ubi”
MENDER_NAND_FLASH_PAGE_SIZE=“2048”
MENDER_PARTITIONING_OVERHEAD_KB=“32768”
MENDER_PARTITIONING_OVERHEAD_KB_DEFAULT=“32768”
MENDER_PARTITIONING_OVERHEAD_KB_DEFAULT_mender-ubi=“655360”
MENDER_PARTITION_ALIGNMENT=“8388608”
MENDER_PARTITION_ALIGNMENT_DEFAULT=“8388608”
MENDER_PARTITION_ALIGNMENT_DEFAULT_mender-ubi=“8388608”
MENDER_RESERVED_SPACE_BOOTLOADER_DATA=“16777216”
MENDER_RESERVED_SPACE_BOOTLOADER_DATA_DEFAULT=“16777216”
MENDER_RESERVED_SPACE_BOOTLOADER_DATA_DEFAULT_mender-uboot=“16777216”
MENDER_ROOTFS_PART_A="/dev/mmcblk1p2"
MENDER_ROOTFS_PART_A_DEFAULT="/dev/mmcblk1p2"
MENDER_ROOTFS_PART_A_DEFAULT_mender-ubi="/dev/mmcblk1p0"
MENDER_ROOTFS_PART_A_NAME="/dev/mmcblk1p2"
MENDER_ROOTFS_PART_A_NAME_DEFAULT="/dev/mmcblk1p2"
MENDER_ROOTFS_PART_A_NAME_DEFAULT_mender-ubi="/dev/mmcblk1:rootfsa"
MENDER_ROOTFS_PART_B="/dev/mmcblk1p3"
MENDER_ROOTFS_PART_B_DEFAULT="/dev/mmcblk1p3"
MENDER_ROOTFS_PART_B_DEFAULT_mender-ubi="/dev/mmcblk1p1"
MENDER_ROOTFS_PART_B_NAME="/dev/mmcblk1p3"
MENDER_ROOTFS_PART_B_NAME_DEFAULT="/dev/mmcblk1p3"
MENDER_ROOTFS_PART_B_NAME_DEFAULT_mender-ubi="/dev/mmcblk1:rootfsb"
MENDER_STATE_SCRIPTS_VERSION=“2”
MENDER_STORAGE_DEVICE="/dev/mmcblk1"
MENDER_STORAGE_DEVICE_BASE="/dev/mmcblk1p"
MENDER_STORAGE_DEVICE_BASE_DEFAULT="/dev/mmcblk1p"
MENDER_STORAGE_DEVICE_BASE_DEFAULT_mender-ubi="/dev/mmcblk1_"
MENDER_STORAGE_DEVICE_DEFAULT="/dev/mmcblk0"
MENDER_STORAGE_DEVICE_DEFAULT_mender-ubi=“ubi0”
MENDER_STORAGE_DEVICE_DEFAULT_x86="/dev/hda"
MENDER_STORAGE_DEVICE_DEFAULT_x86-64="/dev/hda"
MENDER_STORAGE_DEVICE_imx8mmevk="/dev/mmcblk1"
MENDER_STORAGE_DEVICE_imx8mqevk="/dev/mmcblk1"
MENDER_STORAGE_DEVICE_imx8qxpc0mek="/dev/mmcblk1"
MENDER_STORAGE_PEB_SIZE=“8388608”
MENDER_STORAGE_TOTAL_SIZE_MB=“608”
MENDER_STORAGE_TOTAL_SIZE_MB_DEFAULT=“608”
MENDER_UBI_LEB_PEB_BLOCK_OVERHEAD=“0”
MENDER_UBI_LEB_SIZE=“8388608”
MENDER_UBI_TOTAL_BAD_PEB_OVERHEAD=“0”
MENDER_UBI_TOTAL_FIXED_OVERHEAD=“33554432”
MENDER_UBI_TOTAL_LEB_PEB_OVERHEAD=“0”
MENDER_UBOOT_ENV_STORAGE_DEVICE_OFFSET=“8388608”
MENDER_UBOOT_ENV_UBIVOL_NUMBER_1=“3”
MENDER_UBOOT_ENV_UBIVOL_NUMBER_2=“4”
MENDER_UBOOT_POST_SETUP_COMMANDS=""
MENDER_UBOOT_POST_SETUP_COMMANDS_DEFAULT=""
MENDER_UBOOT_PRE_SETUP_COMMANDS=""
MENDER_UBOOT_PRE_SETUP_COMMANDS_DEFAULT=""
MENDER_UBOOT_STORAGE_DEVICE=""
MENDER_UBOOT_STORAGE_DEVICE_DEFAULT=""
MENDER_UBOOT_STORAGE_DEVICE_DEFAULT_mender-ubi=“dummy”
MENDER_UBOOT_STORAGE_INTERFACE=""
MENDER_UBOOT_STORAGE_INTERFACE_DEFAULT=""
MENDER_UBOOT_STORAGE_INTERFACE_DEFAULT_mender-ubi=“dummy”
jenkins@8e82833bfd17:~/imx8/build$

@kacf any ideas on this one?

Failed to read the current active partition: No match between boot and root partitions

The u-boot environment seems to match up on the partition numbering and is read the same in both Linux and U-Boot.

Drew

Hi Drew,
I think the problem is with mender_setup which is not running.
I updated the value of mender_saveenv_canary in u-boot

setenv mender_saveenv_canary 1
saveenv
boot

After booting, I check the mender client, now the partition is seen by mender

root@imx8qxpc0mek:~# journalctl -u mender -f
– Logs begin at Thu 1970-01-01 01:44:14 UTC. –
Jan 01 01:44:17 imx8qxpc0mek systemd[1]: Started Mender OTA update service.
Jan 01 01:44:22 imx8qxpc0mek mender[3726]: time=“1970-01-01T01:44:22Z” level=info msg=“Configuration file does not exist: /var/lib/mender/mender.conf” module=config
Jan 01 01:44:22 imx8qxpc0mek mender[3726]: time=“1970-01-01T01:44:22Z” level=info msg=“Loaded configuration file: /etc/mender/mender.conf” module=config
Jan 01 01:44:23 imx8qxpc0mek mender[3726]: time=“1970-01-01T01:44:23Z” level=info msg=“Mender running on partition: /dev/mmcblk1p2” module=main
Jan 01 01:44:23 imx8qxpc0mek mender[3726]: time=“1970-01-01T01:44:23Z” level=info msg="API Gateway certificate (in PEM format): \n-----BEGIN CERTIFICATE-----\nMIIBfTCCASOgt
Jan 01 01:44:23 imx8qxpc0mek mender[3726]: time=“1970-01-01T01:44:23Z” level=info msg="Issuer: , Valid from: 2016-12-14 19:52:46 +0000 UTC, Valid to: 2026-12-12 19:52:46t
Jan 01 01:44:23 imx8qxpc0mek mender[3726]: time=“1970-01-01T01:44:23Z” level=info msg=“State transition: init [none] → init [none]” module=mender
Jan 01 01:44:23 imx8qxpc0mek mender[3726]: time=“1970-01-01T01:44:23Z” level=info msg=“State transition: init [none] → idle [Idle]” module=mender
Jan 01 01:44:23 imx8qxpc0mek mender[3726]: time=“1970-01-01T01:44:23Z” level=info msg=“State transition: idle [Idle] → authorize-wait [Idle]” module=mender
Jan 01 01:44:23 imx8qxpc0mek mender[3726]: time=“1970-01-01T01:44:23Z” level=info msg=“State transition: authorize-wait [Idle] → authorize [Sync]” module=mender

I will test the switch between the partitions.

@drewmoseley

I wanted to switch between active / inactive partitions (mmcblk1p2 / mmcblk1p3)

root@imx8qxpc0mek:~#fw_setenv mender_boot_part=3
root@imx8qxpc0mek:~#fw_setenv mender_boot_part_hex=3
root@imx8qxpc0mek:~#reboot

After reboot, I checked mender_boot_part an mender_boot_part_hex values :

root@imx8qxpc0mek:~# fw_printenv mender_boot_part
mender_boot_part=3
root@imx8qxpc0mek:~# fw_printenv mender_boot_part_hex
mender_boot_part_hex=3
root@imx8qxpc0mek:~#

But the current partition is /dev/mmcblk1p2 as it was before the reboot

root@imx8qxpc0mek:~# journalctl -u mender -f
– Logs begin at Mon 2021-03-01 02:22:43 UTC. –
Mar 01 02:22:52 imx8qxpc0mek mender[3721]: time=“2021-03-01T02:22:52Z” level=info msg="Configuration file does not exist: /var/lib/mender/mender.cog
Mar 01 02:22:52 imx8qxpc0mek mender[3721]: time=“2021-03-01T02:22:52Z” level=info msg=“Loaded configuration file: /etc/mender/mender.conf” module=cg
Mar 01 02:22:52 imx8qxpc0mek mender[3721]: time=“2021-03-01T02:22:52Z” level=info msg=“Mender running on partition: /dev/mmcblk1p2” module=main

Do you have any idea !

Thanks,

Mahdi

Not off the top of my head. You’ll need to break out to the u-boot command line and troubleshoot a bit. Print the BOOTCMD environment variable and manually step through it to see where it differs from the expected boot sequence.

Drew

Hi @drewmoseley ,
Thank you very much for all your help and useful information !

The problem is with the mmcargs in uboot env.
I updated the mmcargs
=> setenv mmcargs “setenv bootargs console=${console},${baudrate} earlycon root=${mender_kernel_root}”
Now I can switch between partitions.
*I tested the inventory it’s Ok
*I tested the partial_update it’s OK
The current image is flashed in the sdcard.

Now I wanted to generate a build that I will flash it on the emmc.
Here are the changes I made:

In the local.conf
I changed :
MENDER_STORAGE_DEVICE_imx8qxpc0mek = “/dev/mmcblk0”
MENDER_UBOOT_STORAGE_DEVICE_imx8qxpc0mek = “0”

In imx8qxp_mek.h :
I removed this line:
#define CONFIG_SYS_MMC_ENV_DEV 1 /USDHC2/

I compiled u-boot, I generated a new image
I flashed the image in the emmc with uuu.
The problem is that the mender environment variables are not taken into account in u-boot.

=> printenv
auth_os=auth_cntr ${cntr_addr}
baudrate=115200
board_name=MEK
board_rev=iMX8QXP
boot_fdt=try
boot_os=booti ${loadaddr} - ${fdt_addr};
bootargs=console=ttyLP0,115200 earlycon root=/dev/mmcblk0p2 rootwait rw
bootcmd=mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if test ${sec_boot} = yes; then if run loadcntr; then run mmcboot; else run netboot; fi; else if run loadii
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}; fi; else echo "Run;
bootdelay=3
bootscript=echo Running bootscript from mmc …; source
cntr_addr=0x98000000
cntr_file=os_cntr_signed.bin
commit_atf=c949a88
commit_mkimage=8da5cd23
commit_scfw=56682d58
commit_secofw=4f5b6919
console=ttyLP0
dom0fdt_file=imx8qxp-mek-dom0.dtb
emmc_dev=0
ethact=ethernet@5b040000
ethaddr=00:04:9f:06:a5:ff
ethprime=eth0
fastboot_dev=mmc0
fdt_addr=0x83000000
fdt_file=fsl-imx8qxp-mek.dtb
fdt_high=0xffffffffffffffff
fdtcontroladdr=fce0c010
fileaddr=80280000
filesize=164b200
image=Image
initrd_addr=0x83100000
initrd_high=0xffffffffffffffff
jh_mmcboot=setenv fdt_file imx8qxp-mek-root.dtb;setenv boot_os ‘scu_rm dtb ${fdt_addr}; booti ${loadaddr} - ${fdt_addr};’; run mmcboot;
jh_netboot=setenv fdt_file imx8qxp-mek-root.dtb;setenv boot_os ‘scu_rm dtb ${fdt_addr}; booti ${loadaddr} - ${fdt_addr};’; run netboot;
kboot=booti
loadaddr=0x80280000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
loadm4image_0=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4_0_image}
m4_0_image=m4_0.bin
m4boot_0=run loadm4image_0; dcache flush; bootaux ${loadaddr} 0
mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc clk_ignore_unused
mmcargs=setenv bootargs console=${console},${baudrate} earlycon root=${mmcroot}
mmcautodetect=yes
mmcboot=echo Booting from mmc …; run mmcargs; if test ${sec_boot} = yes; then if run auth_os; then run boot_os; else echo ERR: failed to authenticate; fi; else if test ${boot_fdt} = yes || test ${boot;
mmcdev=0
mmcpart=1
mmcroot=/dev/mmcblk0p2 rootwait rw
nandfit_part=yes
netargs=setenv bootargs console=${console},${baudrate} earlycon 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; if test ${sec_boot} = yes; then ${get_cmd} ${cntr_addr} ${cntr_file}; if;
script=boot.scr
sd_dev=1
sec_boot=no
serial#=170d300e829666c2
soc_type=imx8qxp
splashimage=0x9e000000
xenboot_common=${get_cmd} ${loadaddr} xen;${get_cmd} ${fdt_addr} ${dom0fdt_file};${get_cmd} ${xenlinux_addr} ${image};fdt addr ${fdt_addr};fdt resize 256;fdt set /chosen/module@0 reg <0x00000000 ${xenli;
xenhyper_bootargs=console=dtuart dtuart=/serial@5a060000 dom0_mem=1024M dom0_max_vcpus=2 dom0_vcpus_pin=true
xenlinux_addr=0x9e000000
xenlinux_bootargs=
xenlinux_console=hvc0 earlycon=xen
xenmmcboot=setenv get_cmd “fatload mmc ${mmcdev}:${mmcpart}”;setenv console ${xenlinux_console};run mmcargs;run xenboot_common;
xennetboot=setenv get_cmd dhcp;setenv console ${xenlinux_console};run netargs;run xenboot_common;

Do you have any idea !
Are the modifications I made for an image for the emmc are good or not?

Thanks,

Mahdi

Did you rebuild u-boot through Yocto? You will need to make your modification into a patch that is applied by the Yocto recipe to ensure that all the Mender patches are applied as well.

Drew