I would like to ask for the steps needed in order to build modules targeting other kernels than the one that comes with the OS. For example kernel 5.4 (compiled and installed by myself) instead of the one that comes with Ubuntu 18.04 which is the kernel version 5.0.
I have compiled and installed that kernel but when I have tried to run with VisualKernel it looks for the headers and symbols within the Ubuntu repositories and therefore they are not found. Should I place any file obtained from the compilation somewhere? How could I achieve it?
We would advise creating a VisualKernel project for the kernel itself (see this tutorial). First of all, this will allow building and installing the kernel directly from Visual Studio.
Second of all, all you would need to do when creating a new kernel module, is to select “My Kernel is built with VisualKernel” and point it to the Kernel project file. This will automatically handle build paths, versions and source file mappings (see this tutorial).