BeagleBoneNFSBoot

From eLinux.org
Jump to: navigation, search
BeagleBone NFS boot using Ubuntu as host
=========================================

Prepare host
-------------

1. Install packages:
	sudo apt-get install tftpd tftp nfs-kernel-server

2. Create /etc/xinetd.d/tftpd with the following text

------ SNIP ------
# default: off
# description: The tftp server serves files using the Trivial File Transfer
# \
#    Protocol.  The tftp protocol is often used to boot diskless \
#    workstations, download configuration files to network-aware printers, \
#    and to start the installation process for some operating systems.
service tftp
{
    socket_type     = dgram
    protocol        = udp
    wait            = yes
    user            = root
    server          = /usr/sbin/in.tftpd
    server_args     = -s /tftpboot
    disable         = no
}
------ SNIP ------

3. Create /tftpboot
	sudo mkdir /tftpboot
	sudo chown $USER /tftpboot
	touch /tftpboot/testfile   # Create a test file

4. Put the following line in /etc/exports:

/path_to_your_root_filesystem *(rw,sync,no_subtree_check,no_root_squash)

where /path_to_your_root_filesystem is to be replaced with the path to the
rootfs that you want to export.

IMPORTANT: This is a pretty serious security risk. It's advisable to only
do this on a network you have control of. Please read the man page for
exports (run "man exports") to learn more about NFS and security.

5. Start Services
	sudo service nfs-kernel-server restart
	sudo service xinetd restart

6. Check tftp
	tftp localhost
(then from the tftp> prompt)
	get testfile

If there's no error message after "get testfile", it succeeded. Type "exit."

7. Check NFS
	mkdir /mnt/nfstemp
	sudo mount your_ip_address:/path_to_your_root_filesystem /mnt/nfstemp
(where your_ip_address is your IP address, and /path_to_your_root_filesystem
is the path of the root filesystem you exported in step 4.

	umount /mnt/nfstemp

8. Copy your kernel and DTB to /tftpboot

9. Reset your beaglebone, stopping at the u-boot prompt

10. Execute the following:
	dcache off
	setenv ipaddr IP_ADDR_TO_ASSIGN_TO_BONE
	setenv serverip IP_ADDR_OF_YOUR_PC
	tftpboot 0x815f0000 ${serverip}:YOUR_KERNEL_FILE_NAME
	tftpboot DTADDR ${serverip}:YOUR_DTB_FILE_NAME

	setenv bootargs console=ttyO0,115200n8 root=/dev/nfs \
	  nfsroot=${serverip}:/path_to_your_root_filesystem rw ip=${ipaddr}

	bootm 0x815f0000 - DTADDR