Bad Linux ARM64 Image magic!

ABTP
Thu, 06 May 2021 07:41:40 +0000
General Discussions

Hi dear community members,

I have been trying to integrate Mender with a Variscite VAR-SOM-MX8M-MINI running Boot2Qt-Zeus based on :
Yocto: Poky 3.0, BSP: NXP L5.4.3-1.0.0, Linux: lf-5.4.y

Before trying to integrate Mender, I was able to produce a bootable Boot2Qt image. Then, I added meta-mender-community and meta-mender layers both from the Zeus branches and followed the regular integration approach (updating local.conf and bblayers.conf for sdcard image). After tweeking local.conf variables a bit, I managed to get the image to successfully build. However, after flashing it into an SDCard, u-boot is not able to load the kernel. Here is the serial output:

U-Boot SPL 2019.04-lf-5.4.y_v2019.04_var01+gbcdb05a53e (Apr 28 2021 - 08:00:24 +0000)
Normal Boot
Trying to boot from MMC1

U-Boot 2019.04-lf-5.4.y_v2019.04_var01+gbcdb05a53e (Apr 28 2021 - 08:00:24 +0000)

CPU: Freescale i.MX8MMQ rev1.0 1800 MHz (running at 1200 MHz)
CPU: Commercial temperature grade (0C to 95C) at 45C
Reset cause: POR
Model: Variscite VAR-SOM-MX8M-MINI
DRAM: 2 GiB
MMC: FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC… OK
In: serial
Out: serial
Err: serial

BuildInfo:

    ATF 7b3389d
    U-Boot 2019.04-lf-5.4.y_v2019.04_var01+gbcdb05a53e

Part number: VSM-MX8MM-101
Assembly: AS2002150192
Production date: 2020 Apr 06
Serial Number: f8:dc:7a:3e:81:ba
flash target is MMC:1
Net: eth0: ethernet@30be0000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
Bad Linux ARM64 Image magic!

printenv:

u-boot=> printenv
altbootcmd=run mender_altbootcmd; run bootcmd
arch=arm
baudrate=115200
board=imx8mm_var_dart
board_name=VAR-SOM-MX8M-MINI
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_efi_binary=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr ${fdtcontroladdr};fi;load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootaa64.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=mmc2 mmc1
bootargs=root=/dev/mmcblk1p1
bootcmd=run mender_setup; setenv bootargs root=${mender_kernel_root} ${bootargs}; if test “${fdt_addr_r}” != “”; then load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; fi; load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name}; ${mender_boot_kernel_type} ${kernel_addr_r} - ${fdt_addr_r}; run mender_try_to_recover
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;
bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_mmc2=devnum=2; run mmc_boot
bootcount=1
bootdelay=1
bootdir=/boot
bootlimit=1
cma_size=cma=640M@1376M
console=ttymxc3,115200 earlycon=ec_imx6q,0x30a60000,115200
cpu=armv8
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
emmc_dev=1
ethaddr=f8:dc:7a:3e:81:ba
ethprime=FEC
fastboot_dev=mmc1
fdt_addr_r=0x43000000
fdt_high=0xffffffffffffffff
fdtcontroladdr=b6d2d7c0
fdtfile=imx8mm-var-som.dtb
findfdt=if test $fdtfile = undefined; then if test $board_name = VAR-SOM-MX8M-MINI; then if test $som_rev = som_rev10; then setenv fdtfile imx8mm-var-som-rev10.dtb; else setenv fdtfile imx8mm-var-som.dtb; fi;else setenv fdtfile imx8mm-var-dart.dtb;fi; fi;
image=Image.gz
img_addr=0x42000000
initrd_addr=0x43800000
initrd_high=0xffffffffffffffff
kboot=booti
kernel_addr_r=0x40480000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadaddr=0x40480000
loadm4bin=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bootdir}/${m4_bin}; cp.b ${loadaddr} ${m4_addr} ${filesize}
m4_addr=0x7e0000
m4_bin=hello_world.bin
mender_altbootcmd=if test ${mender_boot_part} = 1; then setenv mender_boot_part 2; setenv mender_boot_part_hex 2; else setenv mender_boot_part 1; setenv mender_boot_part_hex 1; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=booti
mender_boot_part=1
mender_boot_part_hex=1
mender_boot_part_name=/dev/mmcblk1p1
mender_check_saveenv_canary=1
mender_kernel_name=Image
mender_kernel_root=/dev/mmcblk1p1
mender_kernel_root_name=/dev/mmcblk1p1
mender_pre_setup_commands= if test “${ramsize_check}” != “”; then run ramsize_check; fi; if test “${mmcargs}” != “”; then run mmcargs; fi; if test “${videoargs}” != “”; then run videoargs; fi; if test “${optargs}” != “”; then run optargs; fi; run findfdt; setenv mender_dtb_name ${fdt_file}; setenv kernel_addr_r ${loadaddr};
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/mmcblk1p${mender_boot_part}; if test ${mender_boot_part} = 1; then setenv mender_boot_part_name /dev/mmcblk1p1; else setenv mender_boot_part_name /dev/mmcblk1p2; 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
mender_uboot_root=mmc 0:1
mender_uboot_root_name=/dev/mmcblk1p1
mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc clk_ignore_unused
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
mmcdev=0
mmcpart=1
ramsize_check=if test $sdram_size -le 512; then setenv cma_size cma=320M; else setenv cma_size cma=640M@1376M; fi;
runm4bin=if test ${m4_addr} = 0x7e0000; then echo Booting M4 from TCM; else echo Booting M4 from DRAM; dcache flush; fi; bootaux ${m4_addr};
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;run scan_dev_for_efi;
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_efi=setenv efi_fdtfile ${fdtfile}; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootaa64.efi; then echo Found EFI removable media binary efi/boot/bootaa64.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing…; fi; setenv efi_fdtfile
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
script=boot.scr
sd_dev=0
sdram_size=2048
serial#=220c1a09dab4b749
soc=imx8m
soc_type=imx8mm
som_rev=som_rev11
stderr=serial
stdin=serial
stdout=serial
upgrade_available=0
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi
use_m4=no
vendor=variscite

