How to create loopback device for nvcamerasrc for TX2?

The topic is a sort of fork of the thread , but still

Question 1: how to get installed ?

Unpacking v4l2loopback-dkms (0.9.1-4) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up dkms ( ...
Setting up v4l2loopback-dkms (0.9.1-4) ...
Loading new v4l2loopback-0.9.1 DKMS files...
First Installation: checking all kernels...
dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
It is likely that 4.4.15-tegra belongs to a chroot's host
Building initial module for 4.4.15-tegra
ERROR (dkms apport): kernel package linux-headers-4.4.15-tegra is not supported
Error! Bad return status for module build on kernel: 4.4.15-tegra (aarch64)
Consult /var/lib/dkms/v4l2loopback/0.9.1/build/make.log for more information.

If that doesn’t seem possible, then arises Question 2 - how to make from gitsource?

make[1]: Entering directory '/usr/src/linux-headers-4.4.15-tegra'
  CC [M]  /home/nvidia/Downloads/v4l2loopback/v4l2loopback.o
In file included from ./arch/arm64/include/asm/sysreg.h:23:0,
                 from ./arch/arm64/include/asm/cpufeature.h:13,
                 from ./arch/arm64/include/asm/hw_breakpoint.h:20,
                 from ./arch/arm64/include/asm/processor.h:33,
                 from ./arch/arm64/include/asm/spinlock.h:21,
                 from include/linux/spinlock.h:87,
                 from include/linux/vmalloc.h:4,
                 from /home/nvidia/Downloads/v4l2loopback/v4l2loopback.c:17:
./arch/arm64/include/asm/opcodes.h:5:43: fatal error: ../../arm/include/asm/opcodes.h: No such file or directory
compilation terminated.
scripts/ recipe for target '/home/nvidia/Downloads/v4l2loopback/v4l2loopback.o' failed
make[2]: *** [/home/nvidia/Downloads/v4l2loopback/v4l2loopback.o] Error 1
Makefile:1399: recipe for target '_module_/home/nvidia/Downloads/v4l2loopback' failed
make[1]: *** [_module_/home/nvidia/Downloads/v4l2loopback] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.4.15-tegra'
Makefile:42: recipe for target 'v4l2loopback.ko' failed
make: *** [v4l2loopback.ko] Error 2

Corresponding threads:

Got some response, which I shall try implement:

Could someone help figuring out how to create the .ko file.
By now I am struggling with determination and localization of the location of the mentioned /drivers/misc folder.
I would be grateful for any help with that.

seems that I shall use there

It seems that there the should be used somehow

shall i download kernel sources with purpose to do the module?
that sources: ?

It seems that unpacked kernel sources have an archive named v4l2-utils_src.tbz2

perhaps the following shall be used: kernel_src.tbz2

linuxdev: Could you share your wisdom on the issue, please?

I have no experience with the camera drivers or code. If you are trying to build a kernel module or kernel image for support of a loopback device, then yes, the kernel_src.tbz2 file would be the correct place to find the source and build that software. As for the loopback feature I do not know anything about which feature would provide this.

The github software might or might not work with this kernel…there may be prerequisites that a different kernel version be used, or perhaps some kernel feature needs to be enabled before the module can be built. Since this is external to the main kernel source it may also have procedures under cross-compile to name a different set of kernel headers than what it might look for by default.

There was mention in your error log of a possible prerequisite requirement being an issue:

ERROR (dkms apport): kernel package linux-headers-4.4.15-tegra is not supported

If you run this command from your Jetson you will get this:

nvidia@tegra-ubuntu:~$ sudo -s
[sudo] password for nvidia: 
root@tegra-ubuntu:~# apt search v4l2loopback
Sorting... Done
Full Text Search... Done
gem-plugin-v4l2/xenial 1:0.93.3-9build1 arm64
  Graphics Environment for Multimedia - V4L2 output support

<b>v4l2loopback-dkms</b>/xenial 0.9.1-4 all
  Source for the v4l2loopback driver (DKMS)

v4l2loopback-source/xenial 0.9.1-4 all
  Source for the v4l2loopback driver

v4l2loopback-utils/xenial 0.9.1-4 arm64
  Commandline utilities for the for the v4l2-loopback module

Perhaps if you install the v4l2loopback-dkms package via “apt-get” the error would go away (this assumes building the module on the Jetson and installing v4l2loopback-dkms on the Jetson). There are just so many possibilities you’re probably going to just have to experiment with adding packages and enabling related features, but I couldn’t tell you which features that might be (I have no camera/video experience).

Thank you for our response.
I tried to install v4l2loopback at Jetson, and it turned out that I shall first compile the kernel module at Host, as it seems to me , with which I have too few experience , perhaps.
Thank you for your explanation!

Colleague from forum advised the following:

aptitude install v4l2loopback-source module-assistant

module-assistant auto-install v4l2loopback-source

insmod with compilled .ko file helped creating devices

Looks like you have get it work.

Here is also a post for reference

gst-launch-1.0 nvcamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! nvtee ! nvvidconv  ! 'video/x-raw, format=(string)I420, framerate=(fraction)30/1' ! tee ! v4l2sink device=/dev/video1

Does the trick and works with

guvcview -d /dev/video1

Now I can say to a Chromium to use it as a source for webskype/hangouts with

insmod ./v4l2loopback.ko devices=1 video_nr=2 exclusive_caps=1


v4l2kernel.tar.gz (254 KB)

found something, shall investigate the way

that one deletes created devices: sudo rmmod v4l2loopback

yeah, now chromium + hangouts can use the camera,
thank you!

next question is how to stream the onboard camera via loopback to the Internet or external port

Please other users can share experience