This version (20 Jul 2015 16:05) was approved by LucianS.The Previously approved version (14 Jul 2015 16:08) is available.Diff

Linux with HDMI video output on the ZED, ZC702 and ZC706 boards

Supported devices

Supported carriers

Overview

Preparing the SD-card

To boot the system on the ZED, ZC702 or ZC706 board you'll need a SD memory card. The SD card should have at least 4 GB of storage and it is recommended to use a card with speed-grade 6 or higher to achieve optimal file transfer performance.

The SD card needs to be partitioned with two partitions. The first one should be about 40MB in size and the second one should take up the remaining space. For optimal performance make sure that the partitions are 4MB aligned. The first partition needs to be formatted with a FAT filesystem. It will hold the bootloader, devicetree and kernel images. The second partition needs to be formatted with a ext4 filesystem. It will store the systems root filesystem.

Obtain the HDL reference design

The ZYNQ does not have a on-chip graphics or audio core, instead the FPGA is used to generate the necessary signals to deliver the video and audio streams to the ADV7511. Analog Devices provides a reference HDL design which contain support for generating the necessary video and audio as well as support for interfacing with the AD-FMCOMMS1-EBZ.

The HDL reference designs can be downloaded from their respective wiki page:

The AD-FMCOMMS1-EBZ reference designs for the ZED, ZC702 and ZC706 include support for the ADV7511. So you only need one of the reference designs depending on whether you want support for the AD-FMCOMMS1-EBZ or not.

You can either use the provided reference designs to build your own system.bit or use a pre-build system.bit file. The system.bit will be required in the next step.

Build the boot image

To complete this step you need to have a u-boot image for the Zynq platform. Please refer to the Xilinx wiki on how to build such an image.

The bootloader can be build with Xilinx SDK. In order to do so it is necessary to first export the HDL design from the Xilinx Platform Studio to the SDK, this is done by clicking the “Export to SDK” button in the Platform Studio GUI.

Export project to SDK:

Once the project has been exported create a new FSBL project in the SDK. To do this right-click on the newly exported hardware platform specification in left “Project Explorer” panel and select “New > Project” from the popup menu. Select “Xilinx - Application Project” on first dialog page. On the second dialog page choose a name for the project (zynq_fsbl for example) and on the third page select “Zynq FSBL” template.

The project should build automatically. If not a manual build can be started by right clicking the newly created project in the left “Project Explorer” panel and selecting “Build Project” from the popup menu. After the project has been build it is time to generate the boot image. This is done by right clicking on the project in the left “Project Explorer” pane and selecting “Create Boot Image”. This will open up the bootgen wizard. The bootgen wizard needs three files:

  • The freshly build zynq_fsbl.elf binary
  • The system.bit bitstream
  • The u-boot.elf binary

Add these files to partitions list in the dialog, then select an output folder.

Clicking “Create Image” will now generate in the chosen location a new boot image for the target platform. The output *.bin file should be named “BOOT.BIN” and needs to be saved on the first partition of the SD-card.

Build and install the kernel image

The prerequistes for following these instructions are to have:

  • mkimage from your distribution (normally apt-get install u-boot-tools)
  • C compiler from the Xilinx SDK

The most stable kernel source tree containing support for the ZED, ZC702 and ZC706 plus AD-FMCOMMS1-EBZ can be found at 2014_R2. For the AD-FMCOMMS2-EBZ use also the 2014_R2 branch.

root Download and build the kernel image

> git clone https://github.com/analogdevicesinc/linux.git
Cloning into 'linux'...
remote: Counting objects: 2550298, done.
remote: Compressing objects: 100% (466978/466978), done.
remote: Total 2550298 (delta 2118600), reused 2483072 (delta 2058083)
Receiving objects: 100% (2550298/2550298), 727.70 MiB | 353 KiB/s, done.
Resolving deltas: 100% (2118600/2118600), done.
Checking out files: 100% (38170/38170), done.
> cd linux
> git checkout xcomm_zynq
> # For AD-FMCOMMS2-EBZ use
> # git checkout xcomm_zynq 
> export ARCH=arm
> export CROSS_COMPILE=/path/to/your/arm/cross-compiler
> # e.g. export CROSS_COMPILE=/opt/CodeSourcery/Sourcery_G++_Lite/bin/arm-xilinxa9-linux-gnueabi-
> make zynq_xcomm_adv7511_defconfig
#
# configuration written to .config
#
> make uImage LOADADDR=0x00008000
  ...
  OBJCOPY arch/arm/boot/uImage
  Kernel: arch/arm/boot/uImage is ready

The same kernel image is used for all HDL reference design.

The next step is to build the devicetree for your target platform. While the kernel is the same for all target boards the devicetree file differs as it describes the board specifics.

The following devicetree files are available:

