Blame view
scripts/Makefile.modinst
2.39 KB
b24413180
|
1 |
# SPDX-License-Identifier: GPL-2.0 |
1da177e4c
|
2 3 4 |
# ========================================================================== # Installing modules # ========================================================================== |
4f1933620
|
5 |
PHONY := __modinst |
1da177e4c
|
6 |
__modinst: |
65ce9c383
|
7 |
include include/config/auto.conf |
3204a7fb9
|
8 |
include $(srctree)/scripts/Kbuild.include |
1da177e4c
|
9 |
|
ccae4cfa7
|
10 11 12 13 14 15 16 17 |
modules := $(sort $(shell cat $(MODORDER))) ifeq ($(KBUILD_EXTMOD),) dst := $(MODLIB)/kernel else INSTALL_MOD_DIR ?= extra dst := $(MODLIB)/$(INSTALL_MOD_DIR) endif |
65ce9c383
|
18 19 20 |
suffix-y := suffix-$(CONFIG_MODULE_COMPRESS_GZIP) := .gz suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz |
c3d7ef377
|
21 |
suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst |
65ce9c383
|
22 23 |
modules := $(patsubst $(extmod_prefix)%, $(dst)/%$(suffix-y), $(modules)) |
1da177e4c
|
24 |
|
1da177e4c
|
25 26 |
__modinst: $(modules) @: |
65ce9c383
|
27 28 29 30 31 32 |
quiet_cmd_none = cmd_none = : # # Installation # |
ccae4cfa7
|
33 |
quiet_cmd_install = INSTALL $@ |
65ce9c383
|
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
cmd_install = mkdir -p $(dir $@); cp $< $@ # Strip # # INSTALL_MOD_STRIP, if defined, will cause modules to be stripped after they # are installed. If INSTALL_MOD_STRIP is '1', then the default option # --strip-debug will be used. Otherwise, INSTALL_MOD_STRIP value will be used # as the options to the strip command. ifdef INSTALL_MOD_STRIP ifeq ($(INSTALL_MOD_STRIP),1) strip-option := --strip-debug else strip-option := $(INSTALL_MOD_STRIP) endif quiet_cmd_strip = STRIP $@ cmd_strip = $(STRIP) $(strip-option) $@ else |
ccae4cfa7
|
54 |
|
65ce9c383
|
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
quiet_cmd_strip = cmd_strip = : endif # # Signing # Don't stop modules_install even if we can't sign external modules. # ifeq ($(CONFIG_MODULE_SIG_ALL),y) quiet_cmd_sign = SIGN $@ $(eval $(call config_filename,MODULE_SIG_KEY)) cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509 $@ \ $(if $(KBUILD_EXTMOD),|| true) else quiet_cmd_sign := cmd_sign := : endif |
961ab4a3c
|
73 |
ifeq ($(modules_sign_only),) |
65ce9c383
|
74 |
$(dst)/%.ko: $(extmod_prefix)%.ko FORCE |
ccae4cfa7
|
75 |
$(call cmd,install) |
65ce9c383
|
76 77 |
$(call cmd,strip) $(call cmd,sign) |
961ab4a3c
|
78 79 80 81 82 83 |
else $(dst)/%.ko: FORCE $(call cmd,sign) endif |
65ce9c383
|
84 85 86 87 88 89 90 |
# # Compression # quiet_cmd_gzip = GZIP $@ cmd_gzip = $(KGZIP) -n -f $< quiet_cmd_xz = XZ $@ cmd_xz = $(XZ) --lzma2=dict=2MiB -f $< |
c3d7ef377
|
91 92 |
quiet_cmd_zstd = ZSTD $@ cmd_zstd = $(ZSTD) -T0 --rm -f -q $< |
65ce9c383
|
93 94 95 96 97 98 |
$(dst)/%.ko.gz: $(dst)/%.ko FORCE $(call cmd,gzip) $(dst)/%.ko.xz: $(dst)/%.ko FORCE $(call cmd,xz) |
ccae4cfa7
|
99 |
|
c3d7ef377
|
100 101 |
$(dst)/%.ko.zst: $(dst)/%.ko FORCE $(call cmd,zstd) |
ccae4cfa7
|
102 103 |
PHONY += FORCE FORCE: |
4f1933620
|
104 |
|
4f1933620
|
105 |
.PHONY: $(PHONY) |