wiki:network boot

Version 10 (modified by ichand, 3 years ago) (diff)

--

This page details to process for configuring a Zynq board to boot via Network boot (NFS+TFTP)

Building Images

BSP

The following instructions present a guide to building images for the Digilent Zybo Board with a Zynq-7000 using a BSP File. Petalinux 2017.4 will be needed.

Clone Github repository and revert to previous commit

$ git clone https://github.com/apollo-lhc/SM_ZYNQ_FW.git
$ cd SM_ZYNQ_FW
$ git checkout b9c9c6d718f7f98fa73ea84179564651ff3035b0 .

Build FPGA FW

$ make

Note: Output will say "Failed to build FW!", but the errors will not interfere with this build

Alter Makefile in SM_ZYNQ_FW/kernel

  • Change VIVADO_VERSION

VIVADO_VERSION = 2017.4

  • Change VIVADO_PETALINUX path

VIVADO_PETALINUX="/work/Xilinx/petalinux/"$(VIVADO_VERSION)"/settings.sh"

  • Add path to BSP file as a variable

BSP_PATH = "/work/ichand/Petalinux-Zybo-2017.4-1.bsp"

  • Change petalinux-create command to use BSP file

petalinux-create --type project --name $(ZYNQ_OS) --s $(BSP_PATH) --force

Build Petalinux Project and Configure Settings

Build the Petalinux project directory by running make in SM_ZYNQ_FW/kernel

Configure general system behavior

$ cd zynq_os
$ source /work/Xilinx/petalinux/2017.4/settings.sh
$ petalinux-config --get-hw-description ../hw --oldconfig
$ petalinux-config

This will open up a settings menu where the following settings should be adjusted

  • DTG Settings -> Kernel Bootargs
    • Disable "generate boot args automatically
    • Set "user set kernel bootargs" to console=ttyPS0,115200 earlycon clk_ignore_unused rootwait root=/dev/nfs rw ip=dhcp nfsroot=<NFS Server IP>:<RFS Directory Path>,nfsvers=3,tcp
  • u-boot Configuration
    • Set "TFTP Server IP address" to <TFTP Server IP>
  • Image Packaging Configuration
    • -> Root File System: Set to NFS
    • -> Location of NFS root directory: Set to <RFS Directory Path>
    • -> NFS Server IP Address: Set to <NFS Server IP>

Configure kernel settings $ petalinux-config -c kernel This will open up a settings menu where the following settings should be enabled

  • Networking support -> Networking Options
    • TCP/IP Networking = Enabled
    • IP: Multicasting = Enabled
    • IP: kernel level autoconfiguration = Enabled
    • IP: DHCP support = Enabled
    • IP: BOOTP support = Enabled
    • IP: RARP support = Enabled
  • File Systems -> Network File Systems
    • NFS client cupport = Enabled
    • NFS client support for NFS version 2 = Enabled
    • NFS client support for NFS version 3 = Enabled
    • NFS client support for NFSv3 ACL protocol extension = Enabled

Build Images

Rebuild the Petalinux Project with the correct configurations

Transfer config files from zynq_os to zynq_os_mods

$ cp SM_ZYNQ_FW/kernel/zynq_os/project-spec/configs/config SM_ZYNQ_FW/kernel/zynq_os_mods/configs/boot_config
$ cp SM_ZYNQ_FW/kernel/zynq_os/project-spec/configs/rootfs_config SM_ZYNQ_FW/kernel/zynq_os_mods/rootfs
$ cp SM_ZYNQ_FW/kernel/zynq_os/project-spec/meta-plnx-generated/recipes-kernel/linux/configs/plnx_kernel.cfg SM_ZYNQ_FW/kernel/zynq_os_mods/kernel/linux/linux-xlnx

Add the following line to SM_ZYNQ_FW/kernel/zynq_os_mods/kernel/linux/linux-xlnx_%.bbappend

SRC_URI += "file://plnx_kernel.cfg"

Run make clean in SM_ZYNQ_FW/kernel/, then run make

After the build completes, BOOT.BIN, image.ub, and rootfs.tar.gz can be found in SM_ZYNQ_FW/kernel/zynq_os/images/linux

Booting Zybo

