File system update after mender install on Yocto. It still boots with old file system

Hi
I am using Apalis imx 8 board.
We have added mender layers to our custom Yocto Build. Layers have been added and local.conf file changed accordingly.
We use QT boot to Qt 6.4.3 layer.
Integrating mender layer have worked and we created tezii image for our board. Loaded this image using Toradex easy installer. IT worked as expected. Partitions has created A/B and data partitions are present.
We tested manual update using “mender install file.mender”. This worked too.

root@b2qt-apalis-imx8:~# mender install /media/sda1/b2qt-embedded-qt6-image-apalis-imx8-20230531134214.mender
INFO[0000] Loaded configuration file: /var/lib/mender/mender.conf
INFO[0000] Loaded configuration file: /etc/mender/mender.conf
INFO[0002] Mender running on partition: /dev/mmcblk0p3
INFO[0003] Mender running on partition: /dev/mmcblk0p3
INFO[0003] Start updating from local image file: [/media/sda1/b2qt-embedded-qt6-image-apalis-imx8-20230531134214.mender]
Installing Artifact of size 852783616…
INFO[0003] No public key was provided for authenticating the artifact
INFO[0003] Opening device “/dev/mmcblk0p2” for writing
INFO[0003] Native sector size of block device /dev/mmcblk0p2 is 512 bytes. Mender will write in chunks of 1048576 bytes
… - 99 %INFO[0119] All bytes were successfully written to the new partition
INFO[0119] The optimized block-device writer wrote a total of 6049 frames, where 97 frames did need to be rewritten (i.e., skipped)
INFO[0120] Wrote 6341787648/6341787648 bytes to the inactive partition
… - 100 %
INFO[0120] Enabling partition with new image installed to be a boot candidate: 2
Use ‘commit’ to update, or ‘rollback’ to roll back the update.
At least one payload requested a reboot of the device it updated.
root@b2qt-apalis-imx8:~#

It was booted from /dev/mmcblk0p3 and as seen from the log it updated /dev/mmcblk0p2 partition.
I have used mender commit on next power up.

The problem is kernel and boot settings (device tree file) have changed with the update. But file system partition has not been updated to correct one. It still boots to /dev/mmcblk0p3.

I have checked /dev/mmcblk0p2 and looks like it is updated with correct image, files are there. But it is not an active partition after the update.

I have started to experiment local.conf file settings and added e a few attributes for mender.

#MENDER_BOOT_PART:apalis-imx8 = “${MENDER_STORAGE_DEVICE_BASE}p1”
#MENDER_ROOTFS_PART_A:apalis-imx8 = “${MENDER_STORAGE_DEVICE_BASE}p2”
MENDER_ROOTFS_PART_A:apalis-imx8 = “/dev/mmcblk0p3”
#MENDER_ROOTFS_PART_B:apalis-imx8 = “${MENDER_STORAGE_DEVICE_BASE}p3”
MENDER_ROOTFS_PART_B:apalis-imx8 = “/dev/mmcblk0p2”
#MENDER_DATA_PART:apalis-imx8 = “${MENDER_STORAGE_DEVICE_BASE}p4”

But no luck with the image created and written to board with this settings it stuck on boot after kernel load.

Waiting for root device /dev/mmcblk02…
These are the partitions in previous test:
b2qt-apalis-imx8:~:>ls /dev/mmcblk0
mmcblk0 mmcblk0boot0 mmcblk0boot1 mmcblk0p1 mmcblk0p2 mmcblk0p3 mmcblk0p4 mmcblk0rpmb

Any help on the topic appreciated. We feel like missed it so close.

Thanks

@drewmoseley any pointers?

Nothing immediately comes to mind. My best guess is something is not right in the uboot environment itself. Can you post the output of “printenv” from the U-Boot prompt?
Drew

Here is my boot env:

