Commit fd6f57bf authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'kbuild-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada:

 - Add new kconfig target 'make mod2noconfig', which will be useful to
   speed up the build and test iteration.

 - Raise the minimum supported version of LLVM to 11.0.0

 - Refactor certs/Makefile

 - Change the format of include/config/auto.conf to stop double-quoting
   string type CONFIG options.

 - Fix ARCH=sh builds in dash

 - Separate compression macros for general purposes (cmd_bzip2 etc.) and
   the ones for decompressors (cmd_bzip2_with_size etc.)

 - Misc Makefile cleanups

* tag 'kbuild-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (34 commits)
  kbuild: add cmd_file_size
  arch: decompressor: remove useless vmlinux.bin.all-y
  kbuild: rename cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22}
  kbuild: drop $(size_append) from cmd_zstd
  sh: rename suffix-y to suffix_y
  doc: kbuild: fix default in `imply` table
  microblaze: use built-in function to get CPU_{MAJOR,MINOR,REV}
  certs: move scripts/extract-cert to certs/
  kbuild: do not quote string values in include/config/auto.conf
  kbuild: do not include include/config/auto.conf from shell scripts
  certs: simplify $(srctree)/ handling and remove config_filename macro
  kbuild: stop using config_filename in scripts/Makefile.modsign
  certs: remove misleading comments about GCC PR
  certs: refactor file cleaning
  certs: remove unneeded -I$(srctree) option for system_certificates.o
  certs: unify duplicated cmd_extract_certs and improve the log
  certs: use $< and $@ to simplify the key generation rule
  kbuild: remove headers_check stub
  kbuild: move headers_check.pl to usr/include/
  certs: use if_changed to re-generate the key when the key type is changed
  ...
