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 | --> |      FIT image     | --> | 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 services
NFS_ROOTFS_PATH - NFS export path used as the root filesystem
TFTP_KERNEL_BIN_PATH - Path to the kernel image served by TFTP
 
 

Image Build

source meta-grinn-genio/meta-grinn-genio-netboot/scripts/setup.sh &&
KAS_MACHINE=grinn-genio-510-sbc \
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}
     
     
    "\
  build meta-grinn-genio/kas/default.yml:meta-grinn-genio/kas/netboot.yml

Post-Build Sync

Once the build is successful, synchronize the updated artifacts to your TFTP and NFS server paths:

meta-grinn-genio/meta-grinn-genio-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 genio device normally and verify it has a valid IP address:

ifconfig end0 | 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
    reset
    

  • Restore default boot flow


    env delete netboot
    saveenv
    reset
    

Note

To enter U-Boot prompt press and hold SPACE during startup.