errror executing modules prepare

root@jetbot:/usr/src/linux-headers-4.9.140-tegra-ubuntu18.04_aarch64/kernel-4.9# modules prepare
bash: modules: command not found
root@jetbot:/usr/src/linux-headers-4.9.140-tegra-ubuntu18.04_aarch64/kernel-4.9# make modules prepare
scripts/kconfig/conf  --silentoldconfig Kconfig
drivers/net/ethernet/nvidia/Kconfig:30: can't open file "drivers/net/ethernet/nvidia/eqos/Kconfig"
scripts/kconfig/Makefile:37: recipe for target 'silentoldconfig' failed
make[2]: *** [silentoldconfig] Error 1
Makefile:565: recipe for target 'silentoldconfig' failed
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/kernel.release'.  Stop.

Previously the approach worked and I installed v4l2loopback module with it, as far as I remember.

Reference found:

I don’t see the underscore ‘_’ between “modules” and “prepare”. If this is copy and paste then I’m thinking it is missing in the actual command. Should be “modules_prepare” instead of “modules prepare”.

However, there are other possible errors even if the “modules_prepare” is correct. Typically what I’ve done is to copy the “” from the host PC to the Jetson at “/usr/src”, run something like this to get full source:

./ -k tegra-l4t-r32.1

Now you will have “/usr/src/sources/kernel/kernel-4.9”. Copy the “/proc/config.gz” there, gunzip it, rename as “.config”, set CONFIG_LOCALVERSION="-tegra" (or whatever your current “uname -r” suffix is), and then update the symbolic link in “/lib/modules/$(uname -r)/”:

cd /lib/modules/$(uname -r)
rm build
ln -s /usr/src/sources/kernel/kernel-4.9 build
cd /usr/src/sources/kernel/kernel-4.9 build
sudo make modules_prepare

At this point you will have a guaranteed full source with any relative paths going outside of the tree also being there. If you want to switch back to the default headers just point the sym link back to the original headers directory.

It turned out:

make modules_prepare

is not required anymore to build the v4l2loopback kernel module

neither at last releases the command work on nano nor on xaviers anymore, though, it is not the issue because of I)

Sorry to raise this topic again, but I was facing the same issue during building v4l2loopback dkms package, and it didn’t worked without make modules_prepare. Maybe I’m doing something wrong?..

First, if I just tried to build the module, I got the following in logs:

make[1]: Entering directory '/usr/src/linux-headers-4.9.140'

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

So, I tried to do “make modules_prepare”, and found same errors (can’t open file “drivers/net/ethernet/nvidia/eqos/Kconfig”) etc.

The fastest way to “solve” this was to just comment out missing files in Kconfig.

After that dkms autoinstall executed correctly, but still I think it’s a workaround, not a solution, because I need to modify kernel sources by myself.

Wherever your config is being searched for I recommend you copy the “/proc/config.gz” there, gunzip it, rename it as “.config”, and then edit the CONFIG_LOCALVERSION to:


(the string would change if your “uname -r” had a suffix other than “-tegra”)

From there try the modules_prepare.

You may try this topic for building v4l2loopback.

Thank you for responses!

I remember trying CONFIG_LOCALVERSION="-tegra" in .config file under linux headers directory, but it produced no effect. I guess, this setting is needed only to find folder with kernel sources?

Also I checked 1058526 and 1044016 topics, but those are apparently about different issues, because my error is

can't open file "drivers/net/ethernet/nvidia/eqos/Kconfig"

I’m building v4l2loopback-dkms v0.12.3-1, but the same happens for the default one (0.10).

The root of the problem is kernel sources. It doesn’t matter what module I try to build.

Currently I’m building with kernel got from nvidia downloads for r32.2.
Before, if I remember correctly, I tried, but with the same result.

This issue won’t reproduce, if you already have prepared kernel. So it needs cleaning before:

cd <kernel source root>
make mrproper
cat /proc/config.gz | gunzip > .config

This is the issue, and requires a bit of explanation:

can't open file "drivers/net/ethernet/nvidia/eqos/Kconfig"

Normally, if you get your kernel source code from some of the more common places, you get only the kernel source. However, there are certain config items which can refer to out of tree content relative to the regular kernel sources. The directory “drivers/net/ethernet/nvidia/eqos/Kconfig” can only be accessed through a relative path to source code outside of the regular kernel source.

If you were to download the kernel source via “” (in the “Linux_for_Tegra/” directory), then you would get this excerpt of subdirectory structure:

├── hardware
│   └── nvidia
├── kernel
│   ├── kernel-4.9
│   ├── nvgpu
│   └── nvidia
└── u-boot

The “sources/kernel/kernel-4.9/” is the base kernel source. The path you need is in “sources/kernel/nvidia/”, and that directory is missing for your case. Earlier there is a suggestion of how to download via, and this will download the out of tree content. The tag to use depends on release, but the example from earlier is this:

./ -k tegra-l4t-r32.1

I think for R32.3.1 it would be:

./ -k tegra-l4t-r32.3-1

When you have the full source it will probably work. If you cut out features referring to the out of tree content, then it would also work, but then you wouldn’t have the features anymore.

Thank you very much, it was super helpful!

Indeed the error was due to missing nvidia folder. I thought it’s unnecessary, but apparently I was wrong.
There’s a line in Makefile, which probably explains why:


So, the correct steps are:

./ -k tegra-l4t-r32.3-1   # should be replaced by installed version
sudo ln -sfn $(pwd)/sources/kernel/kernel-4.9/ /lib/modules/4.9.140/build
cd sources/kernel/kernel-4.9/
cat /proc/config.gz | gunzip > .config

make modules_prepare
sudo apt install --reinstall v4l2loopback-dkms   # or any other module

Version can be found with

head -n 1 /etc/nv_tegra_release can be found somewhere in the download folder of sdkmanager. Not sure if there’s a better way to acquire it…

“” is part of the “driver package”, and the driver package can be downloaded separately. SDKM is just a convenience front end and the actual flash is through that package after SDKM performance the download and unpack.

1 Like