common:application_note:software:tftp_netbooting

Install the following packages on your host PC

$ sudo apt install xinetd tftpd tftp

Create file “/etc/xinetd.d/tftp” with the following contents

service tftp
{
     protocol = udp
     port = 69
     socket_type = dgram
     wait = yes
     user = nobody
     server = /usr/sbin/in.tftpd
     server_args = /tftpboot
     disable = no
}

Create directory `/tftpboot/' (this matches the `server-args' above) and set its permissions:

$ sudo mkdir /tftpboot/
$ sudo chmod -R 777 /tftpboot/
$ sudo chown -R nobody /tftpboot/

Restart the `xinetd' service:

$ sudo service xinetd restart

Test the server by creating a simple `test' file in `/tftpboot/': <coe host> $ cd /tftpboot/ $ echo “this is a test” > test </code>

Get the IP address of your host PC via “ip addr”, then from another system:

$ tftp <host_pc_ip_address>
$ tftp> get test
$ Sent 159 bytes in 0.0 seconds
$ tftp> quit
$ $ cat test
$ this is a test

Copy your kernel and dtb binary into the “/tftpboot” folder.

ODROID-N2

$ cp Image /tftpboot
$ cp meson64_odroidn2.dtb /tftpboot
$ cp uInitrd /tftpboot

ODROID-C4

$ cp Image /tftpboot
$ cp meson64_odroidc4.dtb /tftpboot
$ cp uInitrd /tftpboot

ODROID-C2

$ cp uInitrd /tftpboot
$ cp Image /tftpboot
$ cp meson64_odroidc2.dtb /tftpboot

ODROID GO Advance

$ cp Image /tftpboot
$ cp rk3326-odroidgo2-linux.dtb /tftpboot

Assumptions:

  • TFTP server IP address: 192.168.0.2
  • ODROID Board IP address: 192.168.0.3

Download image and Booting

ODROID-N2

Set the tftp server & board ip address:

target
odroidn2# setenv serverip 192.168.0.2
odroidn2# setenv ipaddr 192.168.0.3

Download images using tftp:

target
odroidn2# tftp 0x1000000 meson64_odroidn2.dtb
odroidn2# tftp 0x11000000 Image
odroidn2# tftp 0x13000000 uInitrd

Booting:

target
odroidn2# setenv condev "console=ttyS0,115200n8 console=tty0"
odroidn2# setenv m "1080p60hz"
odroidn2# setenv m_bpp "32"
odroidn2# setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait rw ${condev} no_console_suspend hdmimode=${m} m_bpp=${m_bpp} fsck.fix=yes"
odroidn2# booti 0x11000000 0x13000000 0x1000000
ODROID-C4

Set the tftp server & board ip address:

target
odroidc4# setenv serverip 192.168.0.2
odroidc4# setenv ipaddr 192.168.0.3

Download images using tftp:

target
odroidc4# tftp 0x1000000 meson64_odroidc4.dtb
odroidc4# tftp 0x11000000 Image
odroidc4# tftp 0x13000000 uInitrd

Booting:

target
odroidc4# setenv condev "console=ttyS0,115200n8 console=tty0"
odroidc4# setenv m "1080p60hz"
odroidc4# setenv m_bpp "32"
odroidc4# setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait rw ${condev} no_console_suspend hdmimode=${m} m_bpp=${m_bpp} fsck.fix=yes"
odroidn2# booti 0x11000000 0x13000000 0x1000000
ODROID-C2

Configure boot.ini file.

Comment out the changes to boot from primary partition /media/boot/boot.ini file.

# fatload mmc 0:1 ${initrd_loadaddr} uInitrd
# fatload mmc 0:1 ${loadaddr} Image
# fatload mmc 0:1 ${dtb_loadaddr} meson64_odroidc2.dtb

And Replace these with following

# Booting via tftp server configuration
# setting up the tftp parameters
setenv tftpImage Image
setenv tftpFdtfile meson64_odroidc2.dtb
setenv tftpuInit uInitrd
setenv ipaddr 192.168.0.3         # client ip address
setenv serverip 192.168.0.2 	    # server ip address
setenv gatewayip 192.168.0.1      # gateway ip address
# Download firmware image via tftp
setenv net_tftp 'tftp ${loadaddr} ${tftpImage};tftp ${dtb_loadaddr} ${tftpFdtfile};tftp ${initrd_loadaddr} ${tftpuInit};'
run net_tftp
ODROID-C1

Configure boot.ini file.

Comment out the changes to boot from primary partition /media/boot/boot.ini file.

# Booting
# fatload mmc 0:1 0x21000000 uImage
# fatload mmc 0:1 0x22000000 uInitrd
# fatload mmc 0:1 0x21800000 meson8b_odroidc.dtb

And Replace these with following

# Booting via tftp server configuration
# setting up the tftp parameters
 
setenv kernel_addr 0x21000000
setenv fdt_addr 0x21800000
setenv uinit_addr 0x22000000
setenv tftpbootfile uImage
setenv tftpfdtfile meson8b_odroidc.dtb
setenv tftpuInit uInitrd
setenv ipaddr 192.168.0.3      # Client ipaddress
setenv serverip 192.168.0.2    # Server ipaddress
setenv gatewayip 192.168.0.1   # Gateway ipaddress
 
setenv net_tftp 'tftp ${kernel_addr} ${tftpbootfile};tftp ${fdt_addr} ${tftpfdtfile};tftp ${uinit_addr} ${tftpuInit};'
run net_tftp
  • common/application_note/software/tftp_netbooting.txt
  • Last modified: 2020/04/23 15:36
  • by luke.go