android_kernel_xiaomi_sm8450/scripts/Makefile.modsign
Masahiro Yamada ea808f5a4b
BACKPORT: kbuild: prefix $(srctree)/ to some included Makefiles
VPATH is used in Kbuild to make pattern rules search for prerequisites
in both $(objtree) and $(srctree). Some of *.c, *.S files are not real
sources, but generated by tools such as flex, bison, perl.

In contrast, I doubt the benefit of --include-dir=$(abs_srctree) because
it is always clear which Makefiles are real sources, and which are not.

So, my hope is to add $(srctree)/ prefix to all check-in Makefiles,
then remove --include-dir=$(abs_srctree) flag in the future.

I am touching only some Kbuild core parts for now. Treewide fixes will
be needed to achieve this goal.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
(cherry picked from commit 3204a7fb98a3bccd0004ea0f2769fbeadc2c2dba)
[nd: conflict in scripts/Makefile.modpost due to d7a956441fef, which is
itself a backport of 850ded46c642]
Bug: 189327973
Bug: 209655537
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: I691d266b68d769ec0fabcc98ed515cfb1cad5ccf
2024-05-08 03:00:09 +03:00

30 lines
802 B
Makefile

# SPDX-License-Identifier: GPL-2.0
# ==========================================================================
# Signing modules
# ==========================================================================
PHONY := __modsign
__modsign:
include $(srctree)/scripts/Kbuild.include
modules := $(sort $(shell cat modules.order))
PHONY += $(modules)
__modsign: $(modules)
@:
quiet_cmd_sign_ko = SIGN [M] $(2)/$(notdir $@)
cmd_sign_ko = $(mod_sign_cmd) $(2)/$(notdir $@)
# Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra
ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
$(modules):
$(call cmd,sign_ko,$(MODLIB)/$(modinst_dir))
.PHONY: $(PHONY)