Sharing data between host computer and the board is crucial in embedded system development. The process I followed to set up TFTP and NFS connection on Beaglebone Black is documented here, hopefully it can be helpful to others.
Beaglebone Black, PC running on Ubuntu system (ver 20.04 in my case)
serial to USB cable, USB type A to mini B cable
By default, the system that came with the board does not have TFTP and NFS clients installed. Thus, I decided to setup Internet sharing to install these packages.
I followed Drew Fustini's instruction on this: https://gist.github.com/pdp7/d2711b5ff1fbb000240bd8337b859412
Just remeber to switch to root by running:
sudo -i
Before adding the default DNS server:
echo "nameserver 8.8.8.8" > /etc/resolv.conf
sudo alone is not enough for the task.
On host PC, run the following commands to install TFTP server:
sudo apt-get update
sudo apt-get install tftpd-hpa
The server home directory should be available at /srv/tftp. Create a small file here for testing.
On the board, run the following to install TFTP client:
sudo apt-get update
sudo apt-get install tftp
Then, enter the TFTP prompt, test the connection by fetching the file to current directory and quit the prompt:
tftp $ip-address-of your-host$
tftp>get $name-of-your-file$
tftp>quit
When you need to share and synchronize multiple files, NFS offers more convenience.
On host PC, install NFS server with:
sudo apt-get update
sudo apt-get install nfs-kernel-server
Add the following line to /etc/exports:
/path/to/shared/folder $ip-address-of-your-board$(rw,no_root_squash,no_subtree_check)
Note that there's no space between the ip address and the parenthese.
Restart the NFS server by:
sudo exportfs -r
On the board, install NFS client:
sudo apt-get update
sudo apt-get install nfs-common
Create the target directory and mount the shared folder:
mkdir -p /path/to/target
sudo mount $ip-address-of-host$:/path/to/shared/folder /path/to/target
Create a small file on the host side, it should be available on the board.
Remove the shared directory with:
sudo umount /path/to/target
- https://www.digikey.ca/en/maker/blogs/how-to-connect-a-beaglebone-black-to-the-internet-using-usb
- https://forum.beagleboard.org/t/bbb-sharing-internet-connection-from-linux-laptop-with-usb/1018
- https://bootlin.com/doc/training/linux-kernel/linux-kernel-labs.pdf
- https://askubuntu.com/questions/311053/how-to-make-ip-forwarding-permanent
- https://askubuntu.com/questions/446570/why-does-su-fail-with-authentication-error
- https://gist.github.com/pdp7/d2711b5ff1fbb000240bd8337b859412
- https://www.quora.com/How-do-I-use-a-TFTP-client-in-Linux
- http://chschneider.eu/linux/server/tftpd-hpa.shtml
- https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-20-04