b2qt-apalis-imx8:~24>fw_printenv
altbootcmd=run mender_altbootcmd; run bootcmd
apply_overlays=for overlay_file in ${fdt_overlays}; do echo Applying Overlay: ${overlay_file} && load ${mender_uboot_root} ${loadaddr} ${overlays_prefix}${overlay_file} && fdt apply ${loadaddr}; env set overlay_file; done; true
arch=arm
baudrate=115200
board=apalis-imx8
board_name=Apalis iMX8QM
board_rev=v1.0
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_file=Image
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=mmc1 mmc2 mmc0 dhcp
bootcmd=run distro_bootcmd
bootcmd_args=run rootfsargs_set && env set bootargs ${defargs} ${rootfsargs} ${setupargs} ${vidargs} ${tdxargs}
bootcmd_boot=echo “Bootargs: ${bootargs}” && booti ${kernel_addr_r} - ${fdt_addr_r}
bootcmd_dhcp=devtype=dhcp; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;
bootcmd_dtb=echo Loading DeviceTree: ${fdtfile}; load ${mender_uboot_root} ${fdt_addr_r} ${load_prefix}${fdtfile}
bootcmd_kernel=load ${mender_uboot_root} ${kernel_addr_load} ${load_prefix}${kernel_image}
bootcmd_mmc0=devnum=0; run mmc_boot
bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_mmc2=devnum=2; run mmc_boot
bootcmd_overlays=run load_overlays_file && run fdt_resize && run apply_overlays
bootcmd_prepare=run set_bootcmd_kernel; run set_bootcmd_dtb; run set_load_overlays_file; run set_apply_overlays
bootcmd_run=run m4boot; run bootcmd_dtb && run bootcmd_overlays && run bootcmd_args && run bootcmd_kernel && run bootcmd_unzip && run bootcmd_boot; echo “Booting from ${devtype} failed!”
bootcmd_unzip=;
bootcount=1
bootdelay=1
bootfstype=fat
bootlimit=1
commit_atf=3c1583b
commit_mkimage=3bfcfccb
commit_scfw=f5623878
commit_secofw=c9de51c0
console=ttyLP1
cpu=armv8
devplist=1
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
ethaddr=00:14:2d:6c:74:10
fdt_addr_r=0x9d400000
fdt_board=eval
fdt_resize=fdt addr ${fdt_addr_r} && fdt resize 0x20000
fdtcontroladdr=fd6a0150
fdtfile=imx8qm-apalis-v1.1-ixora-v1.2.dtb
fileaddr=9d480000
filesize=c93
initrd_addr=0x83800000
initrd_high=0xffffffffffffffff
ipaddr=192.168.10.2
kernel_addr_load=0x95400000
kernel_addr_r=0x95400000
kernel_comp_addr_r=0xf0000000
kernel_comp_size=0x08000000
kernel_image=Image.gz
load_cmd=load ${mender_uboot_root}
load_cmd_boot=load ${mender_uboot_root}
load_overlays_file=load ${mender_uboot_root} ${loadaddr} ${overlays_file}; env import -t ${loadaddr} ${filesize}
load_prefix=boot/
loadaddr=0x95400000
m4boot=;
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_boot_kernel_type=booti
mender_boot_part=2
mender_boot_part_hex=2
mender_check_saveenv_canary=1
mender_dtb_name=imx8qm-apalis-v1.1-ixora-v1.2.dtb
mender_kernel_name=Image.gz
mender_post_setup_commands= ; setenv tdxargs ${tdxargs} ${bootargs}; ; setenv overlays_file /boot/overlays.txt;setenv overlays_prefix boot/overlays/
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_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; then 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 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_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
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
netmask=255.255.255.0
overlays_file=overlays.txt
overlays_prefix=overlays/
preboot=setenv fdtfile ${mender_dtb_name}
ramdisk_addr_r=0x9d500000
rootfsargs_set=env set rootfsargs root=${mender_kernel_root} ro rootwait
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}…; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing…; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing…; fi; done
scriptaddr=0x9d480000
serial#=07107600
serverip=192.168.10.1
set_apply_overlays=env set apply_overlays “for overlay_file in \${fdt_overlays}; do echo Applying Overlay: \${overlay_file} && ${load_cmd_boot} \${loadaddr} \${overlays_prefix}\${overlay_file} && fdt apply \${loadaddr}; env set overlay_file; done; true”
set_bootcmd_dtb=env set bootcmd_dtb “echo Loading DeviceTree: \${fdtfile}; ${load_cmd} \${fdt_addr_r} \${load_prefix}\${fdtfile}”
set_bootcmd_kernel=env set bootcmd_kernel “${load_cmd} \${kernel_addr_load} \${load_prefix}\${kernel_image}”
set_load_overlays_file=env set load_overlays_file “${load_cmd_boot} \${loadaddr} \${overlays_file}; env import -t \${loadaddr} \${filesize}”
setup=setenv setupargs console=tty1 console=${console},${baudrate} consoleblank=0 earlycon
setupargs=console=tty1 console=ttyLP1,115200 consoleblank=0 earlycon
soc=imx8qm
stderr=serial@5a070000
stdin=serial@5a070000
stdout=serial@5a070000
update_uboot=askenv confirm Did you load flash.bin resp. u-boot-dtb.imx (y/N)?; if test “$confirm” = “y”; then setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x0 ${blkcnt}; fi
upgrade_available=0
variant=-v1.1
vendor=toradex
ver=U-Boot 2022.04-0+git.1c83b1aaad86 (Jan 05 2023 - 08:25:45 +0000)

