Sure.
I’ll just mention that I’m using a Yocto distribution based on the meta-tegra layer, instead of Nvidia’s L4T Ubuntu. I’m using it both for the NFS-shared rootfs, and the Initramfs that boots from TFTP and switches root into that NFS share.
So, if someone were to try using an NFS share with a different OS, It should be theoretically possible, however i haven’t tried to switch_rootfs from a Yocto Initramfs to a non-Yocto OS, so it might require some small adjustments, depending on the OS on the NFS share.
So for the TFTPboot, i just configured the Xavier’s boot priority to ‘net’ (build the boot priority DTB according to this page , and write the DTB to the CPUBL-CFG partition according to this page).
Then, to prepare the Initramfs that switches into NFS, i built small Yocto image based on meta-tegra’s tegra-minimal-initramfs. Its init script was modified to this:
#!/bin/sh
# Mount the virtual filesystems
PATH=/sbin:/bin:/usr/sbin:/usr/bin
mount -t proc proc /proc
mount -t devtmpfs none /dev
mount -t sysfs sysfs /sys
# Activate network device
LOCAL_IP_ADDRESS=192.168.13.6
NFS_Host_IP_ADDRESS=192.168.13.10
echo "Activating network device with address ${LOCAL_IP_ADDRESS}..."
ifconfig eth0 $LOCAL_IP_ADDRESS up
# Wait for NFS server to be up
echo "Validating network connectivity by Pinging NFS host (${NFS_Host_IP_ADDRESS}) until an answer is received..."
ping -W1 -c1 $NFS_Host_IP_ADDRESS
while [ $? -ne 0 ]; do ping -W1 -c1 $NFS_Host_IP_ADDRESS; done
# Mount NFS
echo "NFS host is pingable. Trying to mount the NFS share..."
rootdev="${NFS_Host_IP_ADDRESS}:/mnt/r"
opt="vers=3,nolock"
echo "Mounting ${rootdev}..."
mount -t nfs -o "$opt" "${rootdev}" /mnt || exec sh
# Switch rootfs
echo "Switching to rootfs on ${rootdev}..."
mount --move /sys /mnt/sys
mount --move /proc /mnt/proc
mount --move /dev /mnt/dev
exec switch_root /mnt /sbin/init
The image artifact is called tegra-minimal-initramfs-jetson-xavier.cpio.gz.cboot. It has to be signed, as follows (using the tegraflash.py script that is shipped with Nvidia’s SDK):
python tegraflash.py --chip 0x19 --cmd "sign tegra-minimal-initramfs-jetson-xavier.cpio.gz.cboot" --skipuid
Then it has to be placed in the TFTP directory, under the name boot.img, together with the ‘tegra194-p2888-0001-p2822-0000.dtb’ which is also shipped with Nvidia’s utils (both files are required for the CBoot to perform TFTPBoot).
And finally, for the NFS share, I used a Yocto’s core-image with the meta-tegra layer (to build a directory tree rootfs as an artifact, in addition to the tegraflash.zip artifact, add
IMAGE_TYPES += " rootfs.tar.gz"
to the local.conf file). But then again, any rootfs would work, assuming that it can be booted into from initramfs with the switch_root command.
With the above solution, I can switch between flash boot and NFS boot by toggling the TFTP server; That is, if the TFTP server is offline, then CBoot will fail to TFTPBoot and will default to the local boot.