|
| 1 | +# HERO Boot from JTAG+TFTPBOOT+NFS (w/o SDCard) |
| 2 | + |
| 3 | +## Intro |
| 4 | +This tutorial shows how to boot the HERO ecosystem on the ZCU102 instance without the usage of SDCard. JTAG will be used to boot FSBL and U-Boot. Linux kernel, which is quite bigger, is loaded through TFTP, while RootFS is exported using NFS. This tutorial will use also static IP for the HERO board. |
| 5 | + |
| 6 | +## 1. Prerequisite |
| 7 | +### 1.1. Setup JTAG Boot |
| 8 | +Setup the switch on the ZCU102 for JTAG boot (See [https://www.xilinx.com/support/answers/68682.html](https://www.xilinx.com/support/answers/68682.html)). |
| 9 | + |
| 10 | + |
| 11 | +### 1.2. Setup TFTPBOOT and NFS Server |
| 12 | +First, you need to set up your TFT and NFS server. If you have already a TFTP and NFS server installed you can skip this pass. |
| 13 | +#### 1.2.1 Install TFTPBOOT and NFS Server packages (Ubuntu) |
| 14 | +``` |
| 15 | +sudo apt update |
| 16 | +sudo apt install -y tftpd-hpa nfs-kernel-server |
| 17 | +``` |
| 18 | + |
| 19 | +#### 1.2.2 Setup NFS Folder |
| 20 | +Edit the file `/etc/exports` adding the following line to export an NFS folder (i.e. `/opt/hero/rootfs`) to the HERO board: |
| 21 | +``` |
| 22 | +/opt/hero/rootfs <hero_ip>(rw,nohide,insecure,no_subtree_check,async,no_root_squash) |
| 23 | +
|
| 24 | +``` |
| 25 | +After the file modification, you should execute the command `sudo exportfs -ra` to activate the new configuration. |
| 26 | + |
| 27 | +#### 1.2.3. Setup TFTP Folder |
| 28 | +By default, the tftpboot shared folder is located at `/var/lib/tftpboot`. You can select another folder changing in the file `/etc/default/tftpd-hpa` the value of `TFTP_DIRECTORY` (i.e. `TFTP_DIRECTORY="/opt/tftpboot"`). You need also to setup the `--create` to `TFTP_OPTIONS`. |
| 29 | + |
| 30 | +Here an example of `/etc/default/tftpd-hpa`: |
| 31 | +``` |
| 32 | +# /etc/default/tftpd-hpa |
| 33 | +
|
| 34 | +TFTP_USERNAME="tftp" |
| 35 | +TFTP_DIRECTORY="/opt/tftpboot" |
| 36 | +TFTP_ADDRESS=":69" |
| 37 | +TFTP_OPTIONS="--secure --create" |
| 38 | +``` |
| 39 | + |
| 40 | +Then we create the target folder for HERO and we restart the service to update the configuration. |
| 41 | +``` |
| 42 | +sudo mkdir -p /opt/tftpboot |
| 43 | +sudo chown root:nogroup /opt/tftpboot |
| 44 | +sudo chmod 777 /opt/tftpboot |
| 45 | +sudo systemctl restart tftpd-hpa |
| 46 | +``` |
| 47 | +## 2. Setup and Build Custom Configuration of HERO |
| 48 | +### 2.1 Setup custom local.cfg |
| 49 | +You should modify the `local.cfg` as follow: |
| 50 | +``` |
| 51 | +# |
| 52 | +# Buildroot Custom Configurations |
| 53 | +# |
| 54 | +BR2_HERO_BITSTREAM="<path/to/hero/bistream.bit>" |
| 55 | +BR2_HERO_ETH_IP_ADDR="<hero_ip>" |
| 56 | +BR2_HERO_ETH_NETMASK="<netmask>" |
| 57 | +BR2_HERO_ETH_GATEWAY="<gateway_ip>" |
| 58 | +BR2_HERO_ETH_DNS="<dnsserver_ip>" |
| 59 | +
|
| 60 | +# |
| 61 | +# Petalinux Custom Configurations |
| 62 | +# |
| 63 | +PT_NFSSERVER_IP="<server_ip>" |
| 64 | +PT_ROOTFS_NFS="y" |
| 65 | +PT_NFSROOT_DIR="/opt/rootfs" |
| 66 | +PT_TFTPBOOT_DIR="/opt/tftpboot" |
| 67 | +``` |
| 68 | +All the `BR2_HERO_ETH_*` values are optional in case you want to use DHCP. |
| 69 | + |
| 70 | +### 2.2 Build HERO Environment |
| 71 | +In case it is your first build you can build all you need using the following command: |
| 72 | +``` |
| 73 | +make har-exilzcu102 |
| 74 | +``` |
| 75 | + |
| 76 | +Otherwise, if you had already built all toolchain and the auxiliary environment, you can execute the following command to re-build only the Linux Kernel and the RootFS: |
| 77 | +``` |
| 78 | +make br-har-exilzcu102 |
| 79 | +``` |
| 80 | + |
| 81 | +After the build you need to install the generated files into the NFS and TFTP shared folders: |
| 82 | +``` |
| 83 | +cp output/br-har-exilzcu102/images/Image $PT_TFTPBOOT_DIR |
| 84 | +cp output/br-har-exilzcu102/images/system.dtb $PT_TFTPBOOT_DIR |
| 85 | +tar -xf output/br-har-exilzcu102/images/rootfs.tar -C $PT_NFSROOT_DIR |
| 86 | +``` |
| 87 | + |
| 88 | +Note, you can automatically install the generated files executing the following command: |
| 89 | +``` |
| 90 | +util/xsdb/install_tftp_nfs_rootfs.sh |
| 91 | +``` |
| 92 | + |
| 93 | +### 2.3 Boot U-Boot from JTAG |
| 94 | +You can boot FSBL and U-Boot using the following Petalinux command: |
| 95 | +``` |
| 96 | +cd petalinux/zcu102 |
| 97 | +petalinux-boot --jtag --U-Boot --fpga --bitstream <path/to/hero-bistream.bit> -v --hw_server-url <hwserver_ip>:<hwserver_port> |
| 98 | +``` |
| 99 | +Or you can use the following command: |
| 100 | +``` |
| 101 | +util/xsdb/boot_jtag.sh -i <hwserver_ip> -p <hwserver_port> |
| 102 | +``` |
| 103 | + |
| 104 | +The boot process takes around 5 minutes. After that, you can access to the U-Boot prompt connecting to the UART port of the board. |
| 105 | + |
| 106 | + |
| 107 | +### 2.4 Setting U-Boot Bootargs and Boot Linux Kernel (Finally!) |
| 108 | +From the U-Boot prompt you need to fix the `bootargs` (due to some problem of petalinux to generate a correct configuration). Here the comand you should execute inside the prompt of U-Boot (adjust with your local configuration): |
| 109 | +``` |
| 110 | +setenv tftpblocksize 512 |
| 111 | +setenv bootargs console=ttyPS0,115200n8 earlycon clk_ignore_unused ip=<hero_ip>:<server_ip>:<gateway_ip>:<netmask>::eth0:off root=/dev/nfs rootfstype=nfs nfsroot=<server_ip>:/opt/hero/rootfs,tcp,nolock,nfsvers=3 rw |
| 112 | +``` |
| 113 | + |
| 114 | +Now you are able to boot Linux triggering the following list of commands inside the U-Boot prompt: |
| 115 | +``` |
| 116 | +tftpb 0x200000 Image |
| 117 | +tftpb 0x7000000 system.dtb |
| 118 | +booti 0x200000 - 0x7000000 ${bootargs} |
| 119 | +``` |
0 commit comments