Skip to contentSkip to conversation

package/eudev: fix compile-time issue on very old kernels

PATCH Superseded Stefan Ott via buildroot 2 participants 2 messages Apr 5, 2023 – Apr 9, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/eudev: fix compile-time issue on very old kernels

Kernel versions prior to 3.4 did not have V4L2_CAP_DEVICE_CAPS and compiling against such a kernel will fail.

This patch introduces a version check and makes eudev fall back to v2cap.capabilities on these kernels.

---
 ...mpile-time-issue-on-very-old-kernels.patch | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch
package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch new file +29 -0
new file mode 100644
index 0000000000..63546079d6
@@ -0,0 +1,29 @@
+Fix compile-time issue on very old kernels
+
+Kernel versions prior to 3.4 did not have V4L2_CAP_DEVICE_CAPS and
+compiling eudev against such a kernel will fail.
+
+This patch introduces a version check and makes eudev fall back to
+v2cap.capabilities on these kernels.
+
+diff -Naur a/src/v4l_id/v4l_id.c b/src/v4l_id/v4l_id.c
+@@ -28,7 +28,6 @@
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/ioctl.h>
+-#include <linux/version.h>
+ #include <linux/videodev2.h>
+ 
+ #include "util.h"
+@@ -72,11 +71,9 @@
+                 printf("ID_V4L_VERSION=2\n");
+                 printf("ID_V4L_PRODUCT=%s\n", v2cap.card);
+                 printf("ID_V4L_CAPABILITIES=:");
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
+                 if (v2cap.capabilities & V4L2_CAP_DEVICE_CAPS)
+                         capabilities = v2cap.device_caps;
+                 else
+-#endif
+                         capabilities = v2cap.capabilities;
+                 if ((capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0 ||
+                     (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE) > 0)
Signature · 6 lines
2.40.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 1 line · Stefan Ott via buildroot

Kernel versions prior to 3.4 did not have V4L2_CAP_DEVICE_CAPS and

It's kernel *headers*, not kernel. This got me confused for a moment, I
thought there was a problem when trying to build on a system with a very old running kernel...

Quoted 17 lines

compiling against such a kernel will fail.

This patch introduces a version check and makes eudev fall back to v2cap.capabilities on these kernels.

---
  ...mpile-time-issue-on-very-old-kernels.patch | 29 +++++++++++++++++++
  1 file changed, 29 insertions(+)

create mode 100644 package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch

package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch new file +0 -0
new file mode 100644
index 0000000000..63546079d6

package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch line 1

Quoted 1 line
package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch new file +1 -0
@@ -0,0 +1,29 @@
+Fix compile-time issue on very old kernels

Please use git-formatted patches, especially sine the upstream repository is
git [1].

package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch line 8

Quoted 7 lines
package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch new file +7 -0
+
+Kernel versions prior to 3.4 did not have V4L2_CAP_DEVICE_CAPS and
+compiling eudev against such a kernel will fail.
+
+This patch introduces a version check and makes eudev fall back to
+v2cap.capabilities on these kernels.
+

Add a Signed-off-by line for yourself. This is a short way for you to
assert that you are entitled to contribute the patch under the relevant license (in this case, eudev's LGPL2.1+). See [2] for more details.

Also, there should be an upstream reference, i.e. something like:

Upstream: https://github.com/eudev-project/eudev/pulls/...

(of course, you should first create a pull request :-)

Since the Signed-off-by is absolutely essential, I've marked your patch as
Changes Requested.

Regards,
Arnout

[1] https://github.com/eudev-project/eudev
[2] http://elinux.org/Developer_Certificate_Of_Origin

Quoted 11 lines
package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch new file +11 -0
+diff -Naur a/src/v4l_id/v4l_id.c b/src/v4l_id/v4l_id.c
+@@ -28,7 +28,6 @@
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/ioctl.h>
+-#include <linux/version.h>
+ #include <linux/videodev2.h>
+
+ #include "util.h"
+@@ -72,11 +71,9 @@
+                 printf("ID_V4L_VERSION=2\n");

package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch line 29

Quoted 10 lines
package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch new file +10 -0
+                 printf("ID_V4L_PRODUCT=%s\n", v2cap.card);
+                 printf("ID_V4L_CAPABILITIES=:");
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
+                 if (v2cap.capabilities & V4L2_CAP_DEVICE_CAPS)
+                         capabilities = v2cap.device_caps;
+                 else
+-#endif
+                         capabilities = v2cap.capabilities;
+                 if ((capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0 ||
+                     (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE) > 0)

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot