Commit e0b250b5 authored by Jonas Zeiger's avatar Jonas Zeiger Committed by Masahiro Yamada

Makefile: install modules.builtin even if CONFIG_MODULES=n

Many applications check for available kernel features via:

  - /proc/modules (loaded modules, present if CONFIG_MODULES=y)
  - $(MODLIB)/modules.builtin (builtin modules)

They fail to detect features if the kernel was built with CONFIG_MODULES=n
and modules.builtin isn't installed.

Therefore, add the target "_builtin_inst_" and make "install" and
"modules_install" depend on it.

Tests results:

  - make install: kernel image is copied as before, modules.builtin copied
  - make modules_install: (CONFIG_MODULES=n) nothing is copied, exit 1
Signed-off-by: default avatarJonas Zeiger <jonas.zeiger@talpidae.net>
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent 72d24acc
...@@ -1322,6 +1322,16 @@ dt_binding_check: scripts_dtc ...@@ -1322,6 +1322,16 @@ dt_binding_check: scripts_dtc
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Modules # Modules
# install modules.builtin regardless of CONFIG_MODULES
PHONY += _builtin_inst_
_builtin_inst_:
@mkdir -p $(MODLIB)/
@cp -f modules.builtin $(MODLIB)/
@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
PHONY += install
install: _builtin_inst_
ifdef CONFIG_MODULES ifdef CONFIG_MODULES
# By default, build modules as well # By default, build modules as well
...@@ -1365,7 +1375,7 @@ PHONY += modules_install ...@@ -1365,7 +1375,7 @@ PHONY += modules_install
modules_install: _modinst_ _modinst_post modules_install: _modinst_ _modinst_post
PHONY += _modinst_ PHONY += _modinst_
_modinst_: _modinst_: _builtin_inst_
@rm -rf $(MODLIB)/kernel @rm -rf $(MODLIB)/kernel
@rm -f $(MODLIB)/source @rm -f $(MODLIB)/source
@mkdir -p $(MODLIB)/kernel @mkdir -p $(MODLIB)/kernel
...@@ -1375,8 +1385,6 @@ _modinst_: ...@@ -1375,8 +1385,6 @@ _modinst_:
ln -s $(CURDIR) $(MODLIB)/build ; \ ln -s $(CURDIR) $(MODLIB)/build ; \
fi fi
@sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
@cp -f modules.builtin $(MODLIB)/
@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
# This depmod is only for convenience to give the initial # This depmod is only for convenience to give the initial
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment