[PATCH 08/20] build: add make variables for kernel source and object directories
Elliott Mitchell
ehem+openwrt at m5p.com
Sat Nov 11 22:51:08 PST 2023
Precursor to splitting the two apart. Linux kernel sources can be
reused for multiple kernel builds with different configurations.
The object directory cannot be reused.
Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
include/kernel.mk | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/kernel.mk b/include/kernel.mk
index 82d87e8491..ff34f74bed 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -45,6 +45,10 @@ else
endif
KERNEL_BUILD_DIR ?= $(BUILD_DIR)/linux-$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET))
LINUX_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
+ # Location of kernel source files
+ LINUX_SRC_DIR ?= $(LINUX_DIR)
+ # Location of kernel object files
+ LINUX_OBJ_DIR ?= $(LINUX_DIR)
LINUX_UAPI_DIR=uapi/
LINUX_VERMAGIC:=$(strip $(shell cat $(LINUX_DIR)/.vermagic 2>/dev/null))
LINUX_VERMAGIC:=$(if $(LINUX_VERMAGIC),$(LINUX_VERMAGIC),unknown)
@@ -107,6 +111,7 @@ KERNEL_MAKE_FLAGS = \
HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
CROSS_COMPILE="$(KERNEL_CROSS)" \
ARCH="$(LINUX_KARCH)" \
+ O="$(LINUX_OBJ_DIR)" \
KBUILD_HAVE_NLS=no \
KBUILD_BUILD_USER="$(call qstrip,$(CONFIG_KERNEL_BUILD_USER))" \
KBUILD_BUILD_HOST="$(call qstrip,$(CONFIG_KERNEL_BUILD_DOMAIN))" \
@@ -136,7 +141,7 @@ ifneq ($(HOST_OS),Linux)
export SKIP_STACK_VALIDATION:=1
endif
-KERNEL_MAKEOPTS = -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
+KERNEL_MAKEOPTS = -C $(LINUX_SRC_DIR) $(KERNEL_MAKE_FLAGS)
ifdef CONFIG_USE_SPARSE
KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse
--
(\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/)
\BS ( | ehem+openwrt at m5p.com PGP 87145445 | ) /
\_CS\ | _____ -O #include <stddisclaimer.h> O- _____ | / _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
More information about the openwrt-devel
mailing list