i.MX8 - Nitrogen8M - Yocto - Advanced image loading
Network Boot
When you are developing or debugging on your kernel or a file system application, network boot can be handy to avoid multiple flashes and to load new application versions without having to reboot the board each time.
Network boot configuration will load the kernel and device tree from n TFTP server and the root file system will be shared from host PC over NFS.
Host Setup
You will need a TFTP server and a NFS server, you can use the following instruction to set them up if you don't have them already.
TFTP and NFS Configuration
For the following steps you should have a complete Yocto build for the Nitrogen8M as described at Building Yocto
1. Copy the kernel image and the kernel device tree blob from your Yocto build into the TFTP directory.
# You need to change TFTP_SERVER variable to match your TFTP directory TFTP_SERVER=/srv/tftp cd $YOCTO_BUILD_DIR/build/tmp/deploy/images/nitrogen8m cp Image $TFTP_SERVER cp imx8mq-nitrogen8m.dtb $TFTP_SERVER
2. Copy the file system directory to a location exported by the NFS server.
cp -r $YOCTO_BUILD_DIR/tmp/work/nitrogen8m/$IMAGE/1.0-r0/rootfs ~/$NFS_ROOTFS
Target Setup
Finally you need to configure the Nitrogen8M u-boot to boot from network, as follows:
1. Power ON the Nitrogen8M board, and stop the boot up process on u-boot, (press a key during the boot up count down)
2. While in u-boot set the following environment variables
# You need to set <server_ip_address> and <nfs_server_path> to match your host setup setenv tftpserverip <server_ip_address> setenv nfsroot <nfs_server_path> saveenv
Example:
# Nitrogen8m rootfs is at NFS_ROOTFS=/srv/nfs/nitrogen8m setenv tftpserverip 192.168.1.60 setenv nfsroot /srv/nfs/nitrogen8m saveenv
3. Boot the board from network (still in u-boot) with the following command
run netboot
This command should be run each time you restart the board to boot from network.
=> run netboot BOOTP broadcast 1 BOOTP broadcast 2 BOOTP broadcast 3 DHCP client bound to address 192.168.1.78 (1067 ms) Using ethernet@30be0000 device TFTP from server 192.168.1.60; our IP address is 192.168.1.78 Filename 'Image'. Load address: 0x40480000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ###################### 3.1 MiB/s done Bytes transferred = 21408256 (146aa00 hex) BOOTP broadcast 1 DHCP client bound to address 192.168.1.78 (3 ms) Using ethernet@30be0000 device TFTP from server 192.168.1.60; our IP address is 192.168.1.78 Filename 'imx8mq-nitrogen8m.dtb'. Load address: 0x43000000 Loading: ########## 2.9 MiB/s done Bytes transferred = 47956 (bb54 hex) ## Flattened Device Tree blob at 43000000 Booting using the fdt blob at 0x43000000 Using Device Tree in place at 0000000043000000, end 000000004300eb53 Starting kernel ... [ 0.000000] Booting Linux on physical CPU 0x0