V4L-Utils & Libdrm Build Instructions

V4L-Utils & Libdrm Build Instructions

1 Introduction


This wiki page summarizes the build steps for the v4l-utils and LibDRM repositories as used in various versions of the Zynq Base TRD .
Different TRD release versions use different versions of v4l-utils and libdrm. Please refer to the respective TRD tutorial for the exact versions to be used. This tutorial provides generic instructions.

2 Prerequisites


This tutorial requires the ARM GNU tools, which are part of the Xilinx Software Development Kit (SDK), to be installed on your host system. Refer to the Zynq Tools wiki page for more information on how to set up the tool chain and known issues.

Note: These instructions currently require a Linux host for building.

bash> export PATH=/path/to/cross/compiler/bin:$PATH

For simplicity, we define the following environment variable in this tutorial:
  • INSTALL_PREFIX refers to the installation area of the cross-compiled libraries and headers

bash> export INSTALL_PREFIX=/path/to/install

3 Cross-compile v4l-utils


The v4l-utils are a series of packages that provide libraries and utilities for handling media devices such as image sensors, HDMI receivers or USB webcams.

3.1 Download the v4l-utils source archive


Download the v4l-utils sources and extract the archive. Please use the version number as indicated on the specific TRD page.

% tar xzfv v4l-utils-x.y.z.tar.gz

Note: By default, libmediactl and libv4l2subdev will be compiled statically as the APIs are not deemed stable yet. Also, the generated libraries and headers will be excluded from the installation.

In order to generate shared libraries instead of static libraries and to include the libraries and headers with the installation, modify the file utils/media-ctl/Makefile.am as follows:

diff --git a/utils/media-ctl/Makefile.am b/utils/media-ctl/Makefile.am
index a3931fb..31a3762 100644
--- a/utils/media-ctl/Makefile.am
+++ b/utils/media-ctl/Makefile.am
@@ -1,16 +1,14 @@
-noinst_LTLIBRARIES = libmediactl.la libv4l2subdev.la
+lib_LTLIBRARIES = libmediactl.la libv4l2subdev.la
 
 libmediactl_la_SOURCES = libmediactl.c mediactl-priv.h
-libmediactl_la_CFLAGS = -static $(LIBUDEV_CFLAGS)
-libmediactl_la_LDFLAGS = -static $(LIBUDEV_LIBS)
+libmediactl_la_CFLAGS = $(LIBUDEV_CFLAGS)
+libmediactl_la_LDFLAGS = $(LIBUDEV_LIBS)
 
 libv4l2subdev_la_SOURCES = libv4l2subdev.c
 libv4l2subdev_la_LIBADD = libmediactl.la
-libv4l2subdev_la_CFLAGS = -static
-libv4l2subdev_la_LDFLAGS = -static
 
 mediactl_includedir=$(includedir)/mediactl
-noinst_HEADERS = mediactl.h v4l2subdev.h
+mediactl_include_HEADERS = mediactl.h v4l2subdev.h
 
 bin_PROGRAMS = media-ctl
 media_ctl_SOURCES = media-ctl.c options.c options.h tools.h

Lines prefixed with - are removed and lines prefixed with + are added.

3.2 Configure the target build


Configure the build as follows.

% ./bootstrap.sh
% ./configure --prefix=$INSTALL_PREFIX --host=arm-xilinx-linux-gnueabi --without-jpeg --with-udevdir=$INSTALL_PREFIX/lib/udev

3.3 Build and install


The output products will be installed in the INSTALL_PREFIX directory. Please inspect the include, lib, and bin directories.

% make
% make install

4 Cross-compile LibDRM


The LibDRM development repository provide libraries and user-space utilities to test and access display devices.

4.1 Clone the LibDRM repository


Download the libdrm sources and extract the archive. Please use the version number as indicated on the specific TRD page.

% tar xzfv libdrm-x.y.z.tar.gz

4.2 Configure the target build


Configure the build as follows.

% ./autogen.sh --host=arm-xilinx-linux-gnueabi --prefix=$INSTALL_PREFIX --disable-intel --disable-radeon --disable-nouveau --disable-vmwgfx --disable-freedreno --disable-amdgpu --enable-install-test-programs

4.3 Build and Install


The output products will be installed in the INSTALL_PREFIX directory. Please inspect the include, lib, and bin directories.

% make
% make install

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy