[PATCH 17/20] [WIP] build: split kernel object directory from kernel source directory
Elliott Mitchell
ehem+openwrt at m5p.com
Sat Nov 11 22:51:08 PST 2023
Allows for reusing a kernel source directory for multiple builds.
Alternatively allows cleaning out an old kernel build without needing
to delete source files.
Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
I'll confess I'm less than certain about several of these. From
looking I *think* they need the object directory, but this needs
someone to check.
---
package/kernel/bpf-headers/Makefile | 4 ++--
package/network/utils/iptables/Makefile | 2 +-
package/utils/spidev_test/Makefile | 4 ++--
target/imagebuilder/Makefile | 2 +-
target/linux/uml/image/Makefile | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/package/kernel/bpf-headers/Makefile b/package/kernel/bpf-headers/Makefile
index e000a1d56c..a8a5258c64 100644
--- a/package/kernel/bpf-headers/Makefile
+++ b/package/kernel/bpf-headers/Makefile
@@ -31,8 +31,8 @@ GENERIC_FILES_DIR := $(foreach dir,$(wildcard $(GENERIC_PLATFORM_DIR)/files $(GE
PATCH_DIR := $(CURDIR)/patches
FILES_DIR :=
-REAL_LINUX_DIR := $(LINUX_DIR)
-LINUX_DIR := $(PKG_BUILD_DIR)
+REAL_LINUX_DIR := $(LINUX_OBJ_DIR)
+LINUX_SRC_DIR := $(PKG_BUILD_DIR)
include $(INCLUDE_DIR)/bpf.mk
include $(INCLUDE_DIR)/package.mk
diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile
index f3477e8cac..0362559513 100644
--- a/package/network/utils/iptables/Makefile
+++ b/package/network/utils/iptables/Makefile
@@ -608,7 +608,7 @@ MAKE_FLAGS := \
$(TARGET_CONFIGURE_OPTS) \
COPT_FLAGS="$(TARGET_CFLAGS)" \
KERNEL_DIR="$(LINUX_OBJ_DIR)/user_headers/" PREFIX=/usr \
- KBUILD_OUTPUT="$(LINUX_DIR)" \
+ KBUILD_OUTPUT="$(LINUX_OBJ_DIR)" \
BUILTIN_MODULES="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
diff --git a/package/utils/spidev_test/Makefile b/package/utils/spidev_test/Makefile
index fef5c8f646..c06c2f55a8 100644
--- a/package/utils/spidev_test/Makefile
+++ b/package/utils/spidev_test/Makefile
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=spidev-test
PKG_RELEASE:=$(LINUX_VERSION)
-PKG_BUILD_DIR:=$(LINUX_DIR)/tools/spi-$(TARGET_DIR_NAME)
+PKG_BUILD_DIR:=$(LINUX_OBJ_DIR)/tools/spi-$(TARGET_DIR_NAME)
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
@@ -31,7 +31,7 @@ endef
define Build/Prepare
# For SDK: Sources are copied by target/sdk/Makefile's
# USERSPACE_UTILS(_FILES)
- $(CP) $(LINUX_DIR)/tools/spi/* $(PKG_BUILD_DIR)/
+ $(CP) $(LINUX_OBJ_DIR)/tools/spi/* $(PKG_BUILD_DIR)/
endef
MAKE_FLAGS = \
diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile
index 59698d868c..c4910b6c4b 100644
--- a/target/imagebuilder/Makefile
+++ b/target/imagebuilder/Makefile
@@ -87,7 +87,7 @@ endif
$(PKG_BUILD_DIR)/target/linux/*/patches{,-*} \
$(PKG_BUILD_DIR)/target/linux/generic/{pending,backport,hack}{,-*}
-cp $(KERNEL_BUILD_DIR)/* $(IB_KDIR)/ # don't copy subdirectories here
- -cp $(LINUX_DIR)/.config $(IB_LDIR)/
+ -cp $(LINUX_OBJ_DIR)/.config $(IB_LDIR)/
rm -f $(IB_KDIR)/root.*
rm -f $(IB_KDIR)/vmlinux.debug
if [ -x $(LINUX_OBJ_DIR)/scripts/dtc/dtc ]; then \
diff --git a/target/linux/uml/image/Makefile b/target/linux/uml/image/Makefile
index 45ab0cfbcd..225e6efa85 100644
--- a/target/linux/uml/image/Makefile
+++ b/target/linux/uml/image/Makefile
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
define Image/Prepare
- cp $(LINUX_DIR)/linux $(KDIR)/vmlinux.elf
+ cp $(LINUX_OBJ_DIR)/linux $(KDIR)/vmlinux.elf
endef
define Image/Build/squashfs
--
(\___(\___(\______ --=> 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