Skip to content

Commit e0b250b

Browse files
lyindmasahir0y
authored andcommitted
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: Jonas Zeiger <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 72d24ac commit e0b250b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Makefile

+11-3
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,16 @@ dt_binding_check: scripts_dtc
13221322
# ---------------------------------------------------------------------------
13231323
# Modules
13241324

1325+
# install modules.builtin regardless of CONFIG_MODULES
1326+
PHONY += _builtin_inst_
1327+
_builtin_inst_:
1328+
@mkdir -p $(MODLIB)/
1329+
@cp -f modules.builtin $(MODLIB)/
1330+
@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
1331+
1332+
PHONY += install
1333+
install: _builtin_inst_
1334+
13251335
ifdef CONFIG_MODULES
13261336

13271337
# By default, build modules as well
@@ -1365,7 +1375,7 @@ PHONY += modules_install
13651375
modules_install: _modinst_ _modinst_post
13661376

13671377
PHONY += _modinst_
1368-
_modinst_:
1378+
_modinst_: _builtin_inst_
13691379
@rm -rf $(MODLIB)/kernel
13701380
@rm -f $(MODLIB)/source
13711381
@mkdir -p $(MODLIB)/kernel
@@ -1375,8 +1385,6 @@ _modinst_:
13751385
ln -s $(CURDIR) $(MODLIB)/build ; \
13761386
fi
13771387
@sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
1378-
@cp -f modules.builtin $(MODLIB)/
1379-
@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
13801388
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
13811389

13821390
# This depmod is only for convenience to give the initial

0 commit comments

Comments
 (0)