Skip to contentSkip to conversation

package/libcamera: Add libcamera package

PATCH Superseded Kieran Bingham 4 participants 6 messages Apr 3, 2019 – Apr 4, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 package/libcamera: Add libcamera package

http://libcamera.org/

Cameras are complex devices that need heavy hardware image processing operations. Control of the processing is based on advanced algorithms that must run on a programmable processor. This has traditionally been implemented in a dedicated MCU in the camera, but in embedded devices algorithms have been moved to the main CPU to save cost. Blurring the boundary between camera devices and Linux often left the user with no other option than a vendor-specific closed-source solution.

To address this problem the Linux media community has very recently started collaboration with the industry to develop a camera stack that will be open-source-friendly while still protecting vendor core IP. libcamera was born out of that collaboration and will offer modern camera support to Linux-based systems, including traditional Linux distributions, ChromeOS and Android.

The project has not made an official release as of yet, so we're using the latest sha1 from master

We utilise C++ 11 but we mandate GCC5+ due to a bug [0] in earlier versions which result in compile failures on our code base.

[0] Bug 54316 - [C++11] move constructor for stringstream

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54316

Documentation and Tests are disabled from the build.

With the following added to libcamera.config:

BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_PACKAGE_LIBCAMERA=y

./utils/test-pkg -c libcamera.config -p libcamera

                             br-arm-full [1/6]: SKIPPED
                  br-arm-cortex-a9-glibc [2/6]: OK
                   br-arm-cortex-m4-full [3/6]: SKIPPED
                          br-x86-64-musl [4/6]: OK
                      br-arm-full-static [5/6]: SKIPPED
                            sourcery-arm [6/6]: SKIPPED
---
 DEVELOPERS                       |  3 +++
 package/Config.in                |  1 +
 package/libcamera/Config.in      | 13 +++++++++++++
 package/libcamera/libcamera.hash |  4 ++++
 package/libcamera/libcamera.mk   | 18 ++++++++++++++++++
 5 files changed, 39 insertions(+)
 create mode 100644 package/libcamera/Config.in
 create mode 100644 package/libcamera/libcamera.hash
 create mode 100644 package/libcamera/libcamera.mk
DEVELOPERS +3 -0
index 1001d5581520..eb9013fba7da 100644
@@ -1269,6 +1269,9 @@ F:	package/ramsmp/
 N:	Kevin Joly <[email protected]>
 F:	package/libgphoto2/
 
+N:	Kieran Bingham <[email protected]>
+F:	package/libcamera/
+
 N:	Koen Martens <[email protected]>
 F:	package/capnproto/
 F:	package/linuxconsoletools/
package/Config.in +1 -0
index db79b6197152..b1b3c0bd2acb 100644
@@ -1479,6 +1479,7 @@ menu "Multimedia"
 	source "package/libass/Config.in"
 	source "package/libbdplus/Config.in"
 	source "package/libbluray/Config.in"
+	source "package/libcamera/Config.in"
 	source "package/libdcadec/Config.in"
 	source "package/libdvbcsa/Config.in"
 	source "package/libdvbpsi/Config.in"
