Beaglebone Black Kernel Module

Hello Online community,

I am facing a problem, which I need assistence for. I want to write a Kernel Module to my Beaglebone Black, and the Makefile is not working, because the default path /lib/modules/$(shell uname -r)/build does not exist on the Kernel (4.14.71-ti-r80) I am using.

I would like to know which file path is the correct one. I also want to know if it is even possible to compile a Kernelmodule right on the Beaglebone Black, or it has to be done by crosscompiling.

Regards

Chris