forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/base/arm/Makefile
....@@ -1,6 +1,6 @@
11 # SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
22 #
3
-# (C) COPYRIGHT 2021 ARM Limited. All rights reserved.
3
+# (C) COPYRIGHT 2021-2022 ARM Limited. All rights reserved.
44 #
55 # This program is free software and is provided to you under the terms of the
66 # GNU General Public License version 2 as published by the Free Software
....@@ -63,7 +63,7 @@
6363 CONFIG_MALI_CSF_SUPPORT \
6464 CONFIG_DMA_SHARED_BUFFER_TEST_EXPORTER \
6565 CONFIG_MALI_MEMORY_GROUP_MANAGER \
66
- CONFIG_MALI_PROTECTED_MEMORY_ALLOCATOR
66
+ CONFIG_MALI_PROTECTED_MEMORY_ALLOCATOR \
6767
6868
6969 #
....@@ -88,6 +88,60 @@
8888 $(if $(filter y m,$(value $(value config))), \
8989 -D$(value config)=1))
9090
91
+KBUILD_CFLAGS += -Wall -Werror
92
+
93
+ifeq ($(CONFIG_GCOV_KERNEL), y)
94
+ KBUILD_CFLAGS += $(call cc-option, -ftest-coverage)
95
+ KBUILD_CFLAGS += $(call cc-option, -fprofile-arcs)
96
+ EXTRA_CFLAGS += -DGCOV_PROFILE=1
97
+endif
98
+
99
+ifeq ($(CONFIG_MALI_KCOV),y)
100
+ KBUILD_CFLAGS += $(call cc-option, -fsanitize-coverage=trace-cmp)
101
+ EXTRA_CFLAGS += -DKCOV=1
102
+ EXTRA_CFLAGS += -DKCOV_ENABLE_COMPARISONS=1
103
+endif
104
+
105
+# The following were added to align with W=1 in scripts/Makefile.extrawarn
106
+# from the Linux source tree (v5.18.14)
107
+KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
108
+KBUILD_CFLAGS += -Wmissing-declarations
109
+KBUILD_CFLAGS += -Wmissing-format-attribute
110
+KBUILD_CFLAGS += -Wmissing-prototypes
111
+KBUILD_CFLAGS += -Wold-style-definition
112
+# The -Wmissing-include-dirs cannot be enabled as the path to some of the
113
+# included directories change depending on whether it is an in-tree or
114
+# out-of-tree build.
115
+KBUILD_CFLAGS += $(call cc-option, -Wunused-but-set-variable)
116
+KBUILD_CFLAGS += $(call cc-option, -Wunused-const-variable)
117
+KBUILD_CFLAGS += $(call cc-option, -Wpacked-not-aligned)
118
+KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation)
119
+# The following turn off the warnings enabled by -Wextra
120
+KBUILD_CFLAGS += -Wno-sign-compare
121
+KBUILD_CFLAGS += -Wno-shift-negative-value
122
+# This flag is needed to avoid build errors on older kernels
123
+KBUILD_CFLAGS += $(call cc-option, -Wno-cast-function-type)
124
+
125
+KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1
126
+
127
+# The following were added to align with W=2 in scripts/Makefile.extrawarn
128
+# from the Linux source tree (v5.18.14)
129
+KBUILD_CFLAGS += -Wdisabled-optimization
130
+# The -Wshadow flag cannot be enabled unless upstream kernels are
131
+# patched to fix redefinitions of certain built-in functions and
132
+# global variables.
133
+KBUILD_CFLAGS += $(call cc-option, -Wlogical-op)
134
+KBUILD_CFLAGS += -Wmissing-field-initializers
135
+# -Wtype-limits must be disabled due to build failures on kernel 5.x
136
+KBUILD_CFLAGS += -Wno-type-limit
137
+KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized)
138
+KBUILD_CFLAGS += $(call cc-option, -Wunused-macros)
139
+
140
+KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2
141
+
142
+# This warning is disabled to avoid build failures in some kernel versions
143
+KBUILD_CFLAGS += -Wno-ignored-qualifiers
144
+
91145 all:
92146 $(MAKE) -C $(KDIR) M=$(CURDIR) $(MAKE_ARGS) EXTRA_CFLAGS="$(EXTRA_CFLAGS)" KBUILD_EXTRA_SYMBOLS="$(EXTRA_SYMBOLS)" modules
93147