Yocto Setup TFTP/NFS: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
Line 23: Line 23:
<pre>$ sudo /etc/init.d/nfs-kernel-server restart</pre>  
<pre>$ sudo /etc/init.d/nfs-kernel-server restart</pre>  
Make sure you installed TFTP server:  
Make sure you installed TFTP server:  
<pre>$ sudo apt-get install xinetd tftpd tftp
$ sudo apt-get install xinetd tftpd tftp
Verify:
Verify the following:
$ ls /usr/sbin/in.tftpd
$ ls /usr/sbin/in.tftpd
$ sudo gedit /etc/xinetd.d/tftp
$ sudo gedit /etc/xinetd.d/tftp
service tftp
service tftp
{
{
protocol = udp
protocol = udp
port = 69
port = 69
socket_type = dgram
socket_type = dgram
wait = yes
wait = yes
user = nobody
user = nobody
server = /usr/sbin/in.tftpd
server = /usr/sbin/in.tftpd
server_args = /tftpboot
server_args = /tftpboot
disable = no
disable = no
}
}
</pre>
and run:
  $ sudo mkdir /tftpboot
  $ sudo mkdir /tftpboot
  $ sudo chmod -R 777 /tftpboot
  $ sudo chmod -R 777 /tftpboot
Line 44: Line 44:
  $ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_X11}}/
  $ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_X11}}/
  $ cp tmp/deploy/images/{{#var:MACHINE_NAME}}/{{#var:KERNEL_IMAGE}} /tftpboot
  $ cp tmp/deploy/images/{{#var:MACHINE_NAME}}/{{#var:KERNEL_IMAGE}} /tftpboot
  $ cp tmp/deploy/images/{{#var:MACHINE_NAME}}/{{#var:KERNEL_IMAGE}}-imx*.dtb /tftpboot
  $ for f in tmp/deploy/images/*.dtb; do if <nowiki>[[ -L $f ]] && [[</nowiki> $f != *{{#var:MACHINE_NAME}}.dtb <nowiki>]]</nowiki>; then sudo cp $f /tftpboot; fi done
  $ sudo rename 's/{{#var:KERNEL_IMAGE}}-//' /tftpboot/{{#var:KERNEL_IMAGE}}-*.dtb
  $ sudo rename 's/{{#var:KERNEL_IMAGE}}-//' /tftpboot/{{#var:KERNEL_IMAGE}}-*.dtb
  {{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M |
  {{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M |

Revision as of 11:13, 12 January 2020

- Yocto Setup TFTP/NFS

Running Yocto rootfs on Variscite board using TFTP & NFS

Host

Make sure you installed NFS server:

$ sudo apt-get install nfs-kernel-server
$ cd 
$ sudo mkdir rootfs
$ cd rootfs
$ sudo tar xvf  ..//tmp/deploy/images//fsl-image-gui-.tar.gz
$ sudo gedit /etc/exports

Add the following line (change <uname> to the name of user):

/rootfs    *(rw,sync,no_root_squash,no_all_squash,no_subtree_check) 

exit & save

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

Make sure you installed TFTP server:

$ sudo apt-get install xinetd tftpd tftp

Verify the following:

$ ls /usr/sbin/in.tftpd
$ sudo gedit /etc/xinetd.d/tftp
service tftp
{
	protocol = udp
	port = 69
	socket_type = dgram
	wait = yes
	user = nobody
	server = /usr/sbin/in.tftpd
	server_args = /tftpboot
	disable = no
}

and run:

$ sudo mkdir /tftpboot
$ sudo chmod -R 777 /tftpboot
$ sudo /etc/init.d/xinetd restart
$ cd //
$ cp tmp/deploy/images// /tftpboot
$ for f in tmp/deploy/images/*.dtb; do if [[ -L $f ]] && [[ $f != *.dtb ]]; then sudo cp $f /tftpboot; fi done
$ sudo rename 's/-//' /tftpboot/-*.dtb


Target

Make sure you have a serial connection to the target.

Reset and hold the space bar. This will bring you to U-Boot command line.

$ setenv serverip 192.168.1.188
$ setenv nfsroot /rootfs (change <uname> to the name of user)
$ setenv bootcmd run netboot
$ saveenv 

You are all set. Connect Ethernet cable, power cycle the and it should boot over NFS.