Error: "bootcmd_run" not defined; iMX8QXP + Iris Rev 2.0

Hello I’m having issues booting to my custom image.

My SD card was formatted with FAT32, and these were the image files I moved there:

user@rog:~$ ls /media/EBF7-ECC3/
image.json          myos-image-colibri-imx8x.bootfs.tar.xz
imx-boot            myos-image-colibri-imx8x.tar.xz
LA_OPT_NXP_SW.html  toradexlinux.png
marketing.tar       u-boot-initial-env-sd
prepare.sh          wrapup.sh

Installed the image with Tezi 5.7.5+build.19 for Colibri iMX8X, and flashed the image with recovery mode as stated in the documentation.

When booting, I’m having these errors:

U-Boot 2020.04-0+git.1a13a90766f7 (Jan 31 2024 - 17:53:31 +0000)

CPU:   NXP i.MX8QXP RevC A35 at 1200 MHz at 43C

DRAM:  2 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
Model: Toradex Colibri iMX8 QuadXPlus 2GB Wi-Fi / BT IT V1.0D, Serial# 07329830

 BuildInfo: 
  - SCFW 216a2c2e, SECO-FW 376e3c15, IMX-MKIMAGE 6745ccdc, ATF b0a00f2
  - U-Boot 2020.04-0+git.1a13a90766f7 

flash target is MMC:0
Net:   eth0: ethernet@5b040000 [PRIME]
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
973 bytes read in 19 ms (49.8 KiB/s)
## Executing script at 83200000
** Unrecognized filesystem type **
## Error: "bootcmd_run" not defined
SCRIPT FAILED: continuing...

My image.json:

{
    "config_format": "4",
    "autoinstall": false,
    "name": "myos-image version 1.0-r0",
    "description": "A console-only image with more full-featured Linux system functionality installed.",
    "version": "3.1.32",
    "release_date": "2024-03-13",
    "u_boot_env": "u-boot-initial-env-sd",
    "prepare_script": "prepare.sh",
    "wrapup_script": "wrapup.sh",
    "marketing": "marketing.tar",
    "icon": "toradexlinux.png",
    "supported_product_ids": [
        "0038",
        "0050",
        "0051",
        "0052"
    ],
    "blockdevs": [
        {
            "name": "mmcblk0",
            "partitions": [
                {
                    "partition_size_nominal": 48,
                    "want_maximised": false,
                    "content": {
                        "label": "BOOT",
                        "filesystem_type": "FAT",
                        "mkfs_options": "",
                        "filename": "myos-image-colibri-imx8x.bootfs.tar.xz",
                        "uncompressed_size": 12.62890625
                    }
                },
                {
                    "partition_size_nominal": 512,
                    "want_maximised": true,
                    "content": {
                        "label": "RFS",
                        "filesystem_type": "ext4",
                        "mkfs_options": "-E nodiscard",
                        "filename": "myos-image-colibri-imx8x.tar.xz",
                        "uncompressed_size": 1222.00390625
                    }
                }
            ]
        },
        {
            "name": "mmcblk0boot0",
            "erase": true,
            "content": {
                "filesystem_type": "raw",
                "rawfiles": [
                    {
                        "filename": "imx-boot",
                        "dd_options": "seek=0"
                    }
                ]
            }
        }
    ]
}

boot.scr from myos-image-colibri-imx8x.bootfs.tar.xz:

# Copyright 2020 Toradex
#
# TorizonCore boot script.

if test -z "${altbootcmd}"
then
    env set altbootcmd 'env set rollback 1; run bootcmd'
    env save
fi

if test "${rollback}" = "1" && test "${upgrade_available}" = "1"
then
    # Make sure to reset upgrade_available to avoid unnecessary wear
    # Note this also makes rollback permanent. aktualizr will reset rollback
    # when a new (hopefully better) update comes in.
    env set upgrade_available 0
    env save
fi

# save default U-Boot devicetree file to use in a rollback situation
env set fdtfile2 "${fdtfile}"

if test -n "${loadaddr}"
then
    ext4load ${devtype} ${devnum}:1 ${loadaddr} /boot/loader/uEnv.txt; env import -t ${loadaddr} ${filesize}
else
    ext4load ${devtype} ${devnum}:1 ${scriptaddr} /boot/loader/uEnv.txt; env import -t ${scriptaddr} ${filesize}