parents 0ed90597 c4d7f40b
...@@ -176,7 +176,7 @@ applicable everywhere (see syntax). ...@@ -176,7 +176,7 @@ applicable everywhere (see syntax).
y y y Y/m/n y y y Y/m/n
n m n N/m n m n N/m
m m m M/n m m m M/n
y m n M/n y m m M/n
y n * N y n * N
=== === ============= ============== === === ============= ==============
......
...@@ -30,7 +30,7 @@ you probably needn't concern yourself with pcmciautils. ...@@ -30,7 +30,7 @@ you probably needn't concern yourself with pcmciautils.
Program Minimal version Command to check the version Program Minimal version Command to check the version
====================== =============== ======================================== ====================== =============== ========================================
GNU C 5.1 gcc --version GNU C 5.1 gcc --version
Clang/LLVM (optional) 10.0.1 clang --version Clang/LLVM (optional) 11.0.0 clang --version
GNU make 3.81 make --version GNU make 3.81 make --version
binutils 2.23 ld -v binutils 2.23 ld -v
flex 2.5.35 flex --version flex 2.5.35 flex --version
......
...@@ -4467,7 +4467,6 @@ L: keyrings@vger.kernel.org ...@@ -4467,7 +4467,6 @@ L: keyrings@vger.kernel.org
S: Maintained S: Maintained
F: Documentation/admin-guide/module-signing.rst F: Documentation/admin-guide/module-signing.rst
F: certs/ F: certs/
F: scripts/extract-cert.c
F: scripts/sign-file.c F: scripts/sign-file.c
CFAG12864B LCD DRIVER CFAG12864B LCD DRIVER
......
...@@ -1278,15 +1278,6 @@ headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts ...@@ -1278,15 +1278,6 @@ headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts
$(Q)$(MAKE) $(hdr-inst)=include/uapi $(Q)$(MAKE) $(hdr-inst)=include/uapi
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi
# Deprecated. It is no-op now.
PHONY += headers_check
headers_check:
@echo >&2 "=================== WARNING ==================="
@echo >&2 "Since Linux 5.5, 'make headers_check' is no-op,"
@echo >&2 "and will be removed after Linux 5.15 release."
@echo >&2 "Please remove headers_check from your scripts."
@echo >&2 "==============================================="
ifdef CONFIG_HEADERS_INSTALL ifdef CONFIG_HEADERS_INSTALL
prepare: headers prepare: headers
endif endif
...@@ -1497,7 +1488,7 @@ MRPROPER_FILES += include/config include/generated \ ...@@ -1497,7 +1488,7 @@ MRPROPER_FILES += include/config include/generated \
debian snap tar-install \ debian snap tar-install \
.config .config.old .version \ .config .config.old .version \
Module.symvers \ Module.symvers \
certs/signing_key.pem certs/signing_key.x509 \ certs/signing_key.pem \
certs/x509.genkey \ certs/x509.genkey \
vmlinux-gdb.py \ vmlinux-gdb.py \
*.spec *.spec
...@@ -1723,9 +1714,9 @@ PHONY += prepare ...@@ -1723,9 +1714,9 @@ PHONY += prepare
# now expand this into a simple variable to reduce the cost of shell evaluations # now expand this into a simple variable to reduce the cost of shell evaluations
prepare: CC_VERSION_TEXT := $(CC_VERSION_TEXT) prepare: CC_VERSION_TEXT := $(CC_VERSION_TEXT)
prepare: prepare:
@if [ "$(CC_VERSION_TEXT)" != $(CONFIG_CC_VERSION_TEXT) ]; then \ @if [ "$(CC_VERSION_TEXT)" != "$(CONFIG_CC_VERSION_TEXT)" ]; then \
echo >&2 "warning: the compiler differs from the one used to build the kernel"; \ echo >&2 "warning: the compiler differs from the one used to build the kernel"; \
echo >&2 " The kernel was built by: "$(CONFIG_CC_VERSION_TEXT); \ echo >&2 " The kernel was built by: $(CONFIG_CC_VERSION_TEXT)"; \
echo >&2 " You are using: $(CC_VERSION_TEXT)"; \ echo >&2 " You are using: $(CC_VERSION_TEXT)"; \
fi fi
......
...@@ -648,8 +648,7 @@ config ARCH_SUPPORTS_LTO_CLANG_THIN ...@@ -648,8 +648,7 @@ config ARCH_SUPPORTS_LTO_CLANG_THIN
config HAS_LTO_CLANG config HAS_LTO_CLANG
def_bool y def_bool y
# Clang >= 11: https://github.com/ClangBuiltLinux/linux/issues/510 depends on CC_IS_CLANG && LD_IS_LLD && AS_IS_LLVM
depends on CC_IS_CLANG && CLANG_VERSION >= 110000 && LD_IS_LLD && AS_IS_LLVM
depends on $(success,$(NM) --help | head -n 1 | grep -qi llvm) depends on $(success,$(NM) --help | head -n 1 | grep -qi llvm)
depends on $(success,$(AR) --help | head -n 1 | grep -qi llvm) depends on $(success,$(AR) --help | head -n 1 | grep -qi llvm)
depends on ARCH_SUPPORTS_LTO_CLANG depends on ARCH_SUPPORTS_LTO_CLANG
......
...@@ -14,10 +14,10 @@ cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ ...@@ -14,10 +14,10 @@ cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mcpu=arc700 tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mcpu=arc700
tune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38 tune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38
ifeq ($(CONFIG_ARC_TUNE_MCPU),"") ifeq ($(CONFIG_ARC_TUNE_MCPU),)
cflags-y += $(tune-mcpu-def-y) cflags-y += $(tune-mcpu-def-y)
else else
tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU)) tune-mcpu := $(CONFIG_ARC_TUNE_MCPU)
ifneq ($(call cc-option,$(tune-mcpu)),) ifneq ($(call cc-option,$(tune-mcpu)),)
cflags-y += $(tune-mcpu) cflags-y += $(tune-mcpu)
else else
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# Built-in dtb # Built-in dtb
builtindtb-y := nsim_700 builtindtb-y := nsim_700
ifneq ($(CONFIG_ARC_BUILTIN_DTB_NAME),"") ifneq ($(CONFIG_ARC_BUILTIN_DTB_NAME),)
builtindtb-y := $(patsubst "%",%,$(CONFIG_ARC_BUILTIN_DTB_NAME)) builtindtb-y := $(CONFIG_ARC_BUILTIN_DTB_NAME)
endif endif
obj-y += $(builtindtb-y).dtb.o obj-y += $(builtindtb-y).dtb.o
......
...@@ -66,8 +66,6 @@ config UNWINDER_FRAME_POINTER ...@@ -66,8 +66,6 @@ config UNWINDER_FRAME_POINTER
config UNWINDER_ARM config UNWINDER_ARM
bool "ARM EABI stack unwinder" bool "ARM EABI stack unwinder"
depends on AEABI && !FUNCTION_GRAPH_TRACER depends on AEABI && !FUNCTION_GRAPH_TRACER
# https://github.com/ClangBuiltLinux/linux/issues/732
depends on !LD_IS_LLD || LLD_VERSION >= 110000
select ARM_UNWIND select ARM_UNWIND
help help
This option enables stack unwinding support in the kernel This option enables stack unwinding support in the kernel
......
...@@ -76,10 +76,10 @@ CPPFLAGS_vmlinux.lds += -DTEXT_OFFSET="$(TEXT_OFFSET)" ...@@ -76,10 +76,10 @@ CPPFLAGS_vmlinux.lds += -DTEXT_OFFSET="$(TEXT_OFFSET)"
CPPFLAGS_vmlinux.lds += -DMALLOC_SIZE="$(MALLOC_SIZE)" CPPFLAGS_vmlinux.lds += -DMALLOC_SIZE="$(MALLOC_SIZE)"
compress-$(CONFIG_KERNEL_GZIP) = gzip compress-$(CONFIG_KERNEL_GZIP) = gzip
compress-$(CONFIG_KERNEL_LZO) = lzo compress-$(CONFIG_KERNEL_LZO) = lzo_with_size
compress-$(CONFIG_KERNEL_LZMA) = lzma compress-$(CONFIG_KERNEL_LZMA) = lzma_with_size
compress-$(CONFIG_KERNEL_XZ) = xzkern compress-$(CONFIG_KERNEL_XZ) = xzkern_with_size
compress-$(CONFIG_KERNEL_LZ4) = lz4 compress-$(CONFIG_KERNEL_LZ4) = lz4_with_size
libfdt_objs := fdt_rw.o fdt_ro.o fdt_wip.o fdt.o libfdt_objs := fdt_rw.o fdt_ro.o fdt_wip.o fdt.o
......
...@@ -30,9 +30,11 @@ $(obj)/vmlinux.bin: vmlinux FORCE ...@@ -30,9 +30,11 @@ $(obj)/vmlinux.bin: vmlinux FORCE
suffix-$(CONFIG_KERNEL_GZIP) := gzip suffix-$(CONFIG_KERNEL_GZIP) := gzip
suffix-$(CONFIG_KERNEL_LZO) := lzo suffix-$(CONFIG_KERNEL_LZO) := lzo
compress-$(CONFIG_KERNEL_GZIP) := gzip
compress-$(CONFIG_KERNEL_LZO) := lzo_with_size
$(obj)/vmlinux.bin.$(suffix-y): $(obj)/vmlinux.bin FORCE $(obj)/vmlinux.bin.$(suffix-y): $(obj)/vmlinux.bin FORCE
$(call if_changed,$(suffix-y)) $(call if_changed,$(compress-y))
LDFLAGS_piggy.o := -r --format binary --oformat elf32-h8300-linux -T LDFLAGS_piggy.o := -r --format binary --oformat elf32-h8300-linux -T
OBJCOPYFLAGS := -O binary OBJCOPYFLAGS := -O binary
......
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
ifneq '$(CONFIG_H8300_BUILTIN_DTB)' '""' obj-y += $(addsuffix .dtb.o, $(CONFIG_H8300_BUILTIN_DTB))
BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_H8300_BUILTIN_DTB)).dtb.o
endif
obj-y += $(BUILTIN_DTB)
dtb-$(CONFIG_H8300H_SIM) := h8300h_sim.dtb dtb-$(CONFIG_H8300H_SIM) := h8300h_sim.dtb
dtb-$(CONFIG_H8S_SIM) := h8s_sim.dtb dtb-$(CONFIG_H8S_SIM) := h8s_sim.dtb
......
...@@ -5,10 +5,10 @@ UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\" ...@@ -5,10 +5,10 @@ UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\"
# What CPU version are we building for, and crack it open # What CPU version are we building for, and crack it open
# as major.minor.rev # as major.minor.rev
CPU_VER := $(shell echo $(CONFIG_XILINX_MICROBLAZE0_HW_VER)) CPU_VER := $(CONFIG_XILINX_MICROBLAZE0_HW_VER)
CPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1) CPU_MAJOR := $(word 1, $(subst ., , $(CPU_VER)))
CPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2) CPU_MINOR := $(word 2, $(subst ., , $(CPU_VER)))
CPU_REV := $(shell echo $(CPU_VER) | cut -d '.' -f 3) CPU_REV := $(word 3, $(subst ., , $(CPU_VER)))
export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV
......
...@@ -64,12 +64,12 @@ $(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE ...@@ -64,12 +64,12 @@ $(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
tool_$(CONFIG_KERNEL_GZIP) = gzip tool_$(CONFIG_KERNEL_GZIP) = gzip
tool_$(CONFIG_KERNEL_BZIP2) = bzip2 tool_$(CONFIG_KERNEL_BZIP2) = bzip2_with_size
tool_$(CONFIG_KERNEL_LZ4) = lz4 tool_$(CONFIG_KERNEL_LZ4) = lz4_with_size
tool_$(CONFIG_KERNEL_LZMA) = lzma tool_$(CONFIG_KERNEL_LZMA) = lzma_with_size
tool_$(CONFIG_KERNEL_LZO) = lzo tool_$(CONFIG_KERNEL_LZO) = lzo_with_size
tool_$(CONFIG_KERNEL_XZ) = xzkern tool_$(CONFIG_KERNEL_XZ) = xzkern_with_size
tool_$(CONFIG_KERNEL_ZSTD) = zstd22 tool_$(CONFIG_KERNEL_ZSTD) = zstd22_with_size
targets += vmlinux.bin.z targets += vmlinux.bin.z
......
...@@ -31,12 +31,6 @@ core-y += arch/nds32/kernel/ arch/nds32/mm/ ...@@ -31,12 +31,6 @@ core-y += arch/nds32/kernel/ arch/nds32/mm/
core-$(CONFIG_FPU) += arch/nds32/math-emu/ core-$(CONFIG_FPU) += arch/nds32/math-emu/
libs-y += arch/nds32/lib/ libs-y += arch/nds32/lib/
ifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""'
BUILTIN_DTB := y
else
BUILTIN_DTB := n
endif
ifdef CONFIG_CPU_LITTLE_ENDIAN ifdef CONFIG_CPU_LITTLE_ENDIAN
KBUILD_CFLAGS += $(call cc-option, -EL) KBUILD_CFLAGS += $(call cc-option, -EL)
KBUILD_AFLAGS += $(call cc-option, -EL) KBUILD_AFLAGS += $(call cc-option, -EL)
......
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
ifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""' obj-$(CONFIG_OF) += $(addsuffix .dtb.o, $(CONFIG_NDS32_BUILTIN_DTB))
BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_NDS32_BUILTIN_DTB)).dtb.o
else
BUILTIN_DTB :=
endif
obj-$(CONFIG_OF) += $(BUILTIN_DTB)
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
obj-y := $(patsubst "%.dts",%.dtb.o,$(CONFIG_NIOS2_DTB_SOURCE)) obj-y := $(patsubst %.dts,%.dtb.o,$(CONFIG_NIOS2_DTB_SOURCE))
dtstree := $(srctree)/$(src) dtstree := $(srctree)/$(src)
dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts)) dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
ifneq '$(CONFIG_OPENRISC_BUILTIN_DTB)' '""' obj-y += $(addsuffix .dtb.o, $(CONFIG_OPENRISC_BUILTIN_DTB))
BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_OPENRISC_BUILTIN_DTB)).dtb.o
else
BUILTIN_DTB :=
endif
obj-y += $(BUILTIN_DTB)
#DTC_FLAGS ?= -p 1024 #DTC_FLAGS ?= -p 1024
...@@ -50,8 +50,6 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -R .note -S ...@@ -50,8 +50,6 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -R .note -S
$(obj)/vmlinux.bin: vmlinux FORCE $(obj)/vmlinux.bin: vmlinux FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
vmlinux.bin.all-y := $(obj)/vmlinux.bin
suffix-$(CONFIG_KERNEL_GZIP) := gz suffix-$(CONFIG_KERNEL_GZIP) := gz
suffix-$(CONFIG_KERNEL_BZIP2) := bz2 suffix-$(CONFIG_KERNEL_BZIP2) := bz2
suffix-$(CONFIG_KERNEL_LZ4) := lz4 suffix-$(CONFIG_KERNEL_LZ4) := lz4
...@@ -59,18 +57,18 @@ suffix-$(CONFIG_KERNEL_LZMA) := lzma ...@@ -59,18 +57,18 @@ suffix-$(CONFIG_KERNEL_LZMA) := lzma
suffix-$(CONFIG_KERNEL_LZO) := lzo suffix-$(CONFIG_KERNEL_LZO) := lzo
suffix-$(CONFIG_KERNEL_XZ) := xz suffix-$(CONFIG_KERNEL_XZ) := xz
$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
$(call if_changed,gzip) $(call if_changed,gzip)
$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
$(call if_changed,bzip2) $(call if_changed,bzip2_with_size)
$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCE
$(call if_changed,lz4) $(call if_changed,lz4_with_size)
$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
$(call if_changed,lzma) $(call if_changed,lzma_with_size)
$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
$(call if_changed,lzo) $(call if_changed,lzo_with_size)
$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE
$(call if_changed,xzkern) $(call if_changed,xzkern_with_size)
LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
......
...@@ -365,7 +365,7 @@ image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot ...@@ -365,7 +365,7 @@ image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot
endif endif
# Allow extra targets to be added to the defconfig # Allow extra targets to be added to the defconfig
image-y += $(subst ",,$(CONFIG_EXTRA_TARGETS)) image-y += $(CONFIG_EXTRA_TARGETS)
initrd- := $(patsubst zImage%, zImage.initrd%, $(image-)) initrd- := $(patsubst zImage%, zImage.initrd%, $(image-))
initrd-y := $(patsubst zImage%, zImage.initrd%, \ initrd-y := $(patsubst zImage%, zImage.initrd%, \
......
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
ifneq ($(CONFIG_SOC_CANAAN_K210_DTB_SOURCE),"") dtb-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += $(addsuffix .dtb, $(CONFIG_SOC_CANAAN_K210_DTB_SOURCE))
dtb-y += $(strip $(shell echo $(CONFIG_SOC_CANAAN_K210_DTB_SOURCE))).dtb
obj-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += $(addsuffix .o, $(dtb-y)) obj-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += $(addsuffix .o, $(dtb-y))
endif
...@@ -58,8 +58,6 @@ OBJCOPYFLAGS_vmlinux.bin := -O binary --remove-section=.comment --remove-section ...@@ -58,8 +58,6 @@ OBJCOPYFLAGS_vmlinux.bin := -O binary --remove-section=.comment --remove-section
$(obj)/vmlinux.bin: vmlinux FORCE $(obj)/vmlinux.bin: vmlinux FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
vmlinux.bin.all-y := $(obj)/vmlinux.bin
suffix-$(CONFIG_KERNEL_GZIP) := .gz suffix-$(CONFIG_KERNEL_GZIP) := .gz
suffix-$(CONFIG_KERNEL_BZIP2) := .bz2 suffix-$(CONFIG_KERNEL_BZIP2) := .bz2
suffix-$(CONFIG_KERNEL_LZ4) := .lz4 suffix-$(CONFIG_KERNEL_LZ4) := .lz4
...@@ -68,20 +66,20 @@ suffix-$(CONFIG_KERNEL_LZO) := .lzo ...@@ -68,20 +66,20 @@ suffix-$(CONFIG_KERNEL_LZO) := .lzo
suffix-$(CONFIG_KERNEL_XZ) := .xz suffix-$(CONFIG_KERNEL_XZ) := .xz
suffix-$(CONFIG_KERNEL_ZSTD) := .zst suffix-$(CONFIG_KERNEL_ZSTD) := .zst
$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
$(call if_changed,gzip) $(call if_changed,gzip)
$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
$(call if_changed,bzip2) $(call if_changed,bzip2_with_size)
$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCE
$(call if_changed,lz4) $(call if_changed,lz4_with_size)
$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
$(call if_changed,lzma) $(call if_changed,lzma_with_size)
$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
$(call if_changed,lzo) $(call if_changed,lzo_with_size)
$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE
$(call if_changed,xzkern) $(call if_changed,xzkern_with_size)
$(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.zst: $(obj)/vmlinux.bin FORCE
$(call if_changed,zstd22) $(call if_changed,zstd22_with_size)
OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.bin.compressed OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.bin.compressed
$(obj)/piggy.o: $(obj)/vmlinux.bin$(suffix-y) FORCE $(obj)/piggy.o: $(obj)/vmlinux.bin$(suffix-y) FORCE
......
...@@ -19,12 +19,12 @@ CONFIG_ZERO_PAGE_OFFSET ?= 0x00001000 ...@@ -19,12 +19,12 @@ CONFIG_ZERO_PAGE_OFFSET ?= 0x00001000
CONFIG_ENTRY_OFFSET ?= 0x00001000 CONFIG_ENTRY_OFFSET ?= 0x00001000
CONFIG_PHYSICAL_START ?= $(CONFIG_MEMORY_START) CONFIG_PHYSICAL_START ?= $(CONFIG_MEMORY_START)
suffix-y := bin suffix_y := bin
suffix-$(CONFIG_KERNEL_GZIP) := gz suffix_$(CONFIG_KERNEL_GZIP) := gz
suffix-$(CONFIG_KERNEL_BZIP2) := bz2 suffix_$(CONFIG_KERNEL_BZIP2) := bz2
suffix-$(CONFIG_KERNEL_LZMA) := lzma suffix_$(CONFIG_KERNEL_LZMA) := lzma
suffix-$(CONFIG_KERNEL_XZ) := xz suffix_$(CONFIG_KERNEL_XZ) := xz
suffix-$(CONFIG_KERNEL_LZO) := lzo suffix_$(CONFIG_KERNEL_LZO) := lzo
targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz \ targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz \
uImage.bz2 uImage.lzma uImage.xz uImage.lzo uImage.bin \ uImage.bz2 uImage.lzma uImage.xz uImage.lzo uImage.bin \
...@@ -106,10 +106,10 @@ OBJCOPYFLAGS_uImage.srec := -I binary -O srec ...@@ -106,10 +106,10 @@ OBJCOPYFLAGS_uImage.srec := -I binary -O srec
$(obj)/uImage.srec: $(obj)/uImage FORCE $(obj)/uImage.srec: $(obj)/uImage FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
$(obj)/uImage: $(obj)/uImage.$(suffix-y) $(obj)/uImage: $(obj)/uImage.$(suffix_y)
@ln -sf $(notdir $<) $@ @ln -sf $(notdir $<) $@
@echo ' Image $@ is ready' @echo ' Image $@ is ready'
export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \ export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \
CONFIG_PHYSICAL_START CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET \ CONFIG_PHYSICAL_START CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET \
KERNEL_MEMORY suffix-y KERNEL_MEMORY suffix_y
...@@ -47,22 +47,20 @@ $(obj)/vmlinux: $(addprefix $(obj)/, $(OBJECTS)) FORCE ...@@ -47,22 +47,20 @@ $(obj)/vmlinux: $(addprefix $(obj)/, $(OBJECTS)) FORCE
$(obj)/vmlinux.bin: vmlinux FORCE $(obj)/vmlinux.bin: vmlinux FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
vmlinux.bin.all-y := $(obj)/vmlinux.bin $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
$(call if_changed,gzip) $(call if_changed,gzip)
$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
$(call if_changed,bzip2) $(call if_changed,bzip2_with_size)
$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
$(call if_changed,lzma) $(call if_changed,lzma_with_size)
$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE
$(call if_changed,xzkern) $(call if_changed,xzkern_with_size)
$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
$(call if_changed,lzo) $(call if_changed,lzo_with_size)
OBJCOPYFLAGS += -R .empty_zero_page OBJCOPYFLAGS += -R .empty_zero_page
LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix_y) FORCE
$(call if_changed,ld) $(call if_changed,ld)
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"") obj-$(CONFIG_USE_BUILTIN_DTB) += $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_SOURCE))
obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o
endif
...@@ -126,17 +126,17 @@ vmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $(obj)/vmlinux.relocs ...@@ -126,17 +126,17 @@ vmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $(obj)/vmlinux.relocs
$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
$(call if_changed,gzip) $(call if_changed,gzip)
$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
$(call if_changed,bzip2) $(call if_changed,bzip2_with_size)
$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
$(call if_changed,lzma) $(call if_changed,lzma_with_size)
$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
$(call if_changed,xzkern) $(call if_changed,xzkern_with_size)
$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
$(call if_changed,lzo) $(call if_changed,lzo_with_size)
$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
$(call if_changed,lz4) $(call if_changed,lz4_with_size)
$(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE $(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE
$(call if_changed,zstd22) $(call if_changed,zstd22_with_size)
suffix-$(CONFIG_KERNEL_GZIP) := gz suffix-$(CONFIG_KERNEL_GZIP) := gz
suffix-$(CONFIG_KERNEL_BZIP2) := bz2 suffix-$(CONFIG_KERNEL_BZIP2) := bz2
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# Core configuration. # Core configuration.
# (Use VAR=<xtensa_config> to use another default compiler.) # (Use VAR=<xtensa_config> to use another default compiler.)
variant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME)) variant-y := $(CONFIG_XTENSA_VARIANT_NAME)
VARIANT = $(variant-y) VARIANT = $(variant-y)
......
...@@ -7,10 +7,7 @@ ...@@ -7,10 +7,7 @@
# #
# #
BUILTIN_DTB_SOURCE := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o obj-$(CONFIG_OF) += $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_SOURCE))
ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"")
obj-$(CONFIG_OF) += $(BUILTIN_DTB_SOURCE)
endif
# for CONFIG_OF_ALL_DTBS test # for CONFIG_OF_ALL_DTBS test
dtstree := $(srctree)/$(src) dtstree := $(srctree)/$(src)
......
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
/extract-cert
/x509_certificate_list /x509_certificate_list
/x509_revocation_list /x509_revocation_list
...@@ -17,21 +17,19 @@ config MODULE_SIG_KEY ...@@ -17,21 +17,19 @@ config MODULE_SIG_KEY
choice choice
prompt "Type of module signing key to be generated" prompt "Type of module signing key to be generated"
default MODULE_SIG_KEY_TYPE_RSA depends on MODULE_SIG || (IMA_APPRAISE_MODSIG && MODULES)
help help
The type of module signing key type to generate. This option The type of module signing key type to generate. This option
does not apply if a #PKCS11 URI is used. does not apply if a #PKCS11 URI is used.
config MODULE_SIG_KEY_TYPE_RSA config MODULE_SIG_KEY_TYPE_RSA
bool "RSA" bool "RSA"
depends on MODULE_SIG || (IMA_APPRAISE_MODSIG && MODULES)
help help
Use an RSA key for module signing. Use an RSA key for module signing.
config MODULE_SIG_KEY_TYPE_ECDSA config MODULE_SIG_KEY_TYPE_ECDSA
bool "ECDSA" bool "ECDSA"
select CRYPTO_ECDSA select CRYPTO_ECDSA
depends on MODULE_SIG || (IMA_APPRAISE_MODSIG && MODULES)
help help
Use an elliptic curve key (NIST P384) for module signing. Consider Use an elliptic curve key (NIST P384) for module signing. Consider
using a strong hash like sha256 or sha384 for hashing modules. using a strong hash like sha256 or sha384 for hashing modules.
......
...@@ -6,31 +6,21 @@ ...@@ -6,31 +6,21 @@
obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o common.o obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o common.o
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o common.o obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o common.o
obj-$(CONFIG_SYSTEM_REVOCATION_LIST) += revocation_certificates.o obj-$(CONFIG_SYSTEM_REVOCATION_LIST) += revocation_certificates.o
ifneq ($(CONFIG_SYSTEM_BLACKLIST_HASH_LIST),"") ifneq ($(CONFIG_SYSTEM_BLACKLIST_HASH_LIST),)
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_hashes.o obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_hashes.o
else else
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o
endif endif
ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y) quiet_cmd_extract_certs = CERT $@
cmd_extract_certs = $(obj)/extract-cert $(2) $@
$(eval $(call config_filename,SYSTEM_TRUSTED_KEYS))
# GCC doesn't include .incbin files in -MD generated dependencies (PR#66871)
$(obj)/system_certificates.o: $(obj)/x509_certificate_list $(obj)/system_certificates.o: $(obj)/x509_certificate_list
# Cope with signing_key.x509 existing in $(srctree) not $(objtree) $(obj)/x509_certificate_list: $(CONFIG_SYSTEM_TRUSTED_KEYS) $(obj)/extract-cert FORCE
AFLAGS_system_certificates.o := -I$(srctree) $(call if_changed,extract_certs,$(if $(CONFIG_SYSTEM_TRUSTED_KEYS),$<,""))
quiet_cmd_extract_certs = EXTRACT_CERTS $(patsubst "%",%,$(2))
cmd_extract_certs = scripts/extract-cert $(2) $@
targets += x509_certificate_list targets += x509_certificate_list
$(obj)/x509_certificate_list: scripts/extract-cert $(SYSTEM_TRUSTED_KEYS_SRCPREFIX)$(SYSTEM_TRUSTED_KEYS_FILENAME) FORCE
$(call if_changed,extract_certs,$(SYSTEM_TRUSTED_KEYS_SRCPREFIX)$(CONFIG_SYSTEM_TRUSTED_KEYS))
endif # CONFIG_SYSTEM_TRUSTED_KEYRING
clean-files := x509_certificate_list .x509.list x509_revocation_list
ifeq ($(CONFIG_MODULE_SIG),y) ifeq ($(CONFIG_MODULE_SIG),y)
SIGN_KEY = y SIGN_KEY = y
...@@ -50,103 +40,54 @@ ifdef SIGN_KEY ...@@ -50,103 +40,54 @@ ifdef SIGN_KEY
# fail and that the kernel may be used afterwards. # fail and that the kernel may be used afterwards.
# #
############################################################################### ###############################################################################
ifndef CONFIG_MODULE_SIG_HASH
$(error Could not determine digest type to use from kernel config)
endif
redirect_openssl = 2>&1
quiet_redirect_openssl = 2>&1
silent_redirect_openssl = 2>/dev/null
openssl_available = $(shell openssl help 2>/dev/null && echo yes)
# We do it this way rather than having a boolean option for enabling an # We do it this way rather than having a boolean option for enabling an
# external private key, because 'make randconfig' might enable such a # external private key, because 'make randconfig' might enable such a
# boolean option and we unfortunately can't make it depend on !RANDCONFIG. # boolean option and we unfortunately can't make it depend on !RANDCONFIG.
ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem") ifeq ($(CONFIG_MODULE_SIG_KEY),certs/signing_key.pem)
ifeq ($(openssl_available),yes) keytype-$(CONFIG_MODULE_SIG_KEY_TYPE_ECDSA) := -newkey ec -pkeyopt ec_paramgen_curve:secp384r1
X509TEXT=$(shell openssl x509 -in "certs/signing_key.pem" -text 2>/dev/null)
endif
# Support user changing key type quiet_cmd_gen_key = GENKEY $@
ifdef CONFIG_MODULE_SIG_KEY_TYPE_ECDSA cmd_gen_key = openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \
keytype_openssl = -newkey ec -pkeyopt ec_paramgen_curve:secp384r1 -batch -x509 -config $< \
ifeq ($(openssl_available),yes) -outform PEM -out $@ -keyout $@ $(keytype-y) 2>&1
$(if $(findstring id-ecPublicKey,$(X509TEXT)),,$(shell rm -f "certs/signing_key.pem"))
endif
endif # CONFIG_MODULE_SIG_KEY_TYPE_ECDSA
ifdef CONFIG_MODULE_SIG_KEY_TYPE_RSA $(obj)/signing_key.pem: $(obj)/x509.genkey FORCE
ifeq ($(openssl_available),yes) $(call if_changed,gen_key)
$(if $(findstring rsaEncryption,$(X509TEXT)),,$(shell rm -f "certs/signing_key.pem"))
endif targets += signing_key.pem
endif # CONFIG_MODULE_SIG_KEY_TYPE_RSA
$(obj)/signing_key.pem: $(obj)/x509.genkey
@$(kecho) "###"
@$(kecho) "### Now generating an X.509 key pair to be used for signing modules."
@$(kecho) "###"
@$(kecho) "### If this takes a long time, you might wish to run rngd in the"
@$(kecho) "### background to keep the supply of entropy topped up. It"
@$(kecho) "### needs to be run as root, and uses a hardware random"
@$(kecho) "### number generator if one is available."
@$(kecho) "###"
$(Q)openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \
-batch -x509 -config $(obj)/x509.genkey \
-outform PEM -out $(obj)/signing_key.pem \
-keyout $(obj)/signing_key.pem \
$(keytype_openssl) \
$($(quiet)redirect_openssl)
@$(kecho) "###"
@$(kecho) "### Key pair generated."
@$(kecho) "###"
quiet_cmd_copy_x509_config = COPY $@
cmd_copy_x509_config = cat $(srctree)/$(src)/default_x509.genkey > $@
# You can provide your own config file. If not present, copy the default one.
$(obj)/x509.genkey: $(obj)/x509.genkey:
@$(kecho) Generating X.509 key generation config $(call cmd,copy_x509_config)
@echo >$@ "[ req ]"
@echo >>$@ "default_bits = 4096"
@echo >>$@ "distinguished_name = req_distinguished_name"
@echo >>$@ "prompt = no"
@echo >>$@ "string_mask = utf8only"
@echo >>$@ "x509_extensions = myexts"
@echo >>$@
@echo >>$@ "[ req_distinguished_name ]"
@echo >>$@ "#O = Unspecified company"
@echo >>$@ "CN = Build time autogenerated kernel key"
@echo >>$@ "#emailAddress = unspecified.user@unspecified.company"
@echo >>$@
@echo >>$@ "[ myexts ]"
@echo >>$@ "basicConstraints=critical,CA:FALSE"
@echo >>$@ "keyUsage=digitalSignature"
@echo >>$@ "subjectKeyIdentifier=hash"
@echo >>$@ "authorityKeyIdentifier=keyid"
endif # CONFIG_MODULE_SIG_KEY
$(eval $(call config_filename,MODULE_SIG_KEY)) endif # CONFIG_MODULE_SIG_KEY
# If CONFIG_MODULE_SIG_KEY isn't a PKCS#11 URI, depend on it # If CONFIG_MODULE_SIG_KEY isn't a PKCS#11 URI, depend on it
ifeq ($(patsubst pkcs11:%,%,$(firstword $(MODULE_SIG_KEY_FILENAME))),$(firstword $(MODULE_SIG_KEY_FILENAME))) ifneq ($(filter-out pkcs11:%, %(CONFIG_MODULE_SIG_KEY)),)
X509_DEP := $(MODULE_SIG_KEY_SRCPREFIX)$(MODULE_SIG_KEY_FILENAME) X509_DEP := $(CONFIG_MODULE_SIG_KEY)
endif endif
# GCC PR#66871 again.
$(obj)/system_certificates.o: $(obj)/signing_key.x509 $(obj)/system_certificates.o: $(obj)/signing_key.x509
targets += signing_key.x509 $(obj)/signing_key.x509: $(X509_DEP) $(obj)/extract-cert FORCE
$(obj)/signing_key.x509: scripts/extract-cert $(X509_DEP) FORCE $(call if_changed,extract_certs,$(if $(X509_DEP),$<,$(CONFIG_MODULE_SIG_KEY)))
$(call if_changed,extract_certs,$(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY))
endif # CONFIG_MODULE_SIG endif # CONFIG_MODULE_SIG
ifeq ($(CONFIG_SYSTEM_REVOCATION_LIST),y) targets += signing_key.x509
$(eval $(call config_filename,SYSTEM_REVOCATION_KEYS))
$(obj)/revocation_certificates.o: $(obj)/x509_revocation_list $(obj)/revocation_certificates.o: $(obj)/x509_revocation_list
quiet_cmd_extract_certs = EXTRACT_CERTS $(patsubst "%",%,$(2)) $(obj)/x509_revocation_list: $(CONFIG_SYSTEM_REVOCATION_KEYS) $(obj)/extract-cert FORCE
cmd_extract_certs = scripts/extract-cert $(2) $@ $(call if_changed,extract_certs,$(if $(CONFIG_SYSTEM_REVOCATION_KEYS),$<,""))
targets += x509_revocation_list targets += x509_revocation_list
$(obj)/x509_revocation_list: scripts/extract-cert $(SYSTEM_REVOCATION_KEYS_SRCPREFIX)$(SYSTEM_REVOCATION_KEYS_FILENAME) FORCE
$(call if_changed,extract_certs,$(SYSTEM_REVOCATION_KEYS_SRCPREFIX)$(CONFIG_SYSTEM_REVOCATION_KEYS)) hostprogs := extract-cert
endif
HOSTCFLAGS_extract-cert.o = $(shell pkg-config --cflags libcrypto 2> /dev/null)
HOSTLDLIBS_extract-cert = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
[ req ]
default_bits = 4096
distinguished_name = req_distinguished_name
prompt = no
string_mask = utf8only
x509_extensions = myexts
[ req_distinguished_name ]
#O = Unspecified company
CN = Build time autogenerated kernel key
#emailAddress = unspecified.user@unspecified.company
[ myexts ]
basicConstraints=critical,CA:FALSE
keyUsage=digitalSignature
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid
...@@ -29,7 +29,7 @@ static __attribute__((noreturn)) ...@@ -29,7 +29,7 @@ static __attribute__((noreturn))
void format(void) void format(void)
{ {
fprintf(stderr, fprintf(stderr,
"Usage: scripts/extract-cert <source> <dest>\n"); "Usage: extract-cert <source> <dest>\n");
exit(2); exit(2);
} }
......
...@@ -9,7 +9,7 @@ ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT ...@@ -9,7 +9,7 @@ ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT
# ACPI Boot-Time Table Parsing # ACPI Boot-Time Table Parsing
# #
ifeq ($(CONFIG_ACPI_CUSTOM_DSDT),y) ifeq ($(CONFIG_ACPI_CUSTOM_DSDT),y)
tables.o: $(src)/../../include/$(subst $\",,$(CONFIG_ACPI_CUSTOM_DSDT_FILE)) ; tables.o: $(src)/../../include/$(CONFIG_ACPI_CUSTOM_DSDT_FILE) ;
endif endif
......
...@@ -3,10 +3,10 @@ obj-y += main.o ...@@ -3,10 +3,10 @@ obj-y += main.o
# Create $(fwdir) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a # Create $(fwdir) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a
# leading /, it's relative to $(srctree). # leading /, it's relative to $(srctree).
fwdir := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE_DIR)) fwdir := $(CONFIG_EXTRA_FIRMWARE_DIR)
fwdir := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir)) fwdir := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir))
firmware := $(addsuffix .gen.o, $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE))) firmware := $(addsuffix .gen.o, $(CONFIG_EXTRA_FIRMWARE))
obj-y += $(firmware) obj-y += $(firmware)
FWNAME = $(patsubst $(obj)/%.gen.S,%,$@) FWNAME = $(patsubst $(obj)/%.gen.S,%,$@)
......
...@@ -403,8 +403,7 @@ static __always_inline unsigned int __kmalloc_index(size_t size, ...@@ -403,8 +403,7 @@ static __always_inline unsigned int __kmalloc_index(size_t size,
if (size <= 16 * 1024 * 1024) return 24; if (size <= 16 * 1024 * 1024) return 24;
if (size <= 32 * 1024 * 1024) return 25; if (size <= 32 * 1024 * 1024) return 25;
if ((IS_ENABLED(CONFIG_CC_IS_GCC) || CONFIG_CLANG_VERSION >= 110000) if (!IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES) && size_is_constant)
&& !IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES) && size_is_constant)
BUILD_BUG_ON_MSG(1, "unexpected size in kmalloc_index()"); BUILD_BUG_ON_MSG(1, "unexpected size in kmalloc_index()");
else else
BUG(); BUG();
......
...@@ -1051,7 +1051,7 @@ typedef struct mixer_vol_table { ...@@ -1051,7 +1051,7 @@ typedef struct mixer_vol_table {
* the GPL version of OSS-4.x and build against that version * the GPL version of OSS-4.x and build against that version
* of the header. * of the header.
* *
* We redefine the extern keyword so that make headers_check * We redefine the extern keyword so that usr/include/headers_check.pl
* does not complain about SEQ_USE_EXTBUF. * does not complain about SEQ_USE_EXTBUF.
*/ */
#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() #define SEQ_DECLAREBUF() SEQ_USE_EXTBUF()
......
...@@ -1414,7 +1414,6 @@ config LD_DEAD_CODE_DATA_ELIMINATION ...@@ -1414,7 +1414,6 @@ config LD_DEAD_CODE_DATA_ELIMINATION
config LD_ORPHAN_WARN config LD_ORPHAN_WARN
def_bool y def_bool y
depends on ARCH_WANT_LD_ORPHAN_WARN depends on ARCH_WANT_LD_ORPHAN_WARN
depends on !LD_IS_LLD || LLD_VERSION >= 110000
depends on $(ld-option,--orphan-handling=warn) depends on $(ld-option,--orphan-handling=warn)
config SYSCTL config SYSCTL
......
...@@ -31,7 +31,7 @@ quiet_cmd_compile.h = CHK $@ ...@@ -31,7 +31,7 @@ quiet_cmd_compile.h = CHK $@
cmd_compile.h = \ cmd_compile.h = \
$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ $(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT_BUILD)" \ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT_BUILD)" \
"$(CONFIG_PREEMPT_RT)" $(CONFIG_CC_VERSION_TEXT) "$(LD)" "$(CONFIG_PREEMPT_RT)" "$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
include/generated/compile.h: FORCE include/generated/compile.h: FORCE
$(call cmd,compile.h) $(call cmd,compile.h)
...@@ -4,7 +4,6 @@ menu "GCOV-based kernel profiling" ...@@ -4,7 +4,6 @@ menu "GCOV-based kernel profiling"
config GCOV_KERNEL config GCOV_KERNEL
bool "Enable gcov-based kernel profiling" bool "Enable gcov-based kernel profiling"
depends on DEBUG_FS depends on DEBUG_FS
depends on !CC_IS_CLANG || CLANG_VERSION >= 110000
depends on !ARCH_WANTS_NO_INSTR || CC_HAS_NO_PROFILE_FN_ATTR depends on !ARCH_WANTS_NO_INSTR || CC_HAS_NO_PROFILE_FN_ATTR
select CONSTRUCTORS select CONSTRUCTORS
default n default n
......
...@@ -33,8 +33,8 @@ $(obj)/shipped-certs.c: $(wildcard $(srctree)/$(src)/certs/*.hex) ...@@ -33,8 +33,8 @@ $(obj)/shipped-certs.c: $(wildcard $(srctree)/$(src)/certs/*.hex)
echo 'unsigned int shipped_regdb_certs_len = sizeof(shipped_regdb_certs);'; \ echo 'unsigned int shipped_regdb_certs_len = sizeof(shipped_regdb_certs);'; \
) > $@ ) > $@
$(obj)/extra-certs.c: $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%) \ $(obj)/extra-certs.c: $(CONFIG_CFG80211_EXTRA_REGDB_KEYDI) \
$(wildcard $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%)/*.x509) $(wildcard $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR)/*.x509)
@$(kecho) " GEN $@" @$(kecho) " GEN $@"
$(Q)(set -e; \ $(Q)(set -e; \
allf=""; \ allf=""; \
......
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
/asn1_compiler /asn1_compiler
/bin2c /bin2c
/extract-cert
/insert-sys-cert /insert-sys-cert
/kallsyms /kallsyms
/module.lds /module.lds
......
...@@ -195,53 +195,6 @@ why = \ ...@@ -195,53 +195,6 @@ why = \
echo-why = $(call escsq, $(strip $(why))) echo-why = $(call escsq, $(strip $(why)))
endif endif
###############################################################################
#
# When a Kconfig string contains a filename, it is suitable for
# passing to shell commands. It is surrounded by double-quotes, and
# any double-quotes or backslashes within it are escaped by
# backslashes.
#
# This is no use for dependencies or $(wildcard). We need to strip the
# surrounding quotes and the escaping from quotes and backslashes, and
# we *do* need to escape any spaces in the string. So, for example:
#
# Usage: $(eval $(call config_filename,FOO))
#
# Defines FOO_FILENAME based on the contents of the CONFIG_FOO option,
# transformed as described above to be suitable for use within the
# makefile.
#
# Also, if the filename is a relative filename and exists in the source
# tree but not the build tree, define FOO_SRCPREFIX as $(srctree)/ to
# be prefixed to *both* command invocation and dependencies.
#
# Note: We also print the filenames in the quiet_cmd_foo text, and
# perhaps ought to have a version specially escaped for that purpose.
# But it's only cosmetic, and $(patsubst "%",%,$(CONFIG_FOO)) is good
# enough. It'll strip the quotes in the common case where there's no
# space and it's a simple filename, and it'll retain the quotes when
# there's a space. There are some esoteric cases in which it'll print
# the wrong thing, but we don't really care. The actual dependencies
# and commands *do* get it right, with various combinations of single
# and double quotes, backslashes and spaces in the filenames.
#
###############################################################################
#
define config_filename
ifneq ($$(CONFIG_$(1)),"")
$(1)_FILENAME := $$(subst \\,\,$$(subst \$$(quote),$$(quote),$$(subst $$(space_escape),\$$(space),$$(patsubst "%",%,$$(subst $$(space),$$(space_escape),$$(CONFIG_$(1)))))))
ifneq ($$(patsubst /%,%,$$(firstword $$($(1)_FILENAME))),$$(firstword $$($(1)_FILENAME)))
else
ifeq ($$(wildcard $$($(1)_FILENAME)),)
ifneq ($$(wildcard $$(srctree)/$$($(1)_FILENAME)),)
$(1)_SRCPREFIX := $(srctree)/
endif
endif
endif
endif
endef
#
############################################################################### ###############################################################################
# delete partially updated (i.e. corrupted) files on error # delete partially updated (i.e. corrupted) files on error
......
...@@ -3,26 +3,19 @@ ...@@ -3,26 +3,19 @@
# 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.
CRYPTO_LIBS = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
CRYPTO_CFLAGS = $(shell pkg-config --cflags libcrypto 2> /dev/null)
hostprogs-always-$(CONFIG_BUILD_BIN2C) += bin2c 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_TRUSTED_KEYRING) += extract-cert
hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
hostprogs-always-$(CONFIG_SYSTEM_REVOCATION_LIST) += extract-cert
HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
HOSTLDLIBS_sorttable = -lpthread HOSTLDLIBS_sorttable = -lpthread
HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
HOSTCFLAGS_sign-file.o = $(CRYPTO_CFLAGS) HOSTCFLAGS_sign-file.o = $(shell pkg-config --cflags libcrypto 2> /dev/null)
HOSTLDLIBS_sign-file = $(CRYPTO_LIBS) HOSTLDLIBS_sign-file = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
HOSTCFLAGS_extract-cert.o = $(CRYPTO_CFLAGS)
HOSTLDLIBS_extract-cert = $(CRYPTO_LIBS)
ifdef CONFIG_UNWINDER_ORC ifdef CONFIG_UNWINDER_ORC
ifeq ($(ARCH),x86_64) ifeq ($(ARCH),x86_64)
......
...@@ -399,20 +399,35 @@ printf "%08x\n" $$dec_size | \ ...@@ -399,20 +399,35 @@ printf "%08x\n" $$dec_size | \
} \ } \
) )
quiet_cmd_file_size = GEN $@
cmd_file_size = $(size_append) > $@
quiet_cmd_bzip2 = BZIP2 $@ quiet_cmd_bzip2 = BZIP2 $@
cmd_bzip2 = { cat $(real-prereqs) | $(KBZIP2) -9; $(size_append); } > $@ cmd_bzip2 = cat $(real-prereqs) | $(KBZIP2) -9 > $@
quiet_cmd_bzip2_with_size = BZIP2 $@
cmd_bzip2_with_size = { cat $(real-prereqs) | $(KBZIP2) -9; $(size_append); } > $@
# Lzma # Lzma
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
quiet_cmd_lzma = LZMA $@ quiet_cmd_lzma = LZMA $@
cmd_lzma = { cat $(real-prereqs) | $(LZMA) -9; $(size_append); } > $@ cmd_lzma = cat $(real-prereqs) | $(LZMA) -9 > $@
quiet_cmd_lzma_with_size = LZMA $@
cmd_lzma_with_size = { cat $(real-prereqs) | $(LZMA) -9; $(size_append); } > $@
quiet_cmd_lzo = LZO $@ quiet_cmd_lzo = LZO $@
cmd_lzo = { cat $(real-prereqs) | $(KLZOP) -9; $(size_append); } > $@ cmd_lzo = cat $(real-prereqs) | $(KLZOP) -9 > $@
quiet_cmd_lzo_with_size = LZO $@
cmd_lzo_with_size = { cat $(real-prereqs) | $(KLZOP) -9; $(size_append); } > $@
quiet_cmd_lz4 = LZ4 $@ quiet_cmd_lz4 = LZ4 $@
cmd_lz4 = { cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout; \ cmd_lz4 = cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout > $@
quiet_cmd_lz4_with_size = LZ4 $@
cmd_lz4_with_size = { cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout; \
$(size_append); } > $@ $(size_append); } > $@
# U-Boot mkimage # U-Boot mkimage
...@@ -455,7 +470,10 @@ quiet_cmd_uimage = UIMAGE $@ ...@@ -455,7 +470,10 @@ quiet_cmd_uimage = UIMAGE $@
# big dictionary would increase the memory usage too much in the multi-call # big dictionary would increase the memory usage too much in the multi-call
# decompression mode. A BCJ filter isn't used either. # decompression mode. A BCJ filter isn't used either.
quiet_cmd_xzkern = XZKERN $@ quiet_cmd_xzkern = XZKERN $@
cmd_xzkern = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh; \ cmd_xzkern = cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh > $@
quiet_cmd_xzkern_with_size = XZKERN $@
cmd_xzkern_with_size = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh; \
$(size_append); } > $@ $(size_append); } > $@
quiet_cmd_xzmisc = XZMISC $@ quiet_cmd_xzmisc = XZMISC $@
...@@ -478,10 +496,13 @@ quiet_cmd_xzmisc = XZMISC $@ ...@@ -478,10 +496,13 @@ quiet_cmd_xzmisc = XZMISC $@
# be used because it would require zstd to allocate a 128 MB buffer. # be used because it would require zstd to allocate a 128 MB buffer.
quiet_cmd_zstd = ZSTD $@ quiet_cmd_zstd = ZSTD $@
cmd_zstd = { cat $(real-prereqs) | $(ZSTD) -19; $(size_append); } > $@ cmd_zstd = cat $(real-prereqs) | $(ZSTD) -19 > $@
quiet_cmd_zstd22 = ZSTD22 $@ quiet_cmd_zstd22 = ZSTD22 $@
cmd_zstd22 = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@ cmd_zstd22 = cat $(real-prereqs) | $(ZSTD) -22 --ultra > $@
quiet_cmd_zstd22_with_size = ZSTD22 $@
cmd_zstd22_with_size = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@
# ASM offsets # ASM offsets
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
......
...@@ -66,9 +66,9 @@ endif ...@@ -66,9 +66,9 @@ endif
# Don't stop modules_install even if we can't sign external modules. # Don't stop modules_install even if we can't sign external modules.
# #
ifeq ($(CONFIG_MODULE_SIG_ALL),y) ifeq ($(CONFIG_MODULE_SIG_ALL),y)
sig-key := $(if $(wildcard $(CONFIG_MODULE_SIG_KEY)),,$(srctree)/)$(CONFIG_MODULE_SIG_KEY)
quiet_cmd_sign = SIGN $@ quiet_cmd_sign = SIGN $@
$(eval $(call config_filename,MODULE_SIG_KEY)) cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(sig-key) certs/signing_key.x509 $@ \
cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509 $@ \
$(if $(KBUILD_EXTMOD),|| true) $(if $(KBUILD_EXTMOD),|| true)
else else
quiet_cmd_sign := quiet_cmd_sign :=
......
...@@ -16,20 +16,15 @@ case "$KBUILD_VERBOSE" in ...@@ -16,20 +16,15 @@ case "$KBUILD_VERBOSE" in
;; ;;
esac esac
# We need access to CONFIG_ symbols
. include/config/auto.conf
needed_symbols= needed_symbols=
# Special case for modversions (see modpost.c) # Special case for modversions (see modpost.c)
if [ -n "$CONFIG_MODVERSIONS" ]; then if grep -q "^CONFIG_MODVERSIONS=y$" include/config/auto.conf; then
needed_symbols="$needed_symbols module_layout" needed_symbols="$needed_symbols module_layout"
fi fi
ksym_wl= ksym_wl=$(sed -n 's/^CONFIG_UNUSED_KSYMS_WHITELIST=\(.*\)$/\1/p' include/config/auto.conf)
if [ -n "$CONFIG_UNUSED_KSYMS_WHITELIST" ]; then if [ -n "$ksym_wl" ]; then
# Use 'eval' to expand the whitelist path and check if it is relative
eval ksym_wl="$CONFIG_UNUSED_KSYMS_WHITELIST"
[ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl" [ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl"
if [ ! -f "$ksym_wl" ] || [ ! -r "$ksym_wl" ]; then if [ ! -f "$ksym_wl" ] || [ ! -r "$ksym_wl" ]; then
echo "ERROR: '$ksym_wl' whitelist file not found" >&2 echo "ERROR: '$ksym_wl' whitelist file not found" >&2
......
...@@ -69,7 +69,7 @@ localyesconfig localmodconfig: $(obj)/conf ...@@ -69,7 +69,7 @@ localyesconfig localmodconfig: $(obj)/conf
# deprecated for external use # deprecated for external use
simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
alldefconfig randconfig listnewconfig olddefconfig syncconfig \ alldefconfig randconfig listnewconfig olddefconfig syncconfig \
helpnewconfig yes2modconfig mod2yesconfig helpnewconfig yes2modconfig mod2yesconfig mod2noconfig
PHONY += $(simple-targets) PHONY += $(simple-targets)
...@@ -134,6 +134,7 @@ help: ...@@ -134,6 +134,7 @@ help:
@echo ' randconfig - New config with random answer to all options' @echo ' randconfig - New config with random answer to all options'
@echo ' yes2modconfig - Change answers from yes to mod if possible' @echo ' yes2modconfig - Change answers from yes to mod if possible'
@echo ' mod2yesconfig - Change answers from mod to yes if possible' @echo ' mod2yesconfig - Change answers from mod to yes if possible'
@echo ' mod2noconfig - Change answers from mod to no if possible'
@echo ' listnewconfig - List new options' @echo ' listnewconfig - List new options'
@echo ' helpnewconfig - List new options and help text' @echo ' helpnewconfig - List new options and help text'
@echo ' olddefconfig - Same as oldconfig but sets new symbols to their' @echo ' olddefconfig - Same as oldconfig but sets new symbols to their'
......
...@@ -35,6 +35,7 @@ enum input_mode { ...@@ -35,6 +35,7 @@ enum input_mode {
olddefconfig, olddefconfig,
yes2modconfig, yes2modconfig,
mod2yesconfig, mod2yesconfig,
mod2noconfig,
}; };
static enum input_mode input_mode = oldaskconfig; static enum input_mode input_mode = oldaskconfig;
static int input_mode_opt; static int input_mode_opt;
...@@ -163,8 +164,6 @@ enum conf_def_mode { ...@@ -163,8 +164,6 @@ enum conf_def_mode {
def_default, def_default,
def_yes, def_yes,
def_mod, def_mod,
def_y2m,
def_m2y,
def_no, def_no,
def_random def_random
}; };
...@@ -302,12 +301,10 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) ...@@ -302,12 +301,10 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode)
return has_changed; return has_changed;
} }
static void conf_rewrite_mod_or_yes(enum conf_def_mode mode) static void conf_rewrite_tristates(tristate old_val, tristate new_val)
{ {
struct symbol *sym; struct symbol *sym;
int i; int i;
tristate old_val = (mode == def_y2m) ? yes : mod;
tristate new_val = (mode == def_y2m) ? mod : yes;
for_all_symbols(i, sym) { for_all_symbols(i, sym) {
if (sym_get_type(sym) == S_TRISTATE && if (sym_get_type(sym) == S_TRISTATE &&
...@@ -685,6 +682,7 @@ static const struct option long_opts[] = { ...@@ -685,6 +682,7 @@ static const struct option long_opts[] = {
{"olddefconfig", no_argument, &input_mode_opt, olddefconfig}, {"olddefconfig", no_argument, &input_mode_opt, olddefconfig},
{"yes2modconfig", no_argument, &input_mode_opt, yes2modconfig}, {"yes2modconfig", no_argument, &input_mode_opt, yes2modconfig},
{"mod2yesconfig", no_argument, &input_mode_opt, mod2yesconfig}, {"mod2yesconfig", no_argument, &input_mode_opt, mod2yesconfig},
{"mod2noconfig", no_argument, &input_mode_opt, mod2noconfig},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
...@@ -713,6 +711,7 @@ static void conf_usage(const char *progname) ...@@ -713,6 +711,7 @@ static void conf_usage(const char *progname)
printf(" --randconfig New config with random answer to all options\n"); printf(" --randconfig New config with random answer to all options\n");
printf(" --yes2modconfig Change answers from yes to mod if possible\n"); printf(" --yes2modconfig Change answers from yes to mod if possible\n");
printf(" --mod2yesconfig Change answers from mod to yes if possible\n"); printf(" --mod2yesconfig Change answers from mod to yes if possible\n");
printf(" --mod2noconfig Change answers from mod to no if possible\n");
printf(" (If none of the above is given, --oldaskconfig is the default)\n"); printf(" (If none of the above is given, --oldaskconfig is the default)\n");
} }
...@@ -788,6 +787,7 @@ int main(int ac, char **av) ...@@ -788,6 +787,7 @@ int main(int ac, char **av)
case olddefconfig: case olddefconfig:
case yes2modconfig: case yes2modconfig:
case mod2yesconfig: case mod2yesconfig:
case mod2noconfig:
conf_read(NULL); conf_read(NULL);
break; break;
case allnoconfig: case allnoconfig:
...@@ -862,10 +862,13 @@ int main(int ac, char **av) ...@@ -862,10 +862,13 @@ int main(int ac, char **av)
case savedefconfig: case savedefconfig:
break; break;
case yes2modconfig: case yes2modconfig:
conf_rewrite_mod_or_yes(def_y2m); conf_rewrite_tristates(yes, mod);
break; break;
case mod2yesconfig: case mod2yesconfig:
conf_rewrite_mod_or_yes(def_m2y); conf_rewrite_tristates(mod, yes);
break;
case mod2noconfig:
conf_rewrite_tristates(mod, no);
break; break;
case oldaskconfig: case oldaskconfig:
rootEntry = &rootmenu; rootEntry = &rootmenu;
......
...@@ -244,19 +244,21 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) ...@@ -244,19 +244,21 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
p, sym->name); p, sym->name);
return 1; return 1;
case S_STRING: case S_STRING:
if (*p++ != '"') /* No escaping for S_DEF_AUTO (include/config/auto.conf) */
break; if (def != S_DEF_AUTO) {
for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) { if (*p++ != '"')
if (*p2 == '"') {
*p2 = 0;
break; break;
for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
if (*p2 == '"') {
*p2 = 0;
break;
}
memmove(p2, p2 + 1, strlen(p2));
} }
memmove(p2, p2 + 1, strlen(p2)); if (!p2) {
}
if (!p2) {
if (def != S_DEF_AUTO)
conf_warning("invalid string found"); conf_warning("invalid string found");
return 1; return 1;
}
} }
/* fall through */ /* fall through */
case S_INT: case S_INT:
...@@ -700,7 +702,7 @@ static void print_symbol_for_dotconfig(FILE *fp, struct symbol *sym) ...@@ -700,7 +702,7 @@ static void print_symbol_for_dotconfig(FILE *fp, struct symbol *sym)
static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym) static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym)
{ {
__print_symbol(fp, sym, OUTPUT_N_NONE, true); __print_symbol(fp, sym, OUTPUT_N_NONE, false);
} }
void print_symbol_for_listconfig(struct symbol *sym) void print_symbol_for_listconfig(struct symbol *sym)
......
...@@ -170,7 +170,7 @@ sub read_kconfig { ...@@ -170,7 +170,7 @@ sub read_kconfig {
$source =~ s/\$\($env\)/$ENV{$env}/; $source =~ s/\$\($env\)/$ENV{$env}/;
} }
open(my $kinfile, '<', $source) || die "Can't open $kconfig"; open(my $kinfile, '<', $source) || die "Can't open $source";
while (<$kinfile>) { while (<$kinfile>) {
chomp; chomp;
......
...@@ -34,6 +34,10 @@ LD="$1" ...@@ -34,6 +34,10 @@ LD="$1"
KBUILD_LDFLAGS="$2" KBUILD_LDFLAGS="$2"
LDFLAGS_vmlinux="$3" LDFLAGS_vmlinux="$3"
is_enabled() {
grep -q "^$1=y" include/config/auto.conf
}
# Nice output in kbuild format # Nice output in kbuild format
# Will be supressed by "make -s" # Will be supressed by "make -s"
info() info()
...@@ -80,11 +84,11 @@ modpost_link() ...@@ -80,11 +84,11 @@ modpost_link()
${KBUILD_VMLINUX_LIBS} \ ${KBUILD_VMLINUX_LIBS} \
--end-group" --end-group"
if [ -n "${CONFIG_LTO_CLANG}" ]; then if is_enabled CONFIG_LTO_CLANG; then
gen_initcalls gen_initcalls
lds="-T .tmp_initcalls.lds" lds="-T .tmp_initcalls.lds"
if [ -n "${CONFIG_MODVERSIONS}" ]; then if is_enabled CONFIG_MODVERSIONS; then
gen_symversions gen_symversions
lds="${lds} -T .tmp_symversions.lds" lds="${lds} -T .tmp_symversions.lds"
fi fi
...@@ -104,21 +108,21 @@ objtool_link() ...@@ -104,21 +108,21 @@ objtool_link()
local objtoolcmd; local objtoolcmd;
local objtoolopt; local objtoolopt;
if [ "${CONFIG_LTO_CLANG} ${CONFIG_STACK_VALIDATION}" = "y y" ]; then if is_enabled CONFIG_LTO_CLANG && is_enabled CONFIG_STACK_VALIDATION; then
# Don't perform vmlinux validation unless explicitly requested, # Don't perform vmlinux validation unless explicitly requested,
# but run objtool on vmlinux.o now that we have an object file. # but run objtool on vmlinux.o now that we have an object file.
if [ -n "${CONFIG_UNWINDER_ORC}" ]; then if is_enabled CONFIG_UNWINDER_ORC; then
objtoolcmd="orc generate" objtoolcmd="orc generate"
fi fi
objtoolopt="${objtoolopt} --duplicate" objtoolopt="${objtoolopt} --duplicate"
if [ -n "${CONFIG_FTRACE_MCOUNT_USE_OBJTOOL}" ]; then if is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL; then
objtoolopt="${objtoolopt} --mcount" objtoolopt="${objtoolopt} --mcount"
fi fi
fi fi
if [ -n "${CONFIG_VMLINUX_VALIDATION}" ]; then if is_enabled CONFIG_VMLINUX_VALIDATION; then
objtoolopt="${objtoolopt} --noinstr" objtoolopt="${objtoolopt} --noinstr"
fi fi
...@@ -127,19 +131,19 @@ objtool_link() ...@@ -127,19 +131,19 @@ objtool_link()
objtoolcmd="check" objtoolcmd="check"
fi fi
objtoolopt="${objtoolopt} --vmlinux" objtoolopt="${objtoolopt} --vmlinux"
if [ -z "${CONFIG_FRAME_POINTER}" ]; then if ! is_enabled CONFIG_FRAME_POINTER; then
objtoolopt="${objtoolopt} --no-fp" objtoolopt="${objtoolopt} --no-fp"
fi fi
if [ -n "${CONFIG_GCOV_KERNEL}" ] || [ -n "${CONFIG_LTO_CLANG}" ]; then if is_enabled CONFIG_GCOV_KERNEL || is_enabled CONFIG_LTO_CLANG; then
objtoolopt="${objtoolopt} --no-unreachable" objtoolopt="${objtoolopt} --no-unreachable"
fi fi
if [ -n "${CONFIG_RETPOLINE}" ]; then if is_enabled CONFIG_RETPOLINE; then
objtoolopt="${objtoolopt} --retpoline" objtoolopt="${objtoolopt} --retpoline"
fi fi
if [ -n "${CONFIG_X86_SMAP}" ]; then if is_enabled CONFIG_X86_SMAP; then
objtoolopt="${objtoolopt} --uaccess" objtoolopt="${objtoolopt} --uaccess"
fi fi
if [ -n "${CONFIG_SLS}" ]; then if is_enabled CONFIG_SLS; then
objtoolopt="${objtoolopt} --sls" objtoolopt="${objtoolopt} --sls"
fi fi
info OBJTOOL ${1} info OBJTOOL ${1}
...@@ -164,7 +168,7 @@ vmlinux_link() ...@@ -164,7 +168,7 @@ vmlinux_link()
# skip output file argument # skip output file argument
shift shift
if [ -n "${CONFIG_LTO_CLANG}" ]; then if is_enabled CONFIG_LTO_CLANG; then
# Use vmlinux.o instead of performing the slow LTO link again. # Use vmlinux.o instead of performing the slow LTO link again.
objs=vmlinux.o objs=vmlinux.o
libs= libs=
...@@ -192,7 +196,7 @@ vmlinux_link() ...@@ -192,7 +196,7 @@ vmlinux_link()
ldflags="${ldflags} ${wl}--strip-debug" ldflags="${ldflags} ${wl}--strip-debug"
fi fi
if [ -n "${CONFIG_VMLINUX_MAP}" ]; then if is_enabled CONFIG_VMLINUX_MAP; then
ldflags="${ldflags} ${wl}-Map=${output}.map" ldflags="${ldflags} ${wl}-Map=${output}.map"
fi fi
...@@ -242,15 +246,15 @@ kallsyms() ...@@ -242,15 +246,15 @@ kallsyms()
{ {
local kallsymopt; local kallsymopt;
if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then if is_enabled CONFIG_KALLSYMS_ALL; then
kallsymopt="${kallsymopt} --all-symbols" kallsymopt="${kallsymopt} --all-symbols"
fi fi
if [ -n "${CONFIG_KALLSYMS_ABSOLUTE_PERCPU}" ]; then if is_enabled CONFIG_KALLSYMS_ABSOLUTE_PERCPU; then
kallsymopt="${kallsymopt} --absolute-percpu" kallsymopt="${kallsymopt} --absolute-percpu"
fi fi
if [ -n "${CONFIG_KALLSYMS_BASE_RELATIVE}" ]; then if is_enabled CONFIG_KALLSYMS_BASE_RELATIVE; then
kallsymopt="${kallsymopt} --base-relative" kallsymopt="${kallsymopt} --base-relative"
fi fi
...@@ -315,9 +319,6 @@ if [ "$1" = "clean" ]; then ...@@ -315,9 +319,6 @@ if [ "$1" = "clean" ]; then
exit 0 exit 0
fi fi
# We need access to CONFIG_ symbols
. include/config/auto.conf
# Update version # Update version
info GEN .version info GEN .version
if [ -r .version ]; then if [ -r .version ]; then
...@@ -346,7 +347,7 @@ tr '\0' '\n' < modules.builtin.modinfo | sed -n 's/^[[:alnum:]:_]*\.file=//p' | ...@@ -346,7 +347,7 @@ tr '\0' '\n' < modules.builtin.modinfo | sed -n 's/^[[:alnum:]:_]*\.file=//p' |
tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$/.ko/' > modules.builtin tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$/.ko/' > modules.builtin
btf_vmlinux_bin_o="" btf_vmlinux_bin_o=""
if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then if is_enabled CONFIG_DEBUG_INFO_BTF; then
btf_vmlinux_bin_o=.btf.vmlinux.bin.o btf_vmlinux_bin_o=.btf.vmlinux.bin.o
if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then
echo >&2 "Failed to generate BTF for vmlinux" echo >&2 "Failed to generate BTF for vmlinux"
...@@ -358,7 +359,7 @@ fi ...@@ -358,7 +359,7 @@ fi
kallsymso="" kallsymso=""
kallsymso_prev="" kallsymso_prev=""
kallsyms_vmlinux="" kallsyms_vmlinux=""
if [ -n "${CONFIG_KALLSYMS}" ]; then if is_enabled CONFIG_KALLSYMS; then
# kallsyms support # kallsyms support
# Generate section listing all symbols and add it into vmlinux # Generate section listing all symbols and add it into vmlinux
...@@ -398,7 +399,7 @@ fi ...@@ -398,7 +399,7 @@ fi
vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o} vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}
# fill in BTF IDs # fill in BTF IDs
if [ -n "${CONFIG_DEBUG_INFO_BTF}" -a -n "${CONFIG_BPF}" ]; then if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then
info BTFIDS vmlinux info BTFIDS vmlinux
${RESOLVE_BTFIDS} vmlinux ${RESOLVE_BTFIDS} vmlinux
fi fi
...@@ -406,7 +407,7 @@ fi ...@@ -406,7 +407,7 @@ fi
info SYSMAP System.map info SYSMAP System.map
mksysmap vmlinux System.map mksysmap vmlinux System.map
if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then
info SORTTAB vmlinux info SORTTAB vmlinux
if ! sorttable vmlinux; then if ! sorttable vmlinux; then
echo >&2 Failed to sort kernel tables echo >&2 Failed to sort kernel tables
...@@ -415,7 +416,7 @@ if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then ...@@ -415,7 +416,7 @@ if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then
fi fi
# step a (see comment above) # step a (see comment above)
if [ -n "${CONFIG_KALLSYMS}" ]; then if is_enabled CONFIG_KALLSYMS; then
mksysmap ${kallsyms_vmlinux} .tmp_System.map mksysmap ${kallsyms_vmlinux} .tmp_System.map
if ! cmp -s System.map .tmp_System.map; then if ! cmp -s System.map .tmp_System.map; then
......
...@@ -28,7 +28,7 @@ llvm) ...@@ -28,7 +28,7 @@ llvm)
if [ "$SRCARCH" = s390 ]; then if [ "$SRCARCH" = s390 ]; then
echo 13.0.0 echo 13.0.0
else else
echo 10.0.1 echo 11.0.0
fi fi
;; ;;
*) *)
......
...@@ -39,3 +39,5 @@ if [ -n "${building_out_of_srctree}" ]; then ...@@ -39,3 +39,5 @@ if [ -n "${building_out_of_srctree}" ]; then
rm -f arch/parisc/boot/compressed/${f} rm -f arch/parisc/boot/compressed/${f}
done done
fi fi
rm -f scripts/extract-cert
...@@ -111,9 +111,7 @@ if $scm_only; then ...@@ -111,9 +111,7 @@ if $scm_only; then
exit exit
fi fi
if test -e include/config/auto.conf; then if ! test -e include/config/auto.conf; then
. include/config/auto.conf
else
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
...@@ -125,10 +123,11 @@ if test ! "$srctree" -ef .; then ...@@ -125,10 +123,11 @@ if test ! "$srctree" -ef .; then
fi fi
# CONFIG_LOCALVERSION and LOCALVERSION (if set) # CONFIG_LOCALVERSION and LOCALVERSION (if set)
res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}" config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf)
res="${res}${config_localversion}${LOCALVERSION}"
# scm version string if not at a tagged commit # scm version string if not at a tagged commit
if test "$CONFIG_LOCALVERSION_AUTO" = "y"; 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)" res="$res$(scm_version)"
elif [ "${LOCALVERSION+set}" != "set" ]; then elif [ "${LOCALVERSION+set}" != "set" ]; then
......
...@@ -3,11 +3,6 @@ ...@@ -3,11 +3,6 @@
# kbuild file for usr/ - including initramfs image # kbuild file for usr/ - including initramfs image
# #
# cmd_bzip2, cmd_lzma, cmd_lzo, cmd_lz4 from scripts/Makefile.lib appends the
# size at the end of the compressed file, which unfortunately does not work
# with unpack_to_rootfs(). Make size_append no-op.
override size_append := :
compress-y := shipped compress-y := shipped
compress-$(CONFIG_INITRAMFS_COMPRESSION_GZIP) := gzip compress-$(CONFIG_INITRAMFS_COMPRESSION_GZIP) := gzip
compress-$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) := bzip2 compress-$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) := bzip2
...@@ -21,7 +16,7 @@ obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o ...@@ -21,7 +16,7 @@ obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
$(obj)/initramfs_data.o: $(obj)/initramfs_inc_data $(obj)/initramfs_data.o: $(obj)/initramfs_inc_data
ramfs-input := $(strip $(shell echo $(CONFIG_INITRAMFS_SOURCE))) ramfs-input := $(CONFIG_INITRAMFS_SOURCE)
cpio-data := cpio-data :=
# If CONFIG_INITRAMFS_SOURCE is empty, generate a small initramfs with the # If CONFIG_INITRAMFS_SOURCE is empty, generate a small initramfs with the
......
...@@ -99,10 +99,12 @@ quiet_cmd_hdrtest = HDRTEST $< ...@@ -99,10 +99,12 @@ quiet_cmd_hdrtest = HDRTEST $<
cmd_hdrtest = \ cmd_hdrtest = \
$(CC) $(c_flags) -S -o /dev/null -x c /dev/null \ $(CC) $(c_flags) -S -o /dev/null -x c /dev/null \
$(if $(filter-out $(no-header-test), $*.h), -include $< -include $<); \ $(if $(filter-out $(no-header-test), $*.h), -include $< -include $<); \
$(PERL) $(srctree)/scripts/headers_check.pl $(obj) $(SRCARCH) $<; \ $(PERL) $(srctree)/$(src)/headers_check.pl $(obj) $(SRCARCH) $<; \
touch $@ touch $@
$(obj)/%.hdrtest: $(obj)/%.h FORCE $(obj)/%.hdrtest: $(obj)/%.h FORCE
$(call if_changed_dep,hdrtest) $(call if_changed_dep,hdrtest)
clean-files += $(filter-out Makefile, $(notdir $(wildcard $(obj)/*))) # Since GNU Make 4.3, $(patsubst $(obj)/%/,%,$(wildcard $(obj)/*/)) works.
# To support older Make versions, use a somewhat tedious way.
clean-files += $(filter-out Makefile headers_check.pl, $(notdir $(wildcard $(obj)/*)))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment