From 128cded862f766b92d3f066eac40d51c034f2c1e Mon Sep 17 00:00:00 2001 From: Serin Yeh Date: Fri, 13 Mar 2026 15:46:11 +0800 Subject: [PATCH] Add conditions for IPU7 to build necessary modules Signed-off-by: Serin Yeh --- Makefile | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 66a46ee..db7ae5b 100644 --- a/Makefile +++ b/Makefile @@ -4,13 +4,35 @@ KERNELRELEASE ?= $(shell uname -r) KERNEL_SRC ?= /lib/modules/$(KERNELRELEASE)/build MODSRC := $(shell pwd) +KERNEL_VERSION := $(shell echo $(KERNELRELEASE) | sed 's/[^0-9.]*\([0-9.]*\).*/\1/') + +version_lt = $(shell \ + v1=$(1); \ + v2=$(2); \ + IFS='.'; \ + set -- $$v1; i=$${1:-0}; j=$${2:-0}; k=$${3:-0}; \ + set -- $$v2; a=$${1:-0}; b=$${2:-0}; c=$${3:-0}; \ + if [ "$$i" -lt "$$a" ]; then \ + echo "true"; \ + elif [ "$$i" -eq "$$a" ] && [ "$$j" -lt "$$b" ]; then \ + echo "true"; \ + elif [ "$$i" -eq "$$a" ] && [ "$$j" -eq "$$b" ] && [ "$$k" -lt "$$c" ]; then \ + echo "true"; \ + else \ + echo "false"; \ + fi) + +KV_IPU7_ISYS := 6.17.0 export EXTERNAL_BUILD = 1 export CONFIG_VIDEO_INTEL_IPU7 = m export CONFIG_IPU_BRIDGE = y -# Default: only build IPU7 drivers (no ACPI) +ifeq ($(call version_lt,$(KERNEL_VERSION),$(KV_IPU7_ISYS)),true) obj-y += drivers/media/pci/intel/ipu7/ +else +obj-y += drivers/media/pci/intel/ipu7/psys/ +endif # For ACPI build: add platform drivers ifdef BUILD_INTEL_IPU_ACPI