Close

Step 4: Configure TFTP server

A project log for Orange Pi Zero native network boot

Tutorial describing steps to make Orange Pi Zero boot natively from network

andriymalyshenkoandriy.malyshenko 08/13/2021 at 06:350 Comments

When Pi boots it will request certain files from TFTP server. It is very simple server with no authentication and it only server few files, among which kernel, initrd and boot config.

First we will configure some TFTP server, then we will upload those resources.

So next commands are executed on 192.168.1.2 machine, which is ubuntu in my case

$ sudo apt install tftpd-hpa -y
$ sudo nano /etc/default/tftpd-hpa
$ sudo chown $UID:$UID /srv/tftp -R
$ mkdir /srv/tftp/pxelinux.cfg
$ nano /srv/tftp/pxelinux.cfg
$ nano /srv/tftp/pxelinux.cfg/01-02-42-94-b4-99-28

Content of that file is

LABEL linux
KERNEL vmlinuz-5.10.43-sunxi
FDTDIR dtb-5.10.43-sunxi
APPEND root=/dev/nfs initrd=uInitrd-5.10.43-sunxi nfsroot=192.168.1.3:/srv/exports/01-02-42-94-b4-99-28 ip=dhcp rw
DEFAULT linux

As you can see above, configuration is per MAC address, so I can have multiple device configurations in the network.

For now we don't have yet kernel, initrd and dtb files, we will fix that in a minute. Also we inform that NFS server will be under 192.168.1.3 address which not exists yet.

In the Pi boot log we're one step closer

[...]

Autoboot in 1 seconds
MMC: no card present
   
Device 0: unknown device
ethernet@1c30000 Waiting for PHY auto negotiation to complete. done
BOOTP broadcast 1
DHCP client bound to address 192.168.1.49 (8 ms)
Using ethernet@1c30000 device
TFTP from server 192.168.1.2; our IP address is 192.168.1.49
Filename '/pxelinux.0'.
Load address: 0x42000000
Loading: *
TFTP error: 'File not found' (1)
Not retrying...
missing environment variable: pxeuuid
Retrieving file: /pxelinux.cfg/01-02-42-94-b4-99-28
Using ethernet@1c30000 device
TFTP from server 192.168.1.2; our IP address is 192.168.1.49
Filename '/pxelinux.cfg/01-02-42-94-b4-99-28'.
Load address: 0x43200000
Loading: #
         43.9 KiB/s
done
Bytes transferred = 183 (b7 hex)
Config file found
1:      linux
Retrieving file: /initrd.img-5.10.43-sunxi

[...]

Next we'll prepare files specific for Pi both on TFTP server and NFS server

Discussions