Running a Debian distribution on the ZedBoard using tftp and NFS
This page explains how to run a regular Debian distribution on the ZedBord with:
A minimal boot image on the SD card, containing only the First Stage Boot Loader (FSBL) and U-Boot
Loading the kernel image and the device tree blob from a remote tftp server
Mounting the root file system from a remote NFS server
This is not specific to SecBus and can be used for any development project on the ZedBoard.
This setup is extremely convenient as it almost completely avoids SD card manipulations. The Linux kernel and its device tree blob can be re-built any time, copied on the tftp server and re-loaded by the ZedBoard through its Ethernet link at the price of a single reboot. The Debian root file system can also be updated from the NFS server (thanks to Qemu and chroot) using the regular Debian tools. The changes are immediately reflected on the ZedBoard and, in most cases, without rebooting.
In the following we assume that:
<host> is the hostname of the workstation we will use and to which the UART USB cable of the ZedBoard is attached
The Xilinx tool chain is installed on <host> and it is on the PATH
<bistream>.bit is the bistream file used to configure the Programmable Logic (PL), if any
<server> is the hostname of the remote tftp and NFS server (can be the same as <host>)
<server_ip_address> is the IP address of <server>
<zedboard_mac_address> is the Ethernet MAC address of the ZedBoard
<zedboard_ip_address> is the IP address of the ZedBoard
<gateway_ip_address> is the IP address of the gateway through which the ZedBoard connects to <server> (if it connects directly <gateway_ip_address> = <server_ip_address>)
<tftproot> is the absolute path on <server> of the root directory of the tftp server
<tftproot>/<tftpdir> is the absolute path on <server> of the directory containing the tftp-served files
<nfsdir> is the absolute path on <server> of the directory containing the NFS-served file systems
We are root on <server> which runs a Debian variant, has access to Internet and has Qemu installed
Note: there are several ways to configure the Programmable Logic (PL). In the following we present three of them:
Copy the bitstream somewhere in the NFS share on <server> and send it to the /dev/xdevcfg device after the Linux kernel booted. This method is very convenient because it allows to reconfigure the PL at run time without rebooting. On the other hand, it cannot be used when the PL must be configured before booting the Linux kernel.
Let U-Boot download the bitstream from the tftp server and configure the PL. This method is less flexible because the system must be rebooted to change the PL configuration. However, it can be used when the PL must be configured prior booting the Linux kernel.
Include the bitstream in the boot image on the SD card and let the First Stage Boot Loader (FSBL) do the job. This method is the less flexible of all because changing the PL configuration not only requires to reboot but also to regenerate the boot image and store it on the SD card. But it is the only one that can be used if U-Boot needs the PL to be already configured when it boots.
Please adapt the following instructions to your own settings.
On <server>, the NFS server, prepare the root file system
Create an empty image for the Debian root file system and mount it
server> cd <nfsdir>server> dd if=/dev/zero of=debianrootfs4zynq.img bs=1024 count=1MBserver> sudo mkfs.ext3 -F debianrootfs4zynq.imgserver> mkdir debianrootfs4zynqserver> sudo mount -o loop debianrootfs4zynq.img debianrootfs4zynq
On the ZedBoard, set U-Boot environment variables and boot the Linux kernel
Unmount the SD card, insert it in the SD card slot of the ZedBoard, configure the jumpers to boot from the SD Card, connect the Ethernet cable, the USB UART cable, the power cable and power on. Launch minicom (or equivalent) on <host>:
host> minicom -D /dev/ttyACM0
and stop U-Boot by pressing a key before the end of the countdown.
Set the following U-Boot environment variables (please pay attention to the simple and double quotes):
Save the environment variables in the SPI flash memory of the ZedBoard:
zynq-uboot> saveenvzynq-uboot> run netboot...Debian GNU/Linux 7 MyZedBoard ttyPS0MyZedBoard login: rootPassword: Last login: Thu Jan 1 00:01:57 UTC 1970 on ttyPS0Linux MyZedBoard 3.18.0-xilinx-06524-gd51de5a #1 SMP PREEMPT Fri Apr 10 14:39:03 CEST 2015 armv7lThe programs included with the Debian GNU/Linux system are free software;the exact distribution terms for each program are described in theindividual files in /usr/share/doc/*/copyright.Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extentpermitted by applicable law.root@MyZedBoard:~# dfFilesystem 1K-blocks Used Available Use% Mounted onrootfs 967864 373036 544828 41% /<server_ip_address>:<nfsdir>/debianrootfs4zynq 967864 373036 544828 41% /devtmpfs 248100 0 248100 0% /devtmpfs 51284 132 51152 1% /runtmpfs 5120 0 5120 0% /run/locktmpfs 102560 0 102560 0% /run/shmtmpfs 256400 0 256400 0% /tmproot@MyZedBoard:~#
If the PL must be configured from the running Linux kernel, this can be done with:
To avoid leaving your NFS root file system in an unstable state, always shut down properly:
root@MyZedBoard:~# poweroff...[info] Will now halt.reboot: System halted
before turning the power off. Remember that the root file system is on <server> and that resetting the ZedBoard or powering it off without a proper shut down can definitively compromise your NFS share.
Maintaining the NFS share
If the NFS share on <server> still appears busy after the client ZedBoard has been properly shut down, as happens sometimes, it can be unmounted with: