Thanks to milhouse, there is a set of two patches available for NVIDIA 384.98 and (legacy) 340.104 with Kernel 4.15-rc1, and details are here: https://devtalk.nvidia.com/default/topic/1026911/linux/4-15-rc1-patches-for-384-98-and-340-104/
The first patch fixes the compile problems, but the load fails with yet another case of GPL incompatibility:
................... Building modules, stage 2. MODPOST 4 modules FATAL: modpost: GPL-incompatible module nvidia-drm.ko uses GPL-only symbol 'ex_handler_refcount' make: *** [/usr/src/linux-4.15-rc1/scripts/Makefile.modpost:92: __modpost] Error 1 make: *** [/usr/src/linux-4.15-rc1/Makefile:1506: modules] Error 2 make: Leaving directory '/usr/src/linux-4.15-rc1' make: *** [Makefile:146: sub-make] Error 2 make: Leaving directory '/usr/src/linux-4.15-rc1' make: *** [Makefile:81: modules] Error 2
The second patch is technically ‘illegal’, as it changes the licence in ~/kernel/nvidia-drm/nvidia-drm-linux.c from MIT to GPL… but does allow the driver to load successfully..
This GPL problem with NVIDIA seems to occur with monotonous regularity for each new kernel release, now.. If past experience is anything to go by, this will probably be fixed – eventually – by some kindly kernel dev opting to change the licensing requirement back to non-GPL-only..
I have done some digging around, and the change in kernel code would appear to be this mega-patch: https://github.com/torvalds/linux/commit/b24413180f5600bcb3bb70fbed5cf186b60864bd
Another option, which may not be suitable for many systems – is to compile without drm..
# export NV_EXCLUDE_KERNEL_MODULES=nvidia-drm # make ......etc..
Robert Gadsdon. November 28, 2017.