package/libcamera/Config.in new file +13 -0
new file mode 100644
index 000000000000..cc5e84424c38
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_LIBCAMERA
+	bool "libcamera"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	# C++11 + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54316
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
+	depends on BR2_PACKAGE_HAS_UDEV
+	help
+	  libcamera provides a software stack to support
+	  complex devices that need heavy hardware image
+	  processing operations.
+
+		http://www.libcamera.org/
package/libcamera/libcamera.hash new file +4 -0
new file mode 100644
index 000000000000..7d5392dde2bb
@@ -0,0 +1,4 @@
+sha256 2c01dc76d98ef257660f8ef3f4f17f042e112b5eca6b364ad615220c96fbd066  libcamera-d5ca33f6c7b0cd1ca20ec5dc7131aeedf1503080.tar.gz
+sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  licenses/gnu-gpl-2.0.txt
+sha256 592987e8510228d546540b84a22444bde98e48d03078d3b2eefcd889bec5ce8c  licenses/gnu-lgpl-2.1.txt
+
package/libcamera/libcamera.mk new file +18 -0
new file mode 100644
index 000000000000..08cbb9802071
@@ -0,0 +1,18 @@
+################################################################################
+#
+# libcamera
+#
+################################################################################
+
+LIBCAMERA_SITE = https://git.linuxtv.org/libcamera.git
+LIBCAMERA_VERSION = d5ca33f6c7b0cd1ca20ec5dc7131aeedf1503080
+LIBCAMERA_SITE_METHOD = git
+LIBCAMERA_DEPENDENCIES = udev
+LIBCAMERA_CONF_OPTS = -Dtests=false -Ddocumentation=false
+LIBCAMERA_INSTALL_STAGING = yes
+LIBCAMERA_LICENSE = LGPL-2.1+ (library), GPL-2.0+ (utils)
+LIBCAMERA_LICENSE_FILES = \
+	licenses/gnu-gpl-2.0.txt \
+	licenses/gnu-lgpl-2.1.txt
+
+$(eval $(meson-package))
Signature · 1 line
2.19.1
#1 lore raw

PATCH v3 1/1 package/libcamera: Add libcamera package

package/libcamera/libcamera.mk line 9

Quoted 3 lines · Kieran Bingham
package/libcamera/libcamera.mk new file +3 -0
+LIBCAMERA_SITE = https://git.linuxtv.org/libcamera.git
+LIBCAMERA_VERSION = d5ca33f6c7b0cd1ca20ec5dc7131aeedf1503080
+LIBCAMERA_SITE_METHOD = git

That debug line gave me the idea... you can use an http download on gitlab:

LIBCAMERA_SITE =
https://gitlab.com/libcamera/libcamera/-/archive/$(LIBCAMERA_VERSION)
LIBCAMERA_SOURCE = libcamera-$(LIBCAMERA_VERSION).tar.bz2

Only, I'm not sure how stable the tarball generation is, i.e. if it will always
yield the same hash.

Either way:

Regards,
Arnout

#2 lore raw

PATCH v3 1/1 package/libcamera: Add libcamera package

Hi Arnout,

Quoted 8 lines · Arnout Vandecappelle

package/libcamera/libcamera.mk line 9

Quoted 3 lines · Kieran Bingham
package/libcamera/libcamera.mk new file +3 -0
+LIBCAMERA_SITE = https://git.linuxtv.org/libcamera.git
+LIBCAMERA_VERSION = d5ca33f6c7b0cd1ca20ec5dc7131aeedf1503080
+LIBCAMERA_SITE_METHOD = git

That debug line gave me the idea... you can use an http download on gitlab:

Thanks, but we're not actually using gitlab. That was a repo I had control over which I was able to push public branches to for testing and debugging the buildroot build.

Quoted 6 lines

LIBCAMERA_SITE =
https://gitlab.com/libcamera/libcamera/-/archive/$(LIBCAMERA_VERSION)
LIBCAMERA_SOURCE = libcamera-$(LIBCAMERA_VERSION).tar.bz2

Only, I'm not sure how stable the tarball generation is, i.e. if it will always
yield the same hash.

I'm afraid I don't believe this would work with the git.linuxtv.org ... I think it's just a basic gitolite instance or such.

Quoted 3 lines

Either way:

Great thanks.

Quoted 4 lines

Regards,
Arnout

Signature · 3 lines
Regards
--
Kieran
#3 lore raw

PATCH v3 1/1 package/libcamera: Add libcamera package

In reply to Kieran Bingham

Kieran, All,

On 2019-04-03 18:29 +0700, Kieran Bingham spake thusly:

Quoted 34 lines

http://libcamera.org/

Cameras are complex devices that need heavy hardware image processing operations. Control of the processing is based on advanced algorithms that must run on a programmable processor. This has traditionally been implemented in a dedicated MCU in the camera, but in embedded devices algorithms have been moved to the main CPU to save cost. Blurring the boundary between camera devices and Linux often left the user with no other option than a vendor-specific closed-source solution.

