How to Load Kernel, Bootloader & Filesystem Images via TFTP on Embedded Targets

TFTP (Trivial File Transfer Protocol) is a lightweight file transfer protocol ideal for embedded systems. It’s commonly used to load bootloader, kernel, and rootfs images to embedded targets like ARM boards, routers, or IoT devices during development or recovery.

TFTP is:

  • Simple (no authentication or encryption)
  • Fast on local networks
  • Supported by most bootloaders (e.g., U-Boot)

This guide provides a step-by-step method to:

  1. Set up a TFTP server
  2. Load U-Boot, kernel, and root filesystem images
  3. Boot the embedded device from RAM or flash

🛠️ Step 1: Setup TFTP Server on Host (Linux PC)

✅ Install TFTP Server

On Ubuntu/Debian:

sudo apt update
sudo apt install tftpd-hpa

✅ Configure TFTP Directory

Edit /etc/default/tftpd-hpa:

TFTP_DIRECTORY="/tftpboot"
TFTP_OPTIONS="--secure"

Make sure the directory exists:

sudo mkdir -p /tftpboot
sudo chmod -R 777 /tftpboot

Restart the server:

sudo systemctl restart tftpd-hpa

📂 Step 2: Copy Images to /tftpboot

Place the following files in the TFTP root:

cp u-boot.img zImage devicetree.dtb rootfs.ext4 /tftpboot/

🧑‍💻 Step 3: Setup Embedded Board (U-Boot CLI)

Connect via serial and power up your embedded board. You’ll drop into U-Boot shell.

✅ Configure Network (U-Boot)

setenv ipaddr 192.168.1.100          # IP of embedded board
setenv serverip 192.168.1.10         # IP of host PC running TFTP
setenv netmask 255.255.255.0

Save settings:

saveenv

📥 Step 4: Load Images Over TFTP

✅ Load Kernel

tftp 0x81000000 zImage

✅ Load Device Tree

tftp 0x82000000 devicetree.dtb

✅ Load Root Filesystem (if supported via initramfs or RAM boot)

tftp 0x83000000 rootfs.ext4

📌 Replace addresses based on your memory map (0x81000000, etc.)


🚀 Step 5: Boot the Kernel (RAM Boot Example)

bootz 0x81000000 - 0x82000000
  • bootz: Boot zImage
  • First address: kernel
  • -: no initramfs
  • Last address: device tree

If using initramfs:

bootz 0x81000000 0x83000000 0x82000000

💾 Optional: Flash Images to NAND/EMMC

After verifying successful boot from RAM, flash permanently:

# Flash Kernel
tftp 0x81000000 zImage
nand erase.part kernel
nand write 0x81000000 kernel ${filesize}

# Flash Rootfs
tftp 0x83000000 rootfs.ext4
nand erase.part rootfs
nand write 0x83000000 rootfs ${filesize}

⚠️ Always validate partition names (mtdparts) in your U-Boot environment.


🧪 Troubleshooting Common Issues

ProblemSolution
TFTP timeoutCheck firewall or network cable. Verify IP and tftpd-hpa status.
File not foundEnsure file exists in /tftpboot/ and has correct permissions.
bad magic number on bootzWrong file type—use uImage or use bootz for zImage.
Files load but boot hangsVerify matching dtb file and supported kernel/initrd addresses.

Loading images via TFTP is the most efficient way to bring up or debug embedded Linux boards. With just a few lines of U-Boot commands and TFTP setup on your PC, you can test new kernels, root filesystems, or bootloaders without flashing.

✅ Ideal for development, testing, or disaster recovery.

Did this guide help you boot your board successfully over TFTP?
Have a unique board setup or issue to debug? Drop your comments and let’s build a better embedded ecosystem together! 👇

Leave a Comment