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
....@@ -522,6 +529,7 @@
522529 -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
523530 -Werror=implicit-function-declaration -Werror=implicit-int \
524531 -Werror=return-type -Wno-format-security \
532
+ -w \
525533 -std=gnu89
526534 KBUILD_CPPFLAGS := -D__KERNEL__
527535 KBUILD_AFLAGS_KERNEL :=
....@@ -597,8 +605,10 @@
597605 ifneq ($(GCC_TOOLCHAIN),)
598606 CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
599607 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
602612 endif
603613 CLANG_FLAGS += -Werror=unknown-warning-option
604614 KBUILD_CFLAGS += $(CLANG_FLAGS)
....@@ -828,6 +838,10 @@
828838 KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
829839
830840 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
+
831845 ifdef CONFIG_FRAME_POINTER
832846 KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
833847 else
....@@ -871,7 +885,7 @@
871885 DEBUG_CFLAGS += -g
872886 endif
873887
874
-ifeq ($(LLVM_IAS),1)
888
+ifdef CONFIG_AS_IS_LLVM
875889 KBUILD_AFLAGS += -g
876890 else
877891 KBUILD_AFLAGS += -Wa,-gdwarf-2
....@@ -1519,9 +1533,7 @@
15191533
15201534 PHONY += modules
15211535 # 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
15251537
15261538 PHONY += modules_check
15271539 modules_check: modules.order
....@@ -1539,12 +1551,9 @@
15391551 modules_prepare: prepare
15401552 $(Q)$(MAKE) $(build)=scripts scripts/module.lds
15411553
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:
15481557 @rm -rf $(MODLIB)/kernel
15491558 @rm -f $(MODLIB)/source
15501559 @mkdir -p $(MODLIB)/kernel
....@@ -1556,34 +1565,12 @@
15561565 @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
15571566 @cp -f $(mixed-build-prefix)modules.builtin $(MODLIB)/
15581567 @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)
15671568
15681569 ifeq ($(CONFIG_MODULE_SIG), y)
15691570 PHONY += modules_sign
15701571 modules_sign:
15711572 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modsign
15721573 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
15871574
15881575 endif # CONFIG_MODULES
15891576
....@@ -1832,25 +1819,8 @@
18321819 KBUILD_MODULES := 1
18331820
18341821 build-dirs := $(KBUILD_EXTMOD)
1835
-PHONY += modules
1836
-modules: $(MODORDER)
1837
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1838
-
18391822 $(MODORDER): descend
18401823 @:
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)
18541824
18551825 compile_commands.json: $(extmod-prefix)compile_commands.json
18561826 PHONY += compile_commands.json
....@@ -1876,6 +1846,41 @@
18761846
18771847 endif # KBUILD_EXTMOD
18781848
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
+
18791884 # Single targets
18801885 # ---------------------------------------------------------------------------
18811886 # To build individual files in subdirectories, you can do like this:
....@@ -1899,18 +1904,12 @@
18991904 $(single-no-ko): descend
19001905 @:
19011906
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.
19081908 PHONY += single_modpost
19091909 single_modpost: $(single-no-ko) modules_prepare
19101910 $(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
19111911 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1912
-
1913
-KBUILD_MODULES := 1
1912
+ $(Q)rm -f $(MODORDER)
19141913
19151914 export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
19161915
....@@ -1918,10 +1917,6 @@
19181917 build-dirs := $(foreach d, $(build-dirs), \
19191918 $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
19201919
1921
-endif
1922
-
1923
-ifndef CONFIG_MODULES
1924
-KBUILD_MODULES :=
19251920 endif
19261921
19271922 # Handle descending into subdirectories listed in $(build-dirs)
....@@ -2064,11 +2059,6 @@
20642059
20652060 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
20662061 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)
20722062
20732063 # read saved command lines for existing targets
20742064 existing-targets := $(wildcard $(sort $(targets)))