Makefile.modsign 1005 B

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