Network Boot NFS¶
The MitySOM-AM62x can use a NFS to load system boot files (e.g. the kernel, device tree, and filesystem). If you need to load the boot loader over the network, please refer to the Network Boot option on our Boot_options wiki page. This page assumes you have U-Boot loaded and ready to run commands. For most users, this will be a U-Boot loaded from the SD Card or eMMC.
Tested on Host: Ubuntu 24.04 and U-boot 2019/Kernel 6.12
Configure NFS¶
The NFS Server needs to be configured on your host device. There are multiple ways to do this. These general instructions may need to be modified for your particular host.
First, on your host (NOT the MitySOM-AM62x filesystem) create a directory to hold the files that will be shared:
$ sudo mkdir /srv/nfs $ sudo chmod 777 /srv/nfs $ sudo chown nfs /srv/nfs
Add this directory to /etc/exports:
/srv/nfs 10.0.1.0/24(rw,insecure,no_subtree_check,async,no_root_squash)
Where the IP address is the range of IP address that your MitySOM-AM62x target may use.
Caution: Anyone in this ip address range can nfs mount and change files in /srv/nfs with root permissions.
U-boot only supports nfs over udp, so ensure nfsd has udp enabled
Edit /etc/nfs.conf and ensure udp=y
[nfsd] udp=y
Restart the NFS daemon:
sudo systemctl restart nfs-kernel-server
Verify directory is shared
$ sudo exportfs /srv/nfs 10.0.1.0/24
Load files in NFS directory¶
For the filesystem, you can use your rootfs generated from your Yocto build or you can copy over the filesystem from the SD Card image:
With the SD card inserted, you can backup the root filesystem using commands like:
$ cd /run/media/username/rootfs $ sudo tar cvf /srv/nfs/am62x_rootfs.tar.gz .
Then, you can untar it in the /srv/nfs/am62x_rootfs directory:
$ cd /srv/nfs $ mkdir am62x_rootfs $ sudo tar -C am62x_rootfs/ xvf rootfs.tar.gz
Please note that you need to run the tar command as the superuser by using sudo.
Note the kernel and device trees are usually stored in the boot/ directory on the root filesystem.
Configure U-Boot¶
Now that the correct files are being shared via NFS, you need to configure U-Boot to load these files. Boot your system and interrupt U-Boot by pressing any key.
At the U-Boot prompt you can run:
U-Boot> setenv autoload no; dhcp link up on port 1, speed 1000, full duplex BOOTP broadcast 1 DHCP client bound to address 10.0.103.159 (2 ms) U-Boot> setenv serverip <host ip>
to set the IP address of your NFS server.
Then you can load the kernel and device tree using:
U-Boot> nfs ${loadaddr} /srv/nfs/am62x_rootfs/boot/Image
U-Boot> nfs ${fdtaddr} /srv/nfs/am62x_rootfs/boot/dtb/ti/k3-am62x-mitysom-devkit.dtb
where you adjust the path and filenames to match the files on your NFS server.
Next, you need to adjust the bootargs so that the kernel uses the NFS filesystem as its root. You can set the bootargs variable using:
U-Boot> setenv bootargs console=${console} ${optargs} rw root=/dev/nfs nfsroot=${serverip}:/srv/nfs/am62x_rootfs ip=dhcp
If those commands run successfully, you can then boot using:
U-Boot> booti ${loadaddr} - ${fdtaddr}
One-liner so we autoboot nfs on each boot
setenv autoload no;
setenv serverip 10.0.62.2;
setenv bootargs console=${console} ${optargs} rw root=/dev/nfs nfsroot=${serverip}:/srv/nfs/am62x_rootfs ip=dhcp
setenv bootcmd 'dhcp; setenv serverip 10.0.62.2; nfs ${loadaddr} /srv/nfs/am62x_rootfs/boot/Image; nfs ${fdtaddr} /srv/nfs/am62x_rootfs/boot/dtb/ti/k3-am62x-mitysom-devkit.dtb; booti ${loadaddr} - ${fdtaddr}'
saveenv
NFS Boot Troubleshooting¶
The kernel will print out its bootargs in the first few lines of the boot log. Please review that to make sure it matches what you expect.
[ 0.000000] Kernel command line: console=ttyS2,115200n8 rw root=/dev/nfs nfsroot=10.0.62.2:/srv/nfs/am62x_rootfs ip=dhcp
The kernel should print out the IP address it got from dhcp
[ 6.546637] Sending DHCP requests ., OK [ 6.566518] IP-Config: Got DHCP answer from 10.0.0.2, my address is 10.0.103.159 [ 6.573920] IP-Config: Complete: [ 6.577143] device=eth0, hwaddr=28:b5:e8:df:31:a8, ipaddr=10.0.103.159, mask=255.255.0.0, gw=10.0.0.1
Double check the NFS server config to make sure the MitySOM-AM62x has access to the NFS exports.
Double check the kernel has NFS support compiled-in and not as a module.¶
$ ag NFS build-mitysom62x/.config 7760:CONFIG_NFS_FS=y 7774:CONFIG_ROOT_NFS=y ag IP_PNP build-mitysom62x/.config 1000:CONFIG_IP_PNP=y 1001:CONFIG_IP_PNP_DHCP=y
Check the Mount Daemon (mountd)¶
When a client tries to connect, the mountd service handles the authentication and "handshake."
$ journalctl -t rpc.mountd -f
Enable verbose nfsd kernel logging¶
Note: If the host servers more than just the devkit, this may produce way too much logs
Enables all Server debug logging
sudo rpcdebug -m nfsd -s all
Enable just file open calls
sudo rpcdebug -m nfsd -s fh
Enables all RPC (connection) logging
sudo rpcdebug -m rpc -s all
Clear/Disable all logging
sudo rpcdebug -m nfsd -c all
Go to top