Environment size: 6623/131067 bytes

local.conf: (mender section only)

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_IMAGE_BOOTLOADER_FILE_imx6ul-var-dart = “u-boot-spl.img”
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET_imx6ul-var-dart = “2”

MENDER_IMAGE_BOOTLOADER_FILE_imx8mm-var-dart = “imx-boot-imx8mm-var-dart-sd.bin”
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET_imx8mm-var-dart = “66”

MENDER_IMAGE_BOOTLOADER_FILE_imx8mn-var-som = “imx-boot”
MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET_imx8mn-var-som = “64”
do_image_sdimg[depends] += “${@bb.utils.contains(‘MACHINE’, ‘imx8mn-var-som’, ‘imx-boot:do_deploy’, ‘’, d)}”

MENDER_BOOT_PART_SIZE_MB_imx6ul-var-dart = “16”
IMAGE_BOOT_FILES_remove_imx6ul-var-dart = “${KERNEL_IMAGETYPE} ${KERNEL_DEVICETREE}”

MENDER_BOOT_PART_SIZE_MB_imx8mm-var-dart = “16”
IMAGE_BOOT_FILES_remove_imx8mm-var-dart = “${KERNEL_IMAGETYPE} ${@make_dtb_boot_files(d)}”

MENDER_BOOT_PART_SIZE_MB_imx8mn-var-som = “16”
IMAGE_BOOT_FILES_remove_imx8mn-var-som = “${KERNEL_IMAGETYPE} ${@make_dtb_boot_files(d)}”

IMAGE_FSTYPES_remove = “tar.gz ext4 wic.gz wic.bmap multiubi mender.bmap wic sdcard”

MENDER_FEATURES_ENABLE_append = " mender-image-sd mender-uboot"
MENDER_FEATURES_DISABLE_append = " mender-image-uefi mender-grub"

MACHINE_EXTRA_RDEPENDS_append= " u-boot-fw-utils"

VARISCITE_UBOOT_ENV_IN_EMMC = “0”

MENDER_STORAGE_DEVICE_imx6ul-var-dart = “/dev/mmcblk0”
MENDER_UBOOT_STORAGE_DEVICE_imx6ul-var-dart = “0”
UBOOT_CONFIG_imx6ul-var-dart = “sd”

MENDER_STORAGE_DEVICE_imx8mm-var-dart = “/dev/mmcblk1”
MENDER_UBOOT_STORAGE_DEVICE_imx8mm-var-dart = “0”
UBOOT_CONFIG_imx8mm-var-dart = “sd”

MENDER_STORAGE_DEVICE_imx8mn-var-som = “/dev/mmcblk1”
MENDER_UBOOT_STORAGE_DEVICE_imx8mn-var-som = “1”
UBOOT_CONFIG_imx8mm-var-dart = “sd”

MENDER_BOOT_PART_SIZE_MB_mender-uboot = “0”
MENDER_KERNEL_IMAGETYPE= “Image”

MENDER_STORAGE_TOTAL_SIZE_MB_imx8mm-var-dart = “6144”
IMAGE_POSTPROCESS_COMMAND_remove = “do_qbsp_image;”

After going though posts from people facing similar error:

https://hub.mender.io/t/issue-with-variscite-var-som-mx8m-nano/2840/11

https://hub.mender.io/t/variscite-var-dart-imx8mm-problem/2811

I made a couple of changes to the local.conf according to those posts, but I am still getting the same error message.

The only thing that succeeded in loading the kernel was to enable grub:

MENDER_FEATURES_ENABLE_append = " mender-image-sd mender-grub"
MENDER_FEATURES_DISABLE_append = " mender-image-uefi"

This results in u-boot loading Grub then Grub loading the kernel, so somwhere Grub is able to load the kernel but u-boot is not able. I do not want this behavious, as I want u-boot to load the kernel.

Does anyone have an idea how I can solve this " Bad Linux ARM64 Image magic! " issue? I really appreciate any kind of help. Thank you

8 posts - 2 participants