Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | # ========================================================================== |
| 3 | # Installing modules |
| 4 | # ========================================================================== |
| 5 | |
Paul Smith | 4f19336 | 2006-03-05 17:14:10 -0500 | [diff] [blame] | 6 | PHONY := __modinst |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | __modinst: |
| 8 | |
Sam Ravnborg | 8ec4b4f | 2005-07-25 20:10:36 +0000 | [diff] [blame] | 9 | include scripts/Kbuild.include |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | |
Masahiro Yamada | d56aec1 | 2019-07-17 15:17:53 +0900 | [diff] [blame] | 11 | modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | |
Paul Smith | 4f19336 | 2006-03-05 17:14:10 -0500 | [diff] [blame] | 13 | PHONY += $(modules) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | __modinst: $(modules) |
| 15 | @: |
| 16 | |
Rusty Russell | f6a79af | 2012-11-06 11:46:59 +1030 | [diff] [blame] | 17 | # Don't stop modules_install if we can't sign external modules. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | quiet_cmd_modules_install = INSTALL $@ |
Bertrand Jacquin | 40e42f6 | 2014-08-27 20:30:56 +0930 | [diff] [blame] | 19 | cmd_modules_install = \ |
| 20 | mkdir -p $(2) ; \ |
| 21 | cp $@ $(2) ; \ |
| 22 | $(mod_strip_cmd) $(2)/$(notdir $@) ; \ |
Douglas Anderson | f84dde10 | 2019-03-15 09:25:03 -0700 | [diff] [blame] | 23 | $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) ; \ |
Bertrand Jacquin | beb50df | 2014-08-27 20:31:56 +0930 | [diff] [blame] | 24 | $(mod_compress_cmd) $(2)/$(notdir $@) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
| 26 | # Modules built outside the kernel source tree go into extra by default |
| 27 | INSTALL_MOD_DIR ?= extra |
Sam Ravnborg | 9b21311 | 2008-01-01 13:40:28 +0100 | [diff] [blame] | 28 | ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
| 30 | modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D)) |
| 31 | |
| 32 | $(modules): |
| 33 | $(call cmd,modules_install,$(MODLIB)/$(modinst_dir)) |
Paul Smith | 4f19336 | 2006-03-05 17:14:10 -0500 | [diff] [blame] | 34 | |
Paul Smith | 4f19336 | 2006-03-05 17:14:10 -0500 | [diff] [blame] | 35 | .PHONY: $(PHONY) |