Kbuild updates for v5.1 (2nd)
- add more Build-Depends to Debian source package - prefix header search paths with $(srctree)/ - make modpost show verbose section mismatch warnings - avoid hard-coded CROSS_COMPILE for h8300 - fix regression for Debian make-kpkg command - add semantic patch to detect missing put_device() - fix some warnings of 'make deb-pkg' - optimize NOSTDINC_FLAGS evaluation - add warnings about redundant generic-y - clean up Makefiles and scripts -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJcjm13AAoJED2LAQed4NsG9FoQALFscagW8R5LIDmzzRPmslhF W1qm9rEmtdnOHGg20QbYUnJwtGZjVN4lIZp6eQ3v6mhvm6IY2VhInGJpcLnwbojb o7y4wKcP9/ucIpfV/z32DrUfEM+qnQwztn56u7lJBxf4cTFEOIwIIS8v1KEnsNXX Zzvu1kSKsc4ZHHdE7h3dmr3iC5GOz/6EAJ9U33WcLy24tRTevIxcZsYvb/SOvDAT NYdPK8yptuVVO+odHObNwMVBidRcXRb49gWQGWLuAvfbklh33pomYarWkNe/Syif UeCHDNwvqzEmjSks73EomdCjME0roWhgKbm/dXJKXhe2hBzP1psMWNzRPSRa4yIj SHE7UfFPXCa+tNveJo2qzTOhpMw1DRiNgZD3EM2cRvwZ1ip8emJr70qFfL+RGpqq 4ZlLb9Tibb51ApLcn+r0AnOMrC8MkK1zC8dKNxgUwdJ7D4UqZ70348c2GXE54yfv kxst/gtLb9r6YEtaCsKbCk1XgR2y2QGtyYrVLKsI/v6fhPVBKxnDXIpsn0Q6NYFi UiYKojTpFKvEMl0tc1EaYrIGoq9ZH4wDna3q4lOSRiyrypUl8NfflWwDSIuYVP5Z Y2tIPYTcGeCxt3gyXu0riL6tvpy1KGVlByNB9V297rSrVenH4VcfYPLJhYAtqpRo gO2eyp64i9LduVZOrEEP =6GIM -----END PGP SIGNATURE----- Merge tag 'kbuild-v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull more Kbuild updates from Masahiro Yamada: - add more Build-Depends to Debian source package - prefix header search paths with $(srctree)/ - make modpost show verbose section mismatch warnings - avoid hard-coded CROSS_COMPILE for h8300 - fix regression for Debian make-kpkg command - add semantic patch to detect missing put_device() - fix some warnings of 'make deb-pkg' - optimize NOSTDINC_FLAGS evaluation - add warnings about redundant generic-y - clean up Makefiles and scripts * tag 'kbuild-v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kconfig: remove stale lxdialog/.gitignore kbuild: force all architectures except um to include mandatory-y kbuild: warn redundant generic-y Revert "modsign: Abort modules_install when signing fails" kbuild: Make NOSTDINC_FLAGS a simply expanded variable kbuild: deb-pkg: avoid implicit effects coccinelle: semantic code search for missing put_device() kbuild: pkg: grep include/config/auto.conf instead of $KCONFIG_CONFIG kbuild: deb-pkg: introduce is_enabled and if_enabled_echo to builddeb kbuild: deb-pkg: add CONFIG_ prefix to kernel config options kbuild: add workaround for Debian make-kpkg kbuild: source include/config/auto.conf instead of ${KCONFIG_CONFIG} unicore32: simplify linker script generation for decompressor h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux- kbuild: move archive command to scripts/Makefile.lib modpost: always show verbose warning for section mismatch ia64: prefix header search path with $(srctree)/ libfdt: prefix header search paths with $(srctree)/ deb-pkg: generate correct build dependencies
This commit is contained in:
Коммит
28d747f266
|
@ -1274,7 +1274,7 @@ See subsequent chapter for the syntax of the Kbuild file.
|
|||
|
||||
--- 7.4 mandatory-y
|
||||
|
||||
mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild.asm
|
||||
mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild
|
||||
to define the minimum set of ASM headers that all architectures must have.
|
||||
|
||||
This works like optional generic-y. If a mandatory header is missing
|
||||
|
|
18
Makefile
18
Makefile
|
@ -31,6 +31,16 @@ _all:
|
|||
# descending is started. They are now explicitly listed as the
|
||||
# prepare rule.
|
||||
|
||||
# Ugly workaround for Debian make-kpkg:
|
||||
# make-kpkg directly includes the top Makefile of Linux kernel. In such a case,
|
||||
# skip sub-make to support debian_* targets in ruleset/kernel_version.mk, but
|
||||
# displays warning to discourage such abusage.
|
||||
ifneq ($(word 2, $(MAKEFILE_LIST)),)
|
||||
$(warning Do not include top Makefile of Linux Kernel)
|
||||
sub-make-done := 1
|
||||
MAKEFLAGS += -rR
|
||||
endif
|
||||
|
||||
ifneq ($(sub-make-done),1)
|
||||
|
||||
# Do not use make's built-in rules and variables
|
||||
|
@ -402,7 +412,7 @@ CHECK = sparse
|
|||
|
||||
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
|
||||
-Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
|
||||
NOSTDINC_FLAGS =
|
||||
NOSTDINC_FLAGS :=
|
||||
CFLAGS_MODULE =
|
||||
AFLAGS_MODULE =
|
||||
LDFLAGS_MODULE =
|
||||
|
@ -1088,9 +1098,11 @@ asm-generic := -f $(srctree)/scripts/Makefile.asm-generic obj
|
|||
|
||||
PHONY += asm-generic uapi-asm-generic
|
||||
asm-generic: uapi-asm-generic
|
||||
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/asm
|
||||
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/asm \
|
||||
generic=include/asm-generic
|
||||
uapi-asm-generic:
|
||||
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm
|
||||
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm \
|
||||
generic=include/uapi/asm-generic
|
||||
|
||||
PHONY += prepare-objtool
|
||||
prepare-objtool: $(objtool_target)
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd_32.h
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generic-y += kvm_para.h
|
||||
generic-y += ucontext.h
|
||||
|
|
|
@ -18,7 +18,6 @@ generic-y += segment.h
|
|||
generic-y += serial.h
|
||||
generic-y += simd.h
|
||||
generic-y += sizes.h
|
||||
generic-y += timex.h
|
||||
generic-y += trace_clock.h
|
||||
|
||||
generated-y += mach-types.h
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd-common.h
|
||||
generated-y += unistd-oabi.h
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generic-y += kvm_para.h
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generic-y += kvm_para.h
|
||||
generic-y += ucontext.h
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generic-y += ucontext.h
|
||||
|
|
|
@ -27,7 +27,7 @@ KBUILD_LDFLAGS += $(ldflags-y)
|
|||
CHECKFLAGS += -msize-long
|
||||
|
||||
ifeq ($(CROSS_COMPILE),)
|
||||
CROSS_COMPILE := h8300-unknown-linux-
|
||||
CROSS_COMPILE := $(call cc-cross-prefix, h8300-unknown-linux- h8300-linux-)
|
||||
endif
|
||||
|
||||
core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
|
||||
|
|
|
@ -17,7 +17,6 @@ generic-y += fb.h
|
|||
generic-y += ftrace.h
|
||||
generic-y += futex.h
|
||||
generic-y += hardirq.h
|
||||
generic-y += hash.h
|
||||
generic-y += hw_irq.h
|
||||
generic-y += irq_regs.h
|
||||
generic-y += irq_work.h
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generic-y += kvm_para.h
|
||||
generic-y += ucontext.h
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generic-y += ucontext.h
|
||||
|
|
|
@ -1,5 +1,2 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd_64.h
|
||||
generic-y += kvm_para.h
|
||||
generic-y += socket.h
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# Copyright (C) 1999,2001-2006,2008 Silicon Graphics, Inc. All Rights Reserved.
|
||||
#
|
||||
|
||||
ccflags-y := -Iarch/ia64/sn/include
|
||||
ccflags-y := -I $(srctree)/arch/ia64/sn/include
|
||||
|
||||
obj-y += setup.o bte.o bte_error.o irq.o mca.o idle.o \
|
||||
huberror.o io_acpi_init.o io_common.o \
|
||||
|
|
|
@ -9,7 +9,5 @@
|
|||
# sn2 specific kernel files
|
||||
#
|
||||
|
||||
ccflags-y := -Iarch/ia64/sn/include
|
||||
|
||||
obj-y += cache.o io.o ptc_deadlock.o sn2_smp.o sn_proc_fs.o \
|
||||
prominfo_proc.o timer.o timer_interrupt.o sn_hwperf.o
|
||||
|
|
|
@ -7,6 +7,4 @@
|
|||
#
|
||||
# Makefile for the sn pci general routines.
|
||||
|
||||
ccflags-y := -Iarch/ia64/sn/include
|
||||
|
||||
obj-y := pci_dma.o tioca_provider.o tioce_provider.o pcibr/
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#
|
||||
# Makefile for the sn2 io routines.
|
||||
|
||||
ccflags-y := -Iarch/ia64/sn/include
|
||||
ccflags-y := -I $(srctree)/arch/ia64/sn/include
|
||||
|
||||
obj-y += pcibr_dma.o pcibr_reg.o \
|
||||
pcibr_ate.o pcibr_provider.o
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd_32.h
|
||||
generic-y += kvm_para.h
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd_32.h
|
||||
generic-y += kvm_para.h
|
||||
generic-y += ucontext.h
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd_n32.h
|
||||
generated-y += unistd_n64.h
|
||||
generated-y += unistd_o32.h
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generic-y += ucontext.h
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generic-y += kvm_para.h
|
||||
generic-y += ucontext.h
|
||||
|
|
|
@ -15,7 +15,6 @@ generic-y += fb.h
|
|||
generic-y += ftrace.h
|
||||
generic-y += hardirq.h
|
||||
generic-y += hw_irq.h
|
||||
generic-y += irq.h
|
||||
generic-y += irq_regs.h
|
||||
generic-y += irq_work.h
|
||||
generic-y += kdebug.h
|
||||
|
@ -35,7 +34,6 @@ generic-y += qrwlock.h
|
|||
generic-y += sections.h
|
||||
generic-y += segment.h
|
||||
generic-y += shmparam.h
|
||||
generic-y += string.h
|
||||
generic-y += switch_to.h
|
||||
generic-y += topology.h
|
||||
generic-y += trace_clock.h
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generic-y += kvm_para.h
|
||||
generic-y += ucontext.h
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
generated-y += syscall_table_32.h
|
||||
generated-y += syscall_table_64.h
|
||||
generated-y += syscall_table_c32.h
|
||||
generic-y += barrier.h
|
||||
generic-y += current.h
|
||||
generic-y += device.h
|
||||
generic-y += div64.h
|
||||
|
@ -20,7 +19,6 @@ generic-y += percpu.h
|
|||
generic-y += preempt.h
|
||||
generic-y += seccomp.h
|
||||
generic-y += segment.h
|
||||
generic-y += topology.h
|
||||
generic-y += trace_clock.h
|
||||
generic-y += user.h
|
||||
generic-y += vga.h
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd_32.h
|
||||
generated-y += unistd_64.h
|
||||
generic-y += kvm_para.h
|
||||
|
|
|
@ -5,7 +5,6 @@ generated-y += syscall_table_spu.h
|
|||
generic-y += div64.h
|
||||
generic-y += export.h
|
||||
generic-y += irq_regs.h
|
||||
generic-y += irq_work.h
|
||||
generic-y += local64.h
|
||||
generic-y += mcs_spinlock.h
|
||||
generic-y += preempt.h
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd_32.h
|
||||
generated-y += unistd_64.h
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
|
@ -57,9 +57,6 @@ $(obj)/section_cmp%: vmlinux $(obj)/compressed/vmlinux FORCE
|
|||
$(obj)/compressed/vmlinux: $(obj)/startup.a FORCE
|
||||
$(Q)$(MAKE) $(build)=$(obj)/compressed $@
|
||||
|
||||
quiet_cmd_ar = AR $@
|
||||
cmd_ar = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
|
||||
|
||||
$(obj)/startup.a: $(OBJECTS) FORCE
|
||||
$(call if_changed,ar)
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ generic-y += local.h
|
|||
generic-y += local64.h
|
||||
generic-y += mcs_spinlock.h
|
||||
generic-y += mm-arch-hooks.h
|
||||
generic-y += preempt.h
|
||||
generic-y += rwsem.h
|
||||
generic-y += trace_clock.h
|
||||
generic-y += unaligned.h
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd_32.h
|
||||
generated-y += unistd_64.h
|
||||
generic-y += socket.h
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd_32.h
|
||||
generic-y += kvm_para.h
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd_32.h
|
||||
generated-y += unistd_64.h
|
||||
|
|
|
@ -61,7 +61,4 @@ $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/head.o $(obj)/piggy.o \
|
|||
ZTEXTADDR := 0x03000000
|
||||
ZBSSADDR := ALIGN(4)
|
||||
|
||||
SEDFLAGS_lds = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
|
||||
$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/unicore32/boot/Makefile $(KCONFIG_CONFIG)
|
||||
@sed "$(SEDFLAGS_lds)" < $< > $@
|
||||
|
||||
CPPFLAGS_vmlinux.lds = -DTEXT_START="$(ZTEXTADDR)" -DBSS_START="$(ZBSSADDR)"
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generic-y += kvm_para.h
|
||||
generic-y += ucontext.h
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd_32.h
|
||||
generated-y += unistd_64.h
|
||||
generated-y += unistd_x32.h
|
||||
generic-y += socket.h
|
||||
|
|
|
@ -15,7 +15,6 @@ generic-y += irq_work.h
|
|||
generic-y += kdebug.h
|
||||
generic-y += kmap_types.h
|
||||
generic-y += kprobes.h
|
||||
generic-y += linkage.h
|
||||
generic-y += local.h
|
||||
generic-y += local64.h
|
||||
generic-y += mcs_spinlock.h
|
||||
|
|
|
@ -1,5 +1,2 @@
|
|||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
generated-y += unistd_32.h
|
||||
generic-y += kvm_para.h
|
||||
generic-y += socket.h
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
#
|
||||
# asm headers that all architectures except um should have
|
||||
# (This file is not included when SRCARCH=um since UML borrows several
|
||||
# asm headers from the host architecutre.)
|
|
@ -1,6 +1,8 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
#
|
||||
# Headers that are mandatory in usr/include/asm/
|
||||
#
|
||||
# (This file is not included when SRCARCH=um since UML does not support UAPI.)
|
||||
|
||||
mandatory-y += auxvec.h
|
||||
mandatory-y += bitsperlong.h
|
||||
mandatory-y += bpf_perf_event.h
|
|
@ -213,7 +213,7 @@ KCOV_INSTRUMENT_stackdepot.o := n
|
|||
libfdt_files = fdt.o fdt_ro.o fdt_wip.o fdt_rw.o fdt_sw.o fdt_strerror.o \
|
||||
fdt_empty_tree.o
|
||||
$(foreach file, $(libfdt_files), \
|
||||
$(eval CFLAGS_$(file) = -I$(src)/../scripts/dtc/libfdt))
|
||||
$(eval CFLAGS_$(file) = -I $(srctree)/scripts/dtc/libfdt))
|
||||
lib-$(CONFIG_LIBFDT) += $(libfdt_files)
|
||||
|
||||
obj-$(CONFIG_RBTREE_TEST) += rbtree_test.o
|
||||
|
|
|
@ -12,8 +12,19 @@ all:
|
|||
src := $(subst /generated,,$(obj))
|
||||
-include $(src)/Kbuild
|
||||
|
||||
# $(generic)/Kbuild lists mandatory-y. Exclude um since it is a special case.
|
||||
ifneq ($(SRCARCH),um)
|
||||
include $(generic)/Kbuild
|
||||
endif
|
||||
|
||||
include scripts/Kbuild.include
|
||||
|
||||
redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y))
|
||||
redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f)))
|
||||
redundant := $(sort $(redundant))
|
||||
$(if $(redundant),\
|
||||
$(warning redundant generic-y found in $(src)/Kbuild: $(redundant)))
|
||||
|
||||
# If arch does not implement mandatory headers, fallback to asm-generic ones.
|
||||
mandatory-y := $(filter-out $(generated-y), $(mandatory-y))
|
||||
generic-y += $(foreach f, $(mandatory-y), $(if $(wildcard $(srctree)/$(src)/$(f)),,$(f)))
|
||||
|
|
|
@ -426,13 +426,9 @@ $(modorder-target): $(subdir-ym) FORCE
|
|||
# Rule to compile a set of .o files into one .a file (with symbol table)
|
||||
#
|
||||
ifdef lib-target
|
||||
quiet_cmd_link_l_target = AR $@
|
||||
|
||||
# lib target archives do get a symbol table and index
|
||||
cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
|
||||
|
||||
$(lib-target): $(lib-y) FORCE
|
||||
$(call if_changed,link_l_target)
|
||||
$(call if_changed,ar)
|
||||
|
||||
targets += $(lib-target)
|
||||
|
||||
|
|
|
@ -233,6 +233,12 @@ $(obj)/%: $(src)/%_shipped
|
|||
quiet_cmd_ld = LD $@
|
||||
cmd_ld = $(LD) $(ld_flags) $(real-prereqs) -o $@
|
||||
|
||||
# Archive
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
quiet_cmd_ar = AR $@
|
||||
cmd_ar = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
|
||||
|
||||
# Objcopy
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ quiet_cmd_modules_install = INSTALL $@
|
|||
mkdir -p $(2) ; \
|
||||
cp $@ $(2) ; \
|
||||
$(mod_strip_cmd) $(2)/$(notdir $@) ; \
|
||||
$(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) && \
|
||||
$(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) ; \
|
||||
$(mod_compress_cmd) $(2)/$(notdir $@)
|
||||
|
||||
# Modules built outside the kernel source tree go into extra by default
|
||||
|
|
|
@ -77,7 +77,6 @@ modpost = scripts/mod/modpost \
|
|||
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
|
||||
$(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
|
||||
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
|
||||
$(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
|
||||
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
|
||||
$(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
|
||||
|
||||
|
|
|
@ -39,14 +39,7 @@ case "$KBUILD_VERBOSE" in
|
|||
esac
|
||||
|
||||
# We need access to CONFIG_ symbols
|
||||
case "${KCONFIG_CONFIG}" in
|
||||
*/*)
|
||||
. "${KCONFIG_CONFIG}"
|
||||
;;
|
||||
*)
|
||||
# Force using a file from the current directory
|
||||
. "./${KCONFIG_CONFIG}"
|
||||
esac
|
||||
. include/config/auto.conf
|
||||
|
||||
# Generate a new ksym list file with symbols needed by the current
|
||||
# set of modules.
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/// Find missing put_device for every of_find_device_by_node.
|
||||
///
|
||||
// Confidence: Moderate
|
||||
// Copyright: (C) 2018-2019 Wen Yang, ZTE.
|
||||
// Comments:
|
||||
// Options: --no-includes --include-headers
|
||||
|
||||
virtual report
|
||||
virtual org
|
||||
|
||||
@search exists@
|
||||
local idexpression id;
|
||||
expression x,e,e1;
|
||||
position p1,p2;
|
||||
type T,T1,T2,T3;
|
||||
@@
|
||||
|
||||
id = of_find_device_by_node@p1(x)
|
||||
... when != e = id
|
||||
if (id == NULL || ...) { ... return ...; }
|
||||
... when != put_device(&id->dev)
|
||||
when != platform_device_put(id)
|
||||
when != of_dev_put(id)
|
||||
when != if (id) { ... put_device(&id->dev) ... }
|
||||
when != e1 = (T)id
|
||||
when != e1 = &id->dev
|
||||
when != e1 = get_device(&id->dev)
|
||||
when != e1 = (T1)platform_get_drvdata(id)
|
||||
(
|
||||
return
|
||||
( id
|
||||
| (T2)dev_get_drvdata(&id->dev)
|
||||
| (T3)platform_get_drvdata(id)
|
||||
);
|
||||
| return@p2 ...;
|
||||
)
|
||||
|
||||
@script:python depends on report@
|
||||
p1 << search.p1;
|
||||
p2 << search.p2;
|
||||
@@
|
||||
|
||||
coccilib.report.print_report(p2[0], "ERROR: missing put_device; "
|
||||
+ "call of_find_device_by_node on line "
|
||||
+ p1[0].line
|
||||
+ ", but without a corresponding object release "
|
||||
+ "within this function.")
|
||||
|
||||
@script:python depends on org@
|
||||
p1 << search.p1;
|
||||
p2 << search.p2;
|
||||
@@
|
||||
|
||||
cocci.print_main("of_find_device_by_node", p1)
|
||||
cocci.print_secs("needed put_device", p2)
|
|
@ -1,4 +0,0 @@
|
|||
#
|
||||
# Generated files
|
||||
#
|
||||
lxdialog
|
|
@ -171,14 +171,7 @@ if [ "$1" = "clean" ]; then
|
|||
fi
|
||||
|
||||
# We need access to CONFIG_ symbols
|
||||
case "${KCONFIG_CONFIG}" in
|
||||
*/*)
|
||||
. "${KCONFIG_CONFIG}"
|
||||
;;
|
||||
*)
|
||||
# Force using a file from the current directory
|
||||
. "./${KCONFIG_CONFIG}"
|
||||
esac
|
||||
. include/config/auto.conf
|
||||
|
||||
# Update version
|
||||
info GEN .version
|
||||
|
|
|
@ -35,7 +35,6 @@ static int vmlinux_section_warnings = 1;
|
|||
static int warn_unresolved = 0;
|
||||
/* How a symbol is exported */
|
||||
static int sec_mismatch_count = 0;
|
||||
static int sec_mismatch_verbose = 1;
|
||||
static int sec_mismatch_fatal = 0;
|
||||
/* ignore missing files */
|
||||
static int ignore_missing_files;
|
||||
|
@ -1406,8 +1405,6 @@ static void report_sec_mismatch(const char *modname,
|
|||
char *prl_to;
|
||||
|
||||
sec_mismatch_count++;
|
||||
if (!sec_mismatch_verbose)
|
||||
return;
|
||||
|
||||
get_pretty_name(from_is_func, &from, &from_p);
|
||||
get_pretty_name(to_is_func, &to, &to_p);
|
||||
|
@ -1655,9 +1652,7 @@ static void extable_mismatch_handler(const char* modname, struct elf_info *elf,
|
|||
|
||||
sec_mismatch_count++;
|
||||
|
||||
if (sec_mismatch_verbose)
|
||||
report_extable_warnings(modname, elf, mismatch, r, sym,
|
||||
fromsec, tosec);
|
||||
report_extable_warnings(modname, elf, mismatch, r, sym, fromsec, tosec);
|
||||
|
||||
if (match(tosec, mismatch->bad_tosec))
|
||||
fatal("The relocation at %s+0x%lx references\n"
|
||||
|
@ -2433,7 +2428,7 @@ int main(int argc, char **argv)
|
|||
struct ext_sym_list *extsym_iter;
|
||||
struct ext_sym_list *extsym_start = NULL;
|
||||
|
||||
while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awE")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "i:I:e:mnsT:o:awE")) != -1) {
|
||||
switch (opt) {
|
||||
case 'i':
|
||||
kernel_read = optarg;
|
||||
|
@ -2465,9 +2460,6 @@ int main(int argc, char **argv)
|
|||
case 's':
|
||||
vmlinux_section_warnings = 0;
|
||||
break;
|
||||
case 'S':
|
||||
sec_mismatch_verbose = 0;
|
||||
break;
|
||||
case 'T':
|
||||
files_source = optarg;
|
||||
break;
|
||||
|
@ -2525,18 +2517,9 @@ int main(int argc, char **argv)
|
|||
}
|
||||
if (dump_write)
|
||||
write_dump(dump_write);
|
||||
if (sec_mismatch_count) {
|
||||
if (!sec_mismatch_verbose) {
|
||||
warn("modpost: Found %d section mismatch(es).\n"
|
||||
"To see full details build your kernel with:\n"
|
||||
"'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n",
|
||||
sec_mismatch_count);
|
||||
}
|
||||
if (sec_mismatch_fatal) {
|
||||
fatal("modpost: Section mismatches detected.\n"
|
||||
"Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
|
||||
}
|
||||
}
|
||||
if (sec_mismatch_count && sec_mismatch_fatal)
|
||||
fatal("modpost: Section mismatches detected.\n"
|
||||
"Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
|
||||
free(buf.p);
|
||||
|
||||
return err;
|
||||
|
|
|
@ -12,6 +12,18 @@
|
|||
|
||||
set -e
|
||||
|
||||
is_enabled() {
|
||||
grep -q "^$1=y" include/config/auto.conf
|
||||
}
|
||||
|
||||
if_enabled_echo() {
|
||||
if is_enabled "$1"; then
|
||||
echo -n "$2"
|
||||
elif [ $# -ge 3 ]; then
|
||||
echo -n "$3"
|
||||
fi
|
||||
}
|
||||
|
||||
create_package() {
|
||||
local pname="$1" pdir="$2"
|
||||
|
||||
|
@ -62,7 +74,7 @@ parisc|mips|powerpc)
|
|||
installed_image_path="boot/vmlinuz-$version"
|
||||
esac
|
||||
|
||||
BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
|
||||
BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
|
||||
|
||||
# Setup the directory structure
|
||||
rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
|
||||
|
@ -83,14 +95,14 @@ else
|
|||
fi
|
||||
cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path"
|
||||
|
||||
if grep -q "^CONFIG_OF_EARLY_FLATTREE=y" $KCONFIG_CONFIG ; then
|
||||
if is_enabled CONFIG_OF_EARLY_FLATTREE; then
|
||||
# Only some architectures with OF support have this target
|
||||
if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then
|
||||
$MAKE -f $srctree/Makefile INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install
|
||||
fi
|
||||
fi
|
||||
|
||||
if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
|
||||
if is_enabled CONFIG_MODULES; then
|
||||
INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_install
|
||||
rm -f "$tmpdir/lib/modules/$version/build"
|
||||
rm -f "$tmpdir/lib/modules/$version/source"
|
||||
|
@ -111,8 +123,7 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
|
|||
done
|
||||
|
||||
# resign stripped modules
|
||||
MODULE_SIG_ALL="$(grep -s '^CONFIG_MODULE_SIG_ALL=y' $KCONFIG_CONFIG || true)"
|
||||
if [ -n "$MODULE_SIG_ALL" ]; then
|
||||
if is_enabled CONFIG_MODULE_SIG_ALL; then
|
||||
INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_sign
|
||||
fi
|
||||
fi
|
||||
|
@ -129,11 +140,6 @@ fi
|
|||
# make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and
|
||||
# so do we; recent versions of dracut and initramfs-tools will obey this.
|
||||
debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
|
||||
if grep -q '^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG; then
|
||||
want_initrd=Yes
|
||||
else
|
||||
want_initrd=No
|
||||
fi
|
||||
for script in postinst postrm preinst prerm ; do
|
||||
mkdir -p "$tmpdir$debhookdir/$script.d"
|
||||
cat <<EOF > "$tmpdir/DEBIAN/$script"
|
||||
|
@ -145,7 +151,7 @@ set -e
|
|||
export DEB_MAINT_PARAMS="\$*"
|
||||
|
||||
# Tell initramfs builder whether it's wanted
|
||||
export INITRD=$want_initrd
|
||||
export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No)
|
||||
|
||||
test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
|
||||
exit 0
|
||||
|
@ -158,11 +164,11 @@ done
|
|||
(cd $srctree; find arch/*/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles"
|
||||
(cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles"
|
||||
(cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles"
|
||||
if grep -q '^CONFIG_STACK_VALIDATION=y' $KCONFIG_CONFIG ; then
|
||||
if is_enabled CONFIG_STACK_VALIDATION; then
|
||||
(cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles"
|
||||
fi
|
||||
(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles"
|
||||
if grep -q '^CONFIG_GCC_PLUGINS=y' $KCONFIG_CONFIG ; then
|
||||
if is_enabled CONFIG_GCC_PLUGINS; then
|
||||
(cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles"
|
||||
fi
|
||||
destdir=$kernel_headers_dir/usr/src/linux-headers-$version
|
||||
|
|
|
@ -56,7 +56,7 @@ dirs=boot
|
|||
#
|
||||
# Try to install modules
|
||||
#
|
||||
if grep -q '^CONFIG_MODULES=y' "${KCONFIG_CONFIG}"; then
|
||||
if grep -q '^CONFIG_MODULES=y' include/config/auto.conf; then
|
||||
make ARCH="${ARCH}" -f ${srctree}/Makefile INSTALL_MOD_PATH="${tmpdir}" modules_install
|
||||
dirs="$dirs lib"
|
||||
fi
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
set -e
|
||||
|
||||
is_enabled() {
|
||||
grep -q "^CONFIG_$1=y" $KCONFIG_CONFIG
|
||||
grep -q "^$1=y" include/config/auto.conf
|
||||
}
|
||||
|
||||
if_enabled_echo() {
|
||||
|
@ -31,23 +31,23 @@ set_debarch() {
|
|||
x86_64)
|
||||
debarch=amd64 ;;
|
||||
sparc*)
|
||||
debarch=sparc$(if_enabled_echo 64BIT 64) ;;
|
||||
debarch=sparc$(if_enabled_echo CONFIG_64BIT 64) ;;
|
||||
s390*)
|
||||
debarch=s390x ;;
|
||||
ppc*)
|
||||
if is_enabled 64BIT; then
|
||||
debarch=ppc64$(if_enabled_echo CPU_LITTLE_ENDIAN el)
|
||||
if is_enabled CONFIG_64BIT; then
|
||||
debarch=ppc64$(if_enabled_echo CONFIG_CPU_LITTLE_ENDIAN el)
|
||||
else
|
||||
debarch=powerpc$(if_enabled_echo SPE spe)
|
||||
debarch=powerpc$(if_enabled_echo CONFIG_SPE spe)
|
||||
fi
|
||||
;;
|
||||
parisc*)
|
||||
debarch=hppa ;;
|
||||
mips*)
|
||||
if is_enabled CPU_LITTLE_ENDIAN; then
|
||||
debarch=mips$(if_enabled_echo 64BIT 64)$(if_enabled_echo CPU_MIPSR6 r6)el
|
||||
elif is_enabled CPU_MIPSR6; then
|
||||
debarch=mips$(if_enabled_echo 64BIT 64)r6
|
||||
if is_enabled CONFIG_CPU_LITTLE_ENDIAN; then
|
||||
debarch=mips$(if_enabled_echo CONFIG_64BIT 64)$(if_enabled_echo CONFIG_CPU_MIPSR6 r6)el
|
||||
elif is_enabled CONFIG_CPU_MIPSR6; then
|
||||
debarch=mips$(if_enabled_echo CONFIG_64BIT 64)r6
|
||||
else
|
||||
debarch=mips
|
||||
fi
|
||||
|
@ -55,8 +55,8 @@ set_debarch() {
|
|||
aarch64|arm64)
|
||||
debarch=arm64 ;;
|
||||
arm*)
|
||||
if is_enabled AEABI; then
|
||||
debarch=arm$(if_enabled_echo VFP hf el)
|
||||
if is_enabled CONFIG_AEABI; then
|
||||
debarch=arm$(if_enabled_echo CONFIG_VFP hf el)
|
||||
else
|
||||
debarch=arm
|
||||
fi
|
||||
|
@ -64,10 +64,10 @@ set_debarch() {
|
|||
openrisc)
|
||||
debarch=or1k ;;
|
||||
sh)
|
||||
if is_enabled CPU_SH3; then
|
||||
debarch=sh3$(if_enabled_echo CPU_BIG_ENDIAN eb)
|
||||
elif is_enabled CPU_SH4; then
|
||||
debarch=sh4$(if_enabled_echo CPU_BIG_ENDIAN eb)
|
||||
if is_enabled CONFIG_CPU_SH3; then
|
||||
debarch=sh3$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
|
||||
elif is_enabled CONFIG_CPU_SH4; then
|
||||
debarch=sh4$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
@ -132,8 +132,12 @@ else
|
|||
echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly"
|
||||
fi
|
||||
|
||||
mkdir -p debian/
|
||||
mkdir -p debian/source/
|
||||
echo "1.0" > debian/source/format
|
||||
|
||||
echo $debarch > debian/arch
|
||||
extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev)"
|
||||
extra_build_depends="$extra_build_depends, $(if_enabled_echo CONFIG_SYSTEM_TRUSTED_KEYRING libssl-dev:native)"
|
||||
|
||||
# Generate a simple changelog template
|
||||
cat <<EOF > debian/changelog
|
||||
|
@ -170,7 +174,7 @@ Source: $sourcename
|
|||
Section: kernel
|
||||
Priority: optional
|
||||
Maintainer: $maintainer
|
||||
Build-Depends: bc, kmod, cpio
|
||||
Build-Depends: bc, kmod, cpio, bison, flex | flex:native $extra_build_depends
|
||||
Homepage: http://www.kernel.org/
|
||||
|
||||
Package: $packagename
|
||||
|
@ -221,5 +225,6 @@ clean:
|
|||
|
||||
binary: binary-arch
|
||||
EOF
|
||||
chmod +x debian/rules
|
||||
|
||||
exit 0
|
||||
|
|
Загрузка…
Ссылка в новой задаче