1 # SPDX-License-Identifier: GPL-2.0
2 # ==========================================================================
4 # ==========================================================================
9 include include/config/auto.conf
10 include $(srctree)/scripts/Kbuild.include
12 modules := $(sort $(shell cat $(MODORDER)))
14 ifeq ($(KBUILD_EXTMOD),)
15 dst := $(MODLIB)/kernel
17 INSTALL_MOD_DIR ?= extra
18 dst := $(MODLIB)/$(INSTALL_MOD_DIR)
22 suffix-$(CONFIG_MODULE_COMPRESS_GZIP) := .gz
23 suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz
25 modules := $(patsubst $(extmod_prefix)%, $(dst)/%$(suffix-y), $(modules))
36 quiet_cmd_install = INSTALL $@
37 cmd_install = mkdir -p $(dir $@); cp $< $@
41 # INSTALL_MOD_STRIP, if defined, will cause modules to be stripped after they
42 # are installed. If INSTALL_MOD_STRIP is '1', then the default option
43 # --strip-debug will be used. Otherwise, INSTALL_MOD_STRIP value will be used
44 # as the options to the strip command.
45 ifdef INSTALL_MOD_STRIP
47 ifeq ($(INSTALL_MOD_STRIP),1)
48 strip-option := --strip-debug
50 strip-option := $(INSTALL_MOD_STRIP)
53 quiet_cmd_strip = STRIP $@
54 cmd_strip = $(STRIP) $(strip-option) $@
65 # Don't stop modules_install even if we can't sign external modules.
67 ifeq ($(CONFIG_MODULE_SIG_ALL),y)
68 quiet_cmd_sign = SIGN $@
69 $(eval $(call config_filename,MODULE_SIG_KEY))
70 cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509 $@ \
71 $(if $(KBUILD_EXTMOD),|| true)
77 ifeq ($(modules_sign_only),)
79 $(dst)/%.ko: $(extmod_prefix)%.ko FORCE
94 quiet_cmd_gzip = GZIP $@
95 cmd_gzip = $(KGZIP) -n -f $<
97 cmd_xz = $(XZ) --lzma2=dict=2MiB -f $<
99 $(dst)/%.ko.gz: $(dst)/%.ko FORCE
102 $(dst)/%.ko.xz: $(dst)/%.ko FORCE