zynq-zc702-adv7511.dts ZC702 and the on-board ADV7511
zynq-zc702-adv7511-ad9361-fmcomms2-3.dts ZC702, the on-board ADV7511 and the AD-FMCOMMS2-EBZ or AD-FMCOMMS3-EBZ board
zynq-zc702-adv7511-ad9361-fmcomms5.dts ZC702, the on-board ADV7511 and the AD-FMCOMMS5-EBZ
zynq-zc702-adv7511-ad9364-fmcomms4.dts ZC702, the on-board ADV7511 and the AD-FMCOMMS4-EBZ board
zynq-zc702-adv7511-fmcomms1.dts ZC702, the on-board ADV7511 and the AD-FMCOMMS1-EBZ board
zynq-zc706-adv7511.dts ZC706 and the on-board ADV7511
zynq-zc706-adv7511-ad6676-fmc.dts ZC706, the on-board ADV7511 and the AD6676-FMC-EBZ board
zynq-zc706-adv7511-ad9265-fmc-125ebz.dts ZC706, the on-board ADV7511 and the AD9265-FMC-125EBZ board
zynq-zc706-adv7511-ad9361-fmcomms2-3.dts ZC706, the on-board ADV7511 and the AD-FMCOMMS2-EBZ or AD-FMCOMMS3-EBZ board
zynq-zc706-adv7511-ad9361-fmcomms2-3-pr.dts ZC706, the on-board ADV7511 and the AD-FMCOMMS2-EBZ or AD-FMCOMMS3-EBZ board
zynq-zc706-adv7511-ad9361-fmcomms5.dts ZC706, the on-board ADV7511 and the AD-FMCOMMS5-EBZ board
zynq-zc706-adv7511-ad9364-fmcomms4.dts ZC706, the on-board ADV7511 and the AD-FMCOMMS4-EBZ board
zynq-zc706-adv7511-ad9434-fmc-500ebz.dts ZC706, the on-board ADV7511 and the AD9434-FMC-500EBZ board
zynq-zc706-adv7511-ad9625-fmcadc2.dts ZC706, the on-board ADV7511 and the AD-FMCADC2-EBZ board
zynq-zc706-adv7511-fmcadc4.dts ZC706, the on-board ADV7511 and the AD-FMCADC4-EBZ board
zynq-zc706-adv7511-fmcdaq1.dts ZC706, the on-board ADV7511 and the AD-FMCDAQ1-EBZ board
zynq-zc706-adv7511-fmcdaq2.dts ZC706, the on-board ADV7511 and the AD-FMCDAQ2-EBZ board
zynq-zc706-adv7511-fmcjesdadc1.dts ZC706, the the on-board ADV7511 and the AD-FMCJESDADC1-EBZ board
zynq-zc706-adv7511-fmcomms1.dts ZC706, the on-board ADV7511 and the AD-FMCOMMS1-EBZ board
zynq-zc706-adv7511-fmcomms6.dts ZC706, the on-board ADV7511 and the AD-FMCOMMS6-EBZ board
zynq-zed-adv7511.dts Zed Board and the on-board ADV7511
zynq-zed-adv7511-ad9361-fmcomms2-3.dts Zed Board, the on-board ADV7511 and the AD-FMCOMMS2-EBZ or AD-FMCOMMS3-EBZ board
zynq-zed-adv7511-ad9364-fmcomms4.dts Zed Board, the on-board ADV7511 and the AD-FMCOMMS4-EBZ board
zynq-zed-adv7511-ad9467-fmc-250ebz.dts Zed Board, the on-board ADV7511 and the AD9467-FMC-250EBZ board
zynq-zed-adv7511-fmcmotcon1.dts Zed Board, the on-board ADV7511 and the AD-FMCMOTCON1-EBZ board
zynq-zed-adv7511-fmcmotcon2.dts Zed Board, the on-board ADV7511 and the AD-FMCMOTCON2-EBZ board
zynq-zed-adv7511-fmcomms1.dts Zed Board, the on-board ADV7511 and the AD-FMCOMMS1-EBZ board
zynq-mini-itx-adv7511.dts Mini-ITX and the on-board ADV7511
zynq-mini-itx-adv7511-ad9361-fmcomms2-3.dts Mini-ITX, the on-board ADV7511 and the AD-FMCOMMS2-EBZ or AD-FMCOMMS3-EBZ board
zynq-mini-itx-adv7511-ad9361-fmcomms2-3-pr.dts Mini-ITX, the on-board ADV7511 and the AD-FMCOMMS2-EBZ or AD-FMCOMMS3-EBZ board
zynq-mini-itx-adv7511-ad9364-fmcomms4.dts Mini-ITX, the on-board ADV7511 and the AD-FMCOMMS4-EBZ board

The devicetree must match the HDL reference design that is used. It is not possible to use a adv7511 only devicetree for a AD-FMCOMMS1-EBZ reference HDL design, even if the AD-FMCOMMS1-EBZ is not connected to the FMC slot.

To build the devicetree from the devicetree file run `make name-dts-replaced-by-dtb`

Build the devicetree for ZED with HDMI video out and XCOMM

