kernel: Consider depmod version when handling kernel modules

* This fixes dirty boot image rebuilding on devices
  with CONFIG_LOCALVERSION_AUTO=y and any driver
  set to =m.
* Basically appending `cat include/config/kernel.release`
  to modules path makes sure that our find does not
  return old modules which would make cp fail with
  'cp: will not overwrite just-created' message.

Change-Id: Ifb79d33b95d7671d8b2d6633644c8b8290d1f442
This commit is contained in:
LuK1337 2019-07-12 12:55:35 +02:00 committed by TheStrix
parent 28ee87c3b0
commit 9f626425bb
1 changed files with 3 additions and 1 deletions

View File

@ -67,6 +67,7 @@ SELINUX_DEFCONFIG := $(TARGET_KERNEL_SELINUX_CONFIG)
## Internal variables
KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
KERNEL_CONFIG := $(KERNEL_OUT)/.config
KERNEL_RELEASE := $(KERNEL_OUT)/include/config/kernel.release
ifeq ($(KERNEL_ARCH),x86_64)
KERNEL_DEFCONFIG_ARCH := x86
@ -250,7 +251,8 @@ INSTALLED_KERNEL_MODULES: depmod-host
$(hide) if grep -q '=m' $(KERNEL_CONFIG); then \
echo "Installing Kernel Modules"; \
$(call make-kernel-target,INSTALL_MOD_PATH=$(MODULES_INTERMEDIATES) modules_install); \
modules=$$(find $(MODULES_INTERMEDIATES) -type f -name '*.ko'); \
kernel_release=$$(cat $(KERNEL_RELEASE)) \
modules=$$(find $(MODULES_INTERMEDIATES)/lib/modules/$$kernel_release -type f -name '*.ko'); \
for f in $$modules; do \
$(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $$f; \
done; \