Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arducam driver #4

Merged
merged 4 commits into from
Jul 6, 2024
Merged

arducam driver #4

merged 4 commits into from
Jul 6, 2024

Conversation

KantaTamura
Copy link
Collaborator

arducam driverをyoctoに移植した

動作確認はできていないです

Copy link
Member

@yashi yashi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

良さげです。

なぜドライバーを追加する必要があるのか、だけ commit message に書いてください。コピーしてきた版の commit hash も入れておいてもらえると助かります。

あとは @MayaAbe@sasataku のテスト結果が OKなら、マージで。

zero/meta-arducam/recipes-kernelmodule/arducam_0.bb Outdated Show resolved Hide resolved
zero/meta-arducam/recipes-kernelmodule/files/Makefile Outdated Show resolved Hide resolved
zero/meta-arducam/recipes-kernelmodule/files/arducam.c Outdated Show resolved Hide resolved
@KantaTamura KantaTamura force-pushed the wip/arducam branch 6 times, most recently from 31153b0 to 2b89a48 Compare August 23, 2023 01:13
@yashi
Copy link
Member

yashi commented Aug 23, 2023

@MayaAbe のテスト待ち

@KantaTamura KantaTamura force-pushed the wip/arducam branch 2 times, most recently from 1289780 to a49ae4b Compare August 23, 2023 01:46
@KantaTamura
Copy link
Collaborator Author

末尾に改行を加えた結果md5の値が変わっていたので,その部分のみ修正しました

@MayaAbe
Copy link
Contributor

MayaAbe commented Aug 30, 2023

カメラの動確のためにlibcameraを入れられますか?
@KantaTamura

@sasataku sasataku force-pushed the wip/arducam branch 2 times, most recently from 55cee40 to 7b22064 Compare September 18, 2023 12:11
@sasataku
Copy link
Member

kirkstone (kernel 5.15.34)で、libcameraを使ってArducam Cameraが動作したので PRを更新しています。
libcamera-appsは入れていないので、動作確認は cam コマンドのみです。

  • cam -l (使用可能なカメラのリスト表示)
  • cam -c 1 --capture=10 -F (10 Frame分のキャプチャ&ファイル保存)

@yashi
Copy link
Member

yashi commented Sep 18, 2023

Is the library based on https://github.com/ArduCAM/Arducam_dvp?

@yashi
Copy link
Member

yashi commented Sep 18, 2023

I couldn't find license information for the binary file. Do you have it?

@yashi
Copy link
Member

yashi commented Sep 18, 2023

Is the library based on https://github.com/ArduCAM/Arducam_dvp?

I guess not.

yashi
yashi previously requested changes Sep 18, 2023
@@ -0,0 +1,68 @@
SUMMARY = "Arducam libcamera framework"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more like "Arducam fork of libcamera", no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or if you want to keep the orignal, "Arducam fork of Linux libcamera framework"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change to "Arducam fork of Linux libcamera framework"

file://LICENSES/LGPL-2.1-or-later.txt;md5=2a4f4fd2128ea2f65047ee63fbca9f68 \
"

SRC_URI = " \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the diff between this file and the original. Is it still better to fork it instead of overlay?

diff -u meta-multimedia/recipes-multimedia/libcamera/libcamera_0.1.0.bb ~/work/launch2022/rpi-zero/zero/meta-arducam/recipes-multimedia/libcamera-arducam/libcamera-arducam_0.0.5.bb 
--- meta-multimedia/recipes-multimedia/libcamera/libcamera_0.1.0.bb	2023-09-18 21:42:16.622746910 +0900
+++ /home/yashi/work/launch2022/rpi-zero/zero/meta-arducam/recipes-multimedia/libcamera-arducam/libcamera-arducam_0.0.5.bb	2023-09-18 21:32:04.688421677 +0900
@@ -1,4 +1,4 @@
-SUMMARY = "Linux libcamera framework"
+SUMMARY = "Arducam libcamera framework"
 SECTION = "libs"
 
 LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later"
@@ -9,16 +9,16 @@
 "
 
 SRC_URI = " \
-        git://git.libcamera.org/libcamera/libcamera.git;protocol=https;branch=master \
+        git://github.com/ArduCAM/libcamera.git;protocol=https;branch=arducam \
 "
 
