u-boot not running Congatec conga-SMX8-Plus board

Hi,

I’m trying to run BalenaOS on this board conga-SMX8-Plus - congatec, the processor is NXP i.MX 8M Plus family.
I’ve followed instructions in here. I managed to build everything without error. But now my problem is that there’s no output from the serial port. I suspect that the board couldn’t find the bootloader. Could this be something do with partition of the SD card or the image?
This is what I added in the balena-image.inc file:

IMAGE_FSTYPES_append_imx8mp-cgt-sx8p = " balenaos-img"
BALENA_IMAGE_BOOTLOADER_imx8mp-cgt-sx8p = “u-boot”
BALENA_BOOT_PARTITION_FILES_imx8mp-cgt-sx8p = " \
imx8mp-cgtsx8p.dtb:/imx8mp-cgtsx8p.dtb
imx-boot:/imx-boot
"
DEPENDS_append_imx8mp-cgt-sx8p += “imx-boot”

So, I’ve manually flash the bootloader to SD card first 4MB unallocated area using dd command. Now the board can run u-boot. However I’m getting the following errors:
** No partition table - mmc 2 **
** No partition table - mmc 2 **
ERROR: Could not find a resin image of any sort.
Loading resinOS_uEnv.txt from device partition 1
** Bad device specification :1 resinOS_uEnv **
Loading extra_uEnv.txt from device partition 1
** Bad device specification :1 extra_uEnv **
Loading bootcount.env from device partition 1
** Bad device specification :1 bootcount **
No bootcount.env file. Setting bootcount=0 in environment
** Bad device specification :2 resin_root_part_uuid **

Error: “distro_bootcmd” not defined

My partition looks like this:
image

My resin-boot folder looks like this:

full bootlog below:

U-Boot SPL 2020.04-5.4.70-2.3.0+ge30456f013 (Jul 11 2022 - 11:34:41 +0000)
Memory configuration found (4G)
Doing LPDDR init - 4G variant
DDRINFO: start DRAM init
DDRINFO: DRAM rate 4000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Trying to boot from BOOTROM
image offset 0x8000, pagesize 0x200, ivt offset 0x0
NOTICE: BL31: v2.2(release):bup_cgtsx8p_22-02-25-0-0-g0ba43c33
NOTICE: BL31: Built : 13:02:18, Jun 7 2021

U-Boot 2020.04-5.4.70-2.3.0+ge30456f013 (Jul 11 2022 - 11:34:41 +0000)

CPU: i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU: Industrial temperature grade (-40C to 105C)CPU Temperature (29000C), aler t (95000C), critical (105000C) at 29C
Reset cause: POR
Model: congatec SX8P board
DRAM: Bank 1: 0x40000000 - 0x100000000
Bank 2: 0x100000000 - 0x140000000
Bank 3: 0x0 - 0x0
4 GiB
MMC: FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from … Run CMD11 1.8V switch
*** Warning - bad CRC, using default environment

Fail to setup video link
In: serial
Out: serial
Err: serial

BuildInfo:

  • ATF 0ba43c3
  • U-Boot 2020.04-5.4.70-2.3.0+ge30456f013

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: PHY reset timed out

Warning: ethernet@30be0000 using MAC address from ROM

Warning: ethernet@30bf0000 using MAC address from ROM
eth0: ethernet@30be0000, eth1: ethernet@30bf0000 [PRIME]
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
Scanning mmc devices 0 1 2
fatload - load binary file from a dos filesystem

Usage:
fatload [<dev[:part]> [ [ [bytes [pos]]]]]
- Load binary file ‘filename’ from ‘dev’ on ‘interface’
to address ‘addr’ from dos filesystem.
‘pos’ gives the file position to start loading from.
If ‘pos’ is omitted, 0 is used. ‘pos’ requires ‘bytes’.
‘bytes’ gives the size to load. If ‘bytes’ is 0 or omitted,
the load stops on end of file.
If either ‘pos’ or ‘bytes’ are not aligned to
ARCH_DMA_MINALIGN then a misaligned buffer warning will
be printed and performance will suffer for the load.
fatload - load binary file from a dos filesystem

Usage:
fatload [<dev[:part]> [ [ [bytes [pos]]]]]
- Load binary file ‘filename’ from ‘dev’ on ‘interface’
to address ‘addr’ from dos filesystem.
‘pos’ gives the file position to start loading from.
If ‘pos’ is omitted, 0 is used. ‘pos’ requires ‘bytes’.
‘bytes’ gives the size to load. If ‘bytes’ is 0 or omitted,
the load stops on end of file.
If either ‘pos’ or ‘bytes’ are not aligned to
ARCH_DMA_MINALIGN then a misaligned buffer warning will
be printed and performance will suffer for the load.
** No partition table - mmc 2 **
** No partition table - mmc 2 **
ERROR: Could not find a resin image of any sort.
Loading resinOS_uEnv.txt from device partition 1
** Bad device specification :1 resinOS_uEnv **
Loading extra_uEnv.txt from device partition 1
** Bad device specification :1 extra_uEnv **
Loading bootcount.env from device partition 1
** Bad device specification :1 bootcount **
No bootcount.env file. Setting bootcount=0 in environment
** Bad device specification :2 resin_root_part_uuid **

