[Buildroot] Building the Rockchip libv4l plugin

Peter Seiderer ps.report at gmx.net
Tue Jul 3 20:37:43 UTC 2018


Hello Baruch,

On Tue, 3 Jul 2018 06:37:09 +0300, Baruch Siach <baruch at tkos.co.il> wrote:

> Hi peter,
> 
> On Mon, Jul 02, 2018 at 09:16:35PM +0200, Peter Seiderer wrote:
> > On Mon, 2 Jul 2018 11:22:11 +0300, Baruch Siach <baruch at tkos.co.il> wrote:  
> > > I'm trying to build the Rockchip libv4l2 plugin in Buildroot. The source 
> > > is at
> > > 
> > >   https://chromium.googlesource.com/chromiumos/third_party/libv4lplugins/+/master/libv4l-rockchip_v2/
> > > 
> > > As upstream indicated[1], the code is meant to build as part of libv4l, not as 
> > > a standalone library. ChromiumOS sees to copy the code into the libv4l source 
> > > tree, and modify the relevant build configuration files[2].
> > > 
> > > What would be the best way to do that in Buildroot? A symlink to the plugin 
> > > source tree? Copy of the code to libv4l?  
> > 
> > ...or add a configure.ac/configure file to the source?  
> 
> Unfortunately the plugin really needs internal libv4l headers, so this is not 
> possible.

Something like the following (quick hack) patch, done the following first (should be added to libv4l):
 
	$ mkdir staging/usr/include/libv4l-1.14.2
	$ cp build/libv4l-1.14.2/config.h staging/usr/include/libv4l-1.14.2/

But failes with:

libv4l-encplugin-rockchip.c: In function ‘ioctl_qbuf_locked’:
libv4l-encplugin-rockchip.c:392:8: error: ‘struct v4l2_buffer’ has no member named ‘config_store’
  buffer->config_store = buffer->index + 1;
        ^~
libv4l-encplugin-rockchip.c: In function ‘set_encoder_config_locked’:
libv4l-encplugin-rockchip.c:662:11: error: ‘struct v4l2_ext_controls’ has no member named ‘config_store’
  ext_ctrls.config_store = buffer_index + 1;
           ^

Regards,
Peter


From 735576885f1b5b2a4fbdd0afa2467f4425537d42 Mon Sep 17 00:00:00 2001
From: Peter Seiderer <ps.report at gmx.net>
Date: Tue, 3 Jul 2018 22:32:03 +0200
Subject: [PATCH] HACK: libv4l-rockchip: new package

---
 package/Config.in                             |   1 +
 ...001-Add-configure.ac-and-Makefile.am.patch | 129 ++++++++++++++++++
 package/libv4l-rockchip/Config.in             |  14 ++
 package/libv4l-rockchip/libv4l-rockchip.hash  |   2 +
 package/libv4l-rockchip/libv4l-rockchip.mk    |  19 +++
 5 files changed, 165 insertions(+)
 create mode 100644 package/libv4l-rockchip/0001-Add-configure.ac-and-Makefile.am.patch
 create mode 100644 package/libv4l-rockchip/Config.in
 create mode 100644 package/libv4l-rockchip/libv4l-rockchip.hash
 create mode 100644 package/libv4l-rockchip/libv4l-rockchip.mk

diff --git a/package/Config.in b/package/Config.in
index e94a6a8c12..034e0b6866 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1261,6 +1261,7 @@ menu "Hardware handling"
 	source "package/libusb-compat/Config.in"
 	source "package/libusbgx/Config.in"
 	source "package/libv4l/Config.in"
+	source "package/libv4l-rockchip/Config.in"
 	source "package/libxkbcommon/Config.in"
 	source "package/mraa/Config.in"
 	source "package/mtdev/Config.in"
