Compare commits

...

3 Commits

Author SHA1 Message Date
SaschaNes
7ac65709c1 Revert "help me, what is this witchcraft"
This reverts commit 4a4cd14ef8.
2025-08-12 21:05:37 +02:00
SaschaNes
e03abbe8ae Revert "remove standard README.md"
This reverts commit 65a1eeb079.
2025-08-12 21:05:31 +02:00
SaschaNes
e6a05c1b64 Revert "README.md aktualisiert"
This reverts commit 6c843d0e8b.
2025-08-12 21:05:21 +02:00
6 changed files with 342 additions and 1529 deletions

436
Makefile
View File

@@ -5,13 +5,16 @@ SUBLEVEL = 30
EXTRAVERSION = EXTRAVERSION =
NAME = Hurr durr I'ma ninja sloth NAME = Hurr durr I'ma ninja sloth
# *DOCUMENTATION* # *DOCUMENTATION*
# To see a list of typical targets execute "make help" # To see a list of typical targets execute "make help"
# More info can be located in ./README # More info can be located in ./README
# Comments in this file are targeted only to the developer, do not # Comments in this file are targeted only to the developer, do not
# expect to learn how to build the kernel reading this file. # expect to learn how to build the kernel reading this file.
ifeq ($(filter undefine,$(.FEATURES)),)
$(error GNU Make >= 3.82 is required. Your Make version is $(MAKE_VERSION))
endif
$(if $(filter __%, $(MAKECMDGOALS)), \ $(if $(filter __%, $(MAKECMDGOALS)), \
$(error targets prefixed with '__' are only for internal use)) $(error targets prefixed with '__' are only for internal use))
@@ -35,6 +38,10 @@ __all:
# descending is started. They are now explicitly listed as the # descending is started. They are now explicitly listed as the
# prepare rule. # prepare rule.
this-makefile := $(lastword $(MAKEFILE_LIST))
export abs_srctree := $(realpath $(dir $(this-makefile)))
export abs_objtree := $(CURDIR)
ifneq ($(sub_make_done),1) ifneq ($(sub_make_done),1)
# Do not use make's built-in rules and variables # Do not use make's built-in rules and variables
@@ -53,26 +60,21 @@ unexport GREP_OPTIONS
# Beautify output # Beautify output
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# #
# Normally, we echo the whole command before executing it. By making # Most of build commands in Kbuild start with "cmd_". You can optionally define
# that echo $($(quiet)$(cmd)), we now have the possibility to set # "quiet_cmd_*". If defined, the short log is printed. Otherwise, no log from
# $(quiet) to choose other forms of output instead, e.g. # that command is printed by default.
# #
# quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@ # e.g.)
# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< # quiet_cmd_depmod = DEPMOD $(MODLIB)
# # cmd_depmod = $(srctree)/scripts/depmod.sh $(DEPMOD) $(KERNELRELEASE)
# If $(quiet) is empty, the whole command will be printed.
# If it is set to "quiet_", only the short version will be printed.
# If it is set to "silent_", nothing will be printed at all, since
# the variable $(silent_cmd_cc_o_c) doesn't exist.
# #
# A simple variant is to prefix commands with $(Q) - that's useful # A simple variant is to prefix commands with $(Q) - that's useful
# for commands that shall be hidden in non-verbose mode. # for commands that shall be hidden in non-verbose mode.
# #
# $(Q)ln $@ :< # $(Q)$(MAKE) $(build)=scripts/basic
# #
# If KBUILD_VERBOSE equals 0 then the above command will be hidden. # If KBUILD_VERBOSE contains 1, the whole command is echoed.
# If KBUILD_VERBOSE equals 1 then the above command is displayed. # If KBUILD_VERBOSE contains 2, the reason for rebuilding is printed.
# If KBUILD_VERBOSE equals 2 then give the reason why each target is rebuilt.
# #
# To put more focus on warnings, be less verbose as default # To put more focus on warnings, be less verbose as default
# Use 'make V=1' to see the full commands # Use 'make V=1' to see the full commands
@@ -80,16 +82,13 @@ unexport GREP_OPTIONS
ifeq ("$(origin V)", "command line") ifeq ("$(origin V)", "command line")
KBUILD_VERBOSE = $(V) KBUILD_VERBOSE = $(V)
endif endif
ifndef KBUILD_VERBOSE
KBUILD_VERBOSE = 0
endif
ifeq ($(KBUILD_VERBOSE),1)
quiet =
Q =
else
quiet = quiet_ quiet = quiet_
Q = @ Q = @
ifneq ($(findstring 1, $(KBUILD_VERBOSE)),)
quiet =
Q =
endif endif
# If the user is running make -s (silent mode), suppress echoing of # If the user is running make -s (silent mode), suppress echoing of
@@ -97,14 +96,14 @@ endif
# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS. # make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
ifeq ($(filter 3.%,$(MAKE_VERSION)),) ifeq ($(filter 3.%,$(MAKE_VERSION)),)
silence:=$(findstring s,$(firstword -$(MAKEFLAGS))) short-opts := $(firstword -$(MAKEFLAGS))
else else
silence:=$(findstring s,$(filter-out --%,$(MAKEFLAGS))) short-opts := $(filter-out --%,$(MAKEFLAGS))
endif endif
ifeq ($(silence),s) ifneq ($(findstring s,$(short-opts)),)
quiet=silent_ quiet=silent_
KBUILD_VERBOSE = 0 override KBUILD_VERBOSE :=
endif endif
export quiet Q KBUILD_VERBOSE export quiet Q KBUILD_VERBOSE
@@ -208,32 +207,12 @@ $(if $(abs_objtree),, \
# $(realpath ...) resolves symlinks # $(realpath ...) resolves symlinks
abs_objtree := $(realpath $(abs_objtree)) abs_objtree := $(realpath $(abs_objtree))
else
abs_objtree := $(CURDIR)
endif # ifneq ($(KBUILD_OUTPUT),) endif # ifneq ($(KBUILD_OUTPUT),)
ifeq ($(abs_objtree),$(CURDIR))
# Suppress "Entering directory ..." unless we are changing the work directory.
MAKEFLAGS += --no-print-directory
else
need-sub-make := 1
endif
this-makefile := $(lastword $(MAKEFILE_LIST))
abs_srctree := $(realpath $(dir $(this-makefile)))
ifneq ($(words $(subst :, ,$(abs_srctree))), 1) ifneq ($(words $(subst :, ,$(abs_srctree))), 1)
$(error source directory cannot contain spaces or colons) $(error source directory cannot contain spaces or colons)
endif endif
ifneq ($(abs_srctree),$(abs_objtree))
# Look for make include files relative to root of kernel src
#
# --included-dir is added for backward compatibility, but you should not rely on
# it. Please add $(srctree)/ prefix to include Makefiles in the source tree.
MAKEFLAGS += --include-dir=$(abs_srctree)
endif
ifneq ($(filter 3.%,$(MAKE_VERSION)),) ifneq ($(filter 3.%,$(MAKE_VERSION)),)
# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x # 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x
# We need to invoke sub-make to avoid implicit rules in the top Makefile. # We need to invoke sub-make to avoid implicit rules in the top Makefile.
@@ -242,9 +221,25 @@ need-sub-make := 1
$(this-makefile): ; $(this-makefile): ;
endif endif
export abs_srctree abs_objtree
export sub_make_done := 1 export sub_make_done := 1
endif # sub_make_done
ifeq ($(abs_objtree),$(CURDIR))
# Suppress "Entering directory ..." if we are at the final work directory.
no-print-directory := --no-print-directory
else
# Recursion to show "Entering directory ..."
need-sub-make := 1
endif
ifeq ($(filter --no-print-directory, $(MAKEFLAGS)),)
# If --no-print-directory is unset, recurse once again to set it.
# You may end up recursing into __sub-make twice. This is needed due to the
# behavior change in GNU Make 4.4.1.
need-sub-make := 1
endif
ifeq ($(need-sub-make),1) ifeq ($(need-sub-make),1)
PHONY += $(MAKECMDGOALS) __sub-make PHONY += $(MAKECMDGOALS) __sub-make
@@ -254,18 +249,12 @@ $(filter-out $(this-makefile), $(MAKECMDGOALS)) __all: __sub-make
# Invoke a second make in the output directory, passing relevant variables # Invoke a second make in the output directory, passing relevant variables
__sub-make: __sub-make:
$(Q)$(MAKE) -C $(abs_objtree) -f $(abs_srctree)/Makefile $(MAKECMDGOALS) $(Q)$(MAKE) $(no-print-directory) -C $(abs_objtree) \
-f $(abs_srctree)/Makefile $(MAKECMDGOALS)
endif # need-sub-make else # need-sub-make
endif # sub_make_done
# We process the rest of the Makefile if this is the final invocation of make # We process the rest of the Makefile if this is the final invocation of make
ifeq ($(need-sub-make),)
# Do not print "Entering directory ...",
# but we want to display it when entering to the output directory
# so that IDEs/editors are able to understand relative filenames.
MAKEFLAGS += --no-print-directory
ifeq ($(abs_srctree),$(abs_objtree)) ifeq ($(abs_srctree),$(abs_objtree))
# building in the source tree # building in the source tree
@@ -309,10 +298,10 @@ no-dot-config-targets := $(clean-targets) \
# Installation targets should not require compiler. Unfortunately, vdso_install # Installation targets should not require compiler. Unfortunately, vdso_install
# is an exception where build artifacts may be updated. This must be fixed. # is an exception where build artifacts may be updated. This must be fixed.
no-compiler-targets := $(no-dot-config-targets) install dtbs_install \ no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
headers_install modules_install kernelrelease image_name headers_install modules_install modules_sign kernelrelease image_name
no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \ no-sync-config-targets := $(no-dot-config-targets) %install modules_sign kernelrelease \
image_name image_name
single-targets := %.a %.i %.rsi %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/ single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes %/
config-build := config-build :=
mixed-build := mixed-build :=
@@ -395,7 +384,7 @@ else # !mixed-build
include $(srctree)/scripts/Kbuild.include include $(srctree)/scripts/Kbuild.include
# Read KERNELRELEASE from include/config/kernel.release (if it exists) # Read KERNELRELEASE from include/config/kernel.release (if it exists)
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) KERNELRELEASE = $(call read-file, include/config/kernel.release)
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
@@ -478,8 +467,7 @@ HOSTRUSTC = rustc
HOSTPKG_CONFIG = pkg-config HOSTPKG_CONFIG = pkg-config
KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \ KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
-O2 -fomit-frame-pointer -std=gnu11 \ -O2 -fomit-frame-pointer -std=gnu11
-Wdeclaration-after-statement
KBUILD_USERCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS) KBUILD_USERCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS)
KBUILD_USERLDFLAGS := $(USERLDFLAGS) KBUILD_USERLDFLAGS := $(USERLDFLAGS)
@@ -497,6 +485,7 @@ export rust_common_flags := --edition=2021 \
-Dclippy::let_unit_value -Dclippy::mut_mut \ -Dclippy::let_unit_value -Dclippy::mut_mut \
-Dclippy::needless_bitwise_bool \ -Dclippy::needless_bitwise_bool \
-Dclippy::needless_continue \ -Dclippy::needless_continue \
-Dclippy::no_mangle_with_rust_abi \
-Wclippy::dbg_macro -Wclippy::dbg_macro
KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS) KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
@@ -539,7 +528,6 @@ LEX = flex
YACC = bison YACC = bison
AWK = awk AWK = awk
INSTALLKERNEL := installkernel INSTALLKERNEL := installkernel
DEPMOD = depmod
PERL = perl PERL = perl
PYTHON3 = python3 PYTHON3 = python3
CHECK = sparse CHECK = sparse
@@ -585,14 +573,17 @@ LINUXINCLUDE := \
$(USERINCLUDE) $(USERINCLUDE)
KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \ KBUILD_CFLAGS :=
-Werror=implicit-function-declaration -Werror=implicit-int \ KBUILD_CFLAGS += -std=gnu11
-Werror=return-type -Wno-format-security \ KBUILD_CFLAGS += -fshort-wchar
-std=gnu11 KBUILD_CFLAGS += -funsigned-char
KBUILD_CFLAGS += -fno-common
KBUILD_CFLAGS += -fno-PIE
KBUILD_CFLAGS += -fno-strict-aliasing
KBUILD_CPPFLAGS := -D__KERNEL__ KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_RUSTFLAGS := $(rust_common_flags) \ KBUILD_RUSTFLAGS := $(rust_common_flags) \
--target=$(objtree)/rust/target.json \
-Cpanic=abort -Cembed-bitcode=n -Clto=n \ -Cpanic=abort -Cembed-bitcode=n -Clto=n \
-Cforce-unwind-tables=n -Ccodegen-units=1 \ -Cforce-unwind-tables=n -Ccodegen-units=1 \
-Csymbol-mangling-version=v0 \ -Csymbol-mangling-version=v0 \
@@ -843,10 +834,6 @@ endif # may-sync-config
endif # need-config endif # need-config
KBUILD_CFLAGS += -fno-delete-null-pointer-checks KBUILD_CFLAGS += -fno-delete-null-pointer-checks
KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
KBUILD_CFLAGS += -O2 KBUILD_CFLAGS += -O2
@@ -877,40 +864,15 @@ ifdef CONFIG_READABLE_ASM
KBUILD_CFLAGS += -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining KBUILD_CFLAGS += -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining
endif endif
ifneq ($(CONFIG_FRAME_WARN),0)
KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_FRAME_WARN)
endif
stackp-flags-y := -fno-stack-protector stackp-flags-y := -fno-stack-protector
stackp-flags-$(CONFIG_STACKPROTECTOR) := -fstack-protector stackp-flags-$(CONFIG_STACKPROTECTOR) := -fstack-protector
stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong
KBUILD_CFLAGS += $(stackp-flags-y) KBUILD_CFLAGS += $(stackp-flags-y)
KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings
KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y) KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y)
ifdef CONFIG_CC_IS_CLANG
KBUILD_CPPFLAGS += -Qunused-arguments
# The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
KBUILD_CFLAGS += -Wno-gnu
else
# gcc inanely warns about local variables called 'main'
KBUILD_CFLAGS += -Wno-main
endif
# These warnings generated too much noise in a regular build.
# Use make W=1 to enable them (see scripts/Makefile.extrawarn)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
# These result in bogus false positives
KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer)
ifdef CONFIG_FRAME_POINTER ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
KBUILD_RUSTFLAGS += -Cforce-frame-pointers=y KBUILD_RUSTFLAGS += -Cforce-frame-pointers=y
@@ -937,7 +899,9 @@ ifdef CONFIG_INIT_STACK_ALL_ZERO
KBUILD_CFLAGS += -ftrivial-auto-var-init=zero KBUILD_CFLAGS += -ftrivial-auto-var-init=zero
ifdef CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER ifdef CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER
# https://github.com/llvm/llvm-project/issues/44842 # https://github.com/llvm/llvm-project/issues/44842
KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang CC_AUTO_VAR_INIT_ZERO_ENABLER := -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
export CC_AUTO_VAR_INIT_ZERO_ENABLER
KBUILD_CFLAGS += $(CC_AUTO_VAR_INIT_ZERO_ENABLER)
endif endif
endif endif
@@ -961,8 +925,10 @@ ifdef CONFIG_FTRACE_MCOUNT_USE_CC
endif endif
endif endif
ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
ifdef CONFIG_HAVE_OBJTOOL_NOP_MCOUNT
CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT
endif endif
endif
ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
ifdef CONFIG_HAVE_C_RECORDMCOUNT ifdef CONFIG_HAVE_C_RECORDMCOUNT
BUILD_C_RECORDMCOUNT := y BUILD_C_RECORDMCOUNT := y
@@ -997,6 +963,7 @@ ifdef CONFIG_SHADOW_CALL_STACK
ifndef CONFIG_DYNAMIC_SCS ifndef CONFIG_DYNAMIC_SCS
CC_FLAGS_SCS := -fsanitize=shadow-call-stack CC_FLAGS_SCS := -fsanitize=shadow-call-stack
KBUILD_CFLAGS += $(CC_FLAGS_SCS) KBUILD_CFLAGS += $(CC_FLAGS_SCS)
KBUILD_RUSTFLAGS += -Zsanitizer=shadow-call-stack
endif endif
export CC_FLAGS_SCS export CC_FLAGS_SCS
endif endif
@@ -1022,7 +989,7 @@ KBUILD_LDFLAGS += -mllvm -import-instr-limit=5
# Check for frame size exceeding threshold during prolog/epilog insertion # Check for frame size exceeding threshold during prolog/epilog insertion
# when using lld < 13.0.0. # when using lld < 13.0.0.
ifneq ($(CONFIG_FRAME_WARN),0) ifneq ($(CONFIG_FRAME_WARN),0)
ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0) ifeq ($(call test-lt, $(CONFIG_LLD_VERSION), 130000),y)
KBUILD_LDFLAGS += -plugin-opt=-warn-stack-size=$(CONFIG_FRAME_WARN) KBUILD_LDFLAGS += -plugin-opt=-warn-stack-size=$(CONFIG_FRAME_WARN)
endif endif
endif endif
@@ -1036,58 +1003,34 @@ endif
ifdef CONFIG_CFI_CLANG ifdef CONFIG_CFI_CLANG
CC_FLAGS_CFI := -fsanitize=kcfi CC_FLAGS_CFI := -fsanitize=kcfi
ifdef CONFIG_RUST
# If Rust is enabled, this flag is required to support cross-language
# integer types.
# This addresses the problem that on e.g. i686, int != long, and Rust
# maps both to i32.
# See https://rcvalle.com/docs/rust-cfi-design-doc.pdf for details.
$(error "Enabling Rust and CFI silently changes the KMI.")
CC_FLAGS_CFI += -fsanitize-cfi-icall-experimental-normalize-integers
RS_FLAGS_CFI := -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers
KBUILD_RUSTFLAGS += $(RS_FLAGS_CFI)
export RS_FLAGS_CFI
endif
KBUILD_CFLAGS += $(CC_FLAGS_CFI) KBUILD_CFLAGS += $(CC_FLAGS_CFI)
export CC_FLAGS_CFI export CC_FLAGS_CFI
endif endif
ifdef CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B ifneq ($(CONFIG_FUNCTION_ALIGNMENT),0)
KBUILD_CFLAGS += -falign-functions=64 KBUILD_CFLAGS += -falign-functions=$(CONFIG_FUNCTION_ALIGNMENT)
endif endif
# arch Makefile may override CC so keep this after arch Makefile is included # arch Makefile may override CC so keep this after arch Makefile is included
NOSTDINC_FLAGS += -nostdinc NOSTDINC_FLAGS += -nostdinc
# warn about C99 declaration after statement # To gain proper coverage for CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE,
KBUILD_CFLAGS += -Wdeclaration-after-statement # the kernel uses only C99 flexible arrays for dynamically sized trailing
# arrays. Enforce this for everything that may examine structure sizes and
# Variable Length Arrays (VLAs) should not be used anywhere in the kernel # perform bounds checking.
KBUILD_CFLAGS += -Wvla KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3)
# disable pointer signed / unsigned warnings in gcc 4.0
KBUILD_CFLAGS += -Wno-pointer-sign
# In order to make sure new function cast mismatches are not introduced
# in the kernel (to avoid tripping CFI checking), the kernel should be
# globally built with -Wcast-function-type.
KBUILD_CFLAGS += $(call cc-option, -Wcast-function-type)
# disable stringop warnings in gcc 8+
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
# We'll want to enable this eventually, but it's not going away for 5.7 at least
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
# Another good warning that we'll want to enable eventually
KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
# Enabled with W=2, disabled by default as noisy
ifdef CONFIG_CC_IS_GCC
KBUILD_CFLAGS += -Wno-maybe-uninitialized
endif
# The allocators already balk at large sizes, so silence the compiler
# warnings for bounds checks involving those possible values. While
# -Wno-alloc-size-larger-than would normally be used here, earlier versions
# of gcc (<9.1) weirdly don't handle the option correctly when _other_
# warnings are produced (?!). Using -Walloc-size-larger-than=SIZE_MAX
# doesn't work (as it is documented to), silently resolving to "0" prior to
# version 9.1 (and producing an error more recently). Numeric values larger
# than PTRDIFF_MAX also don't work prior to version 9.1, which are silently
# ignored, continuing to default to PTRDIFF_MAX. So, left with no other
# choice, we must perform a versioned check to disable this warning.
# https://lore.kernel.org/lkml/20210824115859.187f272f@canb.auug.org.au
KBUILD_CFLAGS-$(call gcc-min-version, 90100) += -Wno-alloc-size-larger-than
KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
# disable invalid "can't wrap" optimizations for signed / pointers # disable invalid "can't wrap" optimizations for signed / pointers
KBUILD_CFLAGS += -fno-strict-overflow KBUILD_CFLAGS += -fno-strict-overflow
@@ -1100,15 +1043,6 @@ ifdef CONFIG_CC_IS_GCC
KBUILD_CFLAGS += -fconserve-stack KBUILD_CFLAGS += -fconserve-stack
endif endif
# Prohibit date/time macros, which would make the build non-deterministic
KBUILD_CFLAGS += -Werror=date-time
# enforce correct pointer usage
KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types)
# Require designated initializers for all marked structures
KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
# change __FILE__ to the relative path from the srctree # change __FILE__ to the relative path from the srctree
KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
@@ -1148,13 +1082,14 @@ LDFLAGS_vmlinux += -X
endif endif
ifeq ($(CONFIG_RELR),y) ifeq ($(CONFIG_RELR),y)
LDFLAGS_vmlinux += --pack-dyn-relocs=relr --use-android-relr-tags # ld.lld before 15 did not support -z pack-relative-relocs.
LDFLAGS_vmlinux += $(call ld-option,--pack-dyn-relocs=relr,-z pack-relative-relocs)
endif endif
# We never want expected sections to be placed heuristically by the # We never want expected sections to be placed heuristically by the
# linker. All sections should be explicitly named in the linker script. # linker. All sections should be explicitly named in the linker script.
ifdef CONFIG_LD_ORPHAN_WARN ifdef CONFIG_LD_ORPHAN_WARN
LDFLAGS_vmlinux += --orphan-handling=warn LDFLAGS_vmlinux += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL)
endif endif
# Align the bit size of userspace programs with the kernel # Align the bit size of userspace programs with the kernel
@@ -1209,10 +1144,6 @@ export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps
PHONY += headers PHONY += headers
ext-mod-dir := ../sm8650-modules
ext-mod-dirs := $(ext-mod-dir)/qcom/opensource/audio-kernel $(ext-mod-dir)/qcom/opensource/dataipa/drivers/platform/msm $(ext-mod-dir)/qcom/opensource/display-drivers $(ext-mod-dir)/qcom/opensource/video-kernel $(ext-mod-dir)/nxp/opensource/driver
ext-mod-dirs := $(subst $(srctree)/,,$(ext-mod-dirs))
#Default location for installed headers #Default location for installed headers
ifeq ($(KBUILD_EXTMOD),) ifeq ($(KBUILD_EXTMOD),)
PHONY += archheaders archscripts PHONY += archheaders archscripts
@@ -1241,9 +1172,6 @@ ifeq ($(KBUILD_EXTMOD),)
endif endif
$(Q)$(MAKE) $(hdr-inst)=$(hdr-prefix)include/uapi $(Q)$(MAKE) $(hdr-inst)=$(hdr-prefix)include/uapi
$(Q)$(MAKE) $(hdr-inst)=$(hdr-prefix)arch/$(SRCARCH)/include/uapi $(Q)$(MAKE) $(hdr-inst)=$(hdr-prefix)arch/$(SRCARCH)/include/uapi
$(Q)for d in $(ext-mod-dirs); do \
$(MAKE) $(hdr-inst)=$$d/include/uapi; \
done
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Devicetree files # Devicetree files
@@ -1323,28 +1251,12 @@ endif
export KBUILD_VMLINUX_LIBS export KBUILD_VMLINUX_LIBS
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
# Recurse until adjust_autoksyms.sh is satisfied
PHONY += autoksyms_recursive
ifdef CONFIG_TRIM_UNUSED_KSYMS ifdef CONFIG_TRIM_UNUSED_KSYMS
# For the kernel to actually contain only the needed exported symbols, # For the kernel to actually contain only the needed exported symbols,
# we have to build modules as well to determine what those symbols are. # we have to build modules as well to determine what those symbols are.
# (this can be evaluated only once include/config/auto.conf has been included)
KBUILD_MODULES := 1 KBUILD_MODULES := 1
autoksyms_recursive: $(build-dir) modules.order
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
"$(MAKE) -f $(srctree)/Makefile autoksyms_recursive"
endif endif
autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)
quiet_cmd_autoksyms_h = GEN $@
cmd_autoksyms_h = mkdir -p $(dir $@); \
$(CONFIG_SHELL) $(srctree)/scripts/gen_autoksyms.sh $@
$(autoksyms_h):
$(call cmd,autoksyms_h)
# '$(AR) mPi' needs 'T' to workaround the bug of llvm-ar <= 14 # '$(AR) mPi' needs 'T' to workaround the bug of llvm-ar <= 14
quiet_cmd_ar_vmlinux.a = AR $@ quiet_cmd_ar_vmlinux.a = AR $@
cmd_ar_vmlinux.a = \ cmd_ar_vmlinux.a = \
@@ -1353,7 +1265,7 @@ quiet_cmd_ar_vmlinux.a = AR $@
$(AR) mPiT $$($(AR) t $@ | sed -n 1p) $@ $$($(AR) t $@ | grep -F -f $(srctree)/scripts/head-object-list.txt) $(AR) mPiT $$($(AR) t $@ | sed -n 1p) $@ $$($(AR) t $@ | grep -F -f $(srctree)/scripts/head-object-list.txt)
targets += vmlinux.a targets += vmlinux.a
vmlinux.a: $(KBUILD_VMLINUX_OBJS) scripts/head-object-list.txt autoksyms_recursive FORCE vmlinux.a: $(KBUILD_VMLINUX_OBJS) scripts/head-object-list.txt FORCE
$(call if_changed,ar_vmlinux.a) $(call if_changed,ar_vmlinux.a)
ifndef KBUILD_MIXED_TREE ifndef KBUILD_MIXED_TREE
@@ -1385,9 +1297,13 @@ endif
# make sure no implicit rule kicks in # make sure no implicit rule kicks in
$(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): . ; $(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): . ;
filechk_kernel.release = \ -include $(srctree)/scripts/sec_env.mk
echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion \
$(srctree) $(BRANCH) $(KMI_GENERATION))" ifeq ($(origin KERNELRELEASE),file)
filechk_kernel.release = $(srctree)/scripts/setlocalversion $(srctree)
else
filechk_kernel.release = echo $(KERNELRELEASE)
endif
# Store (new) KERNELRELEASE string in include/config/kernel.release # Store (new) KERNELRELEASE string in include/config/kernel.release
include/config/kernel.release: FORCE include/config/kernel.release: FORCE
@@ -1409,7 +1325,7 @@ scripts: scripts_basic scripts_dtc
PHONY += prepare archprepare PHONY += prepare archprepare
archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \ archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \
asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h \ asm-generic $(version_h) include/generated/utsrelease.h \
include/generated/compile.h include/generated/autoconf.h remove-stale-files include/generated/compile.h include/generated/autoconf.h remove-stale-files
prepare0: archprepare prepare0: archprepare
@@ -1588,7 +1504,10 @@ dtbs_prepare: include/config/kernel.release scripts_dtc
ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),) ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
export CHECK_DTBS=y export CHECK_DTBS=y
dtbs: dt_binding_check endif
ifneq ($(CHECK_DTBS),)
dtbs_prepare: dt_binding_check
endif endif
dtbs_check: dtbs dtbs_check: dtbs
@@ -1637,7 +1556,7 @@ endif
# Build modules # Build modules
# #
# *.ko are usually independent of vmlinux, but CONFIG_DEBUG_INFOBTF_MODULES # *.ko are usually independent of vmlinux, but CONFIG_DEBUG_INFO_BTF_MODULES
# is an exception. # is an exception.
ifdef CONFIG_DEBUG_INFO_BTF_MODULES ifdef CONFIG_DEBUG_INFO_BTF_MODULES
KBUILD_BUILTIN := 1 KBUILD_BUILTIN := 1
@@ -1650,40 +1569,6 @@ modules: modules_prepare
modules_prepare: prepare modules_prepare: prepare
$(Q)$(MAKE) $(build)=scripts scripts/module.lds $(Q)$(MAKE) $(build)=scripts scripts/module.lds
export modules_sign_only :=
ifeq ($(CONFIG_MODULE_SIG),y)
PHONY += modules_sign
modules_sign: modules_install
@:
# modules_sign is a subset of modules_install.
# 'make modules_install modules_sign' is equivalent to 'make modules_install'.
ifeq ($(filter modules_install,$(MAKECMDGOALS)),)
modules_sign_only := y
endif
endif
modinst_pre :=
ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
modinst_pre := __modinst_pre
endif
modules_install: $(modinst_pre)
PHONY += __modinst_pre
__modinst_pre:
@rm -rf $(MODLIB)/kernel
@rm -f $(MODLIB)/source
@mkdir -p $(MODLIB)/kernel
@ln -s $(abspath $(srctree)) $(MODLIB)/source
@if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
rm -f $(MODLIB)/build ; \
ln -s $(CURDIR) $(MODLIB)/build ; \
fi
@sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
@cp -f $(mixed-build-prefix)modules.builtin $(MODLIB)/
@cp -f $(or $(mixed-build-prefix),$(objtree)/)modules.builtin.modinfo $(MODLIB)/
endif # CONFIG_MODULES endif # CONFIG_MODULES
### ###
@@ -1694,10 +1579,10 @@ endif # CONFIG_MODULES
# make distclean Remove editor backup files, patch leftover files and the like # make distclean Remove editor backup files, patch leftover files and the like
# Directories & files removed with 'make clean' # Directories & files removed with 'make clean'
CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \ CLEAN_FILES += vmlinux.symvers modules-only.symvers \
modules.builtin modules.builtin.modinfo modules.nsdeps \ modules.builtin modules.builtin.modinfo modules.nsdeps \
compile_commands.json .thinlto-cache rust/test rust/doc \ compile_commands.json .thinlto-cache rust/test \
.vmlinux.objs .vmlinux.export.c rust-project.json .vmlinux.objs .vmlinux.export.c
# Directories & files removed with 'make mrproper' # Directories & files removed with 'make mrproper'
MRPROPER_FILES += include/config include/generated \ MRPROPER_FILES += include/config include/generated \
@@ -1708,8 +1593,8 @@ MRPROPER_FILES += include/config include/generated \
certs/signing_key.pem \ certs/signing_key.pem \
certs/x509.genkey \ certs/x509.genkey \
vmlinux-gdb.py \ vmlinux-gdb.py \
*.spec \ kernel.spec rpmbuild \
rust/target.json rust/libmacros.so rust/libmacros.so
# clean - Delete most, but leave enough to build external modules # clean - Delete most, but leave enough to build external modules
# #
@@ -1721,6 +1606,9 @@ vmlinuxclean:
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
$(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
legoclean:
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/lego/kclean.sh $(srctree)/.legofile
clean: archclean vmlinuxclean resolve_btfids_clean clean: archclean vmlinuxclean resolve_btfids_clean
# mrproper - Delete all generated files, including .config # mrproper - Delete all generated files, including .config
@@ -1775,7 +1663,6 @@ help:
@echo ' mrproper - Remove all generated files + config + various backup files' @echo ' mrproper - Remove all generated files + config + various backup files'
@echo ' distclean - mrproper + remove editor backup and patch files' @echo ' distclean - mrproper + remove editor backup and patch files'
@echo '' @echo ''
@echo 'Configuration targets:'
@$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
@echo '' @echo ''
@echo 'Other generic targets:' @echo 'Other generic targets:'
@@ -1874,8 +1761,9 @@ help:
printf " %-16s - Show all of the above\\n" help-boards; \ printf " %-16s - Show all of the above\\n" help-boards; \
echo '') echo '')
@echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' @echo ' make V=n [targets] 1: verbose build'
@echo ' make V=2 [targets] 2 => give reason for rebuild of target' @echo ' 2: give reason for rebuild of target'
@echo ' V=1 and V=2 can be combined with V=12'
@echo ' make O=dir [targets] Locate all output files in "dir", including .config' @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
@echo ' make C=1 [targets] Check re-compiled c source with $$CHECK' @echo ' make C=1 [targets] Check re-compiled c source with $$CHECK'
@echo ' (sparse by default)' @echo ' (sparse by default)'
@@ -1887,6 +1775,10 @@ help:
@echo ' 3: more obscure warnings, can most likely be ignored' @echo ' 3: more obscure warnings, can most likely be ignored'
@echo ' e: warnings are being treated as errors' @echo ' e: warnings are being treated as errors'
@echo ' Multiple levels can be combined with W=12 or W=123' @echo ' Multiple levels can be combined with W=12 or W=123'
@$(if $(dtstree), \
echo ' make CHECK_DTBS=1 [targets] Check all generated dtb files against schema'; \
echo ' This can be applied both to "dtbs" and to individual "foo.dtb" targets' ; \
)
@echo '' @echo ''
@echo 'Execute "make" or "make all" to build all targets marked with [*] ' @echo 'Execute "make" or "make all" to build all targets marked with [*] '
@echo 'For further info see the ./README file' @echo 'For further info see the ./README file'
@@ -1909,7 +1801,7 @@ $(help-board-dirs): help-%:
# Documentation targets # Documentation targets
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \ DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
linkcheckdocs dochelp refcheckdocs linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
PHONY += $(DOC_TARGETS) PHONY += $(DOC_TARGETS)
$(DOC_TARGETS): $(DOC_TARGETS):
$(Q)$(MAKE) $(build)=Documentation $@ $(Q)$(MAKE) $(build)=Documentation $@
@@ -1955,14 +1847,15 @@ rustfmt:
rustfmtcheck: rustfmt_flags = --check rustfmtcheck: rustfmt_flags = --check
rustfmtcheck: rustfmt rustfmtcheck: rustfmt
# IDE support targets
PHONY += rust-analyzer
rust-analyzer:
$(Q)$(MAKE) $(build)=rust $@
# Misc # Misc
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
PHONY += misc-check
misc-check:
$(Q)$(srctree)/scripts/misc-check
all: misc-check
PHONY += scripts_gdb PHONY += scripts_gdb
scripts_gdb: prepare0 scripts_gdb: prepare0
$(Q)$(MAKE) $(build)=scripts/gdb $(Q)$(MAKE) $(build)=scripts/gdb
@@ -1974,6 +1867,8 @@ endif
else # KBUILD_EXTMOD else # KBUILD_EXTMOD
filechk_kernel.release = echo $(KERNELRELEASE)
### ###
# External module support. # External module support.
# When building external modules the kernel used as basis is considered # When building external modules the kernel used as basis is considered
@@ -2014,14 +1909,42 @@ help:
@echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH' @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'
@echo ' (default: $(abspath $(INSTALL_HDR_PATH)))' @echo ' (default: $(abspath $(INSTALL_HDR_PATH)))'
@echo ' clean - remove generated files in module directory only' @echo ' clean - remove generated files in module directory only'
@echo ' rust-analyzer - generate rust-project.json rust-analyzer support file'
@echo '' @echo ''
ifndef CONFIG_MODULES
modules modules_install: __external_modules_error
__external_modules_error:
@echo >&2 '***'
@echo >&2 '*** The present kernel disabled CONFIG_MODULES.'
@echo >&2 '*** You cannot build or install external modules.'
@echo >&2 '***'
@false
endif
endif # KBUILD_EXTMOD endif # KBUILD_EXTMOD
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Modules # Modules
PHONY += modules modules_install modules_prepare PHONY += modules modules_install modules_sign modules_prepare
modules_install:
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst \
sign-only=$(if $(filter modules_install,$(MAKECMDGOALS)),,y)
ifeq ($(CONFIG_MODULE_SIG),y)
# modules_sign is a subset of modules_install.
# 'make modules_install modules_sign' is equivalent to 'make modules_install'.
modules_sign: modules_install
@:
else
modules_sign:
@echo >&2 '***'
@echo >&2 '*** CONFIG_MODULE_SIG is disabled. You cannot sign modules.'
@echo >&2 '***'
@false
endif
ifdef CONFIG_MODULES ifdef CONFIG_MODULES
@@ -2039,28 +1962,10 @@ PHONY += modules_check
modules_check: $(MODORDER) modules_check: $(MODORDER)
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $< $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
quiet_cmd_depmod = DEPMOD $(MODLIB)
cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
$(KERNELRELEASE) $(mixed-build-prefix)
modules_install:
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
ifndef modules_sign_only
$(call cmd,depmod)
endif
else # CONFIG_MODULES else # CONFIG_MODULES
# Modules not configured modules:
# --------------------------------------------------------------------------- @:
modules modules_install:
@echo >&2 '***'
@echo >&2 '*** The present kernel configuration has modules disabled.'
@echo >&2 '*** To use the module feature, please run "make menuconfig" etc.'
@echo >&2 '*** to enable CONFIG_MODULES.'
@echo >&2 '***'
@exit 1
KBUILD_MODULES := KBUILD_MODULES :=
@@ -2098,7 +2003,7 @@ $(single-no-ko): $(build-dir)
# Remove MODORDER when done because it is not the real one. # Remove MODORDER when done because it is not the real one.
PHONY += single_modules PHONY += single_modules
single_modules: $(single-no-ko) modules_prepare single_modules: $(single-no-ko) modules_prepare
$(Q){ $(foreach m, $(single-ko), echo $(extmod_prefix)$m;) } > $(MODORDER) $(Q){ $(foreach m, $(single-ko), echo $(extmod_prefix)$(m:%.ko=%.o);) } > $(MODORDER)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
ifneq ($(KBUILD_MODPOST_NOFINAL),1) ifneq ($(KBUILD_MODPOST_NOFINAL),1)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
@@ -2131,18 +2036,21 @@ clean: $(clean-dirs)
$(RCS_FIND_IGNORE) \ $(RCS_FIND_IGNORE) \
\( -name '*.[aios]' -o -name '*.rsi' -o -name '*.ko' -o -name '.*.cmd' \ \( -name '*.[aios]' -o -name '*.rsi' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '*.ko.*' \ -o -name '*.ko.*' \
-o -name '*.dtb' -o -name '*.dtbo' -o -name '*.dtb.S' -o -name '*.dt.yaml' \ -o -name '*.dtb' -o -name '*.dtbo' \
-o -name '*.dtb.S' -o -name '*.dtbo.S' \
-o -name '*.dt.yaml' \
-o -name '*.dwo' -o -name '*.lst' \ -o -name '*.dwo' -o -name '*.lst' \
-o -name '*.su' -o -name '*.mod' -o -name '*.usyms' \ -o -name '*.su' -o -name '*.mod' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name '*.lex.c' -o -name '*.tab.[ch]' \ -o -name '*.lex.c' -o -name '*.tab.[ch]' \
-o -name '*.asn1.[ch]' \ -o -name '*.asn1.[ch]' \
-o -name '*.symtypes' -o -name 'modules.order' \ -o -name '*.symtypes' -o -name 'modules.order' \
-o -name '.tmp_*' \
-o -name '*.c.[012]*.*' \ -o -name '*.c.[012]*.*' \
-o -name '*.ll' \ -o -name '*.ll' \
-o -name '*.gcno' \ -o -name '*.gcno' \
-o -name '*.*.symversions' \) -type f -print | xargs rm -f -o -name '*.*.symversions' \) -type f -print \
-o -name '.tmp_*' -print \
| xargs rm -rf
# Generate tags for editors # Generate tags for editors
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -2152,6 +2060,11 @@ quiet_cmd_tags = GEN $@
tags TAGS cscope gtags: FORCE tags TAGS cscope gtags: FORCE
$(call cmd,tags) $(call cmd,tags)
# IDE support targets
PHONY += rust-analyzer
rust-analyzer:
$(Q)$(MAKE) $(build)=rust $@
# Script to generate missing namespace dependencies # Script to generate missing namespace dependencies
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -2224,8 +2137,7 @@ checkstack:
$(PERL) $(srctree)/scripts/checkstack.pl $(CHECKSTACK_ARCH) $(PERL) $(srctree)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
kernelrelease: kernelrelease:
@echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion \ @$(filechk_kernel.release)
$(srctree) $(BRANCH) $(KMI_GENERATION))"
kernelversion: kernelversion:
@echo $(KERNELVERSION) @echo $(KERNELVERSION)
@@ -2233,6 +2145,10 @@ kernelversion:
image_name: image_name:
@echo $(KBUILD_IMAGE) @echo $(KBUILD_IMAGE)
PHONY += run-command
run-command:
$(Q)$(KBUILD_RUN_COMMAND)
quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
cmd_rmfiles = rm -rf $(rm-files) cmd_rmfiles = rm -rf $(rm-files)

160
README.md
View File

@@ -1 +1,161 @@
<<<<<<< HEAD
<<<<<<< HEAD
#TODO #TODO
=======
# How do I submit patches to Android Common Kernels
=======
# .How do I submit patches to Android Common Kernels
>>>>>>> parent of 65a1eeb07 (remove standard README.md)
1. BEST: Make all of your changes to upstream Linux. If appropriate, backport to the stable releases.
These patches will be merged automatically in the corresponding common kernels. If the patch is already
in upstream Linux, post a backport of the patch that conforms to the patch requirements below.
- Do not send patches upstream that contain only symbol exports. To be considered for upstream Linux,
additions of `EXPORT_SYMBOL_GPL()` require an in-tree modular driver that uses the symbol -- so include
the new driver or changes to an existing driver in the same patchset as the export.
- When sending patches upstream, the commit message must contain a clear case for why the patch
is needed and beneficial to the community. Enabling out-of-tree drivers or functionality is not
a persuasive case.
2. LESS GOOD: Develop your patches out-of-tree (from an upstream Linux point-of-view). Unless these are
fixing an Android-specific bug, these are very unlikely to be accepted unless they have been
coordinated with kernel-team@android.com. If you want to proceed, post a patch that conforms to the
patch requirements below.
# Common Kernel patch requirements
- All patches must conform to the Linux kernel coding standards and pass `scripts/checkpatch.pl`
- Patches shall not break gki_defconfig or allmodconfig builds for arm, arm64, x86, x86_64 architectures
(see https://source.android.com/setup/build/building-kernels)
- If the patch is not merged from an upstream branch, the subject must be tagged with the type of patch:
`UPSTREAM:`, `BACKPORT:`, `FROMGIT:`, `FROMLIST:`, or `ANDROID:`.
- All patches must have a `Change-Id:` tag (see https://gerrit-review.googlesource.com/Documentation/user-changeid.html)
- If an Android bug has been assigned, there must be a `Bug:` tag.
- All patches must have a `Signed-off-by:` tag by the author and the submitter
Additional requirements are listed below based on patch type
## Requirements for backports from mainline Linux: `UPSTREAM:`, `BACKPORT:`
- If the patch is a cherry-pick from Linux mainline with no changes at all
- tag the patch subject with `UPSTREAM:`.
- add upstream commit information with a `(cherry picked from commit ...)` line
- Example:
- if the upstream commit message is
```
important patch from upstream
This is the detailed description of the important patch
Signed-off-by: Fred Jones <fred.jones@foo.org>
```
>- then Joe Smith would upload the patch for the common kernel as
```
UPSTREAM: important patch from upstream
This is the detailed description of the important patch
Signed-off-by: Fred Jones <fred.jones@foo.org>
Bug: 135791357
Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
(cherry picked from commit c31e73121f4c1ec41143423ac6ce3ce6dafdcec1)
Signed-off-by: Joe Smith <joe.smith@foo.org>
```
- If the patch requires any changes from the upstream version, tag the patch with `BACKPORT:`
instead of `UPSTREAM:`.
- use the same tags as `UPSTREAM:`
- add comments about the changes under the `(cherry picked from commit ...)` line
- Example:
```
BACKPORT: important patch from upstream
This is the detailed description of the important patch
Signed-off-by: Fred Jones <fred.jones@foo.org>
Bug: 135791357
Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
(cherry picked from commit c31e73121f4c1ec41143423ac6ce3ce6dafdcec1)
[joe: Resolved minor conflict in drivers/foo/bar.c ]
Signed-off-by: Joe Smith <joe.smith@foo.org>
```
## Requirements for other backports: `FROMGIT:`, `FROMLIST:`,
- If the patch has been merged into an upstream maintainer tree, but has not yet
been merged into Linux mainline
- tag the patch subject with `FROMGIT:`
- add info on where the patch came from as `(cherry picked from commit <sha1> <repo> <branch>)`. This
must be a stable maintainer branch (not rebased, so don't use `linux-next` for example).
- if changes were required, use `BACKPORT: FROMGIT:`
- Example:
- if the commit message in the maintainer tree is
```
important patch from upstream
This is the detailed description of the important patch
Signed-off-by: Fred Jones <fred.jones@foo.org>
```
>- then Joe Smith would upload the patch for the common kernel as
```
FROMGIT: important patch from upstream
This is the detailed description of the important patch
Signed-off-by: Fred Jones <fred.jones@foo.org>
Bug: 135791357
(cherry picked from commit 878a2fd9de10b03d11d2f622250285c7e63deace
https://git.kernel.org/pub/scm/linux/kernel/git/foo/bar.git test-branch)
Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
Signed-off-by: Joe Smith <joe.smith@foo.org>
```
- If the patch has been submitted to LKML, but not accepted into any maintainer tree
- tag the patch subject with `FROMLIST:`
- add a `Link:` tag with a link to the submittal on lore.kernel.org
- add a `Bug:` tag with the Android bug (required for patches not accepted into
a maintainer tree)
- if changes were required, use `BACKPORT: FROMLIST:`
- Example:
```
FROMLIST: important patch from upstream
This is the detailed description of the important patch
Signed-off-by: Fred Jones <fred.jones@foo.org>
Bug: 135791357
Link: https://lore.kernel.org/lkml/20190619171517.GA17557@someone.com/
Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
Signed-off-by: Joe Smith <joe.smith@foo.org>
```
## Requirements for Android-specific patches: `ANDROID:`
- If the patch is fixing a bug to Android-specific code
- tag the patch subject with `ANDROID:`
- add a `Fixes:` tag that cites the patch with the bug
- Example:
```
ANDROID: fix android-specific bug in foobar.c
This is the detailed description of the important fix
Fixes: 1234abcd2468 ("foobar: add cool feature")
Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
Signed-off-by: Joe Smith <joe.smith@foo.org>
```
- If the patch is a new feature
- tag the patch subject with `ANDROID:`
- add a `Bug:` tag with the Android bug (required for android-specific features)
<<<<<<< HEAD
>>>>>>> parent of 6c843d0e8 (README.md aktualisiert)
=======
>>>>>>> parent of 65a1eeb07 (remove standard README.md)

View File

@@ -63,8 +63,8 @@ CONFIG_USB_INTERFACE_LPM_LIST=y
CONFIG_USB_NOTIFY_PROC_LOG=y CONFIG_USB_NOTIFY_PROC_LOG=y
CONFIG_USB_USING_ADVANCED_USBLOG=y CONFIG_USB_USING_ADVANCED_USBLOG=y
CONFIG_CIRRUS_FIRMWARE_CL_DSP=m CONFIG_CIRRUS_FIRMWARE_CL_DSP=m
# CONFIG_KPERFMON is not set CONFIG_KPERFMON=y
# CONFIG_KPERFMON_BUILD is not set CONFIG_KPERFMON_BUILD=m
CONFIG_ANDROID_SWITCH=m CONFIG_ANDROID_SWITCH=m
# CONFIG_ANDROID_SWITCH_GPIO is not set # CONFIG_ANDROID_SWITCH_GPIO is not set
CONFIG_HDM=m CONFIG_HDM=m

File diff suppressed because it is too large Load Diff

View File

@@ -1,88 +0,0 @@
// Generated by the protocol buffer compiler for perflog!! DO NOT EDIT!
#ifndef _OLOG_PROTOCOL_BUFFER_H_
#define _OLOG_PROTOCOL_BUFFER_H_
//EnumGenerator::GenerateDefinition in perflog_enum.cc
enum OlogTestEnum_Type {
PERFLOG_DEF = 0,
PERFLOG_LOG = 1,
PERFLOG_EVT = 2,
PERFLOG_WRN = 3,
PERFLOG_CRI = 4
};
#if defined(KPERFMON_KERNEL)
int OlogTestEnum_Type_maxnum = 5;
char * OlogTestEnum_Type_strings[5] = {
"DEF",
"LOG",
"EVT",
"WRN",
"CRI"
};
#endif //KPERFMON_KERNEL
//EnumGenerator::GenerateDefinition in perflog_enum.cc
enum OlogTestEnum_ID {
PERFLOG_UNKNOWN = 0,
PERFLOG_LCDV = 2,
PERFLOG_ARGOS = 3,
PERFLOG_APPLAUNCH = 4,
PERFLOG_LOADAPK = 5,
PERFLOG_MAINLOOPER = 6,
PERFLOG_EXCESSIVECPUUSAGE = 7,
PERFLOG_ACTIVITYSLOW = 8,
PERFLOG_BROADCAST = 9,
PERFLOG_STORE = 10,
PERFLOG_CPUTOP = 11,
PERFLOG_LCD = 12,
PERFLOG_CPU = 13,
PERFLOG_LOCKCONTENTION = 14,
PERFLOG_CPUFREQ = 15,
PERFLOG_MEMPRESSURE = 16,
PERFLOG_INPUTD = 17,
PERFLOG_AMPSS = 18,
PERFLOG_SERVICEMANAGERSLOW = 19,
PERFLOG_IPCSTARVE = 20,
PERFLOG_SCREENSHOT = 21,
PERFLOG_MUTEX = 22,
PERFLOG_SYSTEMSERVER = 23,
PERFLOG_PERFETTOLOGGINGENABLED = 24,
PERFLOG_BIGDATA = 25,
PERFLOG_PSI = 26,
PERFLOG_JANK = 27
};
#if defined(KPERFMON_KERNEL)
int OlogTestEnum_ID_maxnum = 28;
char * OlogTestEnum_ID_strings[28] = {
"UNKNOWN",
" ",
"LCDV",
"ARGOS",
"APPLAUNCH",
"LOADAPK",
"MAINLOOPER",
"EXCESSIVECPUUSAGE",
"ACTIVITYSLOW",
"BROADCAST",
"STORE",
"CPUTOP",
"LCD",
"CPU",
"LOCKCONTENTION",
"CPUFREQ",
"MEMPRESSURE",
"INPUTD",
"AMPSS",
"SERVICEMANAGERSLOW",
"IPCSTARVE",
"SCREENSHOT",
"MUTEX",
"SYSTEMSERVER",
"PERFETTOLOGGINGENABLED",
"BIGDATA",
"PSI",
"JANK"
};
#endif //KPERFMON_KERNEL
#endif //_OLOG_PROTOCOL_BUFFER_H_

View File

@@ -1,15 +0,0 @@
#ifndef _OLOG_KERNEL_H_
#define _OLOG_KERNEL_H_
#include <linux/unistd.h>
#include "olog.pb.h"
#define OLOG_CPU_FREQ_FILTER 1500000
#define PERFLOG_MUTEX_THRESHOLD 20
#define ologk(...) _perflog(PERFLOG_LOG, PERFLOG_UNKNOWN, __VA_ARGS__)
#define perflog(...) _perflog(PERFLOG_LOG, __VA_ARGS__)
extern void _perflog(int type, int logid, const char *fmt, ...);
extern void perflog_evt(int logid, int arg1);
#endif