FAQ_MA35D1_Network File system by Yocto
Posted: 09 Dec 2022, 16:32
This can cross-compile the application on PC and execute it on device through NFS rather than build the whole Linux image or use another way to send the application to device.
The following demo is operated on Ubuntu 20.04 not in the Docker container
First, install the network file system server on host OS
Create a folder to put your application code and shared with device
Modify the network file system setting. Add the following statement in exports
Restart the network file system service
Enable NFS client in Linux kernel
Leave the kernel setting
Add nfs-utils to image and add the command to /build/conf/local.conf
Re-compile image and program to device
Create a folder in device terminal
Check the IP address if device and host are in the same internet domain
Mount the NFS on device
Now, you can find the folder shared with host helloworld folder
After cross-compile the application, you can copy the binary file to USB storage and execute on evaluation board
Copy the application to USB drive, insert it to evaluation board, and confirm USB device number
Create a folder named usb for USB device under mnt folder, and mount on USB device
Execute the application
The following demo is operated on Ubuntu 20.04 not in the Docker container
First, install the network file system server on host OS
Code: Select all
$ sudo apt-get install nfs-kernel-server nfs-common
Modify the network file system setting. Add the following statement in exports
Code: Select all
$ sudo gedit /etc/exports
Add ” *(The folder path you want to share)*(EVB’s IP ADDRESS)(rw,sync,no_root_squash, no_subtree_check) ”
/home/user/yocto/helloworld 192.168.0.100(rw,sync,no_root_squash,no_subtree_check)
Code: Select all
$sudo /etc/init.d/nfs-kernel-server restart
Code: Select all
~/build$ bitbake linux-ma35d1 -c devshell
~/build/tmp-glibc/work-shared/ma35d1-evb/kernel-source# make menuconfig
Code: Select all
File systems --->
[*] Enable POSIX file locking API
[*] Network File Systems --->
<*> NFS client support
<*> NFS client support for NFS version 2
<*> NFS client support for NFS version 3
[*] NFS client support for the NFSv3 ACL protocol extension
<*> NFS client support for NFS version 4
Code: Select all
~/build/tmp-glibc/work-shared/ma35d1-evb/kernel-source# exit
Code: Select all
IMAGE_INSTALL_append = "nfs-utils"
Code: Select all
~/build$ bitbake linux-ma35d1 -C compile
~/build$ bitbake nvt-image-qt5
Code: Select all
root@ma35d1-evb:~# mkdir -p /mnt/nfs
Mount the NFS on device
Code: Select all
mount -o nolock -t nfs 192.168.0.103:/home/user/yocto/build/helloworld /mnt/nfs/
Copy the application to USB drive, insert it to evaluation board, and confirm USB device number
Code: Select all
$ fdisk -l
Code: Select all
$ mount /dev/sda1 /mnt/usb
Code: Select all
$ ./hello