-SRCREV = "960d0c1e19feaf310321c906e14bd5410c6be629"
+SRCREV = "bde06144d10d4a201e761218ba9169d7a00446e6"
 
 PE = "1"
 
 S = "${WORKDIR}/git"
 
-DEPENDS = "python3-pyyaml-native python3-jinja2-native python3-ply-native python3-jinja2-native udev gnutls chrpath-native libevent libyaml"
+DEPENDS = "python3-pyyaml-native python3-jinja2-native python3-ply-native python3-jinja2-native udev gnutls chrpath-native libevent libyaml arducam-pivariety"
 DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'qt', 'qtbase qtbase-native', '', d)}"
 
 PACKAGES =+ "${PN}-gst"
@@ -26,10 +26,9 @@
 PACKAGECONFIG ??= ""
 PACKAGECONFIG[gst] = "-Dgstreamer=enabled,-Dgstreamer=disabled,gstreamer1.0 gstreamer1.0-plugins-base"
 
-LIBCAMERA_PIPELINES ??= "auto"
-
 EXTRA_OEMESON = " \
-    -Dpipelines=${LIBCAMERA_PIPELINES} \
+    -Dpipelines=rpi/vc4 \
+    -Dipas=rpi/vc4 \
     -Dv4l2=true \
     -Dcam=enabled \
     -Dlc-compliance=disabled \
@@ -46,8 +45,7 @@
 }
 
 do_install:append() {
-    chrpath -d ${D}${libdir}/libcamera.so
-    chrpath -d ${D}${libexecdir}/libcamera/v4l2-compat.so
+    rm -rf ${D}/usr/share
 }
 
 addtask do_recalculate_ipa_signatures_package after do_package before do_packagedata
@@ -63,10 +61,8 @@
     ${S}/src/ipa/ipa-sign-install.sh ${B}/src/ipa-priv-key.pem "${modules}"
 }
 
-FILES:${PN} += " ${libexecdir}/libcamera/v4l2-compat.so"
-FILES:${PN}-gst = "${libdir}/gstreamer-1.0"
+FILES:${PN} += " ${libdir}/v4l2-compat.so ${libdir}/libcamera/ipa*"
 
 # libcamera-v4l2 explicitly sets _FILE_OFFSET_BITS=32 to get access to
 # both 32 and 64 bit file APIs.
 GLIBC_64BIT_TIME_FLAGS = ""
-

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was also wondering if I should overlay with bbapend.
I will try to change to use a bbapend.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, do_install fails because the libcamera version targeted by kirkstone's libcamera recipe and
the arducam libcamera version do not match.

So, we forked the recipece from commit below and modified it

LICENSE = "CLOSED"

SRC_URI = "\
file://libarducam_pivariety.so \
Copy link
Member

@yashi yashi Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create the symlink in do_install().

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OKay. will create in do_install().

@@ -0,0 +1,34 @@
SUMMARY = "Arducam pivariety SDK recipe"
SECTION = "libs"
LICENSE = "CLOSED"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the library is non-distributable, we have to do something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I'm asking the license information in Arducam forum.
https://forum.arducam.com/t/what-is-the-license-for-arducam-pivariety-sdk-dev/5760

Comment on lines 33 to 34
FILES:${PN}-dev = "${libdir}/pkgconfig/arducam_pivariety.pc \
${includedir}/arducam"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed .hpp in -dev?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. will fix.

@@ -6,6 +6,7 @@ BBFILES += "\
${LAYERDIR}/recipes-devicetree/linux-raspberrypi_%.bbappend \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know where to put my comment on the commit log so here goes.

  • please check english grammer.
  • The arducam_ppa provides packages and there is a package providing a pre-built "binary".
  • The word "various" isn't the right word because you are installing .so and .hpp. You should generate the symlink.
  • this "Libcamera's build system utilizes the first pkgconfig to search for this SDK, so it also installs .pc file." isn't right. libcamera uses pkgconfig (or pkg-config). pkgconfig uses the first matched .pc file (if it's true; I haven't tested).
  • This "It used the following page as a reference for how to install pre-built packages with Yocto." is unbigous. Since we were just talking about "Libcamera's build system", "pkgconfig", or the .pc file, the word "it" sounds like referencing one of them. Instead I'm sure you are referencing the .bb file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my take:

