Network Boot
Overview
During kernel development, it’s often more efficient to avoid reflashing the board every time a new kernel image is built. Instead, the kernel can be loaded directly over the network, greatly speeding up the test cycle.
Using a remote (NFS-mounted) root filesystem is also extremely helpful during board bring-up and debugging. It allows developers to make changes to the system files instantly on the host machine without needing to reflash the target device, providing a faster and more flexible development workflow.
Here is the boot flow diagram:
+--------------------+ +-------------+
| HOST PC TFTP | | HOST PC NFS |
+--------+ |--------------------| +-------+ |-------------|
| U-Boot | --> | Kernel bin + DTB | --> | Linux | --> | rootfs |
+--------+ +--------------------+ +-------+ +-------------+
Host
TFTP Server
Install TFTP server using
sudo apt-get install tftpd-hpa
Confirm TFTP server settings
sudo vim /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
FTP_DIRECTORY="/srv/tftp"
FTP_ADDRESS=":69"
FTP_OPTIONS="--secure"
Start TFTP sever
sudo systemctl enable tftpd-hpa
sudo systemctl start tftpd-hpa
NFS Server
Install NFS server
sudo apt install nfs-kernel-server
Confirm NFS sever settings
sudo vim /etc/exports
/srv/nfs *(rw,nohide,insecure,no_subtree_check,sync,no_root_squash)
If neccesary, restart NFS server to apply new settings
sudo systemctl restart nfs-kernel-server
Configuration variables
These variables are used to configure the board for network boot:
NETBOOT_SERVER_IP - IP address of the host providing NFS and TFTP servicesNFS_ROOTFS_PATH - NFS export path used as the root filesystemTFTP_KERNEL_BIN_PATH - Path to the kernel image served by TFTPTFTP_DTB_BIN_PATH - Path to the device tree blob served by TFTPTFTP_IMAGE_PATH - Path to the SYNAIMG folder for TFTP flashImage Build
source meta-grinn-astra/meta-grinn-astra-netboot/scripts/setup.sh &&
KAS_MACHINE=grinn-astra-1680-ada \
KAS_CONTAINER_IMAGE_DISTRO=debian-bookworm \
kas-container \
--runtime-args "
-e NETBOOT_SERVER_IP=XXX.XXX.XXX.XXX
-e NFS_ROOTFS_PATH=${NFS_ROOTFS_PATH}
-e TFTP_KERNEL_BIN_PATH=${TFTP_KERNEL_BIN_PATH}
-e TFTP_DTB_BIN_PATH=${TFTP_DTB_BIN_PATH}
-e TFTP_IMAGE_PATH=${TFTP_IMAGE_PATH}
"\
build meta-grinn-astra/kas/default.yml:meta-grinn-astra/kas/netboot.yml
Post-Build Sync
Once the build is successful, synchronize the updated artifacts to your TFTP and NFS server paths:
meta-grinn-astra/meta-grinn-astra-netboot/scripts/sync.sh
Device
Warning
Netboot functionality depends on a pre-configured bootloader environment; hence, the first netboot image must be flashed using the standard procedure. Refer to the Flash Prerequisites section for detailed instructions.
Network Topology
Netbooting requires both the Device and the Host PC to be connected to the same local network subnet via an Ethernet cable. Follow the connection schema below:
+--------+ +-------+
| Device | | PC |
+--------+ +-------+
| |
| |
+---------------+
| Router (DHCP) |
+---------------+
Board Setup Verification
Boot the astra device normally and verify it has a valid IP address:
ifconfig eth0 | grep -i "inet " | awk '{print $2}'
Netboot Flow
Netboot flow is controlled via the U-Boot environment. Enter the U-Boot prompt during startup to:
Enable netboot flow
setenv netboot 1 saveenv resetRestore default boot flow
env delete netboot saveenv reset
Note
To enter U-Boot prompt press and hold SPACE during startup.
Optionally you can execute run tftp_flash command in U-Boot to flash eMMC via TFTP