i.MX8 - iMX8MEVK - Yocto - Alternative image loading

From RidgeRun Developer Connection
< IMX8‎ | iMX8MEVK‎ | Yocto
Jump to: navigation, search


NXP Partner Program Registered Vertical.jpg NXP Partner Program Horizontal.jpg
Previous: iMX8MEVK/Yocto/Installing an Image Index Next: iMX8MEVK/Android





Basic Boot Options

For setting up the basic boot options via board switches, you can check the Selecting Boot Options page.

Network Boot Options

While developing, booting without the need to update your SD card every single time you rebuild your kernel/file system might significantly speed-up and ease your work. Network-based boot options provide the alternative to boot your kernel from the SD card and mount your file system over NFS or even boot the kernel image from a TFTP server and later mount the file system over NFS; both options require some simple host setup as shown below.

  1. Setup a TFTP server
  2. Setup a NFS server

TFTP Kernel Boot + NFS File System Option

The combination of TFTP booting the kernel and mounting the file system over NFS provides flexibility to constantly modify the content of the file system (install / update applications) and test kernel source code modifications without the need of changing the SD card content.

  • Copy the file system directory to a location outside the Yocto directory.

Yocto's internal directory layout can be rather complex, in the case of the file system for the i.MX8M EVK, the file system directory can be found under the following path:

{YOCTO_BUILD_DIR}/tmp/work/{TARGET}/{IMAGE}/1.0-r0/rootfs

One example for a Yocto Rocko build,

cd $YOCTO_BUIlD_DIR/build/tmp/work/imx8mqevk-poky-linux/fsl-image-multimedia-full/1.0-r0
mkdir /home/$USER/imx8-evk-dummy
cp -r rootfs /home/$USER/imx8-evk-dummy/


  • Copy the kernel image and kernel device tree blob into the TFTP directory (as configured during the TFTP service setup).
cd $YOCTO_BUIlD_DIR/build/tmp/deploy/images/imx8mqevk
cp Image /srv/tftp
cp Image-fsl-imx8mq-evk.dtb /srv/tftp/fsl-imx8mq-evk.dtb


  • Power ON the i.MX8M EVK board, stop the booting process while still in u-boot, in the next step, we will set a number of u-boot environment variables.


  • While in u-boot, set the following environment variables:
u-boot=> setenv nfsroot /home/$USER/imx8-evk-dummy/rootfs
u-boot=> setenv bootargs 'console=${console} root=/dev/nfs ip=dhcp rw nfsroot=${serverip}:${nfsroot},v3,tcp'
u-boot=> setenv image Image; setenv fdt_file fsl-imx8mq-evk.dtb
u-boot=> setenv loadaddr 0x40480000; setenv fdt_addr 0x43000000
u-boot=> setenv netboot 'echo Booting from net...; setenv autoload no; setenv autostart no; dhcp; setenv serverip <server_ip_address>; tftpboot ${loadaddr} ${image};   \ 
tftpboot ${fdt_addr} ${fdt_file}; booti ${loadaddr} - ${fdt_addr}'

*** Modify the server_ip_address to match your working environment.


  • Save the current environment. The next time you power cycle the board, it will not be necessary to set the u-boot environment variables from the previous step.
u-boot=> saveenv
Saving Environment to MMC...
Writing to MMC(1)... done


  • Finally, boot the board:
u-boot=> run netboot

Booting from net...
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
DHCP client bound to address 10.251.101.98 (1055 ms)
Using ethernet@30be0000 device
TFTP from server 10.251.101.145; our IP address is 10.251.101.98
Filename 'Image'.
Load address: 0x40480000
Loading: #################################################################
	 #################################################################
	 .
         .
         .
         .
         #################################################################
	 1.3 MiB/s
done
Bytes transferred = 20054528 (1320200 hex)
Using ethernet@30be0000 device
TFTP from server 10.251.101.145; our IP address is 10.251.101.98
Filename 'fsl-imx8mq-evk.dtb'.
Load address: 0x43000000
Loading: #########
	 876 KiB/s
done
Bytes transferred = 42199 (a4d7 hex)
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
   Using Device Tree in place at 0000000043000000, end 000000004300d4d6

Starting kernel ...
u-boot=> env default -a
## Resetting to default environment

u-boot=> saveenv
Saving Environment to MMC...
Writing to MMC(1)... done

At this point, the u-boot should have been restored to the default settings.

Previous: iMX8MEVK/Yocto/Installing an Image Index Next: iMX8MEVK/Android