| .. | .. |
|---|
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 |
|---|
| 2 | 2 | VERSION = 5 |
|---|
| 3 | 3 | PATCHLEVEL = 10 |
|---|
| 4 | | -SUBLEVEL = 160 |
|---|
| 4 | +SUBLEVEL = 198 |
|---|
| 5 | 5 | EXTRAVERSION = |
|---|
| 6 | 6 | NAME = Dare mighty things |
|---|
| 7 | 7 | |
|---|
| .. | .. |
|---|
| 93 | 93 | |
|---|
| 94 | 94 | # If the user is running make -s (silent mode), suppress echoing of |
|---|
| 95 | 95 | # commands |
|---|
| 96 | +# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS. |
|---|
| 96 | 97 | |
|---|
| 97 | | -ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) |
|---|
| 98 | | - quiet=silent_ |
|---|
| 98 | +ifeq ($(filter 3.%,$(MAKE_VERSION)),) |
|---|
| 99 | +silence:=$(findstring s,$(firstword -$(MAKEFLAGS))) |
|---|
| 100 | +else |
|---|
| 101 | +silence:=$(findstring s,$(filter-out --%,$(MAKEFLAGS))) |
|---|
| 102 | +endif |
|---|
| 103 | + |
|---|
| 104 | +ifeq ($(silence),s) |
|---|
| 105 | +quiet=silent_ |
|---|
| 99 | 106 | endif |
|---|
| 100 | 107 | |
|---|
| 101 | 108 | export quiet Q KBUILD_VERBOSE |
|---|
| .. | .. |
|---|
| 522 | 529 | -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \ |
|---|
| 523 | 530 | -Werror=implicit-function-declaration -Werror=implicit-int \ |
|---|
| 524 | 531 | -Werror=return-type -Wno-format-security \ |
|---|
| 532 | + -w \ |
|---|
| 525 | 533 | -std=gnu89 |
|---|
| 526 | 534 | KBUILD_CPPFLAGS := -D__KERNEL__ |
|---|
| 527 | 535 | KBUILD_AFLAGS_KERNEL := |
|---|
| .. | .. |
|---|
| 597 | 605 | ifneq ($(GCC_TOOLCHAIN),) |
|---|
| 598 | 606 | CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN) |
|---|
| 599 | 607 | endif |
|---|
| 600 | | -ifneq ($(LLVM_IAS),1) |
|---|
| 601 | | -CLANG_FLAGS += -no-integrated-as |
|---|
| 608 | +ifeq ($(LLVM_IAS),1) |
|---|
| 609 | +CLANG_FLAGS += -fintegrated-as |
|---|
| 610 | +else |
|---|
| 611 | +CLANG_FLAGS += -fno-integrated-as |
|---|
| 602 | 612 | endif |
|---|
| 603 | 613 | CLANG_FLAGS += -Werror=unknown-warning-option |
|---|
| 604 | 614 | KBUILD_CFLAGS += $(CLANG_FLAGS) |
|---|
| .. | .. |
|---|
| 828 | 838 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) |
|---|
| 829 | 839 | |
|---|
| 830 | 840 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) |
|---|
| 841 | + |
|---|
| 842 | +# These result in bogus false positives |
|---|
| 843 | +KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer) |
|---|
| 844 | + |
|---|
| 831 | 845 | ifdef CONFIG_FRAME_POINTER |
|---|
| 832 | 846 | KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls |
|---|
| 833 | 847 | else |
|---|
| .. | .. |
|---|
| 871 | 885 | DEBUG_CFLAGS += -g |
|---|
| 872 | 886 | endif |
|---|
| 873 | 887 | |
|---|
| 874 | | -ifeq ($(LLVM_IAS),1) |
|---|
| 888 | +ifdef CONFIG_AS_IS_LLVM |
|---|
| 875 | 889 | KBUILD_AFLAGS += -g |
|---|
| 876 | 890 | else |
|---|
| 877 | 891 | KBUILD_AFLAGS += -Wa,-gdwarf-2 |
|---|
| .. | .. |
|---|
| 1519 | 1533 | |
|---|
| 1520 | 1534 | PHONY += modules |
|---|
| 1521 | 1535 | # if KBUILD_BUILTIN && !KBUILD_MIXED_TREE, depend on vmlinux |
|---|
| 1522 | | -modules: $(if $(KBUILD_BUILTIN), $(if $(KBUILD_MIXED_TREE),,vmlinux)) |
|---|
| 1523 | | -modules: modules_check modules_prepare |
|---|
| 1524 | | - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
|---|
| 1536 | +modules: $(if $(KBUILD_BUILTIN), $(if $(KBUILD_MIXED_TREE),,vmlinux)) modules_check modules_prepare |
|---|
| 1525 | 1537 | |
|---|
| 1526 | 1538 | PHONY += modules_check |
|---|
| 1527 | 1539 | modules_check: modules.order |
|---|
| .. | .. |
|---|
| 1539 | 1551 | modules_prepare: prepare |
|---|
| 1540 | 1552 | $(Q)$(MAKE) $(build)=scripts scripts/module.lds |
|---|
| 1541 | 1553 | |
|---|
| 1542 | | -# Target to install modules |
|---|
| 1543 | | -PHONY += modules_install |
|---|
| 1544 | | -modules_install: _modinst_ _modinst_post |
|---|
| 1545 | | - |
|---|
| 1546 | | -PHONY += _modinst_ |
|---|
| 1547 | | -_modinst_: |
|---|
| 1554 | +modules_install: __modinst_pre |
|---|
| 1555 | +PHONY += __modinst_pre |
|---|
| 1556 | +__modinst_pre: |
|---|
| 1548 | 1557 | @rm -rf $(MODLIB)/kernel |
|---|
| 1549 | 1558 | @rm -f $(MODLIB)/source |
|---|
| 1550 | 1559 | @mkdir -p $(MODLIB)/kernel |
|---|
| .. | .. |
|---|
| 1556 | 1565 | @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order |
|---|
| 1557 | 1566 | @cp -f $(mixed-build-prefix)modules.builtin $(MODLIB)/ |
|---|
| 1558 | 1567 | @cp -f $(or $(mixed-build-prefix),$(objtree)/)modules.builtin.modinfo $(MODLIB)/ |
|---|
| 1559 | | - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
|---|
| 1560 | | - |
|---|
| 1561 | | -# This depmod is only for convenience to give the initial |
|---|
| 1562 | | -# boot a modules.dep even before / is mounted read-write. However the |
|---|
| 1563 | | -# boot script depmod is the master version. |
|---|
| 1564 | | -PHONY += _modinst_post |
|---|
| 1565 | | -_modinst_post: _modinst_ |
|---|
| 1566 | | - $(call cmd,depmod) |
|---|
| 1567 | 1568 | |
|---|
| 1568 | 1569 | ifeq ($(CONFIG_MODULE_SIG), y) |
|---|
| 1569 | 1570 | PHONY += modules_sign |
|---|
| 1570 | 1571 | modules_sign: |
|---|
| 1571 | 1572 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modsign |
|---|
| 1572 | 1573 | endif |
|---|
| 1573 | | - |
|---|
| 1574 | | -else # CONFIG_MODULES |
|---|
| 1575 | | - |
|---|
| 1576 | | -# Modules not configured |
|---|
| 1577 | | -# --------------------------------------------------------------------------- |
|---|
| 1578 | | - |
|---|
| 1579 | | -PHONY += modules modules_install |
|---|
| 1580 | | -modules modules_install: |
|---|
| 1581 | | - @echo >&2 |
|---|
| 1582 | | - @echo >&2 "The present kernel configuration has modules disabled." |
|---|
| 1583 | | - @echo >&2 "Type 'make config' and enable loadable module support." |
|---|
| 1584 | | - @echo >&2 "Then build a kernel with module support enabled." |
|---|
| 1585 | | - @echo >&2 |
|---|
| 1586 | | - @exit 1 |
|---|
| 1587 | 1574 | |
|---|
| 1588 | 1575 | endif # CONFIG_MODULES |
|---|
| 1589 | 1576 | |
|---|
| .. | .. |
|---|
| 1832 | 1819 | KBUILD_MODULES := 1 |
|---|
| 1833 | 1820 | |
|---|
| 1834 | 1821 | build-dirs := $(KBUILD_EXTMOD) |
|---|
| 1835 | | -PHONY += modules |
|---|
| 1836 | | -modules: $(MODORDER) |
|---|
| 1837 | | - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
|---|
| 1838 | | - |
|---|
| 1839 | 1822 | $(MODORDER): descend |
|---|
| 1840 | 1823 | @: |
|---|
| 1841 | | - |
|---|
| 1842 | | -PHONY += modules_install |
|---|
| 1843 | | -modules_install: _emodinst_ _emodinst_post |
|---|
| 1844 | | - |
|---|
| 1845 | | -install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra) |
|---|
| 1846 | | -PHONY += _emodinst_ |
|---|
| 1847 | | -_emodinst_: |
|---|
| 1848 | | - $(Q)mkdir -p $(MODLIB)/$(install-dir) |
|---|
| 1849 | | - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
|---|
| 1850 | | - |
|---|
| 1851 | | -PHONY += _emodinst_post |
|---|
| 1852 | | -_emodinst_post: _emodinst_ |
|---|
| 1853 | | - $(call cmd,depmod) |
|---|
| 1854 | 1824 | |
|---|
| 1855 | 1825 | compile_commands.json: $(extmod-prefix)compile_commands.json |
|---|
| 1856 | 1826 | PHONY += compile_commands.json |
|---|
| .. | .. |
|---|
| 1876 | 1846 | |
|---|
| 1877 | 1847 | endif # KBUILD_EXTMOD |
|---|
| 1878 | 1848 | |
|---|
| 1849 | +# --------------------------------------------------------------------------- |
|---|
| 1850 | +# Modules |
|---|
| 1851 | + |
|---|
| 1852 | +PHONY += modules modules_install |
|---|
| 1853 | + |
|---|
| 1854 | +ifdef CONFIG_MODULES |
|---|
| 1855 | + |
|---|
| 1856 | +modules: $(MODORDER) |
|---|
| 1857 | + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
|---|
| 1858 | + |
|---|
| 1859 | +quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) |
|---|
| 1860 | + cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \ |
|---|
| 1861 | + $(KERNELRELEASE) $(mixed-build-prefix) |
|---|
| 1862 | + |
|---|
| 1863 | +modules_install: |
|---|
| 1864 | + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
|---|
| 1865 | + $(call cmd,depmod) |
|---|
| 1866 | + |
|---|
| 1867 | +else # CONFIG_MODULES |
|---|
| 1868 | + |
|---|
| 1869 | +# Modules not configured |
|---|
| 1870 | +# --------------------------------------------------------------------------- |
|---|
| 1871 | + |
|---|
| 1872 | +modules modules_install: |
|---|
| 1873 | + @echo >&2 '***' |
|---|
| 1874 | + @echo >&2 '*** The present kernel configuration has modules disabled.' |
|---|
| 1875 | + @echo >&2 '*** To use the module feature, please run "make menuconfig" etc.' |
|---|
| 1876 | + @echo >&2 '*** to enable CONFIG_MODULES.' |
|---|
| 1877 | + @echo >&2 '***' |
|---|
| 1878 | + @exit 1 |
|---|
| 1879 | + |
|---|
| 1880 | +KBUILD_MODULES := |
|---|
| 1881 | + |
|---|
| 1882 | +endif # CONFIG_MODULES |
|---|
| 1883 | + |
|---|
| 1879 | 1884 | # Single targets |
|---|
| 1880 | 1885 | # --------------------------------------------------------------------------- |
|---|
| 1881 | 1886 | # To build individual files in subdirectories, you can do like this: |
|---|
| .. | .. |
|---|
| 1899 | 1904 | $(single-no-ko): descend |
|---|
| 1900 | 1905 | @: |
|---|
| 1901 | 1906 | |
|---|
| 1902 | | -ifeq ($(KBUILD_EXTMOD),) |
|---|
| 1903 | | -# For the single build of in-tree modules, use a temporary file to avoid |
|---|
| 1904 | | -# the situation of modules_install installing an invalid modules.order. |
|---|
| 1905 | | -MODORDER := .modules.tmp |
|---|
| 1906 | | -endif |
|---|
| 1907 | | - |
|---|
| 1907 | +# Remove MODORDER when done because it is not the real one. |
|---|
| 1908 | 1908 | PHONY += single_modpost |
|---|
| 1909 | 1909 | single_modpost: $(single-no-ko) modules_prepare |
|---|
| 1910 | 1910 | $(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER) |
|---|
| 1911 | 1911 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
|---|
| 1912 | | - |
|---|
| 1913 | | -KBUILD_MODULES := 1 |
|---|
| 1912 | + $(Q)rm -f $(MODORDER) |
|---|
| 1914 | 1913 | |
|---|
| 1915 | 1914 | export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko)) |
|---|
| 1916 | 1915 | |
|---|
| .. | .. |
|---|
| 1918 | 1917 | build-dirs := $(foreach d, $(build-dirs), \ |
|---|
| 1919 | 1918 | $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d))) |
|---|
| 1920 | 1919 | |
|---|
| 1921 | | -endif |
|---|
| 1922 | | - |
|---|
| 1923 | | -ifndef CONFIG_MODULES |
|---|
| 1924 | | -KBUILD_MODULES := |
|---|
| 1925 | 1920 | endif |
|---|
| 1926 | 1921 | |
|---|
| 1927 | 1922 | # Handle descending into subdirectories listed in $(build-dirs) |
|---|
| .. | .. |
|---|
| 2064 | 2059 | |
|---|
| 2065 | 2060 | quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) |
|---|
| 2066 | 2061 | cmd_rmfiles = rm -rf $(rm-files) |
|---|
| 2067 | | - |
|---|
| 2068 | | -# Run depmod only if we have System.map and depmod is executable |
|---|
| 2069 | | -quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) |
|---|
| 2070 | | - cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \ |
|---|
| 2071 | | - $(KERNELRELEASE) $(mixed-build-prefix) |
|---|
| 2072 | 2062 | |
|---|
| 2073 | 2063 | # read saved command lines for existing targets |
|---|
| 2074 | 2064 | existing-targets := $(wildcard $(sort $(targets))) |
|---|