Skip to content
Snippets Groups Projects
  • Theodore Ts'o's avatar
    ac031f26
    kbuild: add option for stripping modules while installing them · ac031f26
    Theodore Ts'o authored
    
    Add option for stripping modules while installing them.
    
    This function adds support for stripping modules while they are being
    installed.  CONFIG_DEBUG_KERNEL (which will probably become more
    popular as developers use kdump) causes the size of the installed
    modules to grow by a factor of 9 or so.
    
    Some kernel package systems solve this problem by stripping the debug
    information from /lib/modules after running "make modules_install",
    but that may not work for people who are installing directly into
    /lib/modules --- root partitions that were sized to handle 16 megs
    worth of modules may not be quite so happy with 145 megs of modules,
    so the "make modules_install" never succeeds.
    
    This patch allows such users to request modules_install to strip the
    modules as they are installed.
    
    Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
    ac031f26
    History
    kbuild: add option for stripping modules while installing them
    Theodore Ts'o authored
    
    Add option for stripping modules while installing them.
    
    This function adds support for stripping modules while they are being
    installed.  CONFIG_DEBUG_KERNEL (which will probably become more
    popular as developers use kdump) causes the size of the installed
    modules to grow by a factor of 9 or so.
    
    Some kernel package systems solve this problem by stripping the debug
    information from /lib/modules after running "make modules_install",
    but that may not work for people who are installing directly into
    /lib/modules --- root partitions that were sized to handle 16 megs
    worth of modules may not be quite so happy with 145 megs of modules,
    so the "make modules_install" never succeeds.
    
    This patch allows such users to request modules_install to strip the
    modules as they are installed.
    
    Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Makefile.modinst 1.00 KiB
# ==========================================================================
# Installing modules
# ==========================================================================

PHONY := __modinst
__modinst:

include scripts/Kbuild.include

#

__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))

PHONY += $(modules)
__modinst: $(modules)
	@:

quiet_cmd_modules_install = INSTALL $@
      cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@)

# Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra
ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(KBUILD_EXTMOD),,$(@D))

modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))

$(modules):
	$(call cmd,modules_install,$(MODLIB)/$(modinst_dir))


# Declare the contents of the .PHONY variable as phony.  We keep that
# information in a variable se we can use it in if_changed and friends.

.PHONY: $(PHONY)