mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 17:22:07 +00:00
Kbuild updates for v6.3
- Change V=1 option to print both short log and full command log. - Allow V=1 and V=2 to be combined as V=12. - Make W=1 detect wrong .gitignore files. - Tree-wide cleanups for unused command line arguments passed to Clang. - Stop using -Qunused-arguments with Clang. - Make scripts/setlocalversion handle only correct release tags instead of any arbitrary annotated tag. - Create Debian and RPM source packages without cleaning the source tree. - Various cleanups for packaging. -----BEGIN PGP SIGNATURE----- iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAmP7iHoVHG1hc2FoaXJv eUBrZXJuZWwub3JnAAoJED2LAQed4NsGL/cQAK9q5rsNL5a2LgTbm89ORA+UV+ST hrAoGo5DkJHUbVH53oPzyLynFBZPvUzLK8yjApjXkyAzy2hXYnj+vbTs0s+JVCFL owS4NB0YP+tpHGuy8bGpWI0GMZSMwmspUteqxk86zuH8uQVAhnCaeV1/Cr6Aqj1h 2jk1FZid3/h7qEkEgu5U8soeyFnV6VhAT6Ie5yfZ2O2RdsSqPUh6vfKrgdyW4RWz gito0SOUwvjIDfSmTnIIacUibisPRv2OW29OvmDp1aXj5rMhe3UfOznVE3NR86yl ZbWDAIm6KYT8V1ASOoAUR80qent9IPKytThLK9BVEQCT6bsujCZMvhYhhEvO30TF Lzsdr+FrES//xag3+hgc63FEied2xxWGQG1cRtzAhfRL9tJ03+mY1omoW6SyKqW/ Gc9PIcTgQbCIrkeL0HuAI1q3I1vkvHXInJKtGkoHh1J9aJ8v5gQpwGA+DDRUnA+A LQSeEbT2Hf3MoF4CqZRnConvfhlMuLI+j5v54YPrhokxXmv7u807kjfwMFTiZ/+m CJFlEMf9YRv3pi8g/AYyGAg5ZQigCwzOCRUC5kguFqzZdgnjiI907GEL804lm1Mg lpx/HtYPyxwWEd2XyU6/C9AEIl3gm7MBd6b1tD54Tb/VmE+AvjS/O9jFYXZqnAnM Llv4BfK/cQKwHb6o =HpFZ -----END PGP SIGNATURE----- Merge tag 'kbuild-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull Kbuild updates from Masahiro Yamada: - Change V=1 option to print both short log and full command log - Allow V=1 and V=2 to be combined as V=12 - Make W=1 detect wrong .gitignore files - Tree-wide cleanups for unused command line arguments passed to Clang - Stop using -Qunused-arguments with Clang - Make scripts/setlocalversion handle only correct release tags instead of any arbitrary annotated tag - Create Debian and RPM source packages without cleaning the source tree - Various cleanups for packaging * tag 'kbuild-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (74 commits) kbuild: rpm-pkg: remove unneeded KERNELRELEASE from modules/headers_install docs: kbuild: remove description of KBUILD_LDS_MODULE .gitattributes: use 'dts' diff driver for *.dtso files kbuild: deb-pkg: improve the usability of source package kbuild: deb-pkg: fix binary-arch and clean in debian/rules kbuild: tar-pkg: use tar rules in scripts/Makefile.package kbuild: make perf-tar*-src-pkg work without relying on git kbuild: deb-pkg: switch over to source format 3.0 (quilt) kbuild: deb-pkg: make .orig tarball a hard link if possible kbuild: deb-pkg: hide KDEB_SOURCENAME from Makefile kbuild: srcrpm-pkg: create source package without cleaning kbuild: rpm-pkg: build binary packages from source rpm kbuild: deb-pkg: create source package without cleaning kbuild: add a tool to list files ignored by git Documentation/llvm: add Chimera Linux, Google and Meta datacenters setlocalversion: use only the correct release tag for git-describe setlocalversion: clean up the construction of version output .gitignore: ignore *.cover and *.mbx kbuild: remove --include-dir MAKEFLAG from top Makefile kbuild: fix trivial typo in comment ...
This commit is contained in:
commit
498a1cf902
8
.gitattributes
vendored
8
.gitattributes
vendored
@ -1,4 +1,4 @@
|
|||||||
*.c diff=cpp
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
*.h diff=cpp
|
*.[ch] diff=cpp
|
||||||
*.dtsi diff=dts
|
*.dts diff=dts
|
||||||
*.dts diff=dts
|
*.dts[io] diff=dts
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,7 +4,7 @@
|
|||||||
# subdirectories here. Add them in the ".gitignore" file
|
# subdirectories here. Add them in the ".gitignore" file
|
||||||
# in that subdirectory instead.
|
# in that subdirectory instead.
|
||||||
#
|
#
|
||||||
# NOTE! Please use 'git ls-files -i --exclude-standard'
|
# NOTE! Please use 'git ls-files -i -c --exclude-per-directory=.gitignore'
|
||||||
# command after changing this file, to see if there are
|
# command after changing this file, to see if there are
|
||||||
# any tracked files which get ignored after the change.
|
# any tracked files which get ignored after the change.
|
||||||
#
|
#
|
||||||
@ -16,6 +16,7 @@
|
|||||||
*.bin
|
*.bin
|
||||||
*.bz2
|
*.bz2
|
||||||
*.c.[012]*.*
|
*.c.[012]*.*
|
||||||
|
*.cover
|
||||||
*.dt.yaml
|
*.dt.yaml
|
||||||
*.dtb
|
*.dtb
|
||||||
*.dtbo
|
*.dtbo
|
||||||
@ -33,6 +34,7 @@
|
|||||||
*.lz4
|
*.lz4
|
||||||
*.lzma
|
*.lzma
|
||||||
*.lzo
|
*.lzo
|
||||||
|
*.mbx
|
||||||
*.mod
|
*.mod
|
||||||
*.mod.c
|
*.mod.c
|
||||||
*.o
|
*.o
|
||||||
|
@ -28,7 +28,7 @@ BUILDDIR = $(obj)/output
|
|||||||
PDFLATEX = xelatex
|
PDFLATEX = xelatex
|
||||||
LATEXOPTS = -interaction=batchmode -no-shell-escape
|
LATEXOPTS = -interaction=batchmode -no-shell-escape
|
||||||
|
|
||||||
ifeq ($(KBUILD_VERBOSE),0)
|
ifeq ($(findstring 1, $(KBUILD_VERBOSE)),)
|
||||||
SPHINXOPTS += "-q"
|
SPHINXOPTS += "-q"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -91,7 +91,6 @@ asm_offsets.h
|
|||||||
autoconf.h*
|
autoconf.h*
|
||||||
av_permissions.h
|
av_permissions.h
|
||||||
bbootsect
|
bbootsect
|
||||||
bin2c
|
|
||||||
binkernel.spec
|
binkernel.spec
|
||||||
bootsect
|
bootsect
|
||||||
bounds.h
|
bounds.h
|
||||||
|
@ -15,12 +15,15 @@ such as GCC and binutils. Ongoing work has allowed for `Clang
|
|||||||
<https://clang.llvm.org/>`_ and `LLVM <https://llvm.org/>`_ utilities to be
|
<https://clang.llvm.org/>`_ and `LLVM <https://llvm.org/>`_ utilities to be
|
||||||
used as viable substitutes. Distributions such as `Android
|
used as viable substitutes. Distributions such as `Android
|
||||||
<https://www.android.com/>`_, `ChromeOS
|
<https://www.android.com/>`_, `ChromeOS
|
||||||
<https://www.chromium.org/chromium-os>`_, and `OpenMandriva
|
<https://www.chromium.org/chromium-os>`_, `OpenMandriva
|
||||||
<https://www.openmandriva.org/>`_ use Clang built kernels. `LLVM is a
|
<https://www.openmandriva.org/>`_, and `Chimera Linux
|
||||||
collection of toolchain components implemented in terms of C++ objects
|
<https://chimera-linux.org/>`_ use Clang built kernels. Google's and Meta's
|
||||||
<https://www.aosabook.org/en/llvm.html>`_. Clang is a front-end to LLVM that
|
datacenter fleets also run kernels built with Clang.
|
||||||
supports C and the GNU C extensions required by the kernel, and is pronounced
|
|
||||||
"klang," not "see-lang."
|
`LLVM is a collection of toolchain components implemented in terms of C++
|
||||||
|
objects <https://www.aosabook.org/en/llvm.html>`_. Clang is a front-end to LLVM
|
||||||
|
that supports C and the GNU C extensions required by the kernel, and is
|
||||||
|
pronounced "klang," not "see-lang."
|
||||||
|
|
||||||
Clang
|
Clang
|
||||||
-----
|
-----
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -11085,7 +11085,7 @@ M: Masahiro Yamada <masahiroy@kernel.org>
|
|||||||
L: linux-kbuild@vger.kernel.org
|
L: linux-kbuild@vger.kernel.org
|
||||||
S: Maintained
|
S: Maintained
|
||||||
Q: https://patchwork.kernel.org/project/linux-kbuild/list/
|
Q: https://patchwork.kernel.org/project/linux-kbuild/list/
|
||||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig
|
T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kbuild
|
||||||
F: Documentation/kbuild/kconfig*
|
F: Documentation/kbuild/kconfig*
|
||||||
F: scripts/Kconfig.include
|
F: scripts/Kconfig.include
|
||||||
F: scripts/kconfig/
|
F: scripts/kconfig/
|
||||||
|
93
Makefile
93
Makefile
@ -56,26 +56,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
|
||||||
@ -83,16 +78,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 = quiet_
|
||||||
|
Q = @
|
||||||
|
|
||||||
|
ifneq ($(findstring 1, $(KBUILD_VERBOSE)),)
|
||||||
quiet =
|
quiet =
|
||||||
Q =
|
Q =
|
||||||
else
|
|
||||||
quiet=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
|
||||||
@ -100,14 +92,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
|
||||||
@ -211,14 +203,6 @@ 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.
|
||||||
@ -290,7 +274,8 @@ no-dot-config-targets := $(clean-targets) \
|
|||||||
cscope gtags TAGS tags help% %docs check% coccicheck \
|
cscope gtags TAGS tags help% %docs check% coccicheck \
|
||||||
$(version_h) headers headers_% archheaders archscripts \
|
$(version_h) headers headers_% archheaders archscripts \
|
||||||
%asm-generic kernelversion %src-pkg dt_binding_check \
|
%asm-generic kernelversion %src-pkg dt_binding_check \
|
||||||
outputmakefile rustavailable rustfmt rustfmtcheck
|
outputmakefile rustavailable rustfmt rustfmtcheck \
|
||||||
|
scripts_package
|
||||||
# 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 \
|
||||||
@ -577,7 +562,7 @@ KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
|
|||||||
-std=gnu11
|
-std=gnu11
|
||||||
KBUILD_CPPFLAGS := -D__KERNEL__
|
KBUILD_CPPFLAGS := -D__KERNEL__
|
||||||
KBUILD_RUSTFLAGS := $(rust_common_flags) \
|
KBUILD_RUSTFLAGS := $(rust_common_flags) \
|
||||||
--target=$(objtree)/rust/target.json \
|
--target=$(objtree)/scripts/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 \
|
||||||
@ -878,7 +863,6 @@ KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings
|
|||||||
KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y)
|
KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y)
|
||||||
|
|
||||||
ifdef CONFIG_CC_IS_CLANG
|
ifdef CONFIG_CC_IS_CLANG
|
||||||
KBUILD_CPPFLAGS += -Qunused-arguments
|
|
||||||
# The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
|
# The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
|
||||||
KBUILD_CFLAGS += -Wno-gnu
|
KBUILD_CFLAGS += -Wno-gnu
|
||||||
else
|
else
|
||||||
@ -921,7 +905,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
|
||||||
|
|
||||||
@ -1267,8 +1253,11 @@ vmlinux: vmlinux.o $(KBUILD_LDS) modpost
|
|||||||
# 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 = \
|
ifeq ($(origin KERNELRELEASE),file)
|
||||||
echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
|
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
|
||||||
@ -1545,7 +1534,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
|
||||||
@ -1617,7 +1606,7 @@ MRPROPER_FILES += include/config include/generated \
|
|||||||
certs/x509.genkey \
|
certs/x509.genkey \
|
||||||
vmlinux-gdb.py \
|
vmlinux-gdb.py \
|
||||||
*.spec \
|
*.spec \
|
||||||
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
|
||||||
#
|
#
|
||||||
@ -1667,6 +1656,10 @@ distclean: mrproper
|
|||||||
%pkg: include/config/kernel.release FORCE
|
%pkg: include/config/kernel.release FORCE
|
||||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@
|
||||||
|
|
||||||
|
PHONY += scripts_package
|
||||||
|
scripts_package: scripts_basic
|
||||||
|
$(Q)$(MAKE) $(build)=scripts scripts/list-gitignored
|
||||||
|
|
||||||
# Brief documentation of the typical targets used
|
# Brief documentation of the typical targets used
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -1782,8 +1775,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)'
|
||||||
@ -1875,6 +1869,12 @@ rust-analyzer:
|
|||||||
# 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
|
||||||
@ -2046,11 +2046,12 @@ clean: $(clean-dirs)
|
|||||||
-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
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -2132,7 +2133,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 $(srctree))"
|
@$(filechk_kernel.release)
|
||||||
|
|
||||||
kernelversion:
|
kernelversion:
|
||||||
@echo $(KERNELVERSION)
|
@echo $(KERNELVERSION)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2009 Simtec Electronics
|
# Copyright 2009 Simtec Electronics
|
||||||
|
|
||||||
include $(src)/Makefile.s3c64xx
|
include $(srctree)/$(src)/Makefile.s3c64xx
|
||||||
|
|
||||||
# Objects we always build independent of SoC choice
|
# Objects we always build independent of SoC choice
|
||||||
|
|
||||||
|
@ -43,4 +43,4 @@ obj-$(CONFIG_ELF_CORE) += elfcore.o
|
|||||||
CFLAGS_traps.o += -mfixed-range=f2-f5,f16-f31
|
CFLAGS_traps.o += -mfixed-range=f2-f5,f16-f31
|
||||||
|
|
||||||
# The gate DSO image is built using a special linker script.
|
# The gate DSO image is built using a special linker script.
|
||||||
include $(src)/Makefile.gate
|
include $(srctree)/$(src)/Makefile.gate
|
||||||
|
@ -7,7 +7,7 @@ subdir-ccflags-y := -Werror
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# platform specific definitions
|
# platform specific definitions
|
||||||
include arch/mips/Kbuild.platforms
|
include $(srctree)/arch/mips/Kbuild.platforms
|
||||||
obj-y := $(platform-y)
|
obj-y := $(platform-y)
|
||||||
|
|
||||||
# make clean traverses $(obj-) without having included .config, so
|
# make clean traverses $(obj-) without having included .config, so
|
||||||
|
@ -95,7 +95,7 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz
|
|||||||
# crossformat linking we rely on the elf2ecoff tool for format conversion.
|
# crossformat linking we rely on the elf2ecoff tool for format conversion.
|
||||||
#
|
#
|
||||||
cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
|
cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
|
||||||
cflags-y += -msoft-float
|
cflags-y += -msoft-float -Wa,-msoft-float
|
||||||
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
|
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
|
||||||
KBUILD_AFLAGS_MODULE += -mlong-calls
|
KBUILD_AFLAGS_MODULE += -mlong-calls
|
||||||
KBUILD_CFLAGS_MODULE += -mlong-calls
|
KBUILD_CFLAGS_MODULE += -mlong-calls
|
||||||
@ -104,15 +104,6 @@ ifeq ($(CONFIG_RELOCATABLE),y)
|
|||||||
LDFLAGS_vmlinux += --emit-relocs
|
LDFLAGS_vmlinux += --emit-relocs
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
|
||||||
# pass -msoft-float to GAS if it supports it. However on newer binutils
|
|
||||||
# (specifically newer than 2.24.51.20140728) we then also need to explicitly
|
|
||||||
# set ".set hardfloat" in all files which manipulate floating point registers.
|
|
||||||
#
|
|
||||||
ifneq ($(call as-option,-Wa$(comma)-msoft-float,),)
|
|
||||||
cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float
|
|
||||||
endif
|
|
||||||
|
|
||||||
cflags-y += -ffreestanding
|
cflags-y += -ffreestanding
|
||||||
|
|
||||||
cflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
|
cflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
|
||||||
@ -152,7 +143,7 @@ cflags-y += -fno-stack-check
|
|||||||
#
|
#
|
||||||
# Avoid this by explicitly disabling that assembler behaviour.
|
# Avoid this by explicitly disabling that assembler behaviour.
|
||||||
#
|
#
|
||||||
cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
|
cflags-y += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
|
||||||
|
|
||||||
#
|
#
|
||||||
# CPU-dependent compiler/assembler options for optimization.
|
# CPU-dependent compiler/assembler options for optimization.
|
||||||
|
@ -10,7 +10,7 @@ PHONY := __archpost
|
|||||||
__archpost:
|
__archpost:
|
||||||
|
|
||||||
-include include/config/auto.conf
|
-include include/config/auto.conf
|
||||||
include scripts/Kbuild.include
|
include $(srctree)/scripts/Kbuild.include
|
||||||
|
|
||||||
CMD_LS3_LLSC = arch/mips/tools/loongson3-llsc-check
|
CMD_LS3_LLSC = arch/mips/tools/loongson3-llsc-check
|
||||||
quiet_cmd_ls3_llsc = LLSCCHK $@
|
quiet_cmd_ls3_llsc = LLSCCHK $@
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
.macro fpu_save_single thread tmp=t0
|
.macro fpu_save_single thread tmp=t0
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
cfc1 \tmp, fcr31
|
cfc1 \tmp, fcr31
|
||||||
s.d $f0, THREAD_FPR0(\thread)
|
s.d $f0, THREAD_FPR0(\thread)
|
||||||
s.d $f2, THREAD_FPR2(\thread)
|
s.d $f2, THREAD_FPR2(\thread)
|
||||||
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
.macro fpu_restore_single thread tmp=t0
|
.macro fpu_restore_single thread tmp=t0
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
lw \tmp, THREAD_FCR31(\thread)
|
lw \tmp, THREAD_FCR31(\thread)
|
||||||
l.d $f0, THREAD_FPR0(\thread)
|
l.d $f0, THREAD_FPR0(\thread)
|
||||||
l.d $f2, THREAD_FPR2(\thread)
|
l.d $f2, THREAD_FPR2(\thread)
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
.macro fpu_save_16even thread tmp=t0
|
.macro fpu_save_16even thread tmp=t0
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
cfc1 \tmp, fcr31
|
cfc1 \tmp, fcr31
|
||||||
sdc1 $f0, THREAD_FPR0(\thread)
|
sdc1 $f0, THREAD_FPR0(\thread)
|
||||||
sdc1 $f2, THREAD_FPR2(\thread)
|
sdc1 $f2, THREAD_FPR2(\thread)
|
||||||
@ -109,7 +109,7 @@
|
|||||||
.set push
|
.set push
|
||||||
.set mips64r2
|
.set mips64r2
|
||||||
.set fp=64
|
.set fp=64
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
sdc1 $f1, THREAD_FPR1(\thread)
|
sdc1 $f1, THREAD_FPR1(\thread)
|
||||||
sdc1 $f3, THREAD_FPR3(\thread)
|
sdc1 $f3, THREAD_FPR3(\thread)
|
||||||
sdc1 $f5, THREAD_FPR5(\thread)
|
sdc1 $f5, THREAD_FPR5(\thread)
|
||||||
@ -142,7 +142,7 @@
|
|||||||
|
|
||||||
.macro fpu_restore_16even thread tmp=t0
|
.macro fpu_restore_16even thread tmp=t0
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
lw \tmp, THREAD_FCR31(\thread)
|
lw \tmp, THREAD_FCR31(\thread)
|
||||||
ldc1 $f0, THREAD_FPR0(\thread)
|
ldc1 $f0, THREAD_FPR0(\thread)
|
||||||
ldc1 $f2, THREAD_FPR2(\thread)
|
ldc1 $f2, THREAD_FPR2(\thread)
|
||||||
@ -168,7 +168,7 @@
|
|||||||
.set push
|
.set push
|
||||||
.set mips64r2
|
.set mips64r2
|
||||||
.set fp=64
|
.set fp=64
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
ldc1 $f1, THREAD_FPR1(\thread)
|
ldc1 $f1, THREAD_FPR1(\thread)
|
||||||
ldc1 $f3, THREAD_FPR3(\thread)
|
ldc1 $f3, THREAD_FPR3(\thread)
|
||||||
ldc1 $f5, THREAD_FPR5(\thread)
|
ldc1 $f5, THREAD_FPR5(\thread)
|
||||||
@ -373,7 +373,7 @@
|
|||||||
.macro _cfcmsa rd, cs
|
.macro _cfcmsa rd, cs
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
insn_if_mips 0x787e0059 | (\cs << 11)
|
insn_if_mips 0x787e0059 | (\cs << 11)
|
||||||
insn32_if_mm 0x587e0056 | (\cs << 11)
|
insn32_if_mm 0x587e0056 | (\cs << 11)
|
||||||
move \rd, $1
|
move \rd, $1
|
||||||
@ -383,7 +383,7 @@
|
|||||||
.macro _ctcmsa cd, rs
|
.macro _ctcmsa cd, rs
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
move $1, \rs
|
move $1, \rs
|
||||||
insn_if_mips 0x783e0819 | (\cd << 6)
|
insn_if_mips 0x783e0819 | (\cd << 6)
|
||||||
insn32_if_mm 0x583e0816 | (\cd << 6)
|
insn32_if_mm 0x583e0816 | (\cd << 6)
|
||||||
@ -393,7 +393,7 @@
|
|||||||
.macro ld_b wd, off, base
|
.macro ld_b wd, off, base
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
PTR_ADDU $1, \base, \off
|
PTR_ADDU $1, \base, \off
|
||||||
insn_if_mips 0x78000820 | (\wd << 6)
|
insn_if_mips 0x78000820 | (\wd << 6)
|
||||||
insn32_if_mm 0x58000807 | (\wd << 6)
|
insn32_if_mm 0x58000807 | (\wd << 6)
|
||||||
@ -403,7 +403,7 @@
|
|||||||
.macro ld_h wd, off, base
|
.macro ld_h wd, off, base
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
PTR_ADDU $1, \base, \off
|
PTR_ADDU $1, \base, \off
|
||||||
insn_if_mips 0x78000821 | (\wd << 6)
|
insn_if_mips 0x78000821 | (\wd << 6)
|
||||||
insn32_if_mm 0x58000817 | (\wd << 6)
|
insn32_if_mm 0x58000817 | (\wd << 6)
|
||||||
@ -413,7 +413,7 @@
|
|||||||
.macro ld_w wd, off, base
|
.macro ld_w wd, off, base
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
PTR_ADDU $1, \base, \off
|
PTR_ADDU $1, \base, \off
|
||||||
insn_if_mips 0x78000822 | (\wd << 6)
|
insn_if_mips 0x78000822 | (\wd << 6)
|
||||||
insn32_if_mm 0x58000827 | (\wd << 6)
|
insn32_if_mm 0x58000827 | (\wd << 6)
|
||||||
@ -423,7 +423,7 @@
|
|||||||
.macro ld_d wd, off, base
|
.macro ld_d wd, off, base
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
PTR_ADDU $1, \base, \off
|
PTR_ADDU $1, \base, \off
|
||||||
insn_if_mips 0x78000823 | (\wd << 6)
|
insn_if_mips 0x78000823 | (\wd << 6)
|
||||||
insn32_if_mm 0x58000837 | (\wd << 6)
|
insn32_if_mm 0x58000837 | (\wd << 6)
|
||||||
@ -433,7 +433,7 @@
|
|||||||
.macro st_b wd, off, base
|
.macro st_b wd, off, base
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
PTR_ADDU $1, \base, \off
|
PTR_ADDU $1, \base, \off
|
||||||
insn_if_mips 0x78000824 | (\wd << 6)
|
insn_if_mips 0x78000824 | (\wd << 6)
|
||||||
insn32_if_mm 0x5800080f | (\wd << 6)
|
insn32_if_mm 0x5800080f | (\wd << 6)
|
||||||
@ -443,7 +443,7 @@
|
|||||||
.macro st_h wd, off, base
|
.macro st_h wd, off, base
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
PTR_ADDU $1, \base, \off
|
PTR_ADDU $1, \base, \off
|
||||||
insn_if_mips 0x78000825 | (\wd << 6)
|
insn_if_mips 0x78000825 | (\wd << 6)
|
||||||
insn32_if_mm 0x5800081f | (\wd << 6)
|
insn32_if_mm 0x5800081f | (\wd << 6)
|
||||||
@ -453,7 +453,7 @@
|
|||||||
.macro st_w wd, off, base
|
.macro st_w wd, off, base
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
PTR_ADDU $1, \base, \off
|
PTR_ADDU $1, \base, \off
|
||||||
insn_if_mips 0x78000826 | (\wd << 6)
|
insn_if_mips 0x78000826 | (\wd << 6)
|
||||||
insn32_if_mm 0x5800082f | (\wd << 6)
|
insn32_if_mm 0x5800082f | (\wd << 6)
|
||||||
@ -463,7 +463,7 @@
|
|||||||
.macro st_d wd, off, base
|
.macro st_d wd, off, base
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
PTR_ADDU $1, \base, \off
|
PTR_ADDU $1, \base, \off
|
||||||
insn_if_mips 0x78000827 | (\wd << 6)
|
insn_if_mips 0x78000827 | (\wd << 6)
|
||||||
insn32_if_mm 0x5800083f | (\wd << 6)
|
insn32_if_mm 0x5800083f | (\wd << 6)
|
||||||
@ -473,7 +473,7 @@
|
|||||||
.macro copy_s_w ws, n
|
.macro copy_s_w ws, n
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
insn_if_mips 0x78b00059 | (\n << 16) | (\ws << 11)
|
insn_if_mips 0x78b00059 | (\n << 16) | (\ws << 11)
|
||||||
insn32_if_mm 0x58b00056 | (\n << 16) | (\ws << 11)
|
insn32_if_mm 0x58b00056 | (\n << 16) | (\ws << 11)
|
||||||
.set pop
|
.set pop
|
||||||
@ -482,7 +482,7 @@
|
|||||||
.macro copy_s_d ws, n
|
.macro copy_s_d ws, n
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
insn_if_mips 0x78b80059 | (\n << 16) | (\ws << 11)
|
insn_if_mips 0x78b80059 | (\n << 16) | (\ws << 11)
|
||||||
insn32_if_mm 0x58b80056 | (\n << 16) | (\ws << 11)
|
insn32_if_mm 0x58b80056 | (\n << 16) | (\ws << 11)
|
||||||
.set pop
|
.set pop
|
||||||
@ -491,7 +491,7 @@
|
|||||||
.macro insert_w wd, n
|
.macro insert_w wd, n
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
insn_if_mips 0x79300819 | (\n << 16) | (\wd << 6)
|
insn_if_mips 0x79300819 | (\n << 16) | (\wd << 6)
|
||||||
insn32_if_mm 0x59300816 | (\n << 16) | (\wd << 6)
|
insn32_if_mm 0x59300816 | (\n << 16) | (\wd << 6)
|
||||||
.set pop
|
.set pop
|
||||||
@ -500,7 +500,7 @@
|
|||||||
.macro insert_d wd, n
|
.macro insert_d wd, n
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
insn_if_mips 0x79380819 | (\n << 16) | (\wd << 6)
|
insn_if_mips 0x79380819 | (\n << 16) | (\wd << 6)
|
||||||
insn32_if_mm 0x59380816 | (\n << 16) | (\wd << 6)
|
insn32_if_mm 0x59380816 | (\n << 16) | (\wd << 6)
|
||||||
.set pop
|
.set pop
|
||||||
@ -553,7 +553,7 @@
|
|||||||
st_d 29, THREAD_FPR29 - FPR_BASE_OFFS, FPR_BASE
|
st_d 29, THREAD_FPR29 - FPR_BASE_OFFS, FPR_BASE
|
||||||
st_d 30, THREAD_FPR30 - FPR_BASE_OFFS, FPR_BASE
|
st_d 30, THREAD_FPR30 - FPR_BASE_OFFS, FPR_BASE
|
||||||
st_d 31, THREAD_FPR31 - FPR_BASE_OFFS, FPR_BASE
|
st_d 31, THREAD_FPR31 - FPR_BASE_OFFS, FPR_BASE
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
_cfcmsa $1, MSA_CSR
|
_cfcmsa $1, MSA_CSR
|
||||||
sw $1, THREAD_MSA_CSR(\thread)
|
sw $1, THREAD_MSA_CSR(\thread)
|
||||||
.set pop
|
.set pop
|
||||||
@ -562,7 +562,7 @@
|
|||||||
.macro msa_restore_all thread
|
.macro msa_restore_all thread
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
lw $1, THREAD_MSA_CSR(\thread)
|
lw $1, THREAD_MSA_CSR(\thread)
|
||||||
_ctcmsa MSA_CSR, $1
|
_ctcmsa MSA_CSR, $1
|
||||||
#ifdef TOOLCHAIN_SUPPORTS_MSA
|
#ifdef TOOLCHAIN_SUPPORTS_MSA
|
||||||
@ -618,7 +618,7 @@
|
|||||||
.macro msa_init_all_upper
|
.macro msa_init_all_upper
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
not $1, zero
|
not $1, zero
|
||||||
msa_init_upper 0
|
msa_init_upper 0
|
||||||
msa_init_upper 1
|
msa_init_upper 1
|
||||||
|
@ -14,20 +14,6 @@
|
|||||||
|
|
||||||
#include <asm/sgidefs.h>
|
#include <asm/sgidefs.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* starting with binutils 2.24.51.20140729, MIPS binutils warn about mixing
|
|
||||||
* hardfloat and softfloat object files. The kernel build uses soft-float by
|
|
||||||
* default, so we also need to pass -msoft-float along to GAS if it supports it.
|
|
||||||
* But this in turn causes assembler errors in files which access hardfloat
|
|
||||||
* registers. We detect if GAS supports "-msoft-float" in the Makefile and
|
|
||||||
* explicitly put ".set hardfloat" where floating point registers are touched.
|
|
||||||
*/
|
|
||||||
#ifdef GAS_HAS_SET_HARDFLOAT
|
|
||||||
#define SET_HARDFLOAT .set hardfloat
|
|
||||||
#else
|
|
||||||
#define SET_HARDFLOAT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _MIPS_SIM == _MIPS_SIM_ABI32
|
#if _MIPS_SIM == _MIPS_SIM_ABI32
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2367,7 +2367,7 @@ do { \
|
|||||||
/*
|
/*
|
||||||
* Macros to access the floating point coprocessor control registers
|
* Macros to access the floating point coprocessor control registers
|
||||||
*/
|
*/
|
||||||
#define _read_32bit_cp1_register(source, gas_hardfloat) \
|
#define read_32bit_cp1_register(source) \
|
||||||
({ \
|
({ \
|
||||||
unsigned int __res; \
|
unsigned int __res; \
|
||||||
\
|
\
|
||||||
@ -2377,36 +2377,24 @@ do { \
|
|||||||
" # gas fails to assemble cfc1 for some archs, \n" \
|
" # gas fails to assemble cfc1 for some archs, \n" \
|
||||||
" # like Octeon. \n" \
|
" # like Octeon. \n" \
|
||||||
" .set mips1 \n" \
|
" .set mips1 \n" \
|
||||||
" "STR(gas_hardfloat)" \n" \
|
" .set hardfloat \n" \
|
||||||
" cfc1 %0,"STR(source)" \n" \
|
" cfc1 %0,"STR(source)" \n" \
|
||||||
" .set pop \n" \
|
" .set pop \n" \
|
||||||
: "=r" (__res)); \
|
: "=r" (__res)); \
|
||||||
__res; \
|
__res; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define _write_32bit_cp1_register(dest, val, gas_hardfloat) \
|
#define write_32bit_cp1_register(dest, val) \
|
||||||
do { \
|
do { \
|
||||||
__asm__ __volatile__( \
|
__asm__ __volatile__( \
|
||||||
" .set push \n" \
|
" .set push \n" \
|
||||||
" .set reorder \n" \
|
" .set reorder \n" \
|
||||||
" "STR(gas_hardfloat)" \n" \
|
" .set hardfloat \n" \
|
||||||
" ctc1 %0,"STR(dest)" \n" \
|
" ctc1 %0,"STR(dest)" \n" \
|
||||||
" .set pop \n" \
|
" .set pop \n" \
|
||||||
: : "r" (val)); \
|
: : "r" (val)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#ifdef GAS_HAS_SET_HARDFLOAT
|
|
||||||
#define read_32bit_cp1_register(source) \
|
|
||||||
_read_32bit_cp1_register(source, .set hardfloat)
|
|
||||||
#define write_32bit_cp1_register(dest, val) \
|
|
||||||
_write_32bit_cp1_register(dest, val, .set hardfloat)
|
|
||||||
#else
|
|
||||||
#define read_32bit_cp1_register(source) \
|
|
||||||
_read_32bit_cp1_register(source, )
|
|
||||||
#define write_32bit_cp1_register(dest, val) \
|
|
||||||
_write_32bit_cp1_register(dest, val, )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TOOLCHAIN_SUPPORTS_DSP
|
#ifdef TOOLCHAIN_SUPPORTS_DSP
|
||||||
#define rddsp(mask) \
|
#define rddsp(mask) \
|
||||||
({ \
|
({ \
|
||||||
|
@ -480,7 +480,7 @@ NESTED(nmi_handler, PT_SIZE, sp)
|
|||||||
.set push
|
.set push
|
||||||
/* gas fails to assemble cfc1 for some archs (octeon).*/ \
|
/* gas fails to assemble cfc1 for some archs (octeon).*/ \
|
||||||
.set mips1
|
.set mips1
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
cfc1 a1, fcr31
|
cfc1 a1, fcr31
|
||||||
.set pop
|
.set pop
|
||||||
.endm
|
.endm
|
||||||
|
@ -64,7 +64,7 @@ LEAF(_restore_fp)
|
|||||||
*/
|
*/
|
||||||
LEAF(_save_fp_context)
|
LEAF(_save_fp_context)
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
li v0, 0 # assume success
|
li v0, 0 # assume success
|
||||||
cfc1 t1, fcr31
|
cfc1 t1, fcr31
|
||||||
EX2(s.d $f0, 0(a0))
|
EX2(s.d $f0, 0(a0))
|
||||||
@ -98,7 +98,7 @@ LEAF(_save_fp_context)
|
|||||||
*/
|
*/
|
||||||
LEAF(_restore_fp_context)
|
LEAF(_restore_fp_context)
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
li v0, 0 # assume success
|
li v0, 0 # assume success
|
||||||
EX(lw t0, (a1))
|
EX(lw t0, (a1))
|
||||||
EX2(l.d $f0, 0(a0))
|
EX2(l.d $f0, 0(a0))
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
.macro EX insn, reg, src
|
.macro EX insn, reg, src
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
.set nomacro
|
.set nomacro
|
||||||
.ex\@: \insn \reg, \src
|
.ex\@: \insn \reg, \src
|
||||||
.set pop
|
.set pop
|
||||||
@ -98,14 +98,14 @@ LEAF(_init_msa_upper)
|
|||||||
*/
|
*/
|
||||||
LEAF(_save_fp_context)
|
LEAF(_save_fp_context)
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
cfc1 t1, fcr31
|
cfc1 t1, fcr31
|
||||||
.set pop
|
.set pop
|
||||||
|
|
||||||
#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPSR2) || \
|
#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPSR2) || \
|
||||||
defined(CONFIG_CPU_MIPSR5) || defined(CONFIG_CPU_MIPSR6)
|
defined(CONFIG_CPU_MIPSR5) || defined(CONFIG_CPU_MIPSR6)
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5)
|
#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5)
|
||||||
.set mips32r2
|
.set mips32r2
|
||||||
.set fp=64
|
.set fp=64
|
||||||
@ -135,7 +135,7 @@ LEAF(_save_fp_context)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
/* Store the 16 even double precision registers */
|
/* Store the 16 even double precision registers */
|
||||||
EX sdc1 $f0, 0(a0)
|
EX sdc1 $f0, 0(a0)
|
||||||
EX sdc1 $f2, 16(a0)
|
EX sdc1 $f2, 16(a0)
|
||||||
@ -173,7 +173,7 @@ LEAF(_restore_fp_context)
|
|||||||
#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPSR2) || \
|
#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPSR2) || \
|
||||||
defined(CONFIG_CPU_MIPSR5) || defined(CONFIG_CPU_MIPSR6)
|
defined(CONFIG_CPU_MIPSR5) || defined(CONFIG_CPU_MIPSR6)
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5)
|
#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5)
|
||||||
.set mips32r2
|
.set mips32r2
|
||||||
.set fp=64
|
.set fp=64
|
||||||
@ -201,7 +201,7 @@ LEAF(_restore_fp_context)
|
|||||||
1: .set pop
|
1: .set pop
|
||||||
#endif
|
#endif
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
EX ldc1 $f0, 0(a0)
|
EX ldc1 $f0, 0(a0)
|
||||||
EX ldc1 $f2, 16(a0)
|
EX ldc1 $f2, 16(a0)
|
||||||
EX ldc1 $f4, 32(a0)
|
EX ldc1 $f4, 32(a0)
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
LEAF(__kvm_save_fpu)
|
LEAF(__kvm_save_fpu)
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
.set fp=64
|
.set fp=64
|
||||||
mfc0 t0, CP0_STATUS
|
mfc0 t0, CP0_STATUS
|
||||||
sll t0, t0, 5 # is Status.FR set?
|
sll t0, t0, 5 # is Status.FR set?
|
||||||
@ -66,7 +66,7 @@ LEAF(__kvm_save_fpu)
|
|||||||
|
|
||||||
LEAF(__kvm_restore_fpu)
|
LEAF(__kvm_restore_fpu)
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
.set fp=64
|
.set fp=64
|
||||||
mfc0 t0, CP0_STATUS
|
mfc0 t0, CP0_STATUS
|
||||||
sll t0, t0, 5 # is Status.FR set?
|
sll t0, t0, 5 # is Status.FR set?
|
||||||
@ -110,7 +110,7 @@ LEAF(__kvm_restore_fpu)
|
|||||||
|
|
||||||
LEAF(__kvm_restore_fcsr)
|
LEAF(__kvm_restore_fcsr)
|
||||||
.set push
|
.set push
|
||||||
SET_HARDFLOAT
|
.set hardfloat
|
||||||
lw t0, VCPU_FCR31(a0)
|
lw t0, VCPU_FCR31(a0)
|
||||||
/*
|
/*
|
||||||
* The ctc1 must stay at this offset in __kvm_restore_fcsr.
|
* The ctc1 must stay at this offset in __kvm_restore_fcsr.
|
||||||
|
@ -25,7 +25,7 @@ cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f
|
|||||||
# binutils does not merge support for the flag then we can revisit & remove
|
# binutils does not merge support for the flag then we can revisit & remove
|
||||||
# this later - for now it ensures vendor toolchains don't cause problems.
|
# this later - for now it ensures vendor toolchains don't cause problems.
|
||||||
#
|
#
|
||||||
cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
|
cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
|
||||||
|
|
||||||
# Enable the workarounds for Loongson2f
|
# Enable the workarounds for Loongson2f
|
||||||
ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
|
ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
|
||||||
|
@ -90,7 +90,7 @@ aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
|
|||||||
|
|
||||||
ifeq ($(HAS_BIARCH),y)
|
ifeq ($(HAS_BIARCH),y)
|
||||||
KBUILD_CFLAGS += -m$(BITS)
|
KBUILD_CFLAGS += -m$(BITS)
|
||||||
KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS)
|
KBUILD_AFLAGS += -m$(BITS)
|
||||||
KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
|
KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ PHONY := __archpost
|
|||||||
__archpost:
|
__archpost:
|
||||||
|
|
||||||
-include include/config/auto.conf
|
-include include/config/auto.conf
|
||||||
include scripts/Kbuild.include
|
include $(srctree)/scripts/Kbuild.include
|
||||||
|
|
||||||
quiet_cmd_head_check = CHKHEAD $@
|
quiet_cmd_head_check = CHKHEAD $@
|
||||||
cmd_head_check = $(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/head_check.sh "$(NM)" "$@"
|
cmd_head_check = $(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/head_check.sh "$(NM)" "$@"
|
||||||
|
@ -51,11 +51,10 @@ do
|
|||||||
# a leading . on the name, so strip it off here.
|
# a leading . on the name, so strip it off here.
|
||||||
UNDEF="${UNDEF#.}"
|
UNDEF="${UNDEF#.}"
|
||||||
|
|
||||||
if [ $KBUILD_VERBOSE ]; then
|
case "$KBUILD_VERBOSE" in
|
||||||
if [ $KBUILD_VERBOSE -ne 0 ]; then
|
*1*)
|
||||||
echo "Checking prom_init.o symbol '$UNDEF'"
|
echo "Checking prom_init.o symbol '$UNDEF'" ;;
|
||||||
fi
|
esac
|
||||||
fi
|
|
||||||
|
|
||||||
OK=0
|
OK=0
|
||||||
for WHITE in $WHITELIST
|
for WHITE in $WHITELIST
|
||||||
|
@ -16,6 +16,11 @@ ifneq ($(c-gettimeofday-y),)
|
|||||||
CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables
|
CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables
|
||||||
CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE)
|
CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE)
|
||||||
CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
|
CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
|
||||||
|
# This flag is supported by clang for 64-bit but not 32-bit so it will cause
|
||||||
|
# an unused command line flag warning for this file.
|
||||||
|
ifdef CONFIG_CC_IS_CLANG
|
||||||
|
CFLAGS_REMOVE_vgettimeofday-32.o += -fno-stack-clash-protection
|
||||||
|
endif
|
||||||
CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y)
|
CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y)
|
||||||
CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
|
CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
|
||||||
CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector)
|
CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector)
|
||||||
@ -48,14 +53,18 @@ UBSAN_SANITIZE := n
|
|||||||
KASAN_SANITIZE := n
|
KASAN_SANITIZE := n
|
||||||
KCSAN_SANITIZE := n
|
KCSAN_SANITIZE := n
|
||||||
|
|
||||||
ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
|
ccflags-y := -fno-common -fno-builtin
|
||||||
ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
|
ldflags-y := -Wl,--hash-style=both -nostdlib -shared -z noexecstack
|
||||||
|
ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
|
||||||
|
# Filter flags that clang will warn are unused for linking
|
||||||
|
ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS))
|
||||||
|
|
||||||
CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
|
CC32FLAGS := -m32
|
||||||
AS32FLAGS := -D__VDSO32__ -s
|
LD32FLAGS := -Wl,-soname=linux-vdso32.so.1
|
||||||
|
AS32FLAGS := -D__VDSO32__
|
||||||
|
|
||||||
CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
|
LD64FLAGS := -Wl,-soname=linux-vdso64.so.1
|
||||||
AS64FLAGS := -D__VDSO64__ -s
|
AS64FLAGS := -D__VDSO64__
|
||||||
|
|
||||||
targets += vdso32.lds
|
targets += vdso32.lds
|
||||||
CPPFLAGS_vdso32.lds += -P -C -Upowerpc
|
CPPFLAGS_vdso32.lds += -P -C -Upowerpc
|
||||||
@ -93,15 +102,15 @@ include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE
|
|||||||
|
|
||||||
# actual build commands
|
# actual build commands
|
||||||
quiet_cmd_vdso32ld_and_check = VDSO32L $@
|
quiet_cmd_vdso32ld_and_check = VDSO32L $@
|
||||||
cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
|
cmd_vdso32ld_and_check = $(VDSOCC) $(ldflags-y) $(CC32FLAGS) $(LD32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check)
|
||||||
quiet_cmd_vdso32as = VDSO32A $@
|
quiet_cmd_vdso32as = VDSO32A $@
|
||||||
cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
|
cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
|
||||||
quiet_cmd_vdso32cc = VDSO32C $@
|
quiet_cmd_vdso32cc = VDSO32C $@
|
||||||
cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $<
|
cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $<
|
||||||
|
|
||||||
quiet_cmd_vdso64ld_and_check = VDSO64L $@
|
quiet_cmd_vdso64ld_and_check = VDSO64L $@
|
||||||
cmd_vdso64ld_and_check = $(VDSOCC) $(c_flags) $(CC64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
|
cmd_vdso64ld_and_check = $(VDSOCC) $(ldflags-y) $(LD64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check)
|
||||||
quiet_cmd_vdso64as = VDSO64A $@
|
quiet_cmd_vdso64as = VDSO64A $@
|
||||||
cmd_vdso64as = $(VDSOCC) $(a_flags) $(CC64FLAGS) $(AS64FLAGS) -c -o $@ $<
|
cmd_vdso64as = $(VDSOCC) $(a_flags) $(AS64FLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJECT_FILES_NON_STANDARD := y
|
OBJECT_FILES_NON_STANDARD := y
|
||||||
|
@ -22,10 +22,10 @@ KBUILD_AFLAGS += -DBUILD_VDSO
|
|||||||
KBUILD_CFLAGS += -DBUILD_VDSO -DDISABLE_BRANCH_PROFILING
|
KBUILD_CFLAGS += -DBUILD_VDSO -DDISABLE_BRANCH_PROFILING
|
||||||
|
|
||||||
KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS))
|
KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS))
|
||||||
KBUILD_AFLAGS_64 += -m64 -s
|
KBUILD_AFLAGS_64 += -m64
|
||||||
|
|
||||||
KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
|
KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
|
||||||
KBUILD_CFLAGS_64 += -m64 -fPIC -shared -fno-common -fno-builtin
|
KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin
|
||||||
ldflags-y := -fPIC -shared -soname=linux-vdso64.so.1 \
|
ldflags-y := -fPIC -shared -soname=linux-vdso64.so.1 \
|
||||||
--hash-style=both --build-id=sha1 -T
|
--hash-style=both --build-id=sha1 -T
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ KCSAN_SANITIZE := n
|
|||||||
KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
|
KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
|
||||||
KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
|
KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
|
||||||
KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
|
KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
|
||||||
KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common
|
KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common
|
||||||
KBUILD_CFLAGS += -fno-stack-protector
|
KBUILD_CFLAGS += -fno-stack-protector
|
||||||
KBUILD_CFLAGS += $(CLANG_FLAGS)
|
KBUILD_CFLAGS += $(CLANG_FLAGS)
|
||||||
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
|
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
|
||||||
|
@ -8,13 +8,6 @@
|
|||||||
OBJECTS := head_32.o misc.o cache.o piggy.o \
|
OBJECTS := head_32.o misc.o cache.o piggy.o \
|
||||||
ashiftrt.o ashldi3.o ashrsi3.o ashlsi3.o lshrsi3.o
|
ashiftrt.o ashldi3.o ashrsi3.o ashlsi3.o lshrsi3.o
|
||||||
|
|
||||||
# These were previously generated files. When you are building the kernel
|
|
||||||
# with O=, make sure to remove the stale files in the output tree. Otherwise,
|
|
||||||
# the build system wrongly compiles the stale ones.
|
|
||||||
ifdef building_out_of_srctree
|
|
||||||
$(shell rm -f $(addprefix $(obj)/, ashiftrt.S ashldi3.c ashrsi3.S ashlsi3.S lshrsi3.S))
|
|
||||||
endif
|
|
||||||
|
|
||||||
targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \
|
targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \
|
||||||
vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo $(OBJECTS)
|
vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo $(OBJECTS)
|
||||||
|
|
||||||
|
@ -72,4 +72,4 @@ CFLAGS_null.o = -DDEV_NULL=$(DEV_NULL_PATH)
|
|||||||
|
|
||||||
CFLAGS_xterm.o += '-DCONFIG_XTERM_CHAN_DEFAULT_EMULATOR="$(CONFIG_XTERM_CHAN_DEFAULT_EMULATOR)"'
|
CFLAGS_xterm.o += '-DCONFIG_XTERM_CHAN_DEFAULT_EMULATOR="$(CONFIG_XTERM_CHAN_DEFAULT_EMULATOR)"'
|
||||||
|
|
||||||
include arch/um/scripts/Makefile.rules
|
include $(srctree)/arch/um/scripts/Makefile.rules
|
||||||
|
@ -29,7 +29,7 @@ obj-$(CONFIG_GENERIC_PCI_IOMAP) += ioport.o
|
|||||||
|
|
||||||
USER_OBJS := config.o
|
USER_OBJS := config.o
|
||||||
|
|
||||||
include arch/um/scripts/Makefile.rules
|
include $(srctree)/arch/um/scripts/Makefile.rules
|
||||||
|
|
||||||
targets := config.c config.tmp capflags.c
|
targets := config.c config.tmp capflags.c
|
||||||
|
|
||||||
|
@ -14,4 +14,4 @@ UNPROFILE_OBJS := clone.o
|
|||||||
|
|
||||||
KCOV_INSTRUMENT := n
|
KCOV_INSTRUMENT := n
|
||||||
|
|
||||||
include arch/um/scripts/Makefile.rules
|
include $(srctree)/arch/um/scripts/Makefile.rules
|
||||||
|
@ -18,4 +18,4 @@ USER_OBJS := $(user-objs-y) elf_aux.o execvp.o file.o helper.o irq.o \
|
|||||||
main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \
|
main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \
|
||||||
tty.o umid.o util.o
|
tty.o umid.o util.o
|
||||||
|
|
||||||
include arch/um/scripts/Makefile.rules
|
include $(srctree)/arch/um/scripts/Makefile.rules
|
||||||
|
@ -10,4 +10,4 @@ obj-y =
|
|||||||
obj-$(CONFIG_UML_NET_ETHERTAP) += ethertap.o
|
obj-$(CONFIG_UML_NET_ETHERTAP) += ethertap.o
|
||||||
obj-$(CONFIG_UML_NET_TUNTAP) += tuntap.o
|
obj-$(CONFIG_UML_NET_TUNTAP) += tuntap.o
|
||||||
|
|
||||||
include arch/um/scripts/Makefile.rules
|
include $(srctree)/arch/um/scripts/Makefile.rules
|
||||||
|
@ -7,4 +7,4 @@ obj-y := mem.o process.o
|
|||||||
|
|
||||||
USER_OBJS := $(obj-y)
|
USER_OBJS := $(obj-y)
|
||||||
|
|
||||||
include arch/um/scripts/Makefile.rules
|
include $(srctree)/arch/um/scripts/Makefile.rules
|
||||||
|
@ -17,7 +17,7 @@ LDS_EXTRA := -Ui386
|
|||||||
export LDS_EXTRA
|
export LDS_EXTRA
|
||||||
|
|
||||||
# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
|
# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
|
||||||
include arch/x86/Makefile_32.cpu
|
include $(srctree)/arch/x86/Makefile_32.cpu
|
||||||
|
|
||||||
# prevent gcc from keeping the stack 16 byte aligned. Taken from i386.
|
# prevent gcc from keeping the stack 16 byte aligned. Taken from i386.
|
||||||
cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
|
cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
|
||||||
|
@ -50,7 +50,7 @@ KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
|
|||||||
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
|
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
|
||||||
KBUILD_CFLAGS += -D__DISABLE_EXPORTS
|
KBUILD_CFLAGS += -D__DISABLE_EXPORTS
|
||||||
# Disable relocation relaxation in case the link is not PIE.
|
# Disable relocation relaxation in case the link is not PIE.
|
||||||
KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no)
|
KBUILD_CFLAGS += $(call cc-option,-Wa$(comma)-mrelax-relocations=no)
|
||||||
KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h
|
KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h
|
||||||
|
|
||||||
# sev.c indirectly inludes inat-table.h which is generated during
|
# sev.c indirectly inludes inat-table.h which is generated during
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
PHONY += posttest
|
PHONY += posttest
|
||||||
|
|
||||||
ifeq ($(KBUILD_VERBOSE),1)
|
ifneq ($(findstring 1, $(KBUILD_VERBOSE)),)
|
||||||
posttest_verbose = -v
|
posttest_verbose = -v
|
||||||
else
|
else
|
||||||
posttest_verbose =
|
posttest_verbose =
|
||||||
|
@ -48,4 +48,4 @@ include/generated/user_constants.h: $(obj)/user-offsets.s FORCE
|
|||||||
UNPROFILE_OBJS := stub_segv.o
|
UNPROFILE_OBJS := stub_segv.o
|
||||||
CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
|
CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
|
||||||
|
|
||||||
include arch/um/scripts/Makefile.rules
|
include $(srctree)/arch/um/scripts/Makefile.rules
|
||||||
|
@ -10,4 +10,4 @@ obj-$(CONFIG_64BIT) += prctl.o
|
|||||||
|
|
||||||
USER_OBJS := $(obj-y)
|
USER_OBJS := $(obj-y)
|
||||||
|
|
||||||
include arch/um/scripts/Makefile.rules
|
include $(srctree)/arch/um/scripts/Makefile.rules
|
||||||
|
@ -78,7 +78,7 @@ static void drain_openssl_errors(void)
|
|||||||
static const char *key_pass;
|
static const char *key_pass;
|
||||||
static BIO *wb;
|
static BIO *wb;
|
||||||
static char *cert_dst;
|
static char *cert_dst;
|
||||||
static int kbuild_verbose;
|
static bool verbose;
|
||||||
|
|
||||||
static void write_cert(X509 *x509)
|
static void write_cert(X509 *x509)
|
||||||
{
|
{
|
||||||
@ -90,19 +90,22 @@ static void write_cert(X509 *x509)
|
|||||||
}
|
}
|
||||||
X509_NAME_oneline(X509_get_subject_name(x509), buf, sizeof(buf));
|
X509_NAME_oneline(X509_get_subject_name(x509), buf, sizeof(buf));
|
||||||
ERR(!i2d_X509_bio(wb, x509), "%s", cert_dst);
|
ERR(!i2d_X509_bio(wb, x509), "%s", cert_dst);
|
||||||
if (kbuild_verbose)
|
if (verbose)
|
||||||
fprintf(stderr, "Extracted cert: %s\n", buf);
|
fprintf(stderr, "Extracted cert: %s\n", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *cert_src;
|
char *cert_src;
|
||||||
|
char *verbose_env;
|
||||||
|
|
||||||
OpenSSL_add_all_algorithms();
|
OpenSSL_add_all_algorithms();
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
|
|
||||||
kbuild_verbose = atoi(getenv("KBUILD_VERBOSE")?:"0");
|
verbose_env = getenv("KBUILD_VERBOSE");
|
||||||
|
if (verbose_env && strchr(verbose_env, '1'))
|
||||||
|
verbose = true;
|
||||||
|
|
||||||
key_pass = getenv("KBUILD_SIGN_PIN");
|
key_pass = getenv("KBUILD_SIGN_PIN");
|
||||||
|
|
||||||
|
@ -6,6 +6,11 @@
|
|||||||
# Rewritten to use lists instead of if-statements.
|
# Rewritten to use lists instead of if-statements.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Some driver Makefiles miss $(srctree)/ for include directive.
|
||||||
|
ifdef building_out_of_srctree
|
||||||
|
MAKEFLAGS += --include-dir=$(srctree)
|
||||||
|
endif
|
||||||
|
|
||||||
obj-y += irqchip/
|
obj-y += irqchip/
|
||||||
obj-y += bus/
|
obj-y += bus/
|
||||||
|
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
# subcomponents.
|
# subcomponents.
|
||||||
|
|
||||||
ifdef CONFIG_X86
|
ifdef CONFIG_X86
|
||||||
dml_ccflags := -mhard-float -msse
|
dml_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float
|
||||||
|
dml_ccflags := $(dml_ccflags-y) -msse
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_PPC64
|
ifdef CONFIG_PPC64
|
||||||
|
@ -8,4 +8,4 @@ hostfs-objs := hostfs_kern.o hostfs_user.o
|
|||||||
obj-y :=
|
obj-y :=
|
||||||
obj-$(CONFIG_HOSTFS) += hostfs.o
|
obj-$(CONFIG_HOSTFS) += hostfs.o
|
||||||
|
|
||||||
include arch/um/scripts/Makefile.rules
|
include $(srctree)/arch/um/scripts/Makefile.rules
|
||||||
|
@ -682,10 +682,6 @@ config CPU_ISOLATION
|
|||||||
|
|
||||||
source "kernel/rcu/Kconfig"
|
source "kernel/rcu/Kconfig"
|
||||||
|
|
||||||
config BUILD_BIN2C
|
|
||||||
bool
|
|
||||||
default n
|
|
||||||
|
|
||||||
config IKCONFIG
|
config IKCONFIG
|
||||||
tristate "Kernel .config support"
|
tristate "Kernel .config support"
|
||||||
help
|
help
|
||||||
|
@ -7,7 +7,7 @@ set -e
|
|||||||
sfile="$(readlink -f "$0")"
|
sfile="$(readlink -f "$0")"
|
||||||
outdir="$(pwd)"
|
outdir="$(pwd)"
|
||||||
tarfile=$1
|
tarfile=$1
|
||||||
cpio_dir=$outdir/$tarfile.tmp
|
cpio_dir=$outdir/${tarfile%/*}/.tmp_cpio_dir
|
||||||
|
|
||||||
dir_list="
|
dir_list="
|
||||||
include/
|
include/
|
||||||
|
1
rust/.gitignore
vendored
1
rust/.gitignore
vendored
@ -1,6 +1,5 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
target.json
|
|
||||||
bindings_generated.rs
|
bindings_generated.rs
|
||||||
bindings_helpers_generated.rs
|
bindings_helpers_generated.rs
|
||||||
exports_*_generated.h
|
exports_*_generated.h
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
always-$(CONFIG_RUST) += target.json
|
|
||||||
no-clean-files += target.json
|
|
||||||
|
|
||||||
obj-$(CONFIG_RUST) += core.o compiler_builtins.o
|
obj-$(CONFIG_RUST) += core.o compiler_builtins.o
|
||||||
always-$(CONFIG_RUST) += exports_core_generated.h
|
always-$(CONFIG_RUST) += exports_core_generated.h
|
||||||
|
|
||||||
@ -232,11 +229,6 @@ rusttest-kernel: $(src)/kernel/lib.rs rusttest-prepare \
|
|||||||
$(call if_changed,rustc_test)
|
$(call if_changed,rustc_test)
|
||||||
$(call if_changed,rustc_test_library)
|
$(call if_changed,rustc_test_library)
|
||||||
|
|
||||||
filechk_rust_target = $(objtree)/scripts/generate_rust_target < $<
|
|
||||||
|
|
||||||
$(obj)/target.json: $(objtree)/include/config/auto.conf FORCE
|
|
||||||
$(call filechk,rust_target)
|
|
||||||
|
|
||||||
ifdef CONFIG_CC_IS_CLANG
|
ifdef CONFIG_CC_IS_CLANG
|
||||||
bindgen_c_flags = $(c_flags)
|
bindgen_c_flags = $(c_flags)
|
||||||
else
|
else
|
||||||
@ -332,11 +324,9 @@ $(obj)/exports_kernel_generated.h: $(obj)/kernel.o FORCE
|
|||||||
quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
|
quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
|
||||||
cmd_rustc_procmacro = \
|
cmd_rustc_procmacro = \
|
||||||
$(RUSTC_OR_CLIPPY) $(rust_common_flags) \
|
$(RUSTC_OR_CLIPPY) $(rust_common_flags) \
|
||||||
--emit=dep-info,link --extern proc_macro \
|
--emit=dep-info=$(depfile) --emit=link=$@ --extern proc_macro \
|
||||||
--crate-type proc-macro --out-dir $(objtree)/$(obj) \
|
--crate-type proc-macro \
|
||||||
--crate-name $(patsubst lib%.so,%,$(notdir $@)) $<; \
|
--crate-name $(patsubst lib%.so,%,$(notdir $@)) $<
|
||||||
mv $(objtree)/$(obj)/$(patsubst lib%.so,%,$(notdir $@)).d $(depfile); \
|
|
||||||
sed -i '/^\#/d' $(depfile)
|
|
||||||
|
|
||||||
# Procedural macros can only be used with the `rustc` that compiled it.
|
# Procedural macros can only be used with the `rustc` that compiled it.
|
||||||
# Therefore, to get `libmacros.so` automatically recompiled when the compiler
|
# Therefore, to get `libmacros.so` automatically recompiled when the compiler
|
||||||
@ -349,11 +339,10 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
|
|||||||
OBJTREE=$(abspath $(objtree)) \
|
OBJTREE=$(abspath $(objtree)) \
|
||||||
$(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \
|
$(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \
|
||||||
$(filter-out $(skip_flags),$(rust_flags) $(rustc_target_flags)) \
|
$(filter-out $(skip_flags),$(rust_flags) $(rustc_target_flags)) \
|
||||||
--emit=dep-info,obj,metadata --crate-type rlib \
|
--emit=dep-info=$(depfile) --emit=obj=$@ \
|
||||||
--out-dir $(objtree)/$(obj) -L$(objtree)/$(obj) \
|
--emit=metadata=$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \
|
||||||
--crate-name $(patsubst %.o,%,$(notdir $@)) $<; \
|
--crate-type rlib -L$(objtree)/$(obj) \
|
||||||
mv $(objtree)/$(obj)/$(patsubst %.o,%,$(notdir $@)).d $(depfile); \
|
--crate-name $(patsubst %.o,%,$(notdir $@)) $< \
|
||||||
sed -i '/^\#/d' $(depfile) \
|
|
||||||
$(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@)
|
$(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@)
|
||||||
|
|
||||||
rust-analyzer:
|
rust-analyzer:
|
||||||
@ -377,7 +366,7 @@ $(obj)/core.o: private skip_clippy = 1
|
|||||||
$(obj)/core.o: private skip_flags = -Dunreachable_pub
|
$(obj)/core.o: private skip_flags = -Dunreachable_pub
|
||||||
$(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--redefine-sym $(sym)=__rust$(sym))
|
$(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--redefine-sym $(sym)=__rust$(sym))
|
||||||
$(obj)/core.o: private rustc_target_flags = $(core-cfgs)
|
$(obj)/core.o: private rustc_target_flags = $(core-cfgs)
|
||||||
$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs $(obj)/target.json FORCE
|
$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs scripts/target.json FORCE
|
||||||
$(call if_changed_dep,rustc_library)
|
$(call if_changed_dep,rustc_library)
|
||||||
|
|
||||||
$(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
|
$(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
|
||||||
|
3
scripts/.gitignore
vendored
3
scripts/.gitignore
vendored
@ -1,11 +1,12 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-only
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
/asn1_compiler
|
/asn1_compiler
|
||||||
/bin2c
|
|
||||||
/generate_rust_target
|
/generate_rust_target
|
||||||
/insert-sys-cert
|
/insert-sys-cert
|
||||||
/kallsyms
|
/kallsyms
|
||||||
|
/list-gitignored
|
||||||
/module.lds
|
/module.lds
|
||||||
/recordmcount
|
/recordmcount
|
||||||
/sign-file
|
/sign-file
|
||||||
/sorttable
|
/sorttable
|
||||||
|
/target.json
|
||||||
/unifdef
|
/unifdef
|
||||||
|
@ -99,11 +99,11 @@ define filechk
|
|||||||
$(check-FORCE)
|
$(check-FORCE)
|
||||||
$(Q)set -e; \
|
$(Q)set -e; \
|
||||||
mkdir -p $(dir $@); \
|
mkdir -p $(dir $@); \
|
||||||
trap "rm -f $(dot-target).tmp" EXIT; \
|
trap "rm -f $(tmp-target)" EXIT; \
|
||||||
{ $(filechk_$(1)); } > $(dot-target).tmp; \
|
{ $(filechk_$(1)); } > $(tmp-target); \
|
||||||
if [ ! -r $@ ] || ! cmp -s $@ $(dot-target).tmp; then \
|
if [ ! -r $@ ] || ! cmp -s $@ $(tmp-target); then \
|
||||||
$(kecho) ' UPD $@'; \
|
$(kecho) ' UPD $@'; \
|
||||||
mv -f $(dot-target).tmp $@; \
|
mv -f $(tmp-target) $@; \
|
||||||
fi
|
fi
|
||||||
endef
|
endef
|
||||||
|
|
||||||
@ -125,15 +125,15 @@ dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj
|
|||||||
# $(Q)$(MAKE) $(clean)=dir
|
# $(Q)$(MAKE) $(clean)=dir
|
||||||
clean := -f $(srctree)/scripts/Makefile.clean obj
|
clean := -f $(srctree)/scripts/Makefile.clean obj
|
||||||
|
|
||||||
# echo command.
|
# pring log
|
||||||
# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
|
#
|
||||||
echo-cmd = $(if $($(quiet)cmd_$(1)),\
|
# If quiet is "silent_", print nothing and sink stdout
|
||||||
echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
|
# If quiet is "quiet_", print short log
|
||||||
|
# If quiet is empty, print short log and whole command
|
||||||
# sink stdout for 'make -s'
|
silent_log_print = exec >/dev/null;
|
||||||
redirect :=
|
quiet_log_print = $(if $(quiet_cmd_$1), echo ' $(call escsq,$(quiet_cmd_$1)$(why))';)
|
||||||
quiet_redirect :=
|
log_print = echo '$(pound) $(call escsq,$(or $(quiet_cmd_$1),cmd_$1 $@)$(why))'; \
|
||||||
silent_redirect := exec >/dev/null;
|
echo ' $(call escsq,$(cmd_$1))';
|
||||||
|
|
||||||
# Delete the target on interruption
|
# Delete the target on interruption
|
||||||
#
|
#
|
||||||
@ -156,8 +156,8 @@ delete-on-interrupt = \
|
|||||||
$(foreach sig, HUP INT QUIT TERM PIPE, \
|
$(foreach sig, HUP INT QUIT TERM PIPE, \
|
||||||
trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);))
|
trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);))
|
||||||
|
|
||||||
# printing commands
|
# print and execute commands
|
||||||
cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(delete-on-interrupt) $(cmd_$(1))
|
cmd = @$(if $(cmd_$(1)),set -e; $($(quiet)log_print) $(delete-on-interrupt) $(cmd_$(1)),:)
|
||||||
|
|
||||||
###
|
###
|
||||||
# if_changed - execute command if any prerequisite is newer than
|
# if_changed - execute command if any prerequisite is newer than
|
||||||
@ -170,10 +170,14 @@ cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(delete-on-interrupt) $(cmd_$(1)
|
|||||||
ifneq ($(KBUILD_NOCMDDEP),1)
|
ifneq ($(KBUILD_NOCMDDEP),1)
|
||||||
# Check if both commands are the same including their order. Result is empty
|
# Check if both commands are the same including their order. Result is empty
|
||||||
# string if equal. User may override this check using make KBUILD_NOCMDDEP=1
|
# string if equal. User may override this check using make KBUILD_NOCMDDEP=1
|
||||||
cmd-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \
|
# If the target does not exist, the *.cmd file should not be included so
|
||||||
|
# $(savedcmd_$@) gets empty. Then, target will be built even if $(newer-prereqs)
|
||||||
|
# happens to become empty.
|
||||||
|
cmd-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(savedcmd_$@))), \
|
||||||
$(subst $(space),$(space_escape),$(strip $(cmd_$1))))
|
$(subst $(space),$(space_escape),$(strip $(cmd_$1))))
|
||||||
else
|
else
|
||||||
cmd-check = $(if $(strip $(cmd_$@)),,1)
|
# We still need to detect missing targets.
|
||||||
|
cmd-check = $(if $(strip $(savedcmd_$@)),,1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Replace >$< with >$$< to preserve $ when reloading the .cmd file
|
# Replace >$< with >$$< to preserve $ when reloading the .cmd file
|
||||||
@ -186,6 +190,8 @@ make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1))))
|
|||||||
|
|
||||||
# Find any prerequisites that are newer than target or that do not exist.
|
# Find any prerequisites that are newer than target or that do not exist.
|
||||||
# PHONY targets skipped in both cases.
|
# PHONY targets skipped in both cases.
|
||||||
|
# If there is no prerequisite other than phony targets, $(newer-prereqs) becomes
|
||||||
|
# empty even if the target does not exist. cmd-check saves this corner case.
|
||||||
newer-prereqs = $(filter-out $(PHONY),$?)
|
newer-prereqs = $(filter-out $(PHONY),$?)
|
||||||
|
|
||||||
# It is a typical mistake to forget the FORCE prerequisite. Check it here so
|
# It is a typical mistake to forget the FORCE prerequisite. Check it here so
|
||||||
@ -199,7 +205,7 @@ if_changed = $(if $(if-changed-cond),$(cmd_and_savecmd),@:)
|
|||||||
|
|
||||||
cmd_and_savecmd = \
|
cmd_and_savecmd = \
|
||||||
$(cmd); \
|
$(cmd); \
|
||||||
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd
|
printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd
|
||||||
|
|
||||||
# Execute the command and also postprocess generated .d dependencies file.
|
# Execute the command and also postprocess generated .d dependencies file.
|
||||||
if_changed_dep = $(if $(if-changed-cond),$(cmd_and_fixdep),@:)
|
if_changed_dep = $(if $(if-changed-cond),$(cmd_and_fixdep),@:)
|
||||||
@ -233,13 +239,13 @@ if_changed_rule = $(if $(if-changed-cond),$(rule_$(1)),@:)
|
|||||||
# (5) No dir/.target.cmd file (used to store command line)
|
# (5) No dir/.target.cmd file (used to store command line)
|
||||||
# (6) No dir/.target.cmd file and target not listed in $(targets)
|
# (6) No dir/.target.cmd file and target not listed in $(targets)
|
||||||
# This is a good hint that there is a bug in the kbuild file
|
# This is a good hint that there is a bug in the kbuild file
|
||||||
ifeq ($(KBUILD_VERBOSE),2)
|
ifneq ($(findstring 2, $(KBUILD_VERBOSE)),)
|
||||||
why = \
|
_why = \
|
||||||
$(if $(filter $@, $(PHONY)),- due to target is PHONY, \
|
$(if $(filter $@, $(PHONY)),- due to target is PHONY, \
|
||||||
$(if $(wildcard $@), \
|
$(if $(wildcard $@), \
|
||||||
$(if $(newer-prereqs),- due to: $(newer-prereqs), \
|
$(if $(newer-prereqs),- due to: $(newer-prereqs), \
|
||||||
$(if $(cmd-check), \
|
$(if $(cmd-check), \
|
||||||
$(if $(cmd_$@),- due to command line change, \
|
$(if $(savedcmd_$@),- due to command line change, \
|
||||||
$(if $(filter $@, $(targets)), \
|
$(if $(filter $@, $(targets)), \
|
||||||
- due to missing .cmd file, \
|
- due to missing .cmd file, \
|
||||||
- due to $(notdir $@) not in $$(targets) \
|
- due to $(notdir $@) not in $$(targets) \
|
||||||
@ -251,7 +257,7 @@ why = \
|
|||||||
) \
|
) \
|
||||||
)
|
)
|
||||||
|
|
||||||
echo-why = $(call escsq, $(strip $(why)))
|
why = $(space)$(strip $(_why))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -33,7 +33,7 @@ ld-option = $(success,$(LD) -v $(1))
|
|||||||
|
|
||||||
# $(as-instr,<instr>)
|
# $(as-instr,<instr>)
|
||||||
# Return y if the assembler supports <instr>, n otherwise
|
# Return y if the assembler supports <instr>, n otherwise
|
||||||
as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler -o /dev/null -)
|
as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler-with-cpp -o /dev/null -)
|
||||||
|
|
||||||
# check if $(CC) and $(LD) exist
|
# check if $(CC) and $(LD) exist
|
||||||
$(error-if,$(failure,command -v $(CC)),C compiler '$(CC)' not found)
|
$(error-if,$(failure,command -v $(CC)),C compiler '$(CC)' not found)
|
||||||
|
@ -3,15 +3,20 @@
|
|||||||
# scripts contains sources for various helper programs used throughout
|
# scripts contains sources for various helper programs used throughout
|
||||||
# the kernel for the build process.
|
# the kernel for the build process.
|
||||||
|
|
||||||
hostprogs-always-$(CONFIG_BUILD_BIN2C) += bin2c
|
|
||||||
hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms
|
hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms
|
||||||
hostprogs-always-$(BUILD_C_RECORDMCOUNT) += recordmcount
|
hostprogs-always-$(BUILD_C_RECORDMCOUNT) += recordmcount
|
||||||
hostprogs-always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable
|
hostprogs-always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable
|
||||||
hostprogs-always-$(CONFIG_ASN1) += asn1_compiler
|
hostprogs-always-$(CONFIG_ASN1) += asn1_compiler
|
||||||
hostprogs-always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file
|
hostprogs-always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file
|
||||||
hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
|
hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
|
||||||
hostprogs-always-$(CONFIG_RUST) += generate_rust_target
|
always-$(CONFIG_RUST) += target.json
|
||||||
|
|
||||||
|
filechk_rust_target = $< < include/config/auto.conf
|
||||||
|
|
||||||
|
$(obj)/target.json: scripts/generate_rust_target include/config/auto.conf FORCE
|
||||||
|
$(call filechk,rust_target)
|
||||||
|
|
||||||
|
hostprogs += generate_rust_target
|
||||||
generate_rust_target-rust := y
|
generate_rust_target-rust := y
|
||||||
|
|
||||||
HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
|
HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
|
||||||
@ -33,7 +38,7 @@ HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# The following programs are only built on demand
|
# The following programs are only built on demand
|
||||||
hostprogs += unifdef
|
hostprogs += list-gitignored unifdef
|
||||||
|
|
||||||
# The module linker script is preprocessed on demand
|
# The module linker script is preprocessed on demand
|
||||||
targets += module.lds
|
targets += module.lds
|
||||||
|
@ -285,12 +285,9 @@ rust_common_cmd = \
|
|||||||
-Zcrate-attr=no_std \
|
-Zcrate-attr=no_std \
|
||||||
-Zcrate-attr='feature($(rust_allowed_features))' \
|
-Zcrate-attr='feature($(rust_allowed_features))' \
|
||||||
--extern alloc --extern kernel \
|
--extern alloc --extern kernel \
|
||||||
--crate-type rlib --out-dir $(obj) -L $(objtree)/rust/ \
|
--crate-type rlib -L $(objtree)/rust/ \
|
||||||
--crate-name $(basename $(notdir $@))
|
--crate-name $(basename $(notdir $@)) \
|
||||||
|
--emit=dep-info=$(depfile)
|
||||||
rust_handle_depfile = \
|
|
||||||
mv $(obj)/$(basename $(notdir $@)).d $(depfile); \
|
|
||||||
sed -i '/^\#/d' $(depfile)
|
|
||||||
|
|
||||||
# `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit
|
# `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit
|
||||||
# will be used. We explicitly request `-Ccodegen-units=1` in any case, and
|
# will be used. We explicitly request `-Ccodegen-units=1` in any case, and
|
||||||
@ -301,34 +298,27 @@ rust_handle_depfile = \
|
|||||||
# would not match each other.
|
# would not match each other.
|
||||||
|
|
||||||
quiet_cmd_rustc_o_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
|
quiet_cmd_rustc_o_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
|
||||||
cmd_rustc_o_rs = \
|
cmd_rustc_o_rs = $(rust_common_cmd) --emit=obj=$@ $<
|
||||||
$(rust_common_cmd) --emit=dep-info,obj $<; \
|
|
||||||
$(rust_handle_depfile)
|
|
||||||
|
|
||||||
$(obj)/%.o: $(src)/%.rs FORCE
|
$(obj)/%.o: $(src)/%.rs FORCE
|
||||||
$(call if_changed_dep,rustc_o_rs)
|
$(call if_changed_dep,rustc_o_rs)
|
||||||
|
|
||||||
quiet_cmd_rustc_rsi_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
|
quiet_cmd_rustc_rsi_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
|
||||||
cmd_rustc_rsi_rs = \
|
cmd_rustc_rsi_rs = \
|
||||||
$(rust_common_cmd) --emit=dep-info -Zunpretty=expanded $< >$@; \
|
$(rust_common_cmd) -Zunpretty=expanded $< >$@; \
|
||||||
command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@; \
|
command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@
|
||||||
$(rust_handle_depfile)
|
|
||||||
|
|
||||||
$(obj)/%.rsi: $(src)/%.rs FORCE
|
$(obj)/%.rsi: $(src)/%.rs FORCE
|
||||||
$(call if_changed_dep,rustc_rsi_rs)
|
$(call if_changed_dep,rustc_rsi_rs)
|
||||||
|
|
||||||
quiet_cmd_rustc_s_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
|
quiet_cmd_rustc_s_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
|
||||||
cmd_rustc_s_rs = \
|
cmd_rustc_s_rs = $(rust_common_cmd) --emit=asm=$@ $<
|
||||||
$(rust_common_cmd) --emit=dep-info,asm $<; \
|
|
||||||
$(rust_handle_depfile)
|
|
||||||
|
|
||||||
$(obj)/%.s: $(src)/%.rs FORCE
|
$(obj)/%.s: $(src)/%.rs FORCE
|
||||||
$(call if_changed_dep,rustc_s_rs)
|
$(call if_changed_dep,rustc_s_rs)
|
||||||
|
|
||||||
quiet_cmd_rustc_ll_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
|
quiet_cmd_rustc_ll_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
|
||||||
cmd_rustc_ll_rs = \
|
cmd_rustc_ll_rs = $(rust_common_cmd) --emit=llvm-ir=$@ $<
|
||||||
$(rust_common_cmd) --emit=dep-info,llvm-ir $<; \
|
|
||||||
$(rust_handle_depfile)
|
|
||||||
|
|
||||||
$(obj)/%.ll: $(src)/%.rs FORCE
|
$(obj)/%.ll: $(src)/%.rs FORCE
|
||||||
$(call if_changed_dep,rustc_ll_rs)
|
$(call if_changed_dep,rustc_ll_rs)
|
||||||
|
@ -36,6 +36,8 @@ endif
|
|||||||
# so they can be implemented or wrapped in cc-option.
|
# so they can be implemented or wrapped in cc-option.
|
||||||
CLANG_FLAGS += -Werror=unknown-warning-option
|
CLANG_FLAGS += -Werror=unknown-warning-option
|
||||||
CLANG_FLAGS += -Werror=ignored-optimization-argument
|
CLANG_FLAGS += -Werror=ignored-optimization-argument
|
||||||
|
CLANG_FLAGS += -Werror=option-ignored
|
||||||
|
CLANG_FLAGS += -Werror=unused-command-line-argument
|
||||||
KBUILD_CFLAGS += $(CLANG_FLAGS)
|
KBUILD_CFLAGS += $(CLANG_FLAGS)
|
||||||
KBUILD_AFLAGS += $(CLANG_FLAGS)
|
KBUILD_AFLAGS += $(CLANG_FLAGS)
|
||||||
export CLANG_FLAGS
|
export CLANG_FLAGS
|
||||||
|
@ -29,16 +29,16 @@ try-run = $(shell set -e; \
|
|||||||
fi)
|
fi)
|
||||||
|
|
||||||
# as-option
|
# as-option
|
||||||
# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
|
# Usage: aflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
|
||||||
|
|
||||||
as-option = $(call try-run,\
|
as-option = $(call try-run,\
|
||||||
$(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
|
$(CC) -Werror $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /dev/null -o "$$TMP",$(1),$(2))
|
||||||
|
|
||||||
# as-instr
|
# as-instr
|
||||||
# Usage: cflags-y += $(call as-instr,instr,option1,option2)
|
# Usage: aflags-y += $(call as-instr,instr,option1,option2)
|
||||||
|
|
||||||
as-instr = $(call try-run,\
|
as-instr = $(call try-run,\
|
||||||
printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
|
printf "%b\n" "$(1)" | $(CC) -Werror $(KBUILD_AFLAGS) -c -x assembler-with-cpp -o "$$TMP" -,$(2),$(3))
|
||||||
|
|
||||||
# __cc-option
|
# __cc-option
|
||||||
# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
|
# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
|
||||||
|
@ -80,25 +80,24 @@ host-rust := $(addprefix $(obj)/,$(host-rust))
|
|||||||
#####
|
#####
|
||||||
# Handle options to gcc. Support building with separate output directory
|
# Handle options to gcc. Support building with separate output directory
|
||||||
|
|
||||||
_hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
|
hostc_flags = -Wp,-MMD,$(depfile) \
|
||||||
|
$(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
|
||||||
$(HOSTCFLAGS_$(target-stem).o)
|
$(HOSTCFLAGS_$(target-stem).o)
|
||||||
_hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
|
hostcxx_flags = -Wp,-MMD,$(depfile) \
|
||||||
|
$(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
|
||||||
$(HOSTCXXFLAGS_$(target-stem).o)
|
$(HOSTCXXFLAGS_$(target-stem).o)
|
||||||
_hostrust_flags = $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \
|
hostrust_flags = --emit=dep-info=$(depfile) \
|
||||||
$(HOSTRUSTFLAGS_$(target-stem))
|
$(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \
|
||||||
|
$(HOSTRUSTFLAGS_$(target-stem))
|
||||||
|
|
||||||
# $(objtree)/$(obj) for including generated headers from checkin source files
|
# $(objtree)/$(obj) for including generated headers from checkin source files
|
||||||
ifeq ($(KBUILD_EXTMOD),)
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
ifdef building_out_of_srctree
|
ifdef building_out_of_srctree
|
||||||
_hostc_flags += -I $(objtree)/$(obj)
|
hostc_flags += -I $(objtree)/$(obj)
|
||||||
_hostcxx_flags += -I $(objtree)/$(obj)
|
hostcxx_flags += -I $(objtree)/$(obj)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
hostc_flags = -Wp,-MMD,$(depfile) $(_hostc_flags)
|
|
||||||
hostcxx_flags = -Wp,-MMD,$(depfile) $(_hostcxx_flags)
|
|
||||||
hostrust_flags = $(_hostrust_flags)
|
|
||||||
|
|
||||||
#####
|
#####
|
||||||
# Compile programs on the host
|
# Compile programs on the host
|
||||||
|
|
||||||
@ -149,10 +148,7 @@ $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE
|
|||||||
# host-rust -> Executable
|
# host-rust -> Executable
|
||||||
quiet_cmd_host-rust = HOSTRUSTC $@
|
quiet_cmd_host-rust = HOSTRUSTC $@
|
||||||
cmd_host-rust = \
|
cmd_host-rust = \
|
||||||
$(HOSTRUSTC) $(hostrust_flags) --emit=dep-info,link \
|
$(HOSTRUSTC) $(hostrust_flags) --emit=link=$@ $<
|
||||||
--out-dir=$(obj)/ $<; \
|
|
||||||
mv $(obj)/$(target-stem).d $(depfile); \
|
|
||||||
sed -i '/^\#/d' $(depfile)
|
|
||||||
$(host-rust): $(obj)/%: $(src)/%.rs FORCE
|
$(host-rust): $(obj)/%: $(src)/%.rs FORCE
|
||||||
$(call if_changed_dep,host-rust)
|
$(call if_changed_dep,host-rust)
|
||||||
|
|
||||||
|
@ -368,40 +368,25 @@ DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
|
|||||||
DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
|
DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
|
||||||
|
|
||||||
# Generate an assembly file to wrap the output of the device tree compiler
|
# Generate an assembly file to wrap the output of the device tree compiler
|
||||||
quiet_cmd_dt_S_dtb= DTBS $@
|
quiet_cmd_wrap_S_dtb = WRAP $@
|
||||||
cmd_dt_S_dtb= \
|
cmd_wrap_S_dtb = { \
|
||||||
{ \
|
symbase=__$(patsubst .%,%,$(suffix $<))_$(subst -,_,$(notdir $*)); \
|
||||||
echo '\#include <asm-generic/vmlinux.lds.h>'; \
|
echo '\#include <asm-generic/vmlinux.lds.h>'; \
|
||||||
echo '.section .dtb.init.rodata,"a"'; \
|
echo '.section .dtb.init.rodata,"a"'; \
|
||||||
echo '.balign STRUCT_ALIGNMENT'; \
|
echo '.balign STRUCT_ALIGNMENT'; \
|
||||||
echo '.global __dtb_$(subst -,_,$(*F))_begin'; \
|
echo ".global $${symbase}_begin"; \
|
||||||
echo '__dtb_$(subst -,_,$(*F))_begin:'; \
|
echo "$${symbase}_begin:"; \
|
||||||
echo '.incbin "$<" '; \
|
echo '.incbin "$<" '; \
|
||||||
echo '__dtb_$(subst -,_,$(*F))_end:'; \
|
echo ".global $${symbase}_end"; \
|
||||||
echo '.global __dtb_$(subst -,_,$(*F))_end'; \
|
echo "$${symbase}_end:"; \
|
||||||
echo '.balign STRUCT_ALIGNMENT'; \
|
echo '.balign STRUCT_ALIGNMENT'; \
|
||||||
} > $@
|
} > $@
|
||||||
|
|
||||||
$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
|
$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
|
||||||
$(call if_changed,dt_S_dtb)
|
$(call if_changed,wrap_S_dtb)
|
||||||
|
|
||||||
# Generate an assembly file to wrap the output of the device tree compiler
|
|
||||||
quiet_cmd_dt_S_dtbo= DTBOS $@
|
|
||||||
cmd_dt_S_dtbo= \
|
|
||||||
{ \
|
|
||||||
echo '\#include <asm-generic/vmlinux.lds.h>'; \
|
|
||||||
echo '.section .dtb.init.rodata,"a"'; \
|
|
||||||
echo '.balign STRUCT_ALIGNMENT'; \
|
|
||||||
echo '.global __dtbo_$(subst -,_,$(*F))_begin'; \
|
|
||||||
echo '__dtbo_$(subst -,_,$(*F))_begin:'; \
|
|
||||||
echo '.incbin "$<" '; \
|
|
||||||
echo '__dtbo_$(subst -,_,$(*F))_end:'; \
|
|
||||||
echo '.global __dtbo_$(subst -,_,$(*F))_end'; \
|
|
||||||
echo '.balign STRUCT_ALIGNMENT'; \
|
|
||||||
} > $@
|
|
||||||
|
|
||||||
$(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE
|
$(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE
|
||||||
$(call if_changed,dt_S_dtbo)
|
$(call if_changed,wrap_S_dtb)
|
||||||
|
|
||||||
quiet_cmd_dtc = DTC $@
|
quiet_cmd_dtc = DTC $@
|
||||||
cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
|
cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
|
||||||
|
@ -54,7 +54,7 @@ newer_prereqs_except = $(filter-out $(PHONY) $(1),$?)
|
|||||||
# Same as if_changed, but allows to exclude specified extra dependencies
|
# Same as if_changed, but allows to exclude specified extra dependencies
|
||||||
if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \
|
if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \
|
||||||
$(cmd); \
|
$(cmd); \
|
||||||
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
|
printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
|
||||||
|
|
||||||
# Re-generate module BTFs if either module's .ko or vmlinux changed
|
# Re-generate module BTFs if either module's .ko or vmlinux changed
|
||||||
%.ko: %.o %.mod.o scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE
|
%.ko: %.o %.mod.o scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE
|
||||||
|
@ -121,16 +121,14 @@ modpost-args += -e $(addprefix -i , $(KBUILD_EXTRA_SYMBOLS))
|
|||||||
|
|
||||||
endif # ($(KBUILD_EXTMOD),)
|
endif # ($(KBUILD_EXTMOD),)
|
||||||
|
|
||||||
ifneq ($(missing-input),)
|
|
||||||
modpost-args += -w
|
|
||||||
endif
|
|
||||||
|
|
||||||
quiet_cmd_modpost = MODPOST $@
|
quiet_cmd_modpost = MODPOST $@
|
||||||
cmd_modpost = \
|
cmd_modpost = \
|
||||||
$(if $(missing-input), \
|
$(if $(missing-input), \
|
||||||
echo >&2 "WARNING: $(missing-input) is missing."; \
|
echo >&2 "WARNING: $(missing-input) is missing."; \
|
||||||
echo >&2 " Modules may not have dependencies or modversions."; \
|
echo >&2 " Modules may not have dependencies or modversions."; \
|
||||||
echo >&2 " You may get many unresolved symbol warnings.";) \
|
echo >&2 " You may get many unresolved symbol errors."; \
|
||||||
|
echo >&2 " You can set KBUILD_MODPOST_WARN=1 to turn errors into warning"; \
|
||||||
|
echo >&2 " if you want to proceed at your own risk.";) \
|
||||||
$(MODPOST) $(modpost-args)
|
$(MODPOST) $(modpost-args)
|
||||||
|
|
||||||
targets += $(output-symdump)
|
targets += $(output-symdump)
|
||||||
|
@ -3,36 +3,13 @@
|
|||||||
|
|
||||||
include $(srctree)/scripts/Kbuild.include
|
include $(srctree)/scripts/Kbuild.include
|
||||||
|
|
||||||
# RPM target
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# The rpm target generates two rpm files:
|
|
||||||
# /usr/src/packages/SRPMS/kernel-2.6.7rc2-1.src.rpm
|
|
||||||
# /usr/src/packages/RPMS/i386/kernel-2.6.7rc2-1.<arch>.rpm
|
|
||||||
# The src.rpm files includes all source for the kernel being built
|
|
||||||
# The <arch>.rpm includes kernel configuration, modules etc.
|
|
||||||
#
|
|
||||||
# Process to create the rpm files
|
|
||||||
# a) clean the kernel
|
|
||||||
# b) Generate .spec file
|
|
||||||
# c) Build a tar ball, using symlink to make kernel version
|
|
||||||
# first entry in the path
|
|
||||||
# d) and pack the result to a tar.gz file
|
|
||||||
# e) generate the rpm files, based on kernel.spec
|
|
||||||
# - Use /. to avoid tar packing just the symlink
|
|
||||||
|
|
||||||
# Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT,
|
|
||||||
# but the binrpm-pkg target can; for some reason O= gets ignored.
|
|
||||||
|
|
||||||
# Remove hyphens since they have special meaning in RPM filenames
|
|
||||||
KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
|
KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
|
||||||
KDEB_SOURCENAME ?= linux-upstream
|
|
||||||
KBUILD_PKG_ROOTCMD ?="fakeroot -u"
|
KBUILD_PKG_ROOTCMD ?="fakeroot -u"
|
||||||
export KDEB_SOURCENAME
|
|
||||||
# Include only those top-level files that are needed by make, plus the GPL copy
|
# Include only those top-level files that are needed by make, plus the GPL copy
|
||||||
TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \
|
TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \
|
||||||
include init io_uring ipc kernel lib mm net rust \
|
include init io_uring ipc kernel lib mm net rust \
|
||||||
samples scripts security sound tools usr virt \
|
samples scripts security sound tools usr virt \
|
||||||
.config .scmversion Makefile \
|
.config Makefile \
|
||||||
Kbuild Kconfig COPYING $(wildcard localversion*)
|
Kbuild Kconfig COPYING $(wildcard localversion*)
|
||||||
MKSPEC := $(srctree)/scripts/package/mkspec
|
MKSPEC := $(srctree)/scripts/package/mkspec
|
||||||
|
|
||||||
@ -42,35 +19,77 @@ if test "$(objtree)" != "$(srctree)"; then \
|
|||||||
echo >&2; \
|
echo >&2; \
|
||||||
echo >&2 " ERROR:"; \
|
echo >&2 " ERROR:"; \
|
||||||
echo >&2 " Building source tarball is not possible outside the"; \
|
echo >&2 " Building source tarball is not possible outside the"; \
|
||||||
echo >&2 " kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
|
echo >&2 " kernel source tree. Don't set KBUILD_OUTPUT"; \
|
||||||
echo >&2 " binrpm-pkg or bindeb-pkg target instead."; \
|
|
||||||
echo >&2; \
|
echo >&2; \
|
||||||
false; \
|
false; \
|
||||||
fi ; \
|
fi ; \
|
||||||
$(srctree)/scripts/setlocalversion --save-scmversion; \
|
|
||||||
tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \
|
tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \
|
||||||
--transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \
|
--transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3)
|
||||||
rm -f $(objtree)/.scmversion
|
|
||||||
|
# .tmp_filelist .tmp_filelist_exclude
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
scripts/list-gitignored: FORCE
|
||||||
|
$(Q)$(MAKE) -f $(srctree)/Makefile scripts_package
|
||||||
|
|
||||||
|
# 1f5d3a6b6532e25a5cdf1f311956b2b03d343a48 removed '*.rej' from .gitignore,
|
||||||
|
# but it is definitely a generated file.
|
||||||
|
filechk_filelist = \
|
||||||
|
$< --exclude='*.rej' --output=$@_exclude --prefix=./ --rootdir=$(srctree) --stat=-
|
||||||
|
|
||||||
|
.tmp_filelist: scripts/list-gitignored FORCE
|
||||||
|
$(call filechk,filelist)
|
||||||
|
|
||||||
|
# tarball
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
quiet_cmd_tar = TAR $@
|
||||||
|
cmd_tar = tar -c -f $@ $(tar-compress-opt) $(tar-exclude-opt) \
|
||||||
|
--owner=0 --group=0 --sort=name \
|
||||||
|
--transform 's:^\.:$*:S' -C $(tar-rootdir) .
|
||||||
|
|
||||||
|
tar-rootdir := $(srctree)
|
||||||
|
|
||||||
|
%.tar:
|
||||||
|
$(call cmd,tar)
|
||||||
|
|
||||||
|
%.tar.gz: private tar-compress-opt := -I $(KGZIP)
|
||||||
|
%.tar.gz:
|
||||||
|
$(call cmd,tar)
|
||||||
|
|
||||||
|
%.tar.bz2: private tar-compress-opt := -I $(KBZIP2)
|
||||||
|
%.tar.bz2:
|
||||||
|
$(call cmd,tar)
|
||||||
|
|
||||||
|
%.tar.xz: private tar-compress-opt := -I $(XZ)
|
||||||
|
%.tar.xz:
|
||||||
|
$(call cmd,tar)
|
||||||
|
|
||||||
|
%.tar.zst: private tar-compress-opt := -I $(ZSTD)
|
||||||
|
%.tar.zst:
|
||||||
|
$(call cmd,tar)
|
||||||
|
|
||||||
|
# Linux source tarball
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
linux.tar.gz: tar-exclude-opt = --exclude=./$@ --exclude-from=$<_exclude
|
||||||
|
linux.tar.gz: .tmp_filelist
|
||||||
|
|
||||||
# rpm-pkg
|
# rpm-pkg
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
PHONY += rpm-pkg
|
PHONY += rpm-pkg
|
||||||
rpm-pkg:
|
rpm-pkg: srpm = $(shell rpmspec --srpm --query --queryformat='%{name}-%{VERSION}-%{RELEASE}.src.rpm' kernel.spec)
|
||||||
$(MAKE) clean
|
rpm-pkg: srcrpm-pkg
|
||||||
$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
|
+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -rb $(srpm) \
|
||||||
$(call cmd,src_tar,$(KERNELPATH),kernel.spec)
|
|
||||||
+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ta $(KERNELPATH).tar.gz \
|
|
||||||
--define='_smp_mflags %{nil}'
|
--define='_smp_mflags %{nil}'
|
||||||
|
|
||||||
# srcrpm-pkg
|
# srcrpm-pkg
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
PHONY += srcrpm-pkg
|
PHONY += srcrpm-pkg
|
||||||
srcrpm-pkg:
|
srcrpm-pkg: linux.tar.gz
|
||||||
$(MAKE) clean
|
|
||||||
$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
|
$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
|
||||||
$(call cmd,src_tar,$(KERNELPATH),kernel.spec)
|
+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -bs kernel.spec \
|
||||||
+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -ts $(KERNELPATH).tar.gz \
|
--define='_smp_mflags %{nil}' --define='_sourcedir .' --define='_srcrpmdir .'
|
||||||
--define='_smp_mflags %{nil}' --define='_srcrpmdir $(srctree)'
|
|
||||||
|
|
||||||
# binrpm-pkg
|
# binrpm-pkg
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -81,18 +100,30 @@ binrpm-pkg:
|
|||||||
+rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
|
+rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
|
||||||
$(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec
|
$(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec
|
||||||
|
|
||||||
|
quiet_cmd_debianize = GEN $@
|
||||||
|
cmd_debianize = $(srctree)/scripts/package/mkdebian
|
||||||
|
|
||||||
|
debian: FORCE
|
||||||
|
$(call cmd,debianize)
|
||||||
|
|
||||||
|
PHONY += debian-orig
|
||||||
|
debian-orig: private source = $(shell dpkg-parsechangelog -S Source)
|
||||||
|
debian-orig: private version = $(shell dpkg-parsechangelog -S Version | sed 's/-[^-]*$$//')
|
||||||
|
debian-orig: private orig-name = $(source)_$(version).orig.tar.gz
|
||||||
|
debian-orig: linux.tar.gz debian
|
||||||
|
$(Q)if [ "$(df --output=target .. 2>/dev/null)" = "$(df --output=target $< 2>/dev/null)" ]; then \
|
||||||
|
ln -f $< ../$(orig-name); \
|
||||||
|
else \
|
||||||
|
cp $< ../$(orig-name); \
|
||||||
|
fi
|
||||||
|
|
||||||
PHONY += deb-pkg
|
PHONY += deb-pkg
|
||||||
deb-pkg:
|
deb-pkg: debian-orig
|
||||||
$(MAKE) clean
|
+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) \
|
||||||
$(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian
|
--build=source,binary -nc -us -uc
|
||||||
$(call cmd,src_tar,$(KDEB_SOURCENAME))
|
|
||||||
origversion=$$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$$//');\
|
|
||||||
mv $(KDEB_SOURCENAME).tar.gz ../$(KDEB_SOURCENAME)_$${origversion}.orig.tar.gz
|
|
||||||
+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -i.git -us -uc
|
|
||||||
|
|
||||||
PHONY += bindeb-pkg
|
PHONY += bindeb-pkg
|
||||||
bindeb-pkg:
|
bindeb-pkg: debian
|
||||||
$(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian
|
|
||||||
+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -b -nc -uc
|
+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -b -nc -uc
|
||||||
|
|
||||||
PHONY += intdeb-pkg
|
PHONY += intdeb-pkg
|
||||||
@ -114,44 +145,77 @@ snap-pkg:
|
|||||||
cd $(objtree)/snap && \
|
cd $(objtree)/snap && \
|
||||||
snapcraft --target-arch=$(UTS_MACHINE)
|
snapcraft --target-arch=$(UTS_MACHINE)
|
||||||
|
|
||||||
# tarball targets
|
# dir-pkg tar*-pkg - tarball targets
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
tar-pkgs := dir-pkg tar-pkg targz-pkg tarbz2-pkg tarxz-pkg tarzst-pkg
|
|
||||||
PHONY += $(tar-pkgs)
|
|
||||||
$(tar-pkgs):
|
|
||||||
$(MAKE) -f $(srctree)/Makefile
|
|
||||||
+$(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
|
|
||||||
|
|
||||||
# perf-pkg - generate a source tarball with perf source
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
perf-tar=perf-$(KERNELVERSION)
|
tar-pkg-tarball = linux-$(KERNELRELEASE)-$(ARCH).$(1)
|
||||||
|
tar-pkg-phony = $(subst .,,$(1))-pkg
|
||||||
|
|
||||||
quiet_cmd_perf_tar = TAR
|
tar-install: FORCE
|
||||||
cmd_perf_tar = \
|
$(Q)$(MAKE) -f $(srctree)/Makefile
|
||||||
git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/ \
|
+$(Q)$(srctree)/scripts/package/buildtar $@
|
||||||
HEAD^{tree} $$(cd $(srctree); \
|
|
||||||
echo $$(cat tools/perf/MANIFEST)) \
|
|
||||||
-o $(perf-tar).tar; \
|
|
||||||
mkdir -p $(perf-tar); \
|
|
||||||
git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \
|
|
||||||
(cd $(srctree)/tools/perf; \
|
|
||||||
util/PERF-VERSION-GEN $(CURDIR)/$(perf-tar)/); \
|
|
||||||
tar rf $(perf-tar).tar $(perf-tar)/HEAD $(perf-tar)/PERF-VERSION-FILE; \
|
|
||||||
rm -r $(perf-tar); \
|
|
||||||
$(if $(findstring tar-src,$@),, \
|
|
||||||
$(if $(findstring bz2,$@),$(KBZIP2), \
|
|
||||||
$(if $(findstring gz,$@),$(KGZIP), \
|
|
||||||
$(if $(findstring xz,$@),$(XZ), \
|
|
||||||
$(if $(findstring zst,$@),$(ZSTD), \
|
|
||||||
$(error unknown target $@))))) \
|
|
||||||
-f -9 $(perf-tar).tar)
|
|
||||||
|
|
||||||
perf-tar-pkgs := perf-tar-src-pkg perf-targz-src-pkg perf-tarbz2-src-pkg \
|
PHONY += dir-pkg
|
||||||
perf-tarxz-src-pkg perf-tarzst-src-pkg
|
dir-pkg: tar-install
|
||||||
PHONY += $(perf-tar-pkgs)
|
@echo "Kernel tree successfully created in $<"
|
||||||
$(perf-tar-pkgs):
|
|
||||||
$(call cmd,perf_tar)
|
define tar-pkg-rule
|
||||||
|
PHONY += $(tar-pkg-phony)
|
||||||
|
$(tar-pkg-phony): $(tar-pkg-tarball)
|
||||||
|
@:
|
||||||
|
|
||||||
|
$(tar-pkg-tarball): private tar-rootdir := tar-install
|
||||||
|
$(tar-pkg-tarball): tar-install
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach x, tar tar.gz tar.bz2 tar.xz tar.zst, $(eval $(call tar-pkg-rule,$(x))))
|
||||||
|
|
||||||
|
# perf-tar*-src-pkg - generate a source tarball with perf source
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
perf-tar-src-pkg-tarball = perf-$(KERNELVERSION).$(1)
|
||||||
|
perf-tar-src-pkg-phony = perf-$(subst .,,$(1))-src-pkg
|
||||||
|
|
||||||
|
quiet_cmd_stage_perf_src = STAGE $@
|
||||||
|
cmd_stage_perf_src = \
|
||||||
|
rm -rf $@; \
|
||||||
|
mkdir -p $@; \
|
||||||
|
tar -c -f - --exclude-from=$<_exclude -C $(srctree) --files-from=$(srctree)/tools/perf/MANIFEST | \
|
||||||
|
tar -x -f - -C $@
|
||||||
|
|
||||||
|
.tmp_perf: .tmp_filelist
|
||||||
|
$(call cmd,stage_perf_src)
|
||||||
|
|
||||||
|
filechk_perf_head = \
|
||||||
|
if test -z "$(git -C $(srctree) rev-parse --show-cdup 2>/dev/null)" && \
|
||||||
|
head=$$(git -C $(srctree) rev-parse --verify HEAD 2>/dev/null); then \
|
||||||
|
echo $$head; \
|
||||||
|
else \
|
||||||
|
echo "not a git tree"; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
.tmp_perf/HEAD: .tmp_perf FORCE
|
||||||
|
$(call filechk,perf_head)
|
||||||
|
|
||||||
|
quiet_cmd_perf_version_file = GEN $@
|
||||||
|
cmd_perf_version_file = cd $(srctree)/tools/perf; util/PERF-VERSION-GEN $(dir $(abspath $@))
|
||||||
|
|
||||||
|
# PERF-VERSION-FILE and HEAD are independent, but this avoids updating the
|
||||||
|
# timestamp of PERF-VERSION-FILE.
|
||||||
|
# The best is to fix tools/perf/util/PERF-VERSION-GEN.
|
||||||
|
.tmp_perf/PERF-VERSION-FILE: .tmp_perf/HEAD $(srctree)/tools/perf/util/PERF-VERSION-GEN
|
||||||
|
$(call cmd,perf_version_file)
|
||||||
|
|
||||||
|
define perf-tar-src-pkg-rule
|
||||||
|
PHONY += $(perf-tar-src-pkg-phony)
|
||||||
|
$(perf-tar-src-pkg-phony): $(perf-tar-src-pkg-tarball)
|
||||||
|
@:
|
||||||
|
|
||||||
|
$(perf-tar-src-pkg-tarball): private tar-rootdir := .tmp_perf
|
||||||
|
$(perf-tar-src-pkg-tarball): .tmp_filelist .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach x, tar tar.gz tar.bz2 tar.xz tar.zst, $(eval $(call perf-tar-src-pkg-rule,$(x))))
|
||||||
|
|
||||||
# Help text displayed when executing 'make help'
|
# Help text displayed when executing 'make help'
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -170,10 +234,13 @@ help:
|
|||||||
@echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
|
@echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
|
||||||
@echo ' tarxz-pkg - Build the kernel as a xz compressed tarball'
|
@echo ' tarxz-pkg - Build the kernel as a xz compressed tarball'
|
||||||
@echo ' tarzst-pkg - Build the kernel as a zstd compressed tarball'
|
@echo ' tarzst-pkg - Build the kernel as a zstd compressed tarball'
|
||||||
@echo ' perf-tar-src-pkg - Build $(perf-tar).tar source tarball'
|
@echo ' perf-tar-src-pkg - Build the perf source tarball with no compression'
|
||||||
@echo ' perf-targz-src-pkg - Build $(perf-tar).tar.gz source tarball'
|
@echo ' perf-targz-src-pkg - Build the perf source tarball with gzip compression'
|
||||||
@echo ' perf-tarbz2-src-pkg - Build $(perf-tar).tar.bz2 source tarball'
|
@echo ' perf-tarbz2-src-pkg - Build the perf source tarball with bz2 compression'
|
||||||
@echo ' perf-tarxz-src-pkg - Build $(perf-tar).tar.xz source tarball'
|
@echo ' perf-tarxz-src-pkg - Build the perf source tarball with xz compression'
|
||||||
@echo ' perf-tarzst-src-pkg - Build $(perf-tar).tar.zst source tarball'
|
@echo ' perf-tarzst-src-pkg - Build the perf source tarball with zst compression'
|
||||||
|
|
||||||
|
PHONY += FORCE
|
||||||
|
FORCE:
|
||||||
|
|
||||||
.PHONY: $(PHONY)
|
.PHONY: $(PHONY)
|
||||||
|
@ -45,7 +45,7 @@ orig_args="$@"
|
|||||||
# Get the first line of the --version output.
|
# Get the first line of the --version output.
|
||||||
IFS='
|
IFS='
|
||||||
'
|
'
|
||||||
set -- $(LC_ALL=C "$@" -Wa,--version -c -x assembler /dev/null -o /dev/null 2>/dev/null)
|
set -- $(LC_ALL=C "$@" -Wa,--version -c -x assembler-with-cpp /dev/null -o /dev/null 2>/dev/null)
|
||||||
|
|
||||||
# Split the line on spaces.
|
# Split the line on spaces.
|
||||||
IFS=' '
|
IFS=' '
|
||||||
|
@ -567,8 +567,8 @@ int main(int argc, char **argv)
|
|||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
kbuild_verbose = getenv("KBUILD_VERBOSE");
|
kbuild_verbose = getenv("KBUILD_VERBOSE");
|
||||||
if (kbuild_verbose)
|
if (kbuild_verbose && strchr(kbuild_verbose, '1'))
|
||||||
verbose_opt = atoi(kbuild_verbose);
|
verbose_opt = true;
|
||||||
|
|
||||||
while (argc > 4) {
|
while (argc > 4) {
|
||||||
if (strcmp(argv[1], "-v") == 0)
|
if (strcmp(argv[1], "-v") == 0)
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
*
|
*
|
||||||
* It first generates a line
|
* It first generates a line
|
||||||
*
|
*
|
||||||
* cmd_<target> = <cmdline>
|
* savedcmd_<target> = <cmdline>
|
||||||
*
|
*
|
||||||
* and then basically copies the .<target>.d file to stdout, in the
|
* and then basically copies the .<target>.d file to stdout, in the
|
||||||
* process filtering out the dependency on autoconf.h and adding
|
* process filtering out the dependency on autoconf.h and adding
|
||||||
@ -94,6 +94,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -112,7 +113,7 @@ struct item {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define HASHSZ 256
|
#define HASHSZ 256
|
||||||
static struct item *hashtab[HASHSZ];
|
static struct item *config_hashtab[HASHSZ], *file_hashtab[HASHSZ];
|
||||||
|
|
||||||
static unsigned int strhash(const char *str, unsigned int sz)
|
static unsigned int strhash(const char *str, unsigned int sz)
|
||||||
{
|
{
|
||||||
@ -124,25 +125,11 @@ static unsigned int strhash(const char *str, unsigned int sz)
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Lookup a value in the configuration string.
|
|
||||||
*/
|
|
||||||
static int is_defined_config(const char *name, int len, unsigned int hash)
|
|
||||||
{
|
|
||||||
struct item *aux;
|
|
||||||
|
|
||||||
for (aux = hashtab[hash % HASHSZ]; aux; aux = aux->next) {
|
|
||||||
if (aux->hash == hash && aux->len == len &&
|
|
||||||
memcmp(aux->name, name, len) == 0)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a new value to the configuration string.
|
* Add a new value to the configuration string.
|
||||||
*/
|
*/
|
||||||
static void define_config(const char *name, int len, unsigned int hash)
|
static void add_to_hashtable(const char *name, int len, unsigned int hash,
|
||||||
|
struct item *hashtab[])
|
||||||
{
|
{
|
||||||
struct item *aux = malloc(sizeof(*aux) + len);
|
struct item *aux = malloc(sizeof(*aux) + len);
|
||||||
|
|
||||||
@ -157,17 +144,34 @@ static void define_config(const char *name, int len, unsigned int hash)
|
|||||||
hashtab[hash % HASHSZ] = aux;
|
hashtab[hash % HASHSZ] = aux;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lookup a string in the hash table. If found, just return true.
|
||||||
|
* If not, add it to the hashtable and return false.
|
||||||
|
*/
|
||||||
|
static bool in_hashtable(const char *name, int len, struct item *hashtab[])
|
||||||
|
{
|
||||||
|
struct item *aux;
|
||||||
|
unsigned int hash = strhash(name, len);
|
||||||
|
|
||||||
|
for (aux = hashtab[hash % HASHSZ]; aux; aux = aux->next) {
|
||||||
|
if (aux->hash == hash && aux->len == len &&
|
||||||
|
memcmp(aux->name, name, len) == 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_to_hashtable(name, len, hash, hashtab);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Record the use of a CONFIG_* word.
|
* Record the use of a CONFIG_* word.
|
||||||
*/
|
*/
|
||||||
static void use_config(const char *m, int slen)
|
static void use_config(const char *m, int slen)
|
||||||
{
|
{
|
||||||
unsigned int hash = strhash(m, slen);
|
if (in_hashtable(m, slen, config_hashtab))
|
||||||
|
return;
|
||||||
|
|
||||||
if (is_defined_config(m, slen, hash))
|
|
||||||
return;
|
|
||||||
|
|
||||||
define_config(m, slen, hash);
|
|
||||||
/* Print out a dependency path from a symbol name. */
|
/* Print out a dependency path from a symbol name. */
|
||||||
printf(" $(wildcard include/config/%.*s) \\\n", slen, m);
|
printf(" $(wildcard include/config/%.*s) \\\n", slen, m);
|
||||||
}
|
}
|
||||||
@ -246,80 +250,158 @@ static int is_ignored_file(const char *s, int len)
|
|||||||
str_ends_with(s, len, "include/generated/autoksyms.h");
|
str_ends_with(s, len, "include/generated/autoksyms.h");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Do not parse these files */
|
||||||
|
static int is_no_parse_file(const char *s, int len)
|
||||||
|
{
|
||||||
|
/* rustc may list binary files in dep-info */
|
||||||
|
return str_ends_with(s, len, ".rlib") ||
|
||||||
|
str_ends_with(s, len, ".rmeta") ||
|
||||||
|
str_ends_with(s, len, ".so");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Important: The below generated source_foo.o and deps_foo.o variable
|
* Important: The below generated source_foo.o and deps_foo.o variable
|
||||||
* assignments are parsed not only by make, but also by the rather simple
|
* assignments are parsed not only by make, but also by the rather simple
|
||||||
* parser in scripts/mod/sumversion.c.
|
* parser in scripts/mod/sumversion.c.
|
||||||
*/
|
*/
|
||||||
static void parse_dep_file(char *m, const char *target)
|
static void parse_dep_file(char *p, const char *target)
|
||||||
{
|
{
|
||||||
char *p;
|
bool saw_any_target = false;
|
||||||
int is_last, is_target;
|
bool is_target = true;
|
||||||
int saw_any_target = 0;
|
bool is_source = false;
|
||||||
int is_first_dep = 0;
|
bool need_parse;
|
||||||
void *buf;
|
char *q, saved_c;
|
||||||
|
|
||||||
while (1) {
|
|
||||||
/* Skip any "white space" */
|
|
||||||
while (*m == ' ' || *m == '\\' || *m == '\n')
|
|
||||||
m++;
|
|
||||||
|
|
||||||
if (!*m)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Find next "white space" */
|
|
||||||
p = m;
|
|
||||||
while (*p && *p != ' ' && *p != '\\' && *p != '\n')
|
|
||||||
p++;
|
|
||||||
is_last = (*p == '\0');
|
|
||||||
/* Is the token we found a target name? */
|
|
||||||
is_target = (*(p-1) == ':');
|
|
||||||
/* Don't write any target names into the dependency file */
|
|
||||||
if (is_target) {
|
|
||||||
/* The /next/ file is the first dependency */
|
|
||||||
is_first_dep = 1;
|
|
||||||
} else if (!is_ignored_file(m, p - m)) {
|
|
||||||
*p = '\0';
|
|
||||||
|
|
||||||
|
while (*p) {
|
||||||
|
/* handle some special characters first. */
|
||||||
|
switch (*p) {
|
||||||
|
case '#':
|
||||||
/*
|
/*
|
||||||
* Do not list the source file as dependency, so that
|
* skip comments.
|
||||||
* kbuild is not confused if a .c file is rewritten
|
* rustc may emit comments to dep-info.
|
||||||
* into .S or vice versa. Storing it in source_* is
|
|
||||||
* needed for modpost to compute srcversions.
|
|
||||||
*/
|
*/
|
||||||
if (is_first_dep) {
|
p++;
|
||||||
|
while (*p != '\0' && *p != '\n') {
|
||||||
/*
|
/*
|
||||||
* If processing the concatenation of multiple
|
* escaped newlines continue the comment across
|
||||||
* dependency files, only process the first
|
* multiple lines.
|
||||||
* target name, which will be the original
|
|
||||||
* source name, and ignore any other target
|
|
||||||
* names, which will be intermediate temporary
|
|
||||||
* files.
|
|
||||||
*/
|
*/
|
||||||
if (!saw_any_target) {
|
if (*p == '\\')
|
||||||
saw_any_target = 1;
|
p++;
|
||||||
printf("source_%s := %s\n\n",
|
p++;
|
||||||
target, m);
|
}
|
||||||
printf("deps_%s := \\\n", target);
|
continue;
|
||||||
|
case ' ':
|
||||||
|
case '\t':
|
||||||
|
/* skip whitespaces */
|
||||||
|
p++;
|
||||||
|
continue;
|
||||||
|
case '\\':
|
||||||
|
/*
|
||||||
|
* backslash/newline combinations continue the
|
||||||
|
* statement. Skip it just like a whitespace.
|
||||||
|
*/
|
||||||
|
if (*(p + 1) == '\n') {
|
||||||
|
p += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '\n':
|
||||||
|
/*
|
||||||
|
* Makefiles use a line-based syntax, where the newline
|
||||||
|
* is the end of a statement. After seeing a newline,
|
||||||
|
* we expect the next token is a target.
|
||||||
|
*/
|
||||||
|
p++;
|
||||||
|
is_target = true;
|
||||||
|
continue;
|
||||||
|
case ':':
|
||||||
|
/*
|
||||||
|
* assume the first dependency after a colon as the
|
||||||
|
* source file.
|
||||||
|
*/
|
||||||
|
p++;
|
||||||
|
is_target = false;
|
||||||
|
is_source = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* find the end of the token */
|
||||||
|
q = p;
|
||||||
|
while (*q != ' ' && *q != '\t' && *q != '\n' && *q != '#' && *q != ':') {
|
||||||
|
if (*q == '\\') {
|
||||||
|
/*
|
||||||
|
* backslash/newline combinations work like as
|
||||||
|
* a whitespace, so this is the end of token.
|
||||||
|
*/
|
||||||
|
if (*(q + 1) == '\n')
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* escaped special characters */
|
||||||
|
if (*(q + 1) == '#' || *(q + 1) == ':') {
|
||||||
|
memmove(p + 1, p, q - p);
|
||||||
|
p++;
|
||||||
}
|
}
|
||||||
is_first_dep = 0;
|
|
||||||
} else {
|
q++;
|
||||||
printf(" %s \\\n", m);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = read_file(m);
|
if (*q == '\0')
|
||||||
|
break;
|
||||||
|
q++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Just discard the target */
|
||||||
|
if (is_target) {
|
||||||
|
p = q;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
saved_c = *q;
|
||||||
|
*q = '\0';
|
||||||
|
need_parse = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Do not list the source file as dependency, so that kbuild is
|
||||||
|
* not confused if a .c file is rewritten into .S or vice versa.
|
||||||
|
* Storing it in source_* is needed for modpost to compute
|
||||||
|
* srcversions.
|
||||||
|
*/
|
||||||
|
if (is_source) {
|
||||||
|
/*
|
||||||
|
* The DT build rule concatenates multiple dep files.
|
||||||
|
* When processing them, only process the first source
|
||||||
|
* name, which will be the original one, and ignore any
|
||||||
|
* other source names, which will be intermediate
|
||||||
|
* temporary files.
|
||||||
|
*
|
||||||
|
* rustc emits the same dependency list for each
|
||||||
|
* emission type. It is enough to list the source name
|
||||||
|
* just once.
|
||||||
|
*/
|
||||||
|
if (!saw_any_target) {
|
||||||
|
saw_any_target = true;
|
||||||
|
printf("source_%s := %s\n\n", target, p);
|
||||||
|
printf("deps_%s := \\\n", target);
|
||||||
|
need_parse = true;
|
||||||
|
}
|
||||||
|
} else if (!is_ignored_file(p, q - p) &&
|
||||||
|
!in_hashtable(p, q - p, file_hashtab)) {
|
||||||
|
printf(" %s \\\n", p);
|
||||||
|
need_parse = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (need_parse && !is_no_parse_file(p, q - p)) {
|
||||||
|
void *buf;
|
||||||
|
|
||||||
|
buf = read_file(p);
|
||||||
parse_config_file(buf);
|
parse_config_file(buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_last)
|
is_source = false;
|
||||||
break;
|
*q = saved_c;
|
||||||
|
p = q;
|
||||||
/*
|
|
||||||
* Start searching for next token immediately after the first
|
|
||||||
* "whitespace" character that follows this token.
|
|
||||||
*/
|
|
||||||
m = p + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!saw_any_target) {
|
if (!saw_any_target) {
|
||||||
@ -343,7 +425,7 @@ int main(int argc, char *argv[])
|
|||||||
target = argv[2];
|
target = argv[2];
|
||||||
cmdline = argv[3];
|
cmdline = argv[3];
|
||||||
|
|
||||||
printf("cmd_%s := %s\n\n", target, cmdline);
|
printf("savedcmd_%s := %s\n\n", target, cmdline);
|
||||||
|
|
||||||
buf = read_file(depfile);
|
buf = read_file(depfile);
|
||||||
parse_dep_file(buf, target);
|
parse_dep_file(buf, target);
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* Unloved program to convert a binary on stdin to a C include on stdout
|
|
||||||
*
|
|
||||||
* Jan 1999 Matt Mackall <mpm@selenic.com>
|
|
||||||
*
|
|
||||||
* This software may be used and distributed according to the terms
|
|
||||||
* of the GNU General Public License, incorporated herein by reference.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
int ch, total = 0;
|
|
||||||
|
|
||||||
if (argc > 1)
|
|
||||||
printf("const char %s[] %s=\n",
|
|
||||||
argv[1], argc > 2 ? argv[2] : "");
|
|
||||||
|
|
||||||
do {
|
|
||||||
printf("\t\"");
|
|
||||||
while ((ch = getchar()) != EOF) {
|
|
||||||
total++;
|
|
||||||
printf("\\x%02x", ch);
|
|
||||||
if (total % 16 == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
printf("\"\n");
|
|
||||||
} while (ch != EOF);
|
|
||||||
|
|
||||||
if (argc > 1)
|
|
||||||
printf("\t;\n\n#include <linux/types.h>\n\nconst size_t %s_size = %d;\n",
|
|
||||||
argv[1], total);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -115,7 +115,7 @@ def parse_options():
|
|||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def print_undefined_symbols():
|
||||||
"""Main function of this module."""
|
"""Main function of this module."""
|
||||||
args = parse_options()
|
args = parse_options()
|
||||||
|
|
||||||
@ -467,5 +467,16 @@ def parse_kconfig_file(kfile):
|
|||||||
return defined, references
|
return defined, references
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
try:
|
||||||
|
print_undefined_symbols()
|
||||||
|
except BrokenPipeError:
|
||||||
|
# Python flushes standard streams on exit; redirect remaining output
|
||||||
|
# to devnull to avoid another BrokenPipeError at shutdown
|
||||||
|
devnull = os.open(os.devnull, os.O_WRONLY)
|
||||||
|
os.dup2(devnull, sys.stdout.fileno())
|
||||||
|
sys.exit(1) # Python exits with error code 1 on EPIPE
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -19,7 +19,7 @@ _DEFAULT_OUTPUT = 'compile_commands.json'
|
|||||||
_DEFAULT_LOG_LEVEL = 'WARNING'
|
_DEFAULT_LOG_LEVEL = 'WARNING'
|
||||||
|
|
||||||
_FILENAME_PATTERN = r'^\..*\.cmd$'
|
_FILENAME_PATTERN = r'^\..*\.cmd$'
|
||||||
_LINE_PATTERN = r'^cmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)'
|
_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)'
|
||||||
_VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
|
_VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
|
||||||
# The tools/ directory adopts a different build system, and produces .cmd
|
# The tools/ directory adopts a different build system, and produces .cmd
|
||||||
# files in a different format. Do not support it.
|
# files in a different format. Do not support it.
|
||||||
|
@ -61,14 +61,21 @@ def run_analysis(entry):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = parse_arguments()
|
try:
|
||||||
|
args = parse_arguments()
|
||||||
|
|
||||||
lock = multiprocessing.Lock()
|
lock = multiprocessing.Lock()
|
||||||
pool = multiprocessing.Pool(initializer=init, initargs=(lock, args))
|
pool = multiprocessing.Pool(initializer=init, initargs=(lock, args))
|
||||||
# Read JSON data into the datastore variable
|
# Read JSON data into the datastore variable
|
||||||
with open(args.path, "r") as f:
|
with open(args.path, "r") as f:
|
||||||
datastore = json.load(f)
|
datastore = json.load(f)
|
||||||
pool.map(run_analysis, datastore)
|
pool.map(run_analysis, datastore)
|
||||||
|
except BrokenPipeError:
|
||||||
|
# Python flushes standard streams on exit; redirect remaining output
|
||||||
|
# to devnull to avoid another BrokenPipeError at shutdown
|
||||||
|
devnull = os.open(os.devnull, os.O_WRONLY)
|
||||||
|
os.dup2(devnull, sys.stdout.fileno())
|
||||||
|
sys.exit(1) # Python exits with error code 1 on EPIPE
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -65,7 +65,7 @@ def print_config(op, config, value, new_value):
|
|||||||
else:
|
else:
|
||||||
print(" %s %s -> %s" % (config, value, new_value))
|
print(" %s %s -> %s" % (config, value, new_value))
|
||||||
|
|
||||||
def main():
|
def show_diff():
|
||||||
global merge_style
|
global merge_style
|
||||||
|
|
||||||
# parse command line args
|
# parse command line args
|
||||||
@ -129,4 +129,16 @@ def main():
|
|||||||
for config in new:
|
for config in new:
|
||||||
print_config("+", config, None, b[config])
|
print_config("+", config, None, b[config])
|
||||||
|
|
||||||
main()
|
def main():
|
||||||
|
try:
|
||||||
|
show_diff()
|
||||||
|
except BrokenPipeError:
|
||||||
|
# Python flushes standard streams on exit; redirect remaining output
|
||||||
|
# to devnull to avoid another BrokenPipeError at shutdown
|
||||||
|
devnull = os.open(os.devnull, os.O_WRONLY)
|
||||||
|
os.dup2(devnull, sys.stdout.fileno())
|
||||||
|
sys.exit(1) # Python exits with error code 1 on EPIPE
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
@ -175,8 +175,8 @@ my $declaration_start_line;
|
|||||||
my ($type, $declaration_name, $return_type);
|
my ($type, $declaration_name, $return_type);
|
||||||
my ($newsection, $newcontents, $prototype, $brcount, %source_map);
|
my ($newsection, $newcontents, $prototype, $brcount, %source_map);
|
||||||
|
|
||||||
if (defined($ENV{'KBUILD_VERBOSE'})) {
|
if (defined($ENV{'KBUILD_VERBOSE'}) && $ENV{'KBUILD_VERBOSE'} =~ '1') {
|
||||||
$verbose = "$ENV{'KBUILD_VERBOSE'}";
|
$verbose = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined($ENV{'KCFLAGS'})) {
|
if (defined($ENV{'KCFLAGS'})) {
|
||||||
|
1057
scripts/list-gitignored.c
Normal file
1057
scripts/list-gitignored.c
Normal file
File diff suppressed because it is too large
Load Diff
19
scripts/misc-check
Executable file
19
scripts/misc-check
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Detect files that are tracked but ignored by git. This is checked only when
|
||||||
|
# ${KBUILD_EXTRA_WARN} contains 1, git is installed, and the source tree is
|
||||||
|
# tracked by git.
|
||||||
|
check_tracked_ignored_files () {
|
||||||
|
case "${KBUILD_EXTRA_WARN}" in
|
||||||
|
*1*) ;;
|
||||||
|
*) return;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
git -C ${srctree:-.} ls-files -i -c --exclude-per-directory=.gitignore 2>/dev/null |
|
||||||
|
sed 's/$/: warning: ignored by one of the .gitignore files/' >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
check_tracked_ignored_files
|
@ -42,11 +42,9 @@ create_package() {
|
|||||||
else
|
else
|
||||||
chown -R root:root "$pdir"
|
chown -R root:root "$pdir"
|
||||||
fi
|
fi
|
||||||
chmod -R go-w "$pdir"
|
# a+rX in case we are in a restrictive umask environment like 0077
|
||||||
# in case we are in a restrictive umask environment like 0077
|
# ug-s in case we build in a setuid/setgid directory
|
||||||
chmod -R a+rX "$pdir"
|
chmod -R go-w,a+rX,ug-s "$pdir"
|
||||||
# in case we build in a setuid/setgid directory
|
|
||||||
chmod -R ug-s "$pdir"
|
|
||||||
|
|
||||||
# Create the package
|
# Create the package
|
||||||
dpkg-gencontrol -p$pname -P"$pdir"
|
dpkg-gencontrol -p$pname -P"$pdir"
|
||||||
|
@ -16,39 +16,7 @@ set -e
|
|||||||
#
|
#
|
||||||
# Some variables and settings used throughout the script
|
# Some variables and settings used throughout the script
|
||||||
#
|
#
|
||||||
tmpdir="${objtree}/tar-install"
|
tmpdir=$1
|
||||||
tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar"
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Figure out how to compress, if requested at all
|
|
||||||
#
|
|
||||||
case "${1}" in
|
|
||||||
dir-pkg|tar-pkg)
|
|
||||||
opts=
|
|
||||||
;;
|
|
||||||
targz-pkg)
|
|
||||||
opts="-I ${KGZIP}"
|
|
||||||
tarball=${tarball}.gz
|
|
||||||
;;
|
|
||||||
tarbz2-pkg)
|
|
||||||
opts="-I ${KBZIP2}"
|
|
||||||
tarball=${tarball}.bz2
|
|
||||||
;;
|
|
||||||
tarxz-pkg)
|
|
||||||
opts="-I ${XZ}"
|
|
||||||
tarball=${tarball}.xz
|
|
||||||
;;
|
|
||||||
tarzst-pkg)
|
|
||||||
opts="-I ${ZSTD}"
|
|
||||||
tarball=${tarball}.zst
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Clean-up and re-create the temporary directory
|
# Clean-up and re-create the temporary directory
|
||||||
@ -148,21 +116,3 @@ case "${ARCH}" in
|
|||||||
sleep 5
|
sleep 5
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "${1}" = dir-pkg ]; then
|
|
||||||
echo "Kernel tree successfully created in $tmpdir"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Create the tarball
|
|
||||||
#
|
|
||||||
if tar --owner=root --group=root --help >/dev/null 2>&1; then
|
|
||||||
opts="$opts --owner=root --group=root"
|
|
||||||
fi
|
|
||||||
|
|
||||||
tar cf $tarball -C $tmpdir $opts $dirs
|
|
||||||
|
|
||||||
echo "Tarball successfully created in $tarball"
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
16
scripts/package/deb-build-option
Executable file
16
scripts/package/deb-build-option
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
|
||||||
|
# Set up CROSS_COMPILE if we are cross-compiling, but not called from the
|
||||||
|
# kernel toplevel Makefile
|
||||||
|
if [ -z "${CROSS_COMPILE}${cross_compiling}" -a "${DEB_HOST_ARCH}" != "${DEB_BUILD_ARCH}" ]; then
|
||||||
|
echo CROSS_COMPILE=${DEB_HOST_GNU_TYPE}-
|
||||||
|
fi
|
||||||
|
|
||||||
|
version=$(dpkg-parsechangelog -S Version)
|
||||||
|
version_upstream="${version%-*}"
|
||||||
|
debian_revision="${version#${version_upstream}}"
|
||||||
|
debian_revision="${debian_revision#*-}"
|
||||||
|
|
||||||
|
echo KERNELRELEASE=${version_upstream}
|
||||||
|
echo KBUILD_BUILD_VERSION=${debian_revision}
|
@ -84,16 +84,16 @@ set_debarch() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rm -rf debian
|
||||||
|
|
||||||
# Some variables and settings used throughout the script
|
# Some variables and settings used throughout the script
|
||||||
version=$KERNELRELEASE
|
version=$KERNELRELEASE
|
||||||
if [ -n "$KDEB_PKGVERSION" ]; then
|
if [ -n "$KDEB_PKGVERSION" ]; then
|
||||||
packageversion=$KDEB_PKGVERSION
|
packageversion=$KDEB_PKGVERSION
|
||||||
revision=${packageversion##*-}
|
|
||||||
else
|
else
|
||||||
revision=$($srctree/init/build-version)
|
packageversion=$version-$($srctree/init/build-version)
|
||||||
packageversion=$version-$revision
|
|
||||||
fi
|
fi
|
||||||
sourcename=$KDEB_SOURCENAME
|
sourcename=${KDEB_SOURCENAME:-linux-upstream}
|
||||||
|
|
||||||
if [ "$ARCH" = "um" ] ; then
|
if [ "$ARCH" = "um" ] ; then
|
||||||
packagename=user-mode-linux
|
packagename=user-mode-linux
|
||||||
@ -133,7 +133,24 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p debian/source/
|
mkdir -p debian/source/
|
||||||
echo "1.0" > debian/source/format
|
echo "3.0 (quilt)" > debian/source/format
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "diff-ignore"
|
||||||
|
echo "extend-diff-ignore = .*"
|
||||||
|
} > debian/source/local-options
|
||||||
|
|
||||||
|
# Add .config as a patch
|
||||||
|
mkdir -p debian/patches
|
||||||
|
{
|
||||||
|
echo "Subject: Add .config"
|
||||||
|
echo "Author: ${maintainer}"
|
||||||
|
echo
|
||||||
|
echo "--- /dev/null"
|
||||||
|
echo "+++ linux/.config"
|
||||||
|
diff -u /dev/null "${KCONFIG_CONFIG}" | tail -n +3
|
||||||
|
} > debian/patches/config
|
||||||
|
echo config > debian/patches/series
|
||||||
|
|
||||||
echo $debarch > debian/arch
|
echo $debarch > debian/arch
|
||||||
extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)"
|
extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)"
|
||||||
@ -225,19 +242,18 @@ srctree ?= .
|
|||||||
|
|
||||||
build-indep:
|
build-indep:
|
||||||
build-arch:
|
build-arch:
|
||||||
\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
|
\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \
|
||||||
KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
|
\$(shell \$(srctree)/scripts/package/deb-build-option) \
|
||||||
|
olddefconfig all
|
||||||
|
|
||||||
build: build-arch
|
build: build-arch
|
||||||
|
|
||||||
binary-indep:
|
binary-indep:
|
||||||
binary-arch: build-arch
|
binary-arch: build-arch
|
||||||
\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
|
\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} intdeb-pkg
|
||||||
KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf debian/*tmp debian/files
|
rm -rf debian/files debian/linux-*
|
||||||
\$(MAKE) clean
|
\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} clean
|
||||||
|
|
||||||
binary: binary-arch
|
binary: binary-arch
|
||||||
EOF
|
EOF
|
||||||
|
@ -33,8 +33,6 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \
|
|||||||
--exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \
|
--exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \
|
||||||
--exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s"
|
--exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s"
|
||||||
|
|
||||||
test -n "$LOCALVERSION" && MAKE="$MAKE LOCALVERSION=$LOCALVERSION"
|
|
||||||
|
|
||||||
# We can label the here-doc lines for conditional output to the spec file
|
# We can label the here-doc lines for conditional output to the spec file
|
||||||
#
|
#
|
||||||
# Labels:
|
# Labels:
|
||||||
@ -49,7 +47,8 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
|
|||||||
Group: System Environment/Kernel
|
Group: System Environment/Kernel
|
||||||
Vendor: The Linux Community
|
Vendor: The Linux Community
|
||||||
URL: https://www.kernel.org
|
URL: https://www.kernel.org
|
||||||
$S Source: kernel-$__KERNELRELEASE.tar.gz
|
$S Source0: linux.tar.gz
|
||||||
|
$S Source1: .config
|
||||||
Provides: $PROVIDES
|
Provides: $PROVIDES
|
||||||
$S BuildRequires: bc binutils bison dwarves
|
$S BuildRequires: bc binutils bison dwarves
|
||||||
$S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
|
$S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
|
||||||
@ -85,12 +84,11 @@ $S$M This package provides kernel headers and makefiles sufficient to build modu
|
|||||||
$S$M against the $__KERNELRELEASE kernel package.
|
$S$M against the $__KERNELRELEASE kernel package.
|
||||||
$S$M
|
$S$M
|
||||||
$S %prep
|
$S %prep
|
||||||
$S %setup -q
|
$S %setup -q -n linux
|
||||||
$S rm -f scripts/basic/fixdep scripts/kconfig/conf
|
$S cp %{SOURCE1} .
|
||||||
$S rm -f tools/objtool/{fixdep,objtool}
|
|
||||||
$S
|
$S
|
||||||
$S %build
|
$S %build
|
||||||
$S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
|
$S $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE KBUILD_BUILD_VERSION=%{release}
|
||||||
$S
|
$S
|
||||||
%install
|
%install
|
||||||
mkdir -p %{buildroot}/boot
|
mkdir -p %{buildroot}/boot
|
||||||
|
@ -21,31 +21,15 @@ set -e
|
|||||||
# then will be really dead and removed from the code base entirely.
|
# then will be really dead and removed from the code base entirely.
|
||||||
|
|
||||||
rm -f arch/powerpc/purgatory/kexec-purgatory.c
|
rm -f arch/powerpc/purgatory/kexec-purgatory.c
|
||||||
|
|
||||||
# These were previously generated source files. When you are building the kernel
|
|
||||||
# with O=, make sure to remove the stale files in the output tree. Otherwise,
|
|
||||||
# the build system wrongly compiles the stale ones.
|
|
||||||
if [ -n "${building_out_of_srctree}" ]; then
|
|
||||||
for f in fdt_rw.c fdt_ro.c fdt_wip.c fdt.c ashldi3.S bswapsdi2.S font.c lib1funcs.S hyp-stub.S
|
|
||||||
do
|
|
||||||
rm -f arch/arm/boot/compressed/${f}
|
|
||||||
done
|
|
||||||
|
|
||||||
for f in uart-ath79.c ashldi3.c bswapdi.c bswapsi.c
|
|
||||||
do
|
|
||||||
rm -f arch/mips/boot/compressed/${f}
|
|
||||||
done
|
|
||||||
|
|
||||||
for f in firmware.c real2.S
|
|
||||||
do
|
|
||||||
rm -f arch/parisc/boot/compressed/${f}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f arch/riscv/purgatory/kexec-purgatory.c
|
rm -f arch/riscv/purgatory/kexec-purgatory.c
|
||||||
|
rm -f arch/x86/purgatory/kexec-purgatory.c
|
||||||
|
|
||||||
rm -f scripts/extract-cert
|
rm -f scripts/extract-cert
|
||||||
|
|
||||||
rm -f arch/x86/purgatory/kexec-purgatory.c
|
|
||||||
|
|
||||||
rm -f scripts/kconfig/[gmnq]conf-cfg
|
rm -f scripts/kconfig/[gmnq]conf-cfg
|
||||||
|
|
||||||
|
rm -f rust/target.json
|
||||||
|
|
||||||
|
rm -f scripts/bin2c
|
||||||
|
|
||||||
|
rm -f .scmversion
|
||||||
|
@ -11,16 +11,11 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $0 [--save-scmversion] [srctree]" >&2
|
echo "Usage: $0 [srctree]" >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
scm_only=false
|
|
||||||
srctree=.
|
srctree=.
|
||||||
if test "$1" = "--save-scmversion"; then
|
|
||||||
scm_only=true
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
if test $# -gt 0; then
|
if test $# -gt 0; then
|
||||||
srctree=$1
|
srctree=$1
|
||||||
shift
|
shift
|
||||||
@ -32,57 +27,69 @@ fi
|
|||||||
scm_version()
|
scm_version()
|
||||||
{
|
{
|
||||||
local short
|
local short
|
||||||
|
local tag
|
||||||
short=false
|
short=false
|
||||||
|
|
||||||
cd "$srctree"
|
cd "$srctree"
|
||||||
if test -e .scmversion; then
|
|
||||||
cat .scmversion
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if test "$1" = "--short"; then
|
if test "$1" = "--short"; then
|
||||||
short=true
|
short=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for git and a git repo.
|
if test -n "$(git rev-parse --show-cdup 2>/dev/null)"; then
|
||||||
if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
|
return
|
||||||
head=$(git rev-parse --verify HEAD 2>/dev/null); then
|
fi
|
||||||
|
|
||||||
# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
|
if ! head=$(git rev-parse --verify HEAD 2>/dev/null); then
|
||||||
# it, because this version is defined in the top level Makefile.
|
return
|
||||||
if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then
|
fi
|
||||||
|
|
||||||
# If only the short version is requested, don't bother
|
# If a localversion*' file and the corresponding annotated tag exist,
|
||||||
# running further git commands
|
# use it. This is the case in linux-next.
|
||||||
if $short; then
|
tag=${file_localversion#-}
|
||||||
echo "+"
|
tag=$(git describe --exact-match --match=$tag $tag 2>/dev/null)
|
||||||
return
|
|
||||||
fi
|
|
||||||
# If we are past a tagged commit (like
|
|
||||||
# "v2.6.30-rc5-302-g72357d5"), we pretty print it.
|
|
||||||
if atag="$(git describe 2>/dev/null)"; then
|
|
||||||
echo "$atag" | awk -F- '{printf("-%05d", $(NF-1))}'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add -g and exactly 12 hex chars.
|
# Otherwise, default to the annotated tag derived from KERNELVERSION.
|
||||||
printf '%s%s' -g "$(echo $head | cut -c1-12)"
|
# mainline kernel: 6.2.0-rc5 -> v6.2-rc5
|
||||||
|
# stable kernel: 6.1.7 -> v6.1.7
|
||||||
|
if [ -z "${tag}" ]; then
|
||||||
|
tag=v$(echo "${KERNELVERSION}" | sed -E 's/^([0-9]+\.[0-9]+)\.0(.*)$/\1\2/')
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If we are at the tagged commit, we ignore it because the version is
|
||||||
|
# well-defined.
|
||||||
|
if [ -z "$(git describe --exact-match --match=$tag 2>/dev/null)" ]; then
|
||||||
|
|
||||||
|
# If only the short version is requested, don't bother
|
||||||
|
# running further git commands
|
||||||
|
if $short; then
|
||||||
|
echo "+"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
# If we are past the tagged commit, we pretty print it.
|
||||||
|
# (like 6.1.0-14595-g292a089d78d3)
|
||||||
|
if atag="$(git describe --match=$tag 2>/dev/null)"; then
|
||||||
|
echo "$atag" | awk -F- '{printf("-%05d", $(NF-1))}'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for uncommitted changes.
|
# Add -g and exactly 12 hex chars.
|
||||||
# This script must avoid any write attempt to the source tree,
|
printf '%s%s' -g "$(echo $head | cut -c1-12)"
|
||||||
# which might be read-only.
|
fi
|
||||||
# You cannot use 'git describe --dirty' because it tries to
|
|
||||||
# create .git/index.lock .
|
# Check for uncommitted changes.
|
||||||
# First, with git-status, but --no-optional-locks is only
|
# This script must avoid any write attempt to the source tree, which
|
||||||
# supported in git >= 2.14, so fall back to git-diff-index if
|
# might be read-only.
|
||||||
# it fails. Note that git-diff-index does not refresh the
|
# You cannot use 'git describe --dirty' because it tries to create
|
||||||
# index, so it may give misleading results. See
|
# .git/index.lock .
|
||||||
# git-update-index(1), git-diff-index(1), and git-status(1).
|
# First, with git-status, but --no-optional-locks is only supported in
|
||||||
if {
|
# git >= 2.14, so fall back to git-diff-index if it fails. Note that
|
||||||
git --no-optional-locks status -uno --porcelain 2>/dev/null ||
|
# git-diff-index does not refresh the index, so it may give misleading
|
||||||
git diff-index --name-only HEAD
|
# results.
|
||||||
} | read dummy; then
|
# See git-update-index(1), git-diff-index(1), and git-status(1).
|
||||||
printf '%s' -dirty
|
if {
|
||||||
fi
|
git --no-optional-locks status -uno --porcelain 2>/dev/null ||
|
||||||
|
git diff-index --name-only HEAD
|
||||||
|
} | read dummy; then
|
||||||
|
printf '%s' -dirty
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,33 +110,29 @@ collect_files()
|
|||||||
echo "$res"
|
echo "$res"
|
||||||
}
|
}
|
||||||
|
|
||||||
if $scm_only; then
|
|
||||||
if test ! -e .scmversion; then
|
|
||||||
res=$(scm_version)
|
|
||||||
echo "$res" >.scmversion
|
|
||||||
fi
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! test -e include/config/auto.conf; then
|
if ! test -e include/config/auto.conf; then
|
||||||
echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
|
echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# localversion* files in the build and source directory
|
if [ -z "${KERNELVERSION}" ]; then
|
||||||
res="$(collect_files localversion*)"
|
echo "KERNELVERSION is not set" >&2
|
||||||
if test ! "$srctree" -ef .; then
|
exit 1
|
||||||
res="$res$(collect_files "$srctree"/localversion*)"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# CONFIG_LOCALVERSION and LOCALVERSION (if set)
|
# localversion* files in the build and source directory
|
||||||
config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf)
|
file_localversion="$(collect_files localversion*)"
|
||||||
res="${res}${config_localversion}${LOCALVERSION}"
|
if test ! "$srctree" -ef .; then
|
||||||
|
file_localversion="${file_localversion}$(collect_files "$srctree"/localversion*)"
|
||||||
|
fi
|
||||||
|
|
||||||
# scm version string if not at a tagged commit
|
# version string from CONFIG_LOCALVERSION
|
||||||
|
config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf)
|
||||||
|
|
||||||
|
# scm version string if not at the kernel version tag or at the file_localversion
|
||||||
if grep -q "^CONFIG_LOCALVERSION_AUTO=y$" include/config/auto.conf; then
|
if grep -q "^CONFIG_LOCALVERSION_AUTO=y$" include/config/auto.conf; then
|
||||||
# full scm version string
|
# full scm version string
|
||||||
res="$res$(scm_version)"
|
scm_version="$(scm_version)"
|
||||||
elif [ "${LOCALVERSION+set}" != "set" ]; then
|
elif [ "${LOCALVERSION+set}" != "set" ]; then
|
||||||
# If the variable LOCALVERSION is not set, append a plus
|
# If the variable LOCALVERSION is not set, append a plus
|
||||||
# sign if the repository is not in a clean annotated or
|
# sign if the repository is not in a clean annotated or
|
||||||
@ -138,8 +141,7 @@ elif [ "${LOCALVERSION+set}" != "set" ]; then
|
|||||||
#
|
#
|
||||||
# If the variable LOCALVERSION is set (including being set
|
# If the variable LOCALVERSION is set (including being set
|
||||||
# to an empty string), we don't want to append a plus sign.
|
# to an empty string), we don't want to append a plus sign.
|
||||||
scm=$(scm_version --short)
|
scm_version="$(scm_version --short)"
|
||||||
res="$res${scm:++}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$res"
|
echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
# Uses the following environment variables:
|
# Uses the following environment variables:
|
||||||
# SUBARCH, SRCARCH, srctree
|
# SUBARCH, SRCARCH, srctree
|
||||||
|
|
||||||
if [ "$KBUILD_VERBOSE" = "1" ]; then
|
if [[ "$KBUILD_VERBOSE" =~ 1 ]]; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user