Kernel Headers not Found After Flashing Jetson Orin NX

I tried installing drivers for an EW-7811Un_V2wifi dongle on a Jetson Orin NX running Jetson Linux r36.4.3

Received an error:

**make[1]: *** No rule to make target ‘modules’. Stop.
**
When looking at the kernel header source directory, I found that both /lib/modules/5.15.148-tegra/build and /lib/modules/5.15.148-tegra/source were symbolic links pointing to a directory on the machine that built the kernel before flashing it to the Jetson.

I tried reflashing the Jetson, but still had links pointing to the computer I built the kernel on.

What fixed it was running the following on the Jetson:

**sudo ln -sfn /usr/src/linux-headers-$(uname -r)-ubuntu22.04_aarch64/3rdparty/canonical/linux-jammy/kernel-source /lib/modules/$(uname -r)/build

sudo ln -sfn /usr/src/linux-headers-$(uname -r)-ubuntu22.04_aarch64/3rdparty/canonical/linux-jammy/kernel-source /lib/modules/$(uname -r)/source
**
After verifying the links had updated I was able to build drivers.

It it expected that this step (updating the links) be left to the end user following flashing, or is this a fault in the cross-compile/flashing process?

Hi,

Please refer to the similar topic

Thanks