Kernel header/source problem on Xavier AGX

Hello,
I’m trying to compile Wireguard on a Xaveir AGX device. However the following error is reported when I try to build the kernel module:

$ make -C wireguard-linux-compat/src -j$(nproc)
make: Entering directory '/home/imperiumdrive/javad/wireguard/wireguard-linux-compat/src'
make[1]: Entering directory '/home/imperiumdrive/javad/wireguard/wireguard-linux-compat/src'
make[1]: *** /lib/modules/4.9.253-tegra/build: No such file or directory. Stop.
make[1]: Leaving directory '/home/imperiumdrive/javad/wireguard/wireguard-linux-compat/src'
Makefile:26: recipe for target 'module' failed
make: *** [module] Error 2

I found this thread that works on Jetson Nano, but not on Xavier AGX

I’m not sure, but NVDIA might have a “linux-headers-...something...” now (the “something” would include 4.9.253-tegra…other headers won’t work if not for that). However, I’ve never used that. You can actually place the full kernel source at that symbolic link location, followed by configuring it to match the running system.

Can anyone from NVIDIA suggest if there is actually a 4.9.253-tegra kernel-headers package?

What L4T release is this? You can find it via “head -n 1 /etc/nv_tegra_release”. Then you can download source for that L4T release. See:
https://developer.nvidia.com/linux-tegra

There is a public sources download. Within that is a kernel sources (you have to extract one package from the other). When you unpack this in an empty location it generates “sources/kernel/kernel-4.9/”. If you perform the unpack with sudo from location “/usr/src/”, then the content you need should be generated (it also includes out of tree content, which just headers might fail to have).

For configuration, once that is there, from the “/usr/src/sources/kernel/kernel-4.9”, you can do this:

  • cp /proc/config.gz .
    (the trailing “.” is important)
  • gunzip config.gz
  • mv config .config
  • make modules_prepare

All of the above would need to be done as root. It is of course easier if there is a package, and maybe there is one these days, not sure. The above though makes the entire source available (and if space is at a premium, then that is a problem).

Thanks a lot for your great help. I will test it and will put the results here.

Follow the steps in https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3271/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/kernel_custom.html#

This will help in downloading the kernel sources and prepare the build environment (like /lib/modules/4.9.253-tegra/build) for compiling your external kernel modules

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.