The following steps detail how to boot the Zybo using the newly generated files

Transfer the files

  • Place image.ub in the TFTP server directory
  • Place BOOT.BIN on the first partition of the SD Card
  • Extract `rootfs.tar.gz' into the NFS server directory

Boot

  • Connect to the board via UART and turn it on
  • When the prompt starts counting down, press any key to stop auto-boot
  • Run the command run netboot

Note: run netboot will likely fail as a result of the boot environment settings being incorrect. Set the following variables as shown:

$ setenv bootargs console=ttyPS0,115200 earlycon clk_ignore_unused rootwait root=/dev/nfs rw ip=dhcp nfsroot=<NFS Server IP>:<RFS Directory Path>,nfsvers=3,tcp
$ setenv serverip <TFTP Server IP>

Note: Need to add more of the U-boot settings

Zynq Template

The following instructions present a guide to building images for the Digilent Zybo Board using the Zynq template to create the project from scratch. Petalinux 2018.2 will be needed

Clone Github repository and revert to previous commit

$ git clone https://github.com/apollo-lhc/SM_ZYNQ_FW.git
$ cd SM_ZYNQ_FW
$ git checkout b9c9c6d718f7f98fa73ea84179564651ff3035b0 .

Build FPGA FW

$ make

Note: Output will say "Failed to build FW!", but the errors will not interfere with this build

Build Petalinux Project and Configure Settings

Build the Petalinux project directory by running make in SM_ZYNQ_FW/kernel

Configure general system behavior

$ cd zynq_os
$ source /work/Xilinx/petalinux/2017.4/settings.sh
$ petalinux-config --get-hw-description ../hw --oldconfig
$ petalinux-config

This will open up a settings menu where the following settings should be adjusted

  • DTG Settings -> Kernel Bootargs
    • Disable "generate boot args automatically
    • Set "user set kernel bootargs" to console=ttyPS0,115200 earlycon clk_ignore_unused rootwait root=/dev/nfs rw ip=dhcp nfsroot=<NFS Server IP>:<RFS Directory Path>,nfsvers=3,tcp
  • u-boot Configuration
    • Set "TFTP Server IP address" to <TFTP Server IP>
  • Image Packaging Configuration
    • -> Root File System: Set to NFS
    • -> Location of NFS root directory: Set to <RFS Directory Path>
    • -> NFS Server IP Address: Set to <NFS Server IP>

Configure kernel settings $ petalinux-config -c kernel This will open up a settings menu where the following settings should be enabled

  • Networking support -> Networking Options
    • TCP/IP Networking = Enabled
    • IP: Multicasting = Enabled
    • IP: kernel level autoconfiguration = Enabled
    • IP: DHCP support = Enabled
    • IP: BOOTP support = Enabled
    • IP: RARP support = Enabled
  • File Systems -> Network File Systems
    • NFS client cupport = Enabled
    • NFS client support for NFS version 2 = Enabled
    • NFS client support for NFS version 3 = Enabled
    • NFS client support for NFSv3 ACL protocol extension = Enabled

Build Images

Rebuild the Petalinux Project with the correct configurations

Transfer config files from zynq_os to zynq_os_mods

$ cp SM_ZYNQ_FW/kernel/zynq_os/project-spec/configs/config SM_ZYNQ_FW/kernel/zynq_os_mods/configs/boot_config
$ cp SM_ZYNQ_FW/kernel/zynq_os/project-spec/configs/rootfs_config SM_ZYNQ_FW/kernel/zynq_os_mods/rootfs
$ cp SM_ZYNQ_FW/kernel/zynq_os/project-spec/meta-plnx-generated/recipes-kernel/linux/configs/plnx_kernel.cfg SM_ZYNQ_FW/kernel/zynq_os_mods/kernel/linux/linux-xlnx

Add the following line to SM_ZYNQ_FW/kernel/zynq_os_mods/kernel/linux/linux-xlnx_%.bbappend

SRC_URI += "file://plnx_kernel.cfg"

Run make clean in SM_ZYNQ_FW/kernel/, then run make

After the build completes, BOOT.BIN, image.ub, and rootfs.tar.gz can be found in SM_ZYNQ_FW/kernel/zynq_os/images/linux