diff --git a/package/libv4l-rockchip/0001-Add-configure.ac-and-Makefile.am.patch b/package/libv4l-rockchip/0001-Add-configure.ac-and-Makefile.am.patch
new file mode 100644
index 0000000000..632380a7f3
--- /dev/null
+++ b/package/libv4l-rockchip/0001-Add-configure.ac-and-Makefile.am.patch
@@ -0,0 +1,129 @@
+From 089ad2e0d66b709c6256b3a2b38e33ffd04d3e05 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <ps.report at gmx.net>
+Date: Tue, 3 Jul 2018 21:37:07 +0200
+Subject: [PATCH] Add configure.ac and Makefile.am.
+
+---
+ AUTHORS                        |  1 +
+ COPYING                        |  1 +
+ ChangeLog                      |  1 +
+ Makefile.am                    |  1 +
+ NEWS                           |  1 +
+ README                         |  1 +
+ configure.ac                   | 30 ++++++++++++++++++++++++++++++
+ libv4l-rockchip_v2/Makefile.am |  4 ++--
+ m4/not_empty                   |  1 +
+ 9 files changed, 39 insertions(+), 2 deletions(-)
+ create mode 100644 AUTHORS
+ create mode 100644 COPYING
+ create mode 100644 ChangeLog
+ create mode 100644 Makefile.am
+ create mode 100644 NEWS
+ create mode 100644 README
+ create mode 100644 configure.ac
+ create mode 100644 m4/not_empty
+
+diff --git a/AUTHORS b/AUTHORS
+new file mode 100644
+index 0000000..e5b6bea
+--- /dev/null
++++ b/AUTHORS
+@@ -0,0 +1 @@
++Authors
+diff --git a/COPYING b/COPYING
+new file mode 100644
+index 0000000..0bd337f
+--- /dev/null
++++ b/COPYING
+@@ -0,0 +1 @@
++Copying
+diff --git a/ChangeLog b/ChangeLog
+new file mode 100644
+index 0000000..b4a545d
+--- /dev/null
++++ b/ChangeLog
+@@ -0,0 +1 @@
++Changelog
+diff --git a/Makefile.am b/Makefile.am
+new file mode 100644
+index 0000000..0503497
+--- /dev/null
++++ b/Makefile.am
+@@ -0,0 +1 @@
++SUBDIRS = libv4l-rockchip_v2
+diff --git a/NEWS b/NEWS
+new file mode 100644
+index 0000000..41e843b
+--- /dev/null
++++ b/NEWS
+@@ -0,0 +1 @@
++News
+diff --git a/README b/README
+new file mode 100644
+index 0000000..304360c
+--- /dev/null
++++ b/README
+@@ -0,0 +1 @@
++Readme
+diff --git a/configure.ac b/configure.ac
+new file mode 100644
+index 0000000..334bb59
+--- /dev/null
++++ b/configure.ac
+@@ -0,0 +1,30 @@
++
++AC_PREREQ(2.59)
++AC_INIT([libv4l-rockchip],[1.14.2])
++
++AC_CONFIG_AUX_DIR([build-aux])
++AC_CONFIG_MACRO_DIR([m4])
++AC_CONFIG_SRCDIR([libv4l-rockchip_v2/libv4l-encplugin-rockchip.c])
++AC_CONFIG_FILES([Makefile
++	libv4l-rockchip_v2/Makefile
++])
++
++AC_GNU_SOURCE
++
++AM_INIT_AUTOMAKE([1.9 subdir-objects no-dist-gzip dist-bzip2 -Wno-portability]) # 1.10 is needed for target_LIBTOOLFLAGS
++
++AM_MAINTAINER_MODE
++m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
++
++# Checks for programs.
++AC_PROG_CXX
++AC_PROG_CC_C99
++AC_PROG_INSTALL
++AC_PROG_LIBTOOL
++AC_PROG_MKDIR_P
++AC_PROG_LN_S
++PKG_PROG_PKG_CONFIG
++
++AC_SUBST([libv4l2plugindir], [$libdir/$with_libv4l2subdir/plugins])
++
++AC_OUTPUT
+diff --git a/libv4l-rockchip_v2/Makefile.am b/libv4l-rockchip_v2/Makefile.am
+index 1ae7d10..d846380 100644
+--- a/libv4l-rockchip_v2/Makefile.am
++++ b/libv4l-rockchip_v2/Makefile.am
+@@ -2,9 +2,9 @@
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+ 
+-if WITH_V4L_PLUGINS
++#if WITH_V4L_PLUGINS
+ libv4l2plugin_LTLIBRARIES = libv4l-encplugin.la
+-endif
++#endif
+ 
+ libv4l_encplugin_la_SOURCES = \
+ 	libv4l-encplugin-rockchip.c \
+diff --git a/m4/not_empty b/m4/not_empty
+new file mode 100644
+index 0000000..884340c
+--- /dev/null
++++ b/m4/not_empty
+@@ -0,0 +1 @@
++Not Empty!
+-- 
+2.17.1
+
diff --git a/package/libv4l-rockchip/Config.in b/package/libv4l-rockchip/Config.in
new file mode 100644
index 0000000000..b48264b2b7
--- /dev/null
+++ b/package/libv4l-rockchip/Config.in
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_LIBV4L_ROCKCHIP
+	bool "libv4l-rockchip"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libv4l
+	depends on BR2_INSTALL_LIBSTDCPP # libv4l
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 # libv4l
+	select BR2_PACKAGE_LIBV4L
+	help
+	  libv4l rochchip plugin
+
+	  https://chromium.googlesource.com/chromiumos/third_party/libv4lplugins/+/master/libv4l-rockchip_v2/
+
+comment "libv4l needs a toolchain w/ threads, C++ and headers >= 3.0"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS \
+		|| !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
diff --git a/package/libv4l-rockchip/libv4l-rockchip.hash b/package/libv4l-rockchip/libv4l-rockchip.hash
new file mode 100644
index 0000000000..62673da3fa
--- /dev/null
+++ b/package/libv4l-rockchip/libv4l-rockchip.hash
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 acef5a4f61aa3bdf8959964d7ac727cc8bd90de527f6fa103523814d64d8ca38 libv4l-rockchip-5e6034258146af6be973fb6a5bb6b9d6e7489437.tar.gz
diff --git a/package/libv4l-rockchip/libv4l-rockchip.mk b/package/libv4l-rockchip/libv4l-rockchip.mk
new file mode 100644
index 0000000000..d1823a14bd
--- /dev/null
+++ b/package/libv4l-rockchip/libv4l-rockchip.mk
@@ -0,0 +1,19 @@
+################################################################################
+#
+# libv4l-rockchip
+#
+################################################################################
+
+LIBV4L_ROCKCHIP_VERSION = 5e6034258146af6be973fb6a5bb6b9d6e7489437
+LIBV4L_ROCKCHIP_SITE = https://chromium.googlesource.com/chromiumos/third_party/libv4lplugins
+LIBV4L_ROCKCHIP_SITE_METHOD = git
+LIBV4L_ROCKCHIP_DEPENDENCIES = libv4l
+# source download
+LIBV4L_ROCKCHIP_AUTORECONF = YES
+
+#LIBV4L_ROCKCHIP_LICENSE = 
+#LIBV4L_ROCKCHIP_LICENSE_FILES = 
+
+LIBV4L_ROCKCHIP_CONF_OPTS += CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/libv4l-1.14.2"
+
+$(eval $(autotools-package))
-- 
2.17.1


> 
> Thanks,
> baruch
> 



More information about the buildroot mailing list