no build directory(kernel source ) present on jetson tx2

there is no kernel source avaliable for which image my jetson is booted

/lib/modules/uname -r/build

o/p of uname -r is 4.4.38ged8e6c8

plz let me know how to find out kernel source path for which present kernel is built n booted

i need this information to build & load my driver, while loading its is failing “invalid exe format” which suggests that source code using which the driver module is built is different from the the source code using which Image is built n booted .

thanks

That directory is more or less “tradition”. If one were to install kernel source for that release, and configure that source to be the same as what produced the modules, then this is what would be at that location. There is no standard mechanism for installing the NVIDIA version of the kernel source, but if you follow this, then you can get the full source correctly installed for native builds. Just make sure to do any kind of download or source_sync.sh command using your actual kernel version:
[url]how to upgrade linux-headers-4.4.38-tegra to latest kernel and headers - Jetson TX2 - NVIDIA Developer Forums

Btw, invalid exe implies you are mixing the arm64/aarch64/ARMv8-a format of the Jetson with something else, e.g., running a PC’s format of executable would cause such an error. If you cross compile instead of doing native compile, then you have more requirements. The above URL is for native install, not foreign/cross compile.