> make zynq-zed-adv7511-xcomm.dtb
  DTC     arch/arm/boot/zynq-zed-adv7511-xcomm.dtb
DTC: dts->dtb  on file "arch/arm/boot/dts/zynq-zed-adv7511-xcomm.dts"

The last step is to copy both the kernel and the devicetree files to the first partition of the SD card. It is important to rename the devicetree file to devicetree.dtb

Copy kernel and device tree to SD card

> cp arch/arm/boot/uImage /media/BOOT/uImage
> cp arch/arm/boot/zynq-zed-adv7511-xcomm.dtb /media/BOOT/devicetree.dtb

uEnv.txt

The default environment that is used by the u-boot bootloader instructions the kernel to use a ramfs disk for its root filesystem. In order to boot from the SD card it is necessary to overwrite the default environment. This can be done by placing a file called uEnv.txt in the BOOT partition of the SD card. This file will be read by u-boot and is used to replace the default environment.

uEnv.txt for using SD card rootfs

uenvcmd=run adi_sdboot
adi_sdboot=echo Copying Linux from SD to RAM... && fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && if fatload mmc 0 0x2000000 ${ramdisk_image}; then bootm 0x3000000 0x2000000 0x2A00000; else bootm 0x3000000 - 0x2A00000; fi
bootargs=console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait

Install the root file system

In this example we will use a Linaro Ubuntu ARM rootfs as it provides a good out of the box experience. The latest version can be found on the Linaro Download page. In this example we will use the 12.11 release.

The first step is to download the archive containing the root filesystem.

Download Linaro Ubuntu ARM rootfs

> wget http://releases.linaro.org/12.11/ubuntu/precise-images/ubuntu-desktop/linaro-precise-ubuntu-desktop-20121124-560.tar.gz

The next step is to extract the root filesystem from the archive to the SD card. It is important to preserve the file permission and owner settings, otherwise the system will be unable to boot. Since some of the files have root permissions it is necessary to run the extraction process as root.

Extract the root filesystem onto the SD card

> sudo tar --strip-components=3 -C /media/rootfs -xzpf linaro-precise-ubuntu-desktop-20121124-560.tar.gz binary/boot/filesystem.dir
> ls /media/rootfs/
bin/  boot/  dev/  etc/  home/  lib/  lost+found/  media/  mnt/ opt/
proc/  root/  run/  sbin/  selinux/  srv/  sys/  tmp/  usr/  var/

Testing the system

Once all of the previous tasks have been completed it is time to test the system. To do this insert the SD-card into the board and power-up the board. After a few seconds the blue “DONE” LED should light up. This means that the bitstream has been loaded and the system will now start to boot. It is also possible to connect to the serial console by using the on-board UART-to-USB bridge, this allows to monitor the boot process and view debug messages.

After another few seconds the monitor connected to the system will turn on and display the Linux mascot in the top left corner, after that the Ubuntu Desktop system will appear on the screen. The system is now ready to be used.

Post-installation tweaks

After the system has been installed it is time to do some post-installation tweaks to the system. None of them is required to get a basic working system, but they improve the overall video and audio experience quite a bit.

Enable xf86-video-modesetting Xorg driver

The xf86-video-modesetting driver is a driver which has been written to take advantage of the new Kernel Mode Setting (KMS) API of the DRM layer. This allows to switch between different screen resolutions at runtime (using the Xservers xrandr interface) and adds plug-and-play support for monitors.

Unfortunately the current Linaro Ubuntu distribution does not contain a package for xf86-video-modesetting driver. So it becomes necessary to manually download and build it. Open up a terminal on the target system and run the following commands.

Download and install xf86-video-modesetting

> sudo apt-get install xserver-xorg-dev libdrm-dev xutils-dev
> wget http://xorg.freedesktop.org/archive/individual/driver/xf86-video-modesetting-0.9.0.tar.bz2
> tar -xjf xf86-video-modesetting-0.9.0.tar.bz2
> cd xf86-video-modesetting-0.9.0
> ./configure --prefix=/usr
> make
> sudo make install

To enable the modesetting driver the create /etc/X11/xorg.conf and add following lines:

Enable the modesetting driver:

  Section "Device"
    Identifier "ADV7511 HDMI"
    Driver "modesetting"
  EndSection

Fixing issues with pulse audio

PulseAudio is the audio daemon used by default on the Linaro Ubuntu installation. Unfortunately PulseAudio's 'glitch-free' algorithm seems to cause audio glitches on this particular platform. To get seamless audio experience it is necessary to disable the glitch-free feature. To disable the 'glitch-free' feature of pulse audio open up a terminal on the target system an run the following commands.

Disable pulse audio 'glitch-free' feature

> sed -i 's,load-module module-udev-detect.*,load-module module-udev-detect tsched=0,' /etc/pulse/default.pa

More information

resources/tools-software/linux-drivers/platforms/zynq.txt · Last modified: 20 Jul 2015 15:59 by LucianS

  沪ICP备09046653号