Makefile.modsign 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. # SPDX-License-Identifier: GPL-2.0
  2. # ==========================================================================
  3. # Signing modules
  4. # ==========================================================================
  5. PHONY := __modsign
  6. __modsign:
  7. include scripts/Kbuild.include
  8. __modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
  9. modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
  10. PHONY += $(modules)
  11. __modsign: $(modules)
  12. @:
  13. quiet_cmd_sign_ko = SIGN [M] $(2)/$(notdir $@)
  14. cmd_sign_ko = $(mod_sign_cmd) $(2)/$(notdir $@)
  15. # Modules built outside the kernel source tree go into extra by default
  16. INSTALL_MOD_DIR ?= extra
  17. ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
  18. modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
  19. $(modules):
  20. $(call cmd,sign_ko,$(MODLIB)/$(modinst_dir))
  21. # Declare the contents of the .PHONY variable as phony. We keep that
  22. # information in a variable se we can use it in if_changed and friends.
  23. .PHONY: $(PHONY)