Hello! I’m trying to create a duplicate of my USB video capture device so that I can stream and record it at the same time. Recording works fine with streamer, and streaming works find with mplayer. I have seen people using v4l2loopback to create additional nodes for their video devices. When I try installing with
sudo apt-get install v4l2loopback-dkms
it produces the following output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libgconf2-4
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
dkms
Suggested packages:
v4l2loopback-utils
The following NEW packages will be installed:
dkms v4l2loopback-dkms
0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
Need to get 89.4 kB of archives.
After this operation, 469 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ports.ubuntu.com/ubuntu-ports/ trusty-updates/main dkms all 2.2.0.3-1.1ubuntu5.14.04.9 [65.7 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports/ trusty/universe v4l2loopback-dkms all 0.8.0-1 [23.6 kB]
Fetched 89.4 kB in 1min 4s (1,392 B/s)
Selecting previously unselected package dkms.
(Reading database ... 149251 files and directories currently installed.)
Preparing to unpack .../dkms_2.2.0.3-1.1ubuntu5.14.04.9_all.deb ...
Unpacking dkms (2.2.0.3-1.1ubuntu5.14.04.9) ...
Selecting previously unselected package v4l2loopback-dkms.
Preparing to unpack .../v4l2loopback-dkms_0.8.0-1_all.deb ...
Unpacking v4l2loopback-dkms (0.8.0-1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up dkms (2.2.0.3-1.1ubuntu5.14.04.9) ...
Setting up v4l2loopback-dkms (0.8.0-1) ...
Loading new v4l2loopback-0.8.0 DKMS files...
First Installation: checking all kernels...
dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
It is likely that 3.10.67-g458d45c belongs to a chroot's host
Building initial module for 3.10.67-g458d45c
ERROR (dkms apport): kernel package linux-headers-3.10.67-g458d45c is not supported
Error! Bad return status for module build on kernel: 3.10.67-g458d45c (aarch64)
Consult /var/lib/dkms/v4l2loopback/0.8.0/build/make.log for more information.
What should I do? Kernel headers are beyond the scope of my linux experience…
This is a fairly old release from back when user space was 32-bit (kernel space was still 64-bit). I’m thinking perhaps the module has some incompatibility with this. Is there a possibility you could flash to a newer release?
My device is installed in a remote location and I can’t access it directly. If it’s possible to flash by downloading an image over wifi then maybe, although I imagine I would have to set up all my services again from scratch :(
The only way to upgrade remotely would be through a series of dd tricks…which in turn would mean the system would have to be booted to alternate media, e.g., SD card or NFS. NFS would be a bad idea.
Very likely the packages are divided into kernel modules and user space components. The mismatched version seems to be a kernel issue. This is not at all surprising since the modules from the repository likely were not built against the Jetson’s kernel. It probably would not be too difficult to build the module on your local PC by cross compiling, and then copying the module to the Jetson over the network. There are some articles and information out there on cross compile. Since this is an old kernel you may find this of use (the kernel edits wouldn’t be needed since the edits are about R24 and you are looking at R23.2, but environment variable setting and such would be correct…also browse elinux.org and the R23.2 docs):
[url]https://devtalk.nvidia.com/default/topic/936880/jetson-tx1/jetson-tx1-24-1-release-need-help-with-complier-directions-can-not-complie/post/4885136/#4885136[/url]
Thanks for the lead - can you suggest any alternative ways to duplicate /dev/video0 without having to compile this module? Cloning a device seems like it should be pretty standard.
Cloning requires either having the device physically present in recovery mode, or else using dd while it is booted to alternative media.
Having a module (assuming module format is supported), or else adding the feature to the kernel image itself as an integrated feature is mandatory to getting a device special file…these files are in fact part of the driver and not really part of the file system. The process itself is considered more or less an ordinary task under Linux, but cross-compiling is a complication. Most any Linux user who wants to develop anything at all needs to be able to configure and build a kernel…no programming knowledge is required since the modules already exist.
Does anyone have advice on cross-compiling on R23.2 for the module to produce “/dev/video0”? If your host is Ubuntu then the cross-compile tools are just a package addition…in other cases you may need to download Linaro tool chains, or else use the tools available from the Documentation download of R23.2 ([url]https://developer.nvidia.com/embedded/linux-tegra-r232[/url]). The “baggage” subdirectory of the unpacked documents has some tools in it…and of course some documentation on kernel customization.
That makes a really good point…all of the effort to cross compile a module would be unnecessary if you flashed, and if you don’t flash expect any bug fixes to be missing.
FYI, I would consider it difficult, but it may be possible to remotely create an entry in extlinux.conf which mounts the file system read-only. Since you have no serial console you would have to make that the default entry and then reboot…you could then use dd to clone. However, there is a serious flaw… if the default entry mounts read-only, and you have no serial console access, then you can never put the Jetson back in read-write mode without physical access. Not a very good plan :P
If there were an SD card in the slot with a rescue image (basically just a clone of the existing system or a standard sample rootfs), then you could edit extlinux.conf and reboot without being in read-only mode. This would allow cloning via dd (which in turn might be done via the internet). The extlinux.conf could then be edited again from the alternate boot image on SD card, and rebooted to go back to the upgraded eMMC root file system. This would be rather dangerous though if physical access is difficult since there is a lot which could go wrong and once more require direct access.
$ sudo su
$ apt-get install v4l2loopback-utils
$ cd /usr/src/linux-headers-4.4.38-tegra
$ make modules_prepare
$ mkdir v4l2loopback
$ cd v4l2loopback
$ git clone https://github.com/umlaeute/v4l2loopback.git
$ cd v4l2loopback
$ make
$ make install
$ modprobe v4l2loopback
In one place I saw you had a “permission denied” error. If at any point you compiled as user root, then leftover intermediate results would interfere with non-root builds. If the directory being modified by a command is root owned and you do not use sudo, then this too would deny.
Within the typical Linux install the headers would be located at “/usr/src/linux-headers-<uname -r>”. Using this directory might mean using “make modules_prepare” (this is if you don’t use the full source and do out of tree build of a module), which in turn modifies that directory and it requires “sudo make modules_prepare”.
For the case of using your own separately downloaded full source make sure the owning directory is not root, or instead use the “O=/some/where” option to not touch the original source. I very highly recommend your original source be pristine (e.g., via “sudo make mrproper”), and only build with an alternate output destination (the “O=/some/where” option).
Because the kernel source tree is not the only tree involved (“source_sync.sh” or more recent source downloads include both a “kernel/kernel-4.4/” directory and a “hardware/nvidia/” directory) cleaning a previous config may not work as expected. In this case you should completely erase your temporary output destination named in the “O=/some/where” and recreate that directory before starting build again. Do not use “sudo” with the “O=/some/where” option.
Building initial module for 4.9.108-tegra
ERROR (dkms apport): kernel package linux-headers-4.9.108-tegra is not supported
Error! Bad return status for module build on kernel: 4.9.108-tegra (aarch64)
Consult /var/lib/dkms/v4l2loopback/0.10.0/build/make.log for more information.