Flashing Apalis iMX6 with custom Yocto build

We have a Yocto Poky console image which boots and runs successfully from NFS boot. We want to flash it to the Apalis iMX6 board. I read the Toradex’s Yocto Project Reference Distribution page, The Yocto Project's Reference Distribution “Poky” on Toradex Hardware, and followed the instructions in the section Build Poky’s Sato Image for Apalis T30, adapted for the iMX6. Here is the adapted procedure:

For this purpose, download the Toradex Linux image, unpack it
and remove the Ångström based root files system replacing it with the Poky root
file system instead:

$ sudo su
# tar xvjf Apalis-iMX6_LXDE-Image_2.7-20180104.tar.bz2
# cd Apalis-iMX6_LXDE-Image_2.7.4
# rm -rf rootfs/
# mkdir rootfs/
# tar xvf path/to/yocto-build/deploy/images/apalis-imx6/filename.rootfs.tar.xz -C rootfs/
# echo "Apalis_iMX6" >> rootfs/etc/issue

Also copy the kernel and U-Boot that are provided externally:

# rm apalis-imx6_bin/u-boot*
# cp -d path/to/yocto-build/deploy/images/apalis-imx6/u-boot* apalis-imx6_bin/
# rm apalis-imx6_bin/uImage*
# cp -d path/to/yocto-build/deploy/images/apalis-imx6/uImage* apalis-imx6_bin/

Then, use update.sh to prepare a SD card with the U-Boot bootloader, Linux 
kernel and the root file system image.

./update.sh -o /run/media/user/UPDATE

(Or, to update via TFTP:

./update.sh -o /srv/tftpd )

The last three steps need to be repeated each time a new image has been
generated by the build system.

Start the Toradex flashing scripts using the U-Boot boot loader's serial console: 

Apalis imx6 # run setupdate
Apalis imx6 # run update

I can ‘run setupdate’ successfully. I can ‘run update’ successfully. But when the board reboots it encounters these errors:

resetting ...

U-Boot 2016.11-2.7.4+g1b121c6ab5 (Oct 12 2018 - 17:09:38 +0000)

CPU:   Freescale i.MX6Q rev1.5 at 792 MHz
Reset cause: WDOG
I2C:   ready
DRAM:  2 GiB
PMIC:  device id: 0x10, revision id: 0x21, programmed
auto-detected panel vga-rgb
Display: vga-rgb (640x480)
In:    serial
Out:   serial
Err:   serial
Model: Toradex Apalis iMX6 Quad 2GB IT V1.1C, Serial# 05185031
Net:   using PHY at 7
Hit any key to stop autoboot:  0
Booting from internal eMMC chip...
reading imx6q-apalis-eval.dtb
50345 bytes read in 18 ms (2.7 MiB/s)
reading zImage
** Unable to read file zImage **

emmcboot failed
MMC: no card present
MMC: no card present
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
USB1:   USB EHCI 1.00
scanning bus 1 for devices... 2 USB Device(s) found
   scanning usb for storage devices... 0 Storage Device(s) found
   scanning usb for ethernet devices... 0 Ethernet Device(s) found

USB device 0: unknown device
BOOTP broadcast 1
DHCP client bound to address (6 ms)
Using FEC device
TFTP from server; our IP address is
Filename 'boot.scr.uimg'.
Load address: 0x17000000
Loading: *
TFTP error: 'file /srv/tftpd/boot.scr.uimg not found' (1)
Not retrying...
Apalis iMX6 # B

The kernel is packaged as uImage, not zImage, and indeed there is not a file ‘boot.src.uimg’ in /srv/tftpd.
How do I modify ‘setupdate’ and ‘update’ to fix these two problems?

I assume that I can do the edits on the workstation before I run ./update.sh.

Contents of /nfs/tftpd/apalis_imx6:

├── boot.vfat
├── flash_blk.img
├── flash_eth.img
├── imx6q-apalis-eval.dtb
├── imx6q-apalis-ixora.dtb
├── imx6q-apalis-ixora-v1.1.dtb
├── mbr.bin
├── root.ext4-100
├── root.ext4-101
├── SPL
├── u-boot.imx-spl
├── uImage
└── versions.txt

Hi @rdepew

Please have a look to this Community Post.

Best regards, Jaski

This was a simple solution to the problem. Thank you!

For anyone else who tries this:

  • I didn’t find it necessary to reset all variables to default, only boot_file and emmcboot.
  • It’s a really good idea, as the referenced Community Post suggests, to save the “zImage” versions of boot_file and emmcboot in a text file on your workstation, so you can recreate them at a future date, should the need arise.

Perfect, that it works. Thanks for the feedback.