I can no longer boot Linux after attempting setenv for m4boot

I followed the instructions for installing and running everything on the target board all the way through building and running hello_world from the command line and in Eclipse. Then I compiled the rpmsg ping pong example and tried to follow the instructions to use setenv to set m4boot and make it run automatically (I have the elf file on an sd card which is inserted on the carrier board).

From that point forward it not only says that it can’t find the rpmsg ping pong elf file but it no longer boots Linux and just gives me a bootp message until it times out. It does this whether I leave the sd card inserted or not. I have no clue how to restore it to work again, nor how to get an m4boot working from the instructions that are very unclear.

Here is my printenv output:

printenv

arch=arm
baudrate=115200
board=colibri_imx7
board_name=colibri_imx7
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
boot_file=zImage
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_targets=mmc1 usb0 dhcp 
bootargs=ip=off root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait console=tty1 console=ttymxc0,115200n8 consoleblank=0 video=mxsfb:640x480M-16@60
bootcmd=run emmcboot ; echo ; echo emmcboot failed ; setenv fdtfile ${soc}-colibri-emmc-${fdt_board}.dtb && run distro_bootcmd;
bootcmd_dhcp=if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;
bootcmd_mmc1=setenv devnum 1; run mmc_boot
bootcmd_usb0=setenv devnum 0; run usb_boot
bootdelay=1
bootfstype=fat
bootm_size=0x10000000
console=ttymxc0
cpu=armv7
devnum=0
devplist=1
devtype=mmc
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
emmcargs=ip=off root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait
emmcboot=run setup; setenv bootargs ${defargs} ${emmcargs} ${setupargs} ${vidargs}; echo Booting from internal eMMC chip...; run m4boot && loa}
eth1addr=00:14:2d:3d:bc:18
ethact=FEC0
ethaddr=00:14:2d:2d:bc:18
ethprime=FEC
fdt_addr_r=0x82000000
fdt_board=eval-v3
fdt_fixup=;
fdt_high=0xffffffff
fdtcontroladdr=bff94a50
fdtfile=imx7d-colibri-emmc-eval-v3.dtb
initrd_high=0xffffffff
ip_dyn=yes
ipaddr=192.168.10.2
kernel_addr_r=0x81000000
kernel_file=zImage
loadaddr=0x80800000
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
netmask=255.255.255.0
nfsargs=ip=:::::eth0: root=/dev/nfs
nfsboot=run setup; setenv bootargs ${defargs} ${nfsargs} ${setupargs} ${vidargs}; echo Booting from NFS...;dhcp ${kernel_addr_r} && tftp ${fdt}
pxefile_addr_r=0x87100000
ramdisk_addr_r=0x82100000
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_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${de
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/exi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found e
scriptaddr=0x87000000
sdargs=root=/dev/mmcblk1p2 ro rootwait
sdboot=run setup; setenv bootargs ${defargs} ${sdargs} ${setupargs} ${vidargs}; echo Booting from MMC/SD card...; run m4boot && load mmc 1:1 $}
serial#=02997272
serverip=192.168.10.1
setethupdate=if env exists ethaddr; then; else setenv ethaddr 00:14:2d:00:00:00; fi; tftpboot ${loadaddr} ${board}/flash_eth.img && source ${l}
setsdupdate=mmc rescan && setenv interface mmc && fatload ${interface} 0:1 ${loadaddr} ${board}/flash_blk.img && source ${loadaddr}
setup=setenv setupargs console=tty1 console=${console},${baudrate}n8 ${memargs} consoleblank=0
setupargs=console=tty1 console=ttymxc0,115200n8 consoleblank=0
setupdate=run setsdupdate || run setusbupdate || run setethupdate
setusbupdate=usb start && setenv interface usb && fatload ${interface} 0:1 ${loadaddr} ${board}/flash_blk.img && source ${loadaddr}
soc=imx7d
splashpos=m,m
updlevel=2
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi
vendor=toradex
vidargs=video=mxsfb:640x480M-16@60
videomode=video=ctfb:x:640,y:480,depth:18,pclk:39722,le:48,ri:16,up:33,lo:10,hs:96,vs:2,sync:0,vmode:0

Environment size: 4579/8188 bytes
Colibri iMX7 #

I found an answer that seems to work to set it back to boot linux again (although still wondering how to get m4boot to work).

env default -f -a
saveenv

then reboot board.

Most possibly you are talking about these instructions which do not apply to the Colibri iMX7D 1GB aka eMMC SKU as indicated here.

Follow the instructions to run the m4boot automatically and don’t forget to disable uart2 and give the unused clk_ignore command

Colibri iMX7 # setenv defargs clk_ignore_unused
Colibri iMX7 # setenv fdt_fixup 'fdt addr ${fdt_addr_r} && fdt rm /soc/aips-bus@30800000/spba-bus@30800000/serial@30890000'
Colibri iMX7 # setenv m4boot 'ubi read ${loadaddr} m4firmware && bootaux ${loadaddr}'
Colibri iMX7 # saveenv

2nd make sure that the firmware is stored in the right ubi volume. I would recommend loading the firmware with the ubiupdatevol tool. Just copy your elf file to the linux image with scp and write it to the firmware volume.

root@colibri-imx7:~# cat /sys/class/ubi/ubi0/ubi0_2/name

Check that the above is m4firmware, afterwards use

ubiupdatevol /dev/ubi0_2  hello_world.elf

or you can store it like this with an sd card. though I had sometimes issues with the ubi part ubi

Colibri iMX7 # ubi part ubi
Colibri iMX7 # fatload mmc 0:1 ${loadaddr} hello_world.elf
Colibri iMX7 # ubi write ${loadaddr} m4firmware ${filesize}

You could probably also load the firmware every time from the sd card directly with a m4boot command similar to this. It should load the firmware directly in ram.

setenv m4boot 'fatload mmc 0:1 ${loadaddr} hello_world.elf && bootaux ${loadaddr}'

(Did not test it)

Please refer to the answer of @andriscewo . In general you need to make sure that you follow steps carefully, e.g. in this case that you store the firmware to UBI.

If things still fail, please post an output when boot is failing. It is hard to guess what exactly went wrong without the error messages/boot messages during failure…

In general, a basic understanding of U-Boot scripting is certainly helpful.