Skip to content

Instantly share code, notes, and snippets.

@Zixuan-Qiao
Last active March 15, 2024 16:11
Show Gist options
  • Save Zixuan-Qiao/20fa82699fb0e01119b79eeaee56d3a3 to your computer and use it in GitHub Desktop.
Save Zixuan-Qiao/20fa82699fb0e01119b79eeaee56d3a3 to your computer and use it in GitHub Desktop.
Summary on how to set up TFTP and NFS on Beaglebone Black

Beaglebone Black - Setting up TFTP and NFS

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.

Required Hardware

Beaglebone Black, PC running on Ubuntu system (ver 20.04 in my case)

serial to USB cable, USB type A to mini B cable

Setup Internet Sharing Through USB 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.

Installing and Testing TFTP

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

Installing and Testing NFS

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

References

  1. https://www.digikey.ca/en/maker/blogs/how-to-connect-a-beaglebone-black-to-the-internet-using-usb
  2. https://forum.beagleboard.org/t/bbb-sharing-internet-connection-from-linux-laptop-with-usb/1018
  3. https://bootlin.com/doc/training/linux-kernel/linux-kernel-labs.pdf
  4. https://askubuntu.com/questions/311053/how-to-make-ip-forwarding-permanent
  5. https://askubuntu.com/questions/446570/why-does-su-fail-with-authentication-error
  6. https://gist.github.com/pdp7/d2711b5ff1fbb000240bd8337b859412
  7. https://www.quora.com/How-do-I-use-a-TFTP-client-in-Linux
  8. http://chschneider.eu/linux/server/tftpd-hpa.shtml
  9. https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-20-04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment