FreeBSD on Zynq-7000 / Zedboard


I'm working on porting FreeBSD to the Zedboard and other Xilinx Zynq-7000 platforms. The Zynq-7000 is an interesting platform combing a Xilinx 7-series FPGA fabric with a dual-core ARM Cortex-A9 "Application Processor Unit" (System-on-a-Chip).

The Zedboard is an evaluation board for the Zynq-7000. It is manufactured by Digilent. More information on the Zedboard can be found at www.zedboard.org.

The information on this page is migrating to the FreeBSD wiki at http://wiki.freebsd.org/FreeBSD/arm/Zedboard.

MicroZed


The Zynq port is now running on the new MicroZed board. It runs the same Zedboard SD card image with a couple file changes in the boot partition. E-mail me if you are interested.

Pre-built SD card image

If you'd like to test-drive FreeBSD on a Zedboard, download the following gzip'ed SD card image file and transfer it to an SD card of 1GB or larger. (This wipes out all previous data on the SD card if you hadn't guessed.).

Download: freebsd-zedboard-041114.img.gz. It's about 120MB.

These are md5 sums for the image:

MD5 (freebsd-zedboard-041114.img) = 2620d1a7228c5c6a74bc9a1f256de85d
MD5 (freebsd-zedboard-041114.img.gz) = 68acef5b144e376ffb0c5f8086379b4f
Uncompress and copy the image to the SD card. On my machine, the SD card shows up as /dev/da0. Be sure that is the same on your machine before cut and pasting this.
# gunzip freebsd-zedboard-041114.img.gz
# dd if=freebsd-zedboard-041114.img of=/dev/da0 bs=32768

Power down the Zedboard. Insert the SD card in the SD slot and be sure the Zedboard's configuration mode jumpers are set for booting from SD card before powering up. (If you've already been booting the Linux image from the SD card shipped with the Zedboard, this shouldn't need to change.)

The USB-UART connected to connect J14 acts as the FreeBSD console (device uart1). This is the same console as the stock Linux image. The Zedboard should automatically boot U-boot and then the FreeBSD kernel.

The FreeBSD kernel has drivers for the UARTs, SDIO, Gig Ethernet, and a USB host driver for the USB OTG connected at J13. There is also a GPIO driver which allows reading of switches and buttons and controlling the LEDs.

Please send any feedback to me via E-mail

Source Code

Zynq/Zedboard support is now in the FreeBSD kernel source. Most of the relevant code is in sys/arm/xilinx and the GigEthernet driver is in sys/dev/cadence.

I've applied this patch to the source to fix various bugs and to add SMP support: patch.all.txt.

I also have a Perforce project branch at freebsd.org: //depot/user/skibo/skibo_zynq.


Building an SD Image

Note: Tim Kientzle's crochet-freebsd tool can now build ZedBoard images.

Here's how I create the SD image from the source.

Build world and kernel

From within the source directory:
make TARGET_ARCH=armv6 KERNCONF=ZEDBOARD buildworld buildkernel

Create SD card image

dd if=/dev/zero of=SDCARD.img count=1048576
mdconfig -f SDCARD.img -u 0

gpart create -s MBR md0
gpart add -s64m -t \!14 md0
gpart set -a active -i 1 md0
newfs_msdos -F 16 /dev/md0s1

gpart add -t freebsd md0
gpart create -s BSD md0s2
gpart add -t freebsd-ufs md0s2
newfs /dev/md0s2a
tunefs -n enable /dev/md0s2a

Mount filessystems

mkdir /mnt/boot /mnt/armroot
mount -t msdosfs /dev/md0s1 /mnt/boot
mount /dev/md0s2a /mnt/armroot

Populate root and boot partitions

From within the source directory:
make TARGET_ARCH=armv6 KERNCONF=ZEDBOARD DESTDIR=/mnt/armroot installworld distribution installkernel
Download and extract these files: extrafiles.tgz. MD5 (extrafiles.tgz) = 9e069893391d744fe6d12a925f1c54dc

Copy these files to the boot partition:

cp BOOT.BIN ubldr zedboard.dtb uEnv.txt /mnt/boot

Final tweaks

Copy these files to the root partition (also in extrafiles.tgz):
mkdir /mnt/armroot/mnt/boot
cp rc.conf fstab /mnt/armroot/etc

Unmount file systems

umount /mnt/boot
umount /mnt/armroot
mdconfig -d -u 0

Copy to an SD card

dd if=SDCARD.img of=/dev/da0 bs=32768

Building u-boot

I no longer use a modified u-boot for FreeBSD on Zynq. The stock u-boot from Xilinx can boot FreeBSD using the uEnv.txt file in extrafiles.tgz.

The official repository for Xilinx port of u-boot is on github here. Follow the instructions to build the zynq_zed configuration of u-boot.


Thomas Skibo

E-mail Me