Error: “distro_bootcmd” not defined

u-boot=> printenv
balena_extra_env_file=extra_uEnv.txt
balena_import_extra_env_file=echo Import ${balena_extra_env_file} in environment;env import -t ${resin_kernel_load_addr} ${filesize}
balena_load_extra_env_file=echo Loading ${balena_extra_env_file} from ${resin_dev_type} device ${resin_dev_index} partition ${resin_boot_part};fatload ${resin_dev_type} ${resin_dev_index}:${resin_boot_part} ${resin_kernel_load_addr} ${balena_extra_env_file};
baudrate=115200
board_name=SX8P
board_rev=iMX8MP
boot_fit=no
bootcmd=setenv resin_kernel_load_addr ${kernel_addr_r};run resin_set_kernel_root;run set_os_cmdline;run distro_bootcmd;
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;
bootcount=0
bootdelay=2
bootdevice=mmc
bootscript=echo Running bootscript from mmc …; source
console=ttymxc1,115200
emmc_dev=2
eth1addr=00:13:95:4c:c8:41
ethact=ethernet@30bf0000
ethaddr=00:13:95:4c:c8:40
ethprime=eth1
fastboot_dev=mmc1
fdt_addr=0x43000000
fdt_file=imx8mp-cgtsx8p.dtb
fdt_high=0xffffffffffffffff
fdtcontroladdr=fdbf74d8
image=Image
initrd_addr=0x43800000
initrd_high=0xffffffffffffffff
jh_clk=
jh_mmcboot=setenv fdt_file imx8mp-evk-root.dtb;setenv jh_clk clk_ignore_unused; if run loadimage; then run mmcboot; else run jh_netboot; fi;
jh_netboot=setenv fdt_file imx8mp-evk-root.dtb; setenv jh_clk clk_ignore_unused; run netboot;
kboot=booti
loadaddr=0x40480000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
loadusbfdt=fatload usb ${usbdev}:${usbpart} ${fdt_addr} ${fdt_file}
loadusbimage=fatload usb ${usbdev}:${usbpart} ${loadaddr} ${image}
mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc clk_ignore_unused
mmcargs=setenv bootargs ${jh_clk} console=${console} root=${mmcroot}
mmcautodetect=yes
mmcboot=echo Booting from mmc …; run mmcargs; if test ${boot_fit} = yes || test ${boot_fit} = try; then bootm ${loadaddr}; else if run loadfdt; then booti ${loadaddr} - ${fdt_addr}; else echo WARN: Cannot load the DT; fi; fi;
mmcdev=1
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
nandfit_part=yes
netargs=setenv bootargs ${jh_clk} console=${console} 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; ${get_cmd} ${loadaddr} ${image}; if test ${boot_fit} = yes || test ${boot_fit} = try; then bootm ${loadaddr}; else if ${get_cmd} ${fdt_addr} ${fdt_file}; then booti ${loadaddr} - ${fdt_addr}; else echo WARN: Cannot load the DT; fi; fi;
os_bc_file=bootcount.env
os_bc_inced=0
os_bc_lim=3
os_bc_skip=0
os_bc_wr_sz=0xd
os_import_bootcount_file=echo Import ${os_bc_file} in environment;env import -t ${resin_kernel_load_addr} ${filesize}
os_inc_bc_save=if test ${os_bc_skip} = 0 && test ${os_bc_inced} = 0 && test ${upgrade_available} = 1; then setexpr bootcount ${bootcount} + 1;env set os_bc_inced 1;echo bootcount=${bootcount} now;env export -t ${resin_kernel_load_addr} bootcount;if fatwrite ${resin_dev_type} ${resin_dev_index}:${resin_boot_part} ${resin_kernel_load_addr} ${os_bc_file} ${os_bc_wr_sz}; then; else; echo FATWRITE FAILED ; fi;echo bootcount=${bootcount} written to ${resin_dev_type} ${resin_dev_index}:${resin_boot_part} ${os_bc_file};fi;
os_load_bootcount_file=echo Loading ${os_bc_file} from ${resin_dev_type} device ${resin_dev_index} partition ${resin_boot_part};fatload ${resin_dev_type} ${resin_dev_index}:${resin_boot_part} ${resin_kernel_load_addr} ${os_bc_file};
resin_boot_part=1
resin_check_altroot=setexpr resin_roota ${resin_boot_part} + 1; setexpr resin_rootb ${resin_boot_part} + 2; run os_inc_bc_save;if test -n ${os_bc_lim}; then if test ${bootcount} -gt ${os_bc_lim}; then echo WARNING! BOOTLIMIT EXCEEDED. SWITCHING TO PREVIOUS ROOT;echo WARNING! was: resin_root_part=${resin_root_part};if test ${resin_root_part} = ${resin_roota}; then env set resin_root_part ${resin_rootb}; else; env set resin_root_part ${resin_roota}; fi;echo WARNING! now: resin_root_part=${resin_root_part};fi;fi;
resin_env_file=resinOS_uEnv.txt
resin_find_root_part_uuid=fsuuid ${resin_dev_type} ${resin_dev_index}:${resin_root_part} resin_root_part_uuid
resin_flasher_detect=if test “${resin_scan_dev_type}” = usb ; then usb start ; fi; fatload ${resin_scan_dev_type} ${resin_scan_dev_index}:${resin_boot_part} ${resin_kernel_load_addr} ${resin_flasher_flag_file};
resin_flasher_flag_file=balena-image-flasher
resin_flasher_skip=0
resin_image_detect=if test “${resin_scan_dev_type}” = usb ; then usb start ; fi; fatload ${resin_scan_dev_type} ${resin_scan_dev_index}:${resin_boot_part} ${resin_kernel_load_addr} ${resin_image_flag_file};
resin_image_flag_file=balena-image
resin_import_env_file=echo Import ${resin_env_file} in environment;env import -t ${resin_kernel_load_addr} ${filesize}
resin_inject_env_file=if run resin_load_env_file; then run resin_import_env_file;fi;if run balena_load_extra_env_file; then run balena_import_extra_env_file;fi;if run os_load_bootcount_file; then run os_import_bootcount_file;else; echo No bootcount.env file. Setting bootcount=0 in environment;env set bootcount 0;fi;
resin_kernel_root=root=UUID=
resin_load_env_file=echo Loading ${resin_env_file} from ${resin_dev_type} device ${resin_dev_index} partition ${resin_boot_part};fatload ${resin_dev_type} ${resin_dev_index}:${resin_boot_part} ${resin_kernel_load_addr} ${resin_env_file};
resin_root_part=2
resin_roota=2
resin_rootb=3
resin_scan_devs=echo Scanning ${resin_uboot_device_types} devices ${resin_uboot_devices}; for resin_scan_dev_type in ${resin_uboot_device_types}; do for resin_scan_dev_index in ${resin_uboot_devices}; do if test ${resin_flasher_skip} = 0 && run resin_flasher_detect; then setenv resin_flasher_dev_index ${resin_scan_dev_index}; setenv resin_dev_type ${resin_scan_dev_type}; exit; else; if test -n “${resin_image_dev_index}”; then ;else if run resin_image_detect; then setenv resin_image_dev_index ${resin_scan_dev_index}; setenv resin_dev_type ${resin_scan_dev_type}; fi; fi; fi; done;done;
resin_set_dev_index=run resin_scan_devs; if test -n ${resin_flasher_dev_index}; then echo Found resin flasher on ${resin_dev_type} ${resin_flasher_dev_index}; setenv bootparam_flasher flasher; setenv resin_dev_index ${resin_flasher_dev_index}; else; if test -n “${resin_image_dev_index}”; then echo Found resin image on ${resin_dev_type} ${resin_image_dev_index}; setenv resin_dev_index ${resin_image_dev_index}; else; echo ERROR: Could not find a resin image of any sort.; fi; fi;
resin_set_kernel_root=run resin_set_dev_index;run resin_inject_env_file;run resin_check_altroot;run resin_find_root_part_uuid;setenv resin_kernel_root root=UUID=${resin_root_part_uuid}
resin_uboot_device_types=mmc
resin_uboot_devices=0 1 2
script=boot.scr
sd_dev=1
serial#=101f3000b3950127
set_os_cmdline=setenv os_cmdline ${base_os_cmdline} ${bootparam_flasher} ${extra_os_cmdline};
soc_type=imx8mp
splashimage=0x50000000
upgrade_available=0
usbargs=setenv bootargs console=${console} root=${usbroot}
usbdev=0
usbpart=1
usbroot=/dev/sda2 rootwait rw

Environment size: 7349/12284 bytes
u-boot=>

So after changing the mmcboot script, I was able to boot the kernel. However, there’s no login, something seems to be wrong with finding the rootfs.

**This is the last message: **
[ 4.291118] Waiting for root device UUID=3a567720-1029-4e69-aace-654ee52a6514…
It just stays there forever.

This was my uboot message before I ran mmcboot:

Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
Scanning mmc devices 0 1 2
24 bytes read in 7 ms (2.9 KiB/s)
** No partition table - mmc 2 **
Found resin image on mmc 1
Loading resinOS_uEnv.txt from mmc device 1 partition 1
Loading extra_uEnv.txt from mmc device 1 partition 1
Loading bootcount.env from mmc device 1 partition 1
No bootcount.env file. Setting bootcount=0 in environment

OK, so I manage to boot BalenOS on this board!
The issue was that I didn’t copy the Image-initramfs-… to the resin-boot partition.
However my image was larger than the default boot partition size (40MB). Had to change BALENA_BOOT_SIZE in image_types_balena.bbclass to 81920 ( 80MB). Still I needed to manually copy the image to this partition after I flashed the SD card. Adding the image file to BALENA_BOOT_PARTITION_FILES_… gave me an error.
Anyway, for now, it’s working : )

1 Like

Wow @shuojin thank you for sharing everything that you did to perform a custom support board on balenaOS. Good job!

I will share with the team what you did!