Table of Contents

FreeBSD on Zedboard

The Zedboard is an evaluation board for Xilinx Zynq-7000 series System-on-a-Chip. The Zynq-7000 is an FPGA combined with an ARM Cortex-A9 core and a set of standard peripherals.

SDCARD images

SD card images for FreeBSD 12-RELEASE on the Zedboard can be found on Thomas Skibo's FreeBSD on Zedboard page.

Also, TimKientzle's system build tool, Crochet, can build Zedboard SD card images. The following describes how to manually build an SD image for Zedboard:

Building FreeBSD for Zedboard

Zynq/Zedboard support is in -CURRENT and 12-STABLE. To build world and kernel for the Zedboard:

make TARGET_ARCH=armv7 KERNCONF=ZEDBOARD buildworld buildkernel

Building u-boot.img and boot.bin

The Zedboard needs several files in a boot partition. The file boot.bin is the first executable the Zynq chip boots. It initializes the Zynq and then hands over execution to u-boot.img. These files can be built by the port sysutils/u-boot-zedboard. Once built, the files will be installed in /usr/local/share/u-boot/u-boot-zedboard.

Building an SDCARD image

Create SD card image

dd if=/dev/zero of=SDCARD.img bs=1m count=2000
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 filesystems

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=armv7 KERNCONF=ZEDBOARD DESTDIR=/mnt/armroot installworld distribution installkernel

Copy u-boot files to the boot partition

cp /usr/local/share/u-boot/u-boot-zedboard/{boot.bin,u-boot.img} /mnt/boot

Copy EFI loader to boot partition

mkdir -p /mnt/boot/EFI/BOOT
cp /usr/obj/usr/src/arm.armv7/stand/efi/loader_lua/loader_lua.efi /mnt/boot/EFI/BOOT/bootarm.efi

Final tweaks

Copy the DTB file to boot partition:

mkdir /mnt/boot/dtb
dtc -I dts -O dtb /usr/src/sys/dtb/arm/zedboard.dts > /mnt/boot/dtb/zedboard.dtb
echo "fdtfile=zedboard.dtb" > /mnt/boot/uEnv.txt

Touch /firstboot:

touch /mnt/armroot/firstboot

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=1M