Home » Development and Build » Development Environment Setup » Load kernel, bootloader and filesystem images on embedded target using tftp

Load kernel, bootloader and filesystem images on embedded target using tftp

Following is the procedure which will guide you for setting up the Linux PC as a tftp server and download the uboot, dts and ramdisk or filesystem using tftpboot at uboot console and then boot the target board.

You will need to make sure following setup:

  • Ubuntu Linux PC in LAN
  • Target board Uboot has Ethernet enabled.
  • You can ping ubuntu PC IP from the uboot console.

On Ubuntu Linux : follow the steps as mentioned in “How to setup tftp server on Ubuntu ?” for setting up TFTP server on Ubuntu machine and copy your kernel, bootloader, dtb and filesystem images as root directory of tftp server as,

tftp server, creates directory /srv/tftp on Ubuntu 20.04, which you can check using below command,

$ ps -ax | grep tftp
  32850 ?        Ss     0:00 /usr/sbin/in.tftpd --listen --user tftp --address :69 --secure /srv/tftp

On other Ubuntu versions, you may see tftp server started with directory /var/lib/tftpboot

One we have setup, tftpserver now we will need to copy images which we want to flash on the target.

$ sudo cp -r FOLDER_WITH_FILES/*   /var/lib/tftpboot

On TARGET Board

Once you have the TFTP server ready with the images you need to download and flash on target board, you need to first set the respective IP address details as below, which identifies your board and the TFTP server.

 $ setenv ipaddr  YOUR_BOARD_IP
 $ setenv netmask  255.255.255.0
 $ setenv serverip  YOUR_TFTP_SERVER_IP
 $ setenv dnsip  YOUR_DNS_IP
 $ setenv gatewayip  YOUR_GATEWAY_IP

you can use “saveenv” command to save the environment variables to flash so that you don’t need to type those IP address everytime you reboot your board.

$ saveenv

Use below command to set the kernel, dtb and filesystem load memory address.

 setenv kernel_addr "YOUR KERNEL MEMORY ADDRESS" 
 setenv dtb_addr "YOUR DTB MEMORY ADDRESS" 
 setenv filesystemimage_addr "YOUR FILESYSTEM MEMORY ADDRESS" 

Load kernel, dtb and filesystem images using “tftpboot” command. Below command will connect to tftp server and load kernel, dtb and filesystem images as your given the names to the respective address.

 tftpboot ${kernel_addr}  kernel_image_name
 tftpboot ${dtb_addr}  dtb_image_name
 tftpboot ${filesystemimage_addr}  filesystem_image_name

Boot the kernel now using bootm command as below,

 bootm ${kernel_addr} 
STM32 Bootloader Tutorial Part 6 - ...
STM32 Bootloader Tutorial Part 6 - Wireless Firmware Update FOTA through BLE

Leave a Comment

Sign up to our newsletter!