TFTP Boot - lulu98/projects-with-sel4 GitHub Wiki
The initial idea is to load the kernel image os_image.bin
straight from the SD card into RAM. The problem is that this requires the developer to always get the SD card from the board, insert it into the laptop, transfer the kernel image to the SD card and move the SD card back into the SD card slot on the board. This requires so much time when the kernel image should be tested regularly.
A way to speed this up, is to use U-Boot to pull the kernel image over the network via TFTP.
Install tftpd-hpa
package:
sudo apt-get install tftpd-hpa
Check status of tftpd-hpa
service:
sudo systemctl status tftpd-hpa
Edit TFTP server configuration in /etc/default/tftpd-hpa
:
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-s -c -l"
The kernel image that is created when building a CAmkES application for a platform can be put into the /tftpboot
folder. This is the location TFTP clients will pull images from.
Restart TFTP service:
sudo mkdir /tftpboot
sudo chmod -R 777 /tftpboot
sudo chown -R nobody /tftpboot
sudo service tftpd-hpa restart
- Set IP address for the ethernet port of the laptop that you connect with the ethernet port of the board:
sudo ip addr add 192.168.137.1/24 dev <eth-port>
This configures the ethernet interface <eth-port>
of the development machine (i.e. the TFTP server) to have the IP address 192.168.137.1
.
- Set up DHCP server:
sudo dnsmasq -p 0 -i <eth-port> -F 192.168.137.50,192.168.137.100,255.255.255.0 -M os_image.bin
This configures DHCP to give connecting clients an IP address in the range 192.168.137.50
to 192.168.137.100
and push the os_image.bin
file to the client.
When dropping to the U-Boot command line, the following commands can be executed to pull images from the TFTP server.
- Configure IP:
uboot# setenv serverip 192.168.137.1
Sets the IP address of the TFTP server.
- Load file over network:
odroidc2# dhcp <load-address>
odroidc2# bootefi <load-address>
These U-Boot commands can be combined and put into the boot.scr
image. If this boot script is available, U-Boot will automatically execute these commands.