forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/Makefile
....@@ -1,7 +1,7 @@
11 # SPDX-License-Identifier: GPL-2.0
22 VERSION = 5
33 PATCHLEVEL = 10
4
-SUBLEVEL = 160
4
+SUBLEVEL = 198
55 EXTRAVERSION =
66 NAME = Dare mighty things
77
....@@ -93,9 +93,16 @@
9393
9494 # If the user is running make -s (silent mode), suppress echoing of
9595 # commands
96
+# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
9697
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_
99106 endif
100107
101108 export quiet Q KBUILD_VERBOSE
....@@ -598,8 +605,10 @@
598605 ifneq ($(GCC_TOOLCHAIN),)
599606 CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
600607 endif
601
-ifneq ($(LLVM_IAS),1)
602
-CLANG_FLAGS += -no-integrated-as
608
+ifeq ($(LLVM_IAS),1)
609
+CLANG_FLAGS += -fintegrated-as
610
+else
611
+CLANG_FLAGS += -fno-integrated-as
603612 endif
604613 CLANG_FLAGS += -Werror=unknown-warning-option
605614 KBUILD_CFLAGS += $(CLANG_FLAGS)
....@@ -829,6 +838,10 @@
829838 KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
830839
831840 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
+
832845 ifdef CONFIG_FRAME_POINTER
833846 KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
834847 else
....@@ -872,7 +885,7 @@
872885 DEBUG_CFLAGS += -g
873886 endif
874887
875
-ifeq ($(LLVM_IAS),1)
888
+ifdef CONFIG_AS_IS_LLVM
876889 KBUILD_AFLAGS += -g
877890 else
878891 KBUILD_AFLAGS += -Wa,-gdwarf-2
....@@ -1520,9 +1533,7 @@
15201533
15211534 PHONY += modules
15221535 # if KBUILD_BUILTIN && !KBUILD_MIXED_TREE, depend on vmlinux
1523
-modules: $(if $(KBUILD_BUILTIN), $(if $(KBUILD_MIXED_TREE),,vmlinux))
1524
-modules: modules_check modules_prepare
1525
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1536
+modules: $(if $(KBUILD_BUILTIN), $(if $(KBUILD_MIXED_TREE),,vmlinux)) modules_check modules_prepare
15261537
15271538 PHONY += modules_check
15281539 modules_check: modules.order
....@@ -1540,12 +1551,9 @@
15401551 modules_prepare: prepare
15411552 $(Q)$(MAKE) $(build)=scripts scripts/module.lds
15421553
1543
-# Target to install modules
1544
-PHONY += modules_install
1545
-modules_install: _modinst_ _modinst_post
1546
-
1547
-PHONY += _modinst_
1548
-_modinst_:
1554
+modules_install: __modinst_pre
1555
+PHONY += __modinst_pre
1556
+__modinst_pre:
15491557 @rm -rf $(MODLIB)/kernel
15501558 @rm -f $(MODLIB)/source
15511559 @mkdir -p $(MODLIB)/kernel
....@@ -1557,34 +1565,12 @@
15571565 @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
15581566 @cp -f $(mixed-build-prefix)modules.builtin $(MODLIB)/
15591567 @cp -f $(or $(mixed-build-prefix),$(objtree)/)modules.builtin.modinfo $(MODLIB)/
1560
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1561
-
1562
-# This depmod is only for convenience to give the initial
1563
-# boot a modules.dep even before / is mounted read-write. However the
1564
-# boot script depmod is the master version.
1565
-PHONY += _modinst_post
1566
-_modinst_post: _modinst_
1567
- $(call cmd,depmod)
15681568
15691569 ifeq ($(CONFIG_MODULE_SIG), y)
15701570 PHONY += modules_sign
15711571 modules_sign:
15721572 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modsign
15731573 endif
1574
-
1575
-else # CONFIG_MODULES
1576
-
1577
-# Modules not configured
1578
-# ---------------------------------------------------------------------------
1579
-
1580
-PHONY += modules modules_install
1581
-modules modules_install:
1582
- @echo >&2
1583
- @echo >&2 "The present kernel configuration has modules disabled."
1584
- @echo >&2 "Type 'make config' and enable loadable module support."
1585
- @echo >&2 "Then build a kernel with module support enabled."
1586
- @echo >&2
1587
- @exit 1
15881574
15891575 endif # CONFIG_MODULES
15901576
....@@ -1833,25 +1819,8 @@
18331819 KBUILD_MODULES := 1
18341820
18351821 build-dirs := $(KBUILD_EXTMOD)
1836
-PHONY += modules
1837
-modules: $(MODORDER)
1838
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1839
-
18401822 $(MODORDER): descend
18411823 @:
1842
-
1843
-PHONY += modules_install
1844
-modules_install: _emodinst_ _emodinst_post
1845
-
1846
-install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
1847
-PHONY += _emodinst_
1848
-_emodinst_:
1849
- $(Q)mkdir -p $(MODLIB)/$(install-dir)
1850
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1851
-
1852
-PHONY += _emodinst_post
1853
-_emodinst_post: _emodinst_
1854
- $(call cmd,depmod)
18551824
18561825 compile_commands.json: $(extmod-prefix)compile_commands.json
18571826 PHONY += compile_commands.json
....@@ -1877,6 +1846,41 @@
18771846
18781847 endif # KBUILD_EXTMOD
18791848
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
+
18801884 # Single targets
18811885 # ---------------------------------------------------------------------------
18821886 # To build individual files in subdirectories, you can do like this:
....@@ -1900,18 +1904,12 @@
19001904 $(single-no-ko): descend
19011905 @:
19021906
1903
-ifeq ($(KBUILD_EXTMOD),)
1904
-# For the single build of in-tree modules, use a temporary file to avoid
1905
-# the situation of modules_install installing an invalid modules.order.
1906
-MODORDER := .modules.tmp
1907
-endif
1908
-
1907
+# Remove MODORDER when done because it is not the real one.
19091908 PHONY += single_modpost
19101909 single_modpost: $(single-no-ko) modules_prepare
19111910 $(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
19121911 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1913
-
1914
-KBUILD_MODULES := 1
1912
+ $(Q)rm -f $(MODORDER)
19151913
19161914 export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
19171915
....@@ -1919,10 +1917,6 @@
19191917 build-dirs := $(foreach d, $(build-dirs), \
19201918 $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
19211919
1922
-endif
1923
-
1924
-ifndef CONFIG_MODULES
1925
-KBUILD_MODULES :=
19261920 endif
19271921
19281922 # Handle descending into subdirectories listed in $(build-dirs)
....@@ -2065,11 +2059,6 @@
20652059
20662060 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
20672061 cmd_rmfiles = rm -rf $(rm-files)
2068
-
2069
-# Run depmod only if we have System.map and depmod is executable
2070
-quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
2071
- cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
2072
- $(KERNELRELEASE) $(mixed-build-prefix)
20732062
20742063 # read saved command lines for existing targets
20752064 existing-targets := $(wildcard $(sort $(targets)))