18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci# ==========================================================================
38c2ecf20Sopenharmony_ci# Installing modules
48c2ecf20Sopenharmony_ci# ==========================================================================
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ciPHONY := __modinst
78c2ecf20Sopenharmony_ci__modinst:
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciinclude scripts/Kbuild.include
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cimodules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order))
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciPHONY += $(modules)
148c2ecf20Sopenharmony_ci__modinst: $(modules)
158c2ecf20Sopenharmony_ci	@:
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci# Don't stop modules_install if we can't sign external modules.
188c2ecf20Sopenharmony_ciquiet_cmd_modules_install = INSTALL $@
198c2ecf20Sopenharmony_ci      cmd_modules_install = \
208c2ecf20Sopenharmony_ci    mkdir -p $(2) ; \
218c2ecf20Sopenharmony_ci    cp $@ $(2) ; \
228c2ecf20Sopenharmony_ci    $(mod_strip_cmd) $(2)/$(notdir $@) ; \
238c2ecf20Sopenharmony_ci    $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) ; \
248c2ecf20Sopenharmony_ci    $(mod_compress_cmd) $(2)/$(notdir $@)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci# Modules built outside the kernel source tree go into extra by default
278c2ecf20Sopenharmony_ciINSTALL_MOD_DIR ?= extra
288c2ecf20Sopenharmony_ciext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cimodinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci$(modules):
338c2ecf20Sopenharmony_ci	$(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci.PHONY: $(PHONY)
36