Step by step guide PXE diskless configuration.
I haven't find a guide to setup a proper PXE boot for Rock64 (and Pine64) cards, so I will write down mine here hoping that it is useful.

In this guide I assume that the user is familiar with Linux, another assumption is about the distributions:
- on the Rock64 card we are going to install the Debian minimal;
- on the server that will provide the operating system I use Debian.
I think this guide can work for other distributions too but I haven't tried other combinations.
For the rest of the guide all the commands will run on the server Debian.

About the hardware I tried on a Rock64pro, I have also a Pine64 and a Rock64 but are in production and I needed a spare board to do the tests. Now that it works I will try also for the others, but for this guide I assume the Rock64pro.

Step 1: Flash the SPI
This is actually the only step that requires an SD card.
The SPI is a little memory (128MB) that can be flashed to add instruction at the boot time. Ayufan has a nice SPI image that adds the possibility to boot from network (PXE), and we are going to use it.

So go to this link and download the image file that is useful for your system. I used the u-boot-flash-spi-rockpro64.img.xz file.
Uncompress it with

unxz u-boot-flash-spi-rockpro64.img.xz
and flash it on the SD card with dd
dd bs=1M if=u-boot-flash-spi-rockpro64.img of=/dev/sd<SOMETHING>
Put the card into the Rock64 board and boot it. I had no monitor connected so I do not know what it writes on a screen, but it is enough that you wait some time (one minute is probably enough) and you will see the boot (white) led flashing once per second. It means that the SPI is flashed. You can now turn off the board and remove the SD card.
Step 2: find the ethernet address of the board.
I assume that you have already a DHCP server installed in your network that assign the addresses to every device connected.
If this DHCP server is the router of your internet connection you will have to change it later (unless is a very advanced router and you can specify advanced features). In any case to identify the mac address is sufficient that something assign an IP address to your board.
So turn on your Rock64. It will now spin up and try to boot from SD, eMMC, USB and PXE, and it will fail in all of these tentatives because it has no cards installed and the network boot is not yet configured. Nevertheless, when it tries the PXE the board will get an IP and it will announce its existence to the local network. This means that after few seconds that the ethernet led flashes you can write on your Debian server
arp -a
and you will get the list of connected devices on the network with their IP address and hardware address.
Write down the ethernet address; the one that I will use in my example is 56:31:cd:bb:92:7b.
Step 3: the DHCP server.
We need a DHCP server capable of some advanced features if you have the DHCP on your router you have to disable it and from this moment on you will use the DHCP on your Debian server.
Install it with
sudo apt-get install isc-dhcp-server
Once installed edit the /etc/dhcp/dhcpd.conf in this way

ddns-update-style none;
option domain-name "";
option domain-name-servers;
default-lease-time 6000;
max-lease-time 72000;
log-facility local7;