zero/meta-arducam: Install libarducam_pivariety.so.1.0.2 from Arducam SDK

This commit adds pre-built libarducam_pivariety.so taken from Arducam SDK.

Arducam has extended libcamera source code and has published it on
GitHub. However, the source code needs libarducam_pivariety.so and
it's header file to build and run.

(We should add SHA hash or tags where we obtained files)
(We should add list of files taken from the package)

Libcamera build system utilizes pkgconfig and pkgconfig utilizes the
first .pc, we are adding the .pc file to -dev package as well.

The arducam-pivariety_1.0.2.bb was writen referencing the following
page: "Working with Pre-Built Libraries"

Please update hash value, tags, package name, list of files taken.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. will update commit log and add SHA hash.etc.

@yashi
Copy link
Member

yashi commented Sep 18, 2023

BTW, if the files are taken from someother places, you don't need to fix it. But please write it down where you've got them from.

@sasataku sasataku force-pushed the wip/arducam branch 2 times, most recently from aae9535 to e6c2d6d Compare September 25, 2023 07:27
KantaTamura and others added 3 commits July 6, 2024 20:06
This commit add a dts overlay file and enable driver to use the
Arducam camera.

The DTS and driver for the Arducam camera have been merged into
the raspberrypi linux kernel as of version 5.15.38

Signed-off-by: KantaTamura <[email protected]>
Co-authored-by:: Takuya Sasaki <[email protected]>
Signed-off-by: Takuya Sasaki <[email protected]>
If we build with core-image-minimal, we will need to enable some
kernel configurations.

For configurations that should be enabled by at startup, CONFIG_XX
is set to 'y' with reference to the following page.

  - https://docs.yoctoproject.org/singleindex.html#changing-the-configuration

Kernel modules loaded from other drivers are added in layer.conf.

Signed-off-by: Takuya Sasaki <[email protected]>
This commit adds pre-built libarducam_pivariety.so taken from
Arducam SDK.

Arducam has extended libcamera source code and has published it on
GitHub. However, the source code needs libarducam_pivariety.so and
it's header file to build and run.

   - repository: https://github.com/ArduCAM/arducam_ppa
   - package name: arducam-pivariety-sdk-dev
   - hash: 332543a
   - file: pool/main/a/arducam-pivariety-sdk-dev/\
           arducam-pivariety-sdk-dev_1.0.6_armhf.deb
   - file lst: usr/include/arducam/arducam_pivariety.hpp
               usr/lib/libarducam_pivariety.so.1.0.6
               usr/lib/pkgconfig/arducam_pivariety.pc

Libcamera build system utilizes pkgconfig and pkgconfig utilizes the
first .pc, we are adding the .pc file to -dev package as well.

The arducam-pivariety_1.0.6.bb was writen referencing the following
page: "Working with Pre-Built Libraries"

  https://docs.yoctoproject.org/dev/dev-manual/prebuilt-libraries.html

Signed-off-by: Takuya Sasaki <[email protected]>
This commit adds libcamera library provided by Arducam as
repository below.

  - https://github.com/ArduCAM/libcamera.git

In meta-openembedded, there exists the original version receipe of
libcamera, but Arducam has independently extended libcamera and
published it on gitHub.

However, do_install fails because the libcamera version targeted
by kirkstone's libcamera recipe and the arducam libcamera version
do not match.

So, we forked the recipece from commit below and modified it

  - repository: https://github.com/openembedded/meta-openembedded
  - hash: d369384
  - subject: libcamera: Simplify pipeline configuration

Signed-off-by: Takuya Sasaki <[email protected]>
@sasataku sasataku dismissed yashi’s stale review July 6, 2024 11:15

It has been fixed, so dismiss review and merge to master.

@sasataku sasataku merged commit 173b492 into main Jul 6, 2024
12 checks passed
@sasataku sasataku deleted the wip/arducam branch July 6, 2024 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants