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 āsource_sync.shā from the host PC to the Jetson at ā/usr/srcā, run something like this to get full source:
./source_sync.sh -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.
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:
CONFIG_LOCALVERSION="-tegra"
(the string would change if your āuname -rā had a suffix other than ā-tegraā)
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).
Conclusion
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 source_sync.sh, 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 āsource_sync.shā (in the āLinux_for_Tegra/ā directory), then you would get this excerpt of subdirectory structure:
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 source_sync.sh, and this will download the out of tree content. The tag to use depends on release, but the example from earlier is this:
./source_sync.sh -k tegra-l4t-r32.1
I think for R32.3.1 it would be:
./source_sync.sh -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.
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:
KERNEL_OVERLAYS += $(CURDIR)/../nvidia
So, the correct steps are:
./source_sync.sh -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
source_sync.sh can be found somewhere in the download folder of sdkmanager. Not sure if thereās a better way to acquire itā¦
āsource_sync.shā 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.