To address this problem the Linux media community has very recently started collaboration with the industry to develop a camera stack that will be open-source-friendly while still protecting vendor core IP. libcamera was born out of that collaboration and will offer modern camera support to Linux-based systems, including traditional Linux distributions, ChromeOS and Android.

The project has not made an official release as of yet, so we're using the latest sha1 from master

We utilise C++ 11 but we mandate GCC5+ due to a bug [0] in earlier versions which result in compile failures on our code base.

[0] Bug 54316 - [C++11] move constructor for stringstream

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54316

Documentation and Tests are disabled from the build.

With the following added to libcamera.config:

BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_PACKAGE_LIBCAMERA=y

./utils/test-pkg -c libcamera.config -p libcamera

Quoted 8 lines
                             br-arm-full [1/6]: SKIPPED
                  br-arm-cortex-a9-glibc [2/6]: OK
                   br-arm-cortex-m4-full [3/6]: SKIPPED
                          br-x86-64-musl [4/6]: OK
                      br-arm-full-static [5/6]: SKIPPED
                            sourcery-arm [6/6]: SKIPPED

Third time's a charm, as they say:

But since nothing can be perfect in this world:

[--SNIP--]

Quoted 9 lines
package/libcamera/Config.in new file +3 -0
new file mode 100644
index 000000000000..cc5e84424c38
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_LIBCAMERA
+	bool "libcamera"
+	depends on BR2_INSTALL_LIBSTDCPP

package/libcamera/Config.in line 13

Quoted 10 lines
package/libcamera/Config.in new file +10 -0
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	# C++11 + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54316
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
+	depends on BR2_PACKAGE_HAS_UDEV
+	help
+	  libcamera provides a software stack to support
+	  complex devices that need heavy hardware image
+	  processing operations.
+
+		http://www.libcamera.org/

.. I am going to nitpick and bikeshed: we usually do not super-indent the upstream URL, and just leave it at the same level as the rest of the help text.

But oh well... ;-)

Regards,
Yann E. MORIN.

Quoted 37 lines
package/libcamera/libcamera.hash new file +4 -0
new file mode 100644
index 000000000000..7d5392dde2bb
@@ -0,0 +1,4 @@
+sha256 2c01dc76d98ef257660f8ef3f4f17f042e112b5eca6b364ad615220c96fbd066  libcamera-d5ca33f6c7b0cd1ca20ec5dc7131aeedf1503080.tar.gz
+sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  licenses/gnu-gpl-2.0.txt
+sha256 592987e8510228d546540b84a22444bde98e48d03078d3b2eefcd889bec5ce8c  licenses/gnu-lgpl-2.1.txt
+
package/libcamera/libcamera.mk new file +18 -0
new file mode 100644
index 000000000000..08cbb9802071
@@ -0,0 +1,18 @@
+################################################################################
+#
+# libcamera
+#
+################################################################################
+
+LIBCAMERA_SITE = https://git.linuxtv.org/libcamera.git
+LIBCAMERA_VERSION = d5ca33f6c7b0cd1ca20ec5dc7131aeedf1503080
+LIBCAMERA_SITE_METHOD = git
+LIBCAMERA_DEPENDENCIES = udev
+LIBCAMERA_CONF_OPTS = -Dtests=false -Ddocumentation=false
+LIBCAMERA_INSTALL_STAGING = yes
+LIBCAMERA_LICENSE = LGPL-2.1+ (library), GPL-2.0+ (utils)
+LIBCAMERA_LICENSE_FILES = \
+	licenses/gnu-gpl-2.0.txt \
+	licenses/gnu-lgpl-2.1.txt
+
+$(eval $(meson-package))
Signature · 1 line
2.19.1
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH v3 1/1 package/libcamera: Add libcamera package

In reply to Kieran Bingham

Hello Kieran,

Quoted 1 line · On Wed, 3 Apr 2019 18:29:02 +0700 Kieran Bingham…

http://libcamera.org/

I've applied to master, with a few minor changes.

First, our canonical commit title for new packages is:

package/foo: new package

Quoted 9 lines
package/libcamera/Config.in new file +3 -0
new file mode 100644
index 000000000000..cc5e84424c38
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_LIBCAMERA
+	bool "libcamera"
+	depends on BR2_INSTALL_LIBSTDCPP

