Difference between revisions of "DESK-MX8M-L/General/Booting from NFS"

From DAVE Developer's Wiki
Jump to: navigation, search
(Installing the root file system)
(Target configuration)
Line 134: Line 134:
 
<pre>
 
<pre>
 
=> setenv bootfile /tftpboot/desk-mx-l/Image
 
=> setenv bootfile /tftpboot/desk-mx-l/Image
=> setenv fdtfile /tftpboot/desk-mx-l/imx8mp-mito8mplus-cb1001.dtb
+
=> setenv fdt_file /tftpboot/desk-mx-l/imx8mp-mito8mplus-cb1001.dtb
 +
=> setenv loadk 'tftpboot ${loadaddr} ${serverip}:${bootfile}'
 +
=> setenv loadfdt 'tftpboot ${fdt_addr} ${serverip}:${fdt_file}'
 
</pre>
 
</pre>
  
Line 144: Line 146:
  
 
<pre class="mw-collapsible mw-collapsed workstation-terminal">
 
<pre class="mw-collapsible mw-collapsed workstation-terminal">
=> run net_nfs
+
=> run loadk loadfdt nfsargs addip addcons addmisc; booti ${loadaddr} - ${fdt_addr}
 +
 
 
</pre>
 
</pre>
  

Revision as of 12:47, 15 February 2022

History
Version Issue Date Notes
1.0.0 Feb 2022 First DESK-MX8M-L release


Booting from NFS[edit | edit source]

This configuration is very helpful during the software development (both for kernel and applications). The kernel image is downloaded via TFTP while the root file system is remotely mounted via NFS from the host. It is assumed that the development host:

  • is connected with the target host board through an Ethernet LAN
  • exports the directory containing the root file system for the target through the NFS server
  • runs a TFTP server.
  • has a proper subnet IP address

net_nfs configuration[edit | edit source]

DESK-MX8M-L Virtual Machine is properly configured for the TFTP and NFS debug.

In any case, some variables has to be configured on the target and the VM itself has to be configured for respect to the network environment.

Host (Virtual Machine) configuration[edit | edit source]

The DESK-MX8M-L Virtual Machine has the tftp and nfs services already running. Optionally, their configuration has to be changed according to the network configuration where the target is connected to.

Check and properly configure the items the following chapters: network adapter, nfs server

network adapter[edit | edit source]

The network adpater should be configured in bridge mode in order to allow the target to get the files from the VM


Network-bridge.png


XELK VM Network.png


then check or re-configure the Host IP address

dvdk@vagrant:~$ ifconfig 
eth0      Link encap:Ethernet  HWaddr 08:00:27:ed:54:80  
          inet addr:192.168.0.121  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feed:5480/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:342143 errors:0 dropped:0 overruns:0 frame:0
          TX packets:267700 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:160784829 (160.7 MB)  TX bytes:214001179 (214.0 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:201 errors:0 dropped:0 overruns:0 frame:0
          TX packets:201 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:21929 (21.9 KB)  TX bytes:21929 (21.9 KB)

dvdk@vagrant:~$ 

nfs server[edit | edit source]

The NFS server should exports the correct file system directory (in our example)

dvdk@vagrant:~$ cat /etc/exports 
/home 0.0.0.0/0.0.0.0(rw,async,no_root_squash,no_subtree_check,crossmnt)
dvdk@vagrant:~$ 

otherwise, change its configuration and then restart the nfs server:

dvdk@vagrant:~$ sudo /etc/init.d/nfs-kernel-server restart
[sudo] password for dvdk: 
 * Stopping NFS kernel daemon                                                                                                                                                                                                         [ OK ] 
 * Unexporting directories for NFS kernel daemon...                                                                                                                                                                                   [ OK ] 
 * Exporting directories for NFS kernel daemon...                                                                                                                                                                                     [ OK ] 
 * Starting NFS kernel daemon                                                                                                                                                                                                         [ OK ] 
dvdk@vagrant:~$ 

Installing the root file system[edit | edit source]

Using the DESK-MX6-L Virtual Machine it is required to extracting the rfs in the exported file system:

  • download the fsl-imx-wayland-glibc-x86_64-meta-toolchain-aarch64-desk-mx8mp-toolchain-5.4-zeus.sh from the mirror server
dvdk@vagrant:~/desk-mx-l/rfs$ wget https://mirror.dave.eu/desk-mx-l/desk-mx8m-l-2.0.0-rc2/dave-image-devel-desk-mx8mp.tar.bz2
dvdk@vagrant:~/desk-mx-l/rfs$ 

extracting the archive (with root permissions!!) and create the symbloic link:

mkdir /home/dvdk/desk-mx-l/rfs/desk-mx8m-l-2.0.0-rc2
sudo tar jxpf dave-image-devel-desk-mx8mp.tar.bz2 -C /home/dvdk/desk-mx-l/rfs/desk-mx8m-l-2.0.0-rc2/
ln -s /home/dvdk/desk-mx-l/rfs/desk-mx8m-l-2.0.0-rc2 /home/dvdk/desk-mx-l/rfs/desk-mx8m-l

Then, the rfs directory appears like:

dvdk@vagrant:~/desk-mx-l/rfs$ ls -la
total 725876
drwxr-xr-x  4 dvdk dvdk      4096 Feb 15 12:37 .
drwxr-xr-x  7 dvdk dvdk      4096 Feb 15 11:50 ..
lrwxrwxrwx  1 root root        41 Apr  9  2021 desk-mx6-l -> /home/dvdk/desk-mx-l/rfs/desk-mx6-l-1.0.0
drwxr-xr-x 19  541  502      4096 Jan 25  2021 desk-mx6-l-1.0.0
lrwxrwxrwx  1 dvdk dvdk        46 Feb 15 12:37 desk-mx8m-l -> /home/dvdk/desk-mx-l/rfs/desk-mx8m-l-2.0.0-rc2
drwxrwxr-x  8 dvdk dvdk      4096 Feb 15 12:36 desk-mx8m-l-2.0.0-rc2
dvdk@vagrant:~/desk-mx-l/rfs$ 

Target configuration[edit | edit source]

The IP address for server and target should be configured: an example (for a network subnet 192.168.0.x)

=> setenv serverip 192.168.0.120
=> setenv ipaddr 192.168.0.121
  • serverip is the IP address of the host machine running the tftp/nfs server
  • ipaddr is the IP address of the target

The kernel and device tree files have to be selected

=> setenv bootfile /tftpboot/desk-mx-l/Image
=> setenv fdt_file /tftpboot/desk-mx-l/imx8mp-mito8mplus-cb1001.dtb
=> setenv loadk 'tftpboot ${loadaddr} ${serverip}:${bootfile}'
=> setenv loadfdt 'tftpboot ${fdt_addr} ${serverip}:${fdt_file}'

finally, the root file system directory on the Virtual Machine should be configured to let the kernel find the INIT

=> setenv rootpath /home/dvdk/desk-mx-l/rfs/desk-mx8m-l

To run this configuration just issue the net_nfs command which firstly downloads the kernel and device tree using the tftp protocol

=> run loadk loadfdt nfsargs addip addcons addmisc; booti ${loadaddr} - ${fdt_addr}