subnet netmask {
   option subnet-mask;
   option broadcast-address;
   option routers;
   option domain-name-servers;

host rock64pro {
  hardware ethernet 56:31:cd:bb:92:7b;
I don't want to go into the details but basically this configuration allocates random addresses between and for the normal devices (like computers or telephones) and assign the to the rock64pro identifying it with the ethernet address that we find in the previous step. Moreover, and this is the advanced feature, the server will tell to the rock64pro that after it takes the address it has to communicate with for "further instructions" (the next-server directive).
Here I am assuming that is the IP address of the Debian server.
Once this file is in place restart the DHCP server with

sudo systemctl restart isc-dhcp-server
 You can test if this configuration works turning on the Rock64pro board, waiting couple of seconds and try again the arp -a. If everything is fine you should see that now the Rock has the address

Step 4: TFTP server
We have now to instruct the Rock64pro for the next step. The way to take information is through a special version of an ftp server called tftp (t is for trivial). So we need a tftp server running on our Debian and to install it we do
sudo apt-get install tftp-hpa
once installed edit the file /etc/defaults/tftpd-hpa as
here I am assuming that we will store the data to boot the Rock64pro into a directory /storage/pxe-boot and in this directory we will put all the files for the boot and for the operating system.
So we need to do these steps

sudo mkdir /storage
sudo mkdir /storage/rock64pro
sudo mkdir /storage/tftp
sudo mkdir /storage/tftp/pxelinux.cfg
  In rock64pro we will put the operating system (the content of the boot image) while in the tftp we will put all the files to the initial boot procedure (linux kernel and its configurations).
Now we can restart the tftp server
sudo systemctl restart tftpd-hpa

Step 5: NFS server
The kernel and the boot execution is provided through the tftp server, but the operating system will live entirely on a folder that will be served to the rock64pro through NFS, so we need a working NFS server.
To install it
sudo apt-get install nfs-kernel-server rpcbind
the edit the file /etc/exports as
/storage/pxe-boot/rock64pro     *(rw,sync,no_root_squash)
and the file /etc/hosts.allow as
portmap: 192.168.0.
The first file says to NFS server that has to export the directory /storage/pxe-boot/rock64pro to everyone with specific flags (read/write, sync, and no limitation for root). The second file allows the IPs of the subnet 192.168.0.x to connect to the NFS server. You may want to limit the NFS server only to the IP of the rock64pro substituting to the * of the exports file and writing the full ip into the hosts.allow.
Restart the NFS server with
sudo systemctl restart nfs-kernel-server

Step 6: setup the filesystem
Download the Debian image for your Rock card from this link (you can use wget). I used the stretch-minimal-rockpro64-0.7.11-1075-arm64.img.xz. Uncompress it with
unxz stretch-minimal-rockpro64-0.7.11-1075-arm64.img.xz

Once downloaded you have to mount the linux partition contained in the img file. The file contains also another partition that is to boot and we are not interested in it, so we have to find the right position of the linux. To do it we use fdisk as

sudo fdisk -l stretch-minimal-rockpro64-0.7.11-1075-arm64.img
the result is something like
Disk stretch-minimal-rockpro64-0.7.11-1075-arm64.img: 2 GiB, 2144337920 bytes, 4188160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: FB84DCAE-4E0E-486F-890C-A979BEECCFF9

Device                                            Start     End Sectors  Size Type
stretch-minimal-rockpro64-0.7.11-1075-arm64.img1     64    8063    8000  3.9M Linux filesystem
stretch-minimal-rockpro64-0.7.11-1075-arm64.img2   8064    8191     128   64K Linux filesystem
stretch-minimal-rockpro64-0.7.11-1075-arm64.img3   8192   16383    8192    4M Linux filesystem
stretch-minimal-rockpro64-0.7.11-1075-arm64.img4  16384   24575    8192    4M Linux filesystem
stretch-minimal-rockpro64-0.7.11-1075-arm64.img5  24576   32767    8192    4M Linux filesystem
stretch-minimal-rockpro64-0.7.11-1075-arm64.img6  32768  262143  229376  112M Microsoft basic data
stretch-minimal-rockpro64-0.7.11-1075-arm64.img7 262144 4186111 3923968  1.9G Linux filesystem
Here you have to identify two things: the first one is the size of one unit sector (512 bytes) and the second information is the begin of the filesystem that we are looking for. In our case it is the last one and we know because is the one of 1.9GB of size. Then this filesystem starts at the position 262144. Now we multiply these two numbers: 512x262144=134217728. This is the starting position of the linux partition. We can use it to mount the partition as

sudo mkdir /storage/tmpimage
sudo mount -o loop,offset=134217728 stretch-minimal-rockpro64-0.7.11-1075-arm64.img /storage/tmpimage

now we copy the content of the filesystem into our nfs server. I use rsync to do it because I trust the way it preserves permissions and links, but probably a simple cp -a can do the job.

sudo rsync -val /storage/tmpimage/* /storage/pxe-boot/rock64pro/
After the sync the image is no longer needed

sudo umount /storage/tmpimage
sudo rmdir /storage/tmpimage
sudo rm stretch-minimal-rockpro64-0.7.11-1075-arm64.img

Step 7: Finalize the boot
We have now the system ready, we need only to put in the tftp directory the instructions to send the kernel to the board for the boot.
To do this we first copy the boot folder of the rock64pro filesystem to the tftp directory. We need to do it because we need to provide the kernel via tftp before mounting the NFS root.

sudo rsync -val /storage/pxe-boot/rock64pro/boot /storage/pxe-boot/tftp/

finally we need to provide to the board the extlinux.conf boot file. When the Rock boots it searches for a boot file with various names, we will use the pxelinux.cfg/default-arm-rockchip. So we first copy the extlinux.conf as
sudo cp /storage/pxe-boot/tftp/boot/extlinux/extlinux.conf /storage/pxe-boot/tftp/pxelinux.cfg/default-arm-rockchip
then we need to edit this file because by default it will try to load the kernel from the storage device (SD Card) but we want to mount the root directory from the nfs server. So edit it, remove the second block and modify the line of root as the following
timeout 10
menu title select kernel

label kernel-4.4.154-1124-rockchip-ayufan-ged3ce4d15ec1
   kernel /boot/vmlinuz-4.4.154-1124-rockchip-ayufan-ged3ce4d15ec1
   initrd /boot/initrd.img-4.4.154-1124-rockchip-ayufan-ged3ce4d15ec1
   devicetreedir /boot/dtbs/4.4.154-1124-rockchip-ayufan-ged3ce4d15ec1
   append rw panic=10 init=/sbin/init coherent_pool=1M ethaddr=${ethaddr} eth1addr=${eth1addr} serial=${serial#} cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1 root=/dev/nfs nfsroot=${serverip}:/storage/pxe-boot/rock64pro rootwait rootfstype=ext4
the only part to modify is the root= and the nfsroot= the rest of the file is the same as the extlinux.conf.
Finally, the SD card mounts the boot directory from a vfat partition while we are using our tftp boot, so we need to fix this.
The way is to edit the file /storage/pxe-boot/rock64pro/etc/fstab and remove the line about the boot (that should be the only one, so the final file will be empty).
Known Issues.
The reboot does't work always. It seems that the tftp server stucks and doesn't work in the next boot. I will try another tftp server.
The workaround is to force kill the tftpd and restart it.

If in the update process some component of the boot is upgraded, it is necessary to update the tftp boot folder and the pxelinux.cfg/default-arm-rockchip.

Messages In This Thread
Step by step guide PXE diskless configuration. - by burglar_ot - 11-15-2018, 03:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Beginners Guide: Migrating to SSD rontant 18 41,091 01-19-2022, 09:30 AM
Last Post: Ellesar Dragon
Information Beginners Guide: Adding USB Storage, Linux Formatting and Permissions Ptheven 4 12,542 03-06-2021, 01:49 PM
Last Post: helpmerock
Thumbs Up A guide for how I made RetroPie, RetroArch, and EmulationStation Work on the Rock64 Mrfixit2001 4 16,419 12-17-2018, 03:52 AM
Last Post: va88
  Guide - XRDP - Debian Stretch / Ubuntu Xenial / OMV S3phi40T 3 14,200 05-05-2018, 06:08 AM
Last Post: S3phi40T
Information Guide - Raid Array (Raid 0) Ptheven 0 4,908 10-07-2017, 09:22 AM
Last Post: Ptheven
Information Guide - Setting up a NFS Share Ptheven 0 5,594 09-26-2017, 04:44 AM
Last Post: Ptheven
  Guide - Setting up a SMB(Windows) file server Ptheven 0 12,753 08-21-2017, 08:54 AM
Last Post: Ptheven
Information Beginners Guide: Locating your board, connecting to it. Ptheven 5 16,260 08-21-2017, 04:12 AM
Last Post: Ptheven

Forum Jump:

Users browsing this thread: 1 Guest(s)