Makefile: Use $(MODLIB)/build/source symlink for kernel source

After kernel commit d8131c2965d5ee59bfa4d548641e52a13cbe17c9 ("kbuild: remove $(MODLIB)/source symlink") https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d8131c2965d5ee59bfa4d548641e52a13cbe17c9 $(MODLIB)/source no longer exists.  Add support for $(MODLIB)/build/source.
This commit is contained in:
Erich Ritz 2023-11-22 15:06:39 -06:00 committed by GitHub
parent 4c29105335
commit 6996743e65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,7 +28,7 @@ else
else
KERNEL_UNAME ?= $(shell uname -r)
KERNEL_MODLIB := /lib/modules/$(KERNEL_UNAME)
KERNEL_SOURCES := $(shell test -d $(KERNEL_MODLIB)/source && echo $(KERNEL_MODLIB)/source || echo $(KERNEL_MODLIB)/build)
KERNEL_SOURCES := $(shell test -d $(KERNEL_MODLIB)/source && echo $(KERNEL_MODLIB)/source || $(shell test -d $(KERNEL_MODLIB)/build/source && echo $(KERNEL_MODLIB)/build/source || echo $(KERNEL_MODLIB)/build)
endif
KERNEL_OUTPUT := $(KERNEL_SOURCES)
@ -46,6 +46,10 @@ else
KERNEL_OUTPUT := $(KERNEL_MODLIB)/build
KBUILD_PARAMS := KBUILD_OUTPUT=$(KERNEL_OUTPUT)
endif
ifeq ($(KERNEL_SOURCES), $(KERNEL_MODLIB)/build/source)
KERNEL_OUTPUT := $(KERNEL_MODLIB)/build
KBUILD_PARAMS := KBUILD_OUTPUT=$(KERNEL_OUTPUT)
endif
endif
CC ?= cc