@@ -1458,7 +1458,6 @@ endif
1458
1458
1459
1459
PHONY += modules
1460
1460
modules : $(if $(KBUILD_BUILTIN ) ,vmlinux) modules_check modules_prepare
1461
- $(Q )$(MAKE ) -f $(srctree ) /scripts/Makefile.modpost
1462
1461
1463
1462
PHONY += modules_check
1464
1463
modules_check : modules.order
@@ -1476,12 +1475,9 @@ PHONY += modules_prepare
1476
1475
modules_prepare : prepare
1477
1476
$(Q )$(MAKE ) $(build ) =scripts scripts/module.lds
1478
1477
1479
- # Target to install modules
1480
- PHONY += modules_install
1481
- modules_install : _modinst_ _modinst_post
1482
-
1483
- PHONY += _modinst_
1484
- _modinst_ :
1478
+ modules_install : __modinst_pre
1479
+ PHONY += __modinst_pre
1480
+ __modinst_pre :
1485
1481
@rm -rf $(MODLIB ) /kernel
1486
1482
@rm -f $(MODLIB ) /source
1487
1483
@mkdir -p $(MODLIB ) /kernel
@@ -1493,35 +1489,13 @@ _modinst_:
1493
1489
@sed ' s:^:kernel/:' modules.order > $(MODLIB ) /modules.order
1494
1490
@cp -f modules.builtin $(MODLIB ) /
1495
1491
@cp -f $(objtree ) /modules.builtin.modinfo $(MODLIB ) /
1496
- $(Q )$(MAKE ) -f $(srctree ) /scripts/Makefile.modinst
1497
-
1498
- # This depmod is only for convenience to give the initial
1499
- # boot a modules.dep even before / is mounted read-write. However the
1500
- # boot script depmod is the master version.
1501
- PHONY += _modinst_post
1502
- _modinst_post : _modinst_
1503
- $(call cmd,depmod)
1504
1492
1505
1493
ifeq ($(CONFIG_MODULE_SIG ) , y)
1506
1494
PHONY += modules_sign
1507
1495
modules_sign :
1508
1496
$(Q )$(MAKE ) -f $(srctree ) /scripts/Makefile.modsign
1509
1497
endif
1510
1498
1511
- else # CONFIG_MODULES
1512
-
1513
- # Modules not configured
1514
- # ---------------------------------------------------------------------------
1515
-
1516
- PHONY += modules modules_install
1517
- modules modules_install :
1518
- @echo >&2
1519
- @echo >&2 " The present kernel configuration has modules disabled."
1520
- @echo >&2 " Type 'make config' and enable loadable module support."
1521
- @echo >&2 " Then build a kernel with module support enabled."
1522
- @echo >&2
1523
- @exit 1
1524
-
1525
1499
endif # CONFIG_MODULES
1526
1500
1527
1501
# ##
@@ -1769,24 +1743,9 @@ KBUILD_BUILTIN :=
1769
1743
KBUILD_MODULES := 1
1770
1744
1771
1745
build-dirs := $(KBUILD_EXTMOD )
1772
- PHONY += modules
1773
- modules : $(MODORDER )
1774
- $(Q )$(MAKE ) -f $(srctree ) /scripts/Makefile.modpost
1775
-
1776
1746
$(MODORDER ) : descend
1777
1747
@:
1778
1748
1779
- PHONY += modules_install
1780
- modules_install : _emodinst_ _emodinst_post
1781
-
1782
- PHONY += _emodinst_
1783
- _emodinst_ :
1784
- $(Q )$(MAKE ) -f $(srctree ) /scripts/Makefile.modinst
1785
-
1786
- PHONY += _emodinst_post
1787
- _emodinst_post : _emodinst_
1788
- $(call cmd,depmod)
1789
-
1790
1749
compile_commands.json : $(extmod-prefix ) compile_commands.json
1791
1750
PHONY += compile_commands.json
1792
1751
@@ -1809,6 +1768,39 @@ PHONY += prepare modules_prepare
1809
1768
1810
1769
endif # KBUILD_EXTMOD
1811
1770
1771
+ # ---------------------------------------------------------------------------
1772
+ # Modules
1773
+
1774
+ PHONY += modules modules_install
1775
+
1776
+ ifdef CONFIG_MODULES
1777
+
1778
+ modules : $(MODORDER )
1779
+ $(Q )$(MAKE ) -f $(srctree ) /scripts/Makefile.modpost
1780
+
1781
+ quiet_cmd_depmod = DEPMOD $(KERNELRELEASE )
1782
+ cmd_depmod = $(CONFIG_SHELL ) $(srctree ) /scripts/depmod.sh $(DEPMOD ) \
1783
+ $(KERNELRELEASE )
1784
+
1785
+ modules_install :
1786
+ $(Q )$(MAKE ) -f $(srctree ) /scripts/Makefile.modinst
1787
+ $(call cmd,depmod)
1788
+
1789
+ else # CONFIG_MODULES
1790
+
1791
+ # Modules not configured
1792
+ # ---------------------------------------------------------------------------
1793
+
1794
+ modules modules_install :
1795
+ @echo >&2 ' ***'
1796
+ @echo >&2 ' *** The present kernel configuration has modules disabled.'
1797
+ @echo >&2 ' *** To use the module feature, please run "make menuconfig" etc.'
1798
+ @echo >&2 ' *** to enable CONFIG_MODULES.'
1799
+ @echo >&2 ' ***'
1800
+ @exit 1
1801
+
1802
+ endif # CONFIG_MODULES
1803
+
1812
1804
# Single targets
1813
1805
# ---------------------------------------------------------------------------
1814
1806
# To build individual files in subdirectories, you can do like this:
@@ -1997,11 +1989,6 @@ tools/%: FORCE
1997
1989
quiet_cmd_rmfiles = $(if $(wildcard $(rm-files ) ) ,CLEAN $(wildcard $(rm-files ) ) )
1998
1990
cmd_rmfiles = rm -rf $(rm-files )
1999
1991
2000
- # Run depmod only if we have System.map and depmod is executable
2001
- quiet_cmd_depmod = DEPMOD $(KERNELRELEASE )
2002
- cmd_depmod = $(CONFIG_SHELL ) $(srctree ) /scripts/depmod.sh $(DEPMOD ) \
2003
- $(KERNELRELEASE )
2004
-
2005
1992
# read saved command lines for existing targets
2006
1993
existing-targets := $(wildcard $(sort $(targets ) ) )
2007
1994
0 commit comments