any help would be appreciated. we are this close to integrating it with the system now !! maybe something in our uboot environment that we are missing out !!

Well it uses distro_bootcmd which is expected. Since you are using boot2qt I’m assuming you didn’t use the same steps as documented here to get your sources right? Can you share the details of how you got the full set of sources?

Drew

repo init -u git://code.qt.io/yocto/boot2qt-manifest -m v6.4.3.xml

repo sync

Thats how we got the boot2qt sources.

after that we downloaded mender using git clone to kirkstone branch.

git clone GitHub - mendersoftware/meta-mender-community: Community supported integration layers for Mender on various boards -b kirkstone

git clone GitHub - mendersoftware/meta-mender: Yocto Project meta layer for the Mender client -b kirkstone

updated the local.conf baed on lessons from this post.

https://hub.mender.io/t/toradex-apalis-imx8-yocto-with-mender/3759

here are local.conf variables:

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 = “”

INHERIT += “mender-toradex”

MENDER_FEATURES_ENABLE:append = " mender-uboot mender-image-sd"
MENDER_FEATURES_DISABLE:append = " mender-grub mender-image-uefi"

IMAGE_CLASSES += “image_type_mender_tezi”
IMAGE_FSTYPES:append = " mender_tezi"
IMAGE_FSTYPES:remove = " teziimg"

Default is Image.gz, which is not compatible with GRUB

KERNEL_IMAGETYPE:aarch64_mender-grub = “Image”

boot.scr conflicts when using GRUB

IMAGE_BOOT_FILES:remove:mender-grub = “boot.scr-verdin-imx8mm;boot.scr”

Remove files from boot partition that are loaded by Mender

from the root partitions; this allows the files to be updated OTA

IMAGE_BOOT_FILES:remove:mender-uboot = “zImage ${KERNEL_DEVICETREE} overlays.txt overlays/*;overlays/”

MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET:apalis-imx8 = “0”
MENDER_BOOT_PART_SIZE_MB:apalis-imx8 = “32”
OFFSET_SPL_PAYLOAD:apalis-imx8 = “”
MENDER_STORAGE_DEVICE:apalis-imx8 = “/dev/mmcblk0”
MENDER_STORAGE_TOTAL_SIZE_MB:apalis-imx8 = “12288”

MENDER_UBOOT_POST_SETUP_COMMANDS:append = " ; setenv tdxargs ${tdxargs} ${bootargs}; "

MENDER_UBOOT_POST_SETUP_COMMANDS:append = " ; setenv overlays_file /boot/overlays.txt;setenv overlays_prefix boot/overlays/ "

I’ve never tried to get it working using the Boot2QT repo manifests. I’ve only ever used the Toradex manifests. I suspect something is not getting applied properly related to the Distro Boot stuff. Specifically I would suggest investigating this patch.

I’ll try to build with TORADEX_BSP_VERSION=6.2.0 and will probably need to make a few mods to the layer to support that but I suspect in your case you will need even more changes.

Drew

1 Like

yes , i remember i applied this patch as it was failing in patching. I manually created this patch and applied.

so seems like i applied.

+env set bootcmd_run 'run m4boot; run bootcmd_dtb && run bootcmd_overlays && run bootcmd_args && run bootcmd_kernel && run bootcmd_unzip && run bootcmd_boot; echo “Booting from ${devtype} failed!” && false’env set bootcmd_run ‘run m4boot; run bootcmd_dtb && run bootcmd_overlays && run bootcmd_args && run bootcmd_kernel && run bootcmd_unzip && run bootcmd_boot; echo “Booting from ${devtype} failed!”’

instead of

+env set bootcmd_run ‘run m4boot; run bootcmd_dtb && run bootcmd_overlays && run bootcmd_args && run bootcmd_kernel && run bootcmd_unzip && run bootcmd_boot; echo “Booting from ${devtype} failed!”’

Let us try that again and see if that works !!

Thanks drewmoseley , things are working fine now !!

you are a saviour :slight_smile: we may mark this thread as solved. i can list down few steps for boot2qt on imxapalis8 if you are okay with that.

Thanks All!
It is working with b2qt now.

1 Like

Noting down a kind of summary would be very much appreciated @dhiry2k, es far as I know the board also does not have a known good integration at the moment.

Greets
Josef

1 Like

sure, i added here, please update if you feel changes are needed.

1 Like