PXE-boot

From Tinker Board Wiki
Revision as of 06:34, 13 August 2018 by N hirota (talk | contribs) (nfs mount shoud be "nfsroot=10.42.0.1:/nfs/rootfs". No include SPACE between ":" and "/".)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

 Image version

        Please use the image version before V1.9.1 (include), or after V2.0.5 (include).

        NOTE : There is some problem from the image version V2.0.1 to V2.0.4, we have fixed it at V2.0.5.

 Install tftp

  1. Install following packages
sudo apt install xinetd tftpd

      2. Create /etc/xinet.d/tftp and put this entry

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

      3. Create a folder /tftpboot

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

      4. Restart the xinetd service.

sudo service xinetd restart

 Install nfs

  1. Install following packages
sudo apt install nfs-kernel-server nfs-common

      2. Create a folder/var/nfsshare

sudo mkdir /var/nfsshare
sudo chmod -R 777 /var/nfsshare

      3. Create /etc/exports and put this entry

/var/nfsshare        10.42.0.0/24(rw,sync,no_subtree_check,no_root_squash)

      4. Restart NFS server

/etc/init.d/nfs-kernel-server restart

 PXE Boot

  1. Set up a DHCP server as a PXE server. This server must provide functions of TFTP server and NFS server.
  2. Prepare PXE config file in tftpboot directory. Create a directory “pxelinux.cfg” in tftpboot directory. The file name of PXE config is “default ”. The patch of PXE config should be :

"/tftpboot/pxelinux.cfg/default " The content of PXE config is like "/boot/extlinux/extlinux.conf " in Tinker Board, but the path of rootfs should be modified. The following is an example. “10.42.0.1 ” is IP of NFS server. “/nfs/rootfs/ ” is path of NFS ROOT.

label kernel-4.4
   kernel /zImage
   fdt /rk3288-miniarm.dtb
   append  earlyprintk console=tty1 console=ttyS1,115200n8 root=/dev/nfs nfsroot=10.42.0.1:/nfs/rootfs rw ip=dhcp rootwait elevator=deadline
  1. Put the following files into tftpboot directory for PXE boot. hw_intf.conf: You can get it from “/boot/hw_intf.conf ” in Tinker Board. rk3288-miniarm.dtb: Device Tree config for Linux kernel. zImage: Linux kernel image with NFS functions(CONFIG_IP_PNP, CONFIG_IP_PNP_DHCP, CONFIG_IP_PNP_BOOTP, CONFIG_IP_PNP_RARP, and CONFIG_ROOT_NFS). The paths should be : "/tftpboot/hw_intf.conf ", "/tftpboot/rk3288-miniarm.dtb", "/tftpboot/zImage"
  2. Copy the whole rootfs of Tinker Board into NFS directory in NFS server. According to the example above, the path of NFS ROOT in NFS server should be: “/nfs/rootfs” This path needs to be shared by NFS server. Modify the partition definitions in “/nfs/rootfs/etc/fstab”. There should be only one partition.

    proc            /proc           proc    defaults          0       0
    
  3. Remove the following files in Tinker Board. “/boot/rk3288-miniarm.dtb” “/boot/zImage” The bootloader will start PXE boot if these files are removed from Tinker Board.