fi

run bootcmd_run

u-boot-initial-env-sd:

bootcmd=run bootcmd_mmc0
bootdelay=1
baudrate=115200
ethprime=eth0
ipaddr=192.168.10.2
serverip=192.168.10.1
preboot=setenv fdtfile ${soc}-colibri-${fdt_board}.dtb
rootpath=/srv/nfs
netmask=255.255.255.0
loadaddr=0x87000000
arch=arm
cpu=armv8
board=colibri-imx8x
board_name=colibri-imx8x
vendor=toradex
soc=imx8
bootlimit=3
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
boot_pci_enum=pci enum
boot_net_usb_start=usb start
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi
boot_prefixes=/ /boot/
boot_scripts=boot.scr.uimg boot.scr
boot_script_dhcp=boot.scr.uimg
boot_targets=mmc1 mmc0 usb0 dhcp 
boot_syslinux_conf=extlinux/extlinux.conf
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
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
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
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
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
bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_mmc0=devnum=0; run mmc_boot
bootcmd_usb0=devnum=0; run usb_boot
bootcmd_dhcp=setenv devtype dhcp; run boot_net_usb_start; run boot_pci_enum; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
sec_boot=no
m4_0_image=m4_0.bin
loadm4image_0=${load_cmd} ${loadaddr} ${m4_0_image}
m4boot_0=run loadm4image_0; dcache flush; bootaux ${loadaddr} 0
kernel_addr_r=0x96000000
fdt_addr_r=0x83100000
ramdisk_addr_r=0x8a000000
scriptaddr=0x83200000
boot_scripts=boot.scr
boot_script_dhcp=boot.scr
bootcmd_mfg=select_dt_from_module_version && fastboot 0
console=ttyLP3,115200 earlycon=lpuart32,0x5a090000,115200
fdt_addr=0x83000000
fdt_high=
fdt_board=eval-v3
finduuid=part uuid mmc ${mmcdev}:2 uuid
image=Image
initrd_addr=0x83800000
mmcargs=setenv bootargs console=${console},${baudrate} root=PARTUUID=${uuid} rootwait mmcdev=0
mmcpart=1
panel=NULL
setup=run mmcargs
update_uboot=askenv confirm Did you load 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
vidargs=video=imxdpufb5:off video=imxdpufb6:off video=imxdpufb7:off

I suppose there is something wrong with the u-boot configuration?
Any idea where I can start looking & debugging in order to fix it?
I can provide more info, if needed.

Hello @robs,

Welcome to the Toradex Community!

What Toradex BSP are you using as a base for your custom image?

Best Regards,
Bruno

Hello Bruno, here’s my bblayers.conf:

BBLAYERS ?= " \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-mono \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-security \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta\
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-filesystems \
 /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-networking \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-oe \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-perl \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-poky \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-python \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-myos \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-skeleton \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-webserver \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-freescale \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-freescale-3rdparty \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-freescale-distro \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-toradex-distro \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-toradex-nxp \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-toradex-bsp-common \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-toradex-torizon \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-updater \
  /home/ubuntu/roby/colibri-imx8x-bsp/layers/meta-virtualization \
  "

The “distro” comes from meta-myos, but I didnt setup anything related to boot there, only my custom recipes and distro.
I am using dunfell for everything also.

Hello @robs,

I am using dunfell for everything also.

The Toradex BSP release that uses Dunfell is the 5.x.y series.
Do you know which tag of the toradex-manifest your image is based on?

Also, looking at your boot.scr scripts, it looks like you are using TorizonCore, but your image.json file appears to be one from our standard BSP.
Is your image based on TorizonCore?

Best Regards,
Bruno

I’m using dunfell.5.x.y yes.
Im not sure what manifest I’m using, since I kinda build this manually.
About boot.scr, I have build TorizonCore in the past, but right now i’m building my own image. In the .bootfs.tar folder the boot.scr is auto generated.

Hello @robs,

We recommend that you base your image on one of our releases, to avoid issues with possibly conflicting configurations.

My recommendation is that you use our reference minimal image as a starting point for your image.
It is also important to use only the layers required for your project:

Mixing and matching the two may cause issues such as the one you are experiencing.

Best Regards,
Bruno