package/libcamera/Config.in line 13

Quoted 10 lines
package/libcamera/Config.in new file +10 -0
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	# C++11 + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54316
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
+	depends on BR2_PACKAGE_HAS_UDEV
+	help
+	  libcamera provides a software stack to support
+	  complex devices that need heavy hardware image
+	  processing operations.
+
+		http://www.libcamera.org/

The indentation of the URL should have been one tab + two spaces.

More importantly (and that was the only thing really missing): the Config.in comment that describes the dependencies was missing.

package/libcamera/libcamera.hash line 4

Quoted 10 lines
package/libcamera/libcamera.hash new file +4 -0
new file mode 100644
index 000000000000..7d5392dde2bb
@@ -0,0 +1,4 @@
+sha256 2c01dc76d98ef257660f8ef3f4f17f042e112b5eca6b364ad615220c96fbd066  libcamera-d5ca33f6c7b0cd1ca20ec5dc7131aeedf1503080.tar.gz
+sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  licenses/gnu-gpl-2.0.txt
+sha256 592987e8510228d546540b84a22444bde98e48d03078d3b2eefcd889bec5ce8c  licenses/gnu-lgpl-2.1.txt
+

Unneeded empty new line that was causing a check-package warning.

Thanks for this contribution! Great to see libcamera moving forward!

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

PATCH v3 1/1 package/libcamera: Add libcamera package

Hi Thomas,

Quoted 8 lines · Thomas Petazzoni

Hello Kieran,

Quoted 1 line · On Wed, 3 Apr 2019 18:29:02 +0700 Kieran Bingham…

http://libcamera.org/

I've applied to master, with a few minor changes.

Thank you very much.

I'm perfectly happy for you to have made changes as required.

Quoted 26 lines

First, our canonical commit title for new packages is:

package/foo: new package

Quoted 9 lines
package/libcamera/Config.in new file +3 -0
new file mode 100644
index 000000000000..cc5e84424c38
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_LIBCAMERA
+	bool "libcamera"
+	depends on BR2_INSTALL_LIBSTDCPP

package/libcamera/Config.in line 13

Quoted 10 lines
package/libcamera/Config.in new file +10 -0
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	# C++11 + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54316
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
+	depends on BR2_PACKAGE_HAS_UDEV
+	help
+	  libcamera provides a software stack to support
+	  complex devices that need heavy hardware image
+	  processing operations.
+
+		http://www.libcamera.org/

The indentation of the URL should have been one tab + two spaces.

Quoted 2 lines

More importantly (and that was the only thing really missing): the Config.in comment that describes the dependencies was missing.

Ahh, that's neat - so it shows up the comment when the dependencies aren't met.

Thank you for adding it.

Quoted 4 lines
Quoted 4 lines
package/libcamera/libcamera.hash new file +0 -1
new file mode 100644
index 000000000000..7d5392dde2bb
--- /dev/null
Quoted 8 lines

package/libcamera/libcamera.hash line 4

Quoted 6 lines

+++ b/package/libcamera/libcamera.hash

package/libcamera/libcamera.hash new file +4 -0
@@ -0,0 +1,4 @@
+sha256 2c01dc76d98ef257660f8ef3f4f17f042e112b5eca6b364ad615220c96fbd066  libcamera-d5ca33f6c7b0cd1ca20ec5dc7131aeedf1503080.tar.gz
+sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  licenses/gnu-gpl-2.0.txt
+sha256 592987e8510228d546540b84a22444bde98e48d03078d3b2eefcd889bec5ce8c  licenses/gnu-lgpl-2.1.txt
+

Unneeded empty new line that was causing a check-package warning.

Doh :S at least that's an easy fix. :-)

Quoted 1 line

Thanks for this contribution! Great to see libcamera moving forward!

Thank you all for accepting it into Buildroot!

It has already proved very valuable to us, catching several build issues when compiling against different toolchains.

Quoted 5 lines

Best regards,

Thomas

Signature · 3 lines
Regards
--
Kieran