i.MX setup TFTP and NFS

Using TFTP(Trivial File Transfer Protocol) and NFS(Network File System) to load kernel and rootfs can help to reduce operations of flash write efficiently, which can make you EVK board live longer…

This summary is based on Alexey‘s version, with some modifications according to my experiment.

TFTP

Install necessary tools

1
sudo apt-get install xinetd tftpd tftp

Setup TFTP

1
2
3
4
5
6
7
8
9
10
11
12
13
mkdir -p /etc/xinetd.d/
nano /etc/xinetd.d/tftp
service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /srv/tftp
disable = no
}

create folder to store tftp files:

1
2
3
sudo mkdir /srv/tftp
sudo chmod -R 777 /srv/tftp
sudo chown -R nobody /srv/tftp

restart tftpd by xinetd:

1
sudo /etc/init.d/xinetd restart

copy device trees/kernel image to tftp folder:

1
2
cp Image /srv/tftp
cp Image-fsl-imx8mq-evk.dtb /srv/tftp/fsl-imx8mq-evk.dtb

NFS

Install necessary tools

1
sudo apt-get install nfs-kernel-server nfs-common portmap

Setup NFS

Add below line at end of /etc/exports

1
/home/ *(rw,insecure,no_root_squash,no_subtree_check)

restart nfs server:

1
sudo /etc/init.d/nfs-kernel-server restart

create copy of your rootfs:

1
2
3
4
5
cd ~
mkdir imx8-evk-dummy
# goto your yocto image build dir, i.e. imx-yocto-bsp/imx8mmevk_build/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0
cd <your_yocto_image_build_folder>
cp -r rootfs ~/imx8-evk-dummy

Notice: Seems long path of rootfs will cause rootfs mounting error, suggest copy your rootfs to a short path

Target

Interrupt board booting up then type into u-boot terminal:

1
2
3
4
5
6
7
setenv nfsroot <path-to-your-rootfs>
setenv image <kernel-image-name-in-tftp-folder>
setenv fdt_file <devid-tree-file-name-in-tftp-folder>
setenv serverip <pc-ip-address>
setenv bootcmd 'run netboot'
sav
reset

i.e.:

1
2
3
4
5
6
7
setenv nfsroot /home/alex/imx8-evk-dummy/rootfs
setenv image Image
setenv fdt_file fsl-imx8mm-evk.dtb
setenv serverip 10.0.1.17
setenv bootcmd 'run netboot'
sav
reset