From 1565054e3925885a5a727c59145485eb928b65c8 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Wed, 25 Nov 2015 02:59:45 -0800 Subject: [PATCH 1/4] kbuild: derive relative path for KBUILD_SRC from CURDIR This enables relocating source and build trees to different roots, provided they stay reachable relative to one another. Useful for builds done within a sandbox where the eventual root is prefixed by some undesirable path component. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 790e8faf0ddc65..780b8757cd8deb 100644 --- a/Makefile +++ b/Makefile @@ -143,7 +143,8 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make # Invoke a second make in the output directory, passing relevant variables sub-make: - $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \ + $(Q)$(MAKE) -C $(KBUILD_OUTPUT) \ + KBUILD_SRC=$(shell realpath --relative-to=$(KBUILD_OUTPUT) $(CURDIR)) \ -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS)) # Leave processing to above invocation of make From d1a996e00fc7b58bfffc3cfcd807c9dde2949634 Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Fri, 11 Nov 2016 17:28:52 -0800 Subject: [PATCH 2/4] Add arm64 coreos verity hash Signed-off-by: Geoff Levand --- arch/arm64/kernel/efi-header.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/kernel/efi-header.S b/arch/arm64/kernel/efi-header.S index 613fc3000677f7..fdaf86c783329c 100644 --- a/arch/arm64/kernel/efi-header.S +++ b/arch/arm64/kernel/efi-header.S @@ -103,6 +103,11 @@ section_table: .set section_count, (. - section_table) / 40 + /* CoreOS 64 byte verity hash value. */ + .org _head + 512 + .ascii "verity-hash" + .org _head + 512 + 64 + #ifdef CONFIG_DEBUG_EFI /* * The debug table is referenced via its Relative Virtual Address (RVA), From 178edc68fcd926a894972ea889b5265428fdc5ac Mon Sep 17 00:00:00 2001 From: David Michael Date: Thu, 8 Feb 2018 21:23:12 -0500 Subject: [PATCH 3/4] tools/objtool/Makefile: Don't fail on fallthrough with new GCCs --- tools/lib/subcmd/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile index 95563b8e1ad743..307652c42a7b6e 100644 --- a/tools/lib/subcmd/Makefile +++ b/tools/lib/subcmd/Makefile @@ -33,6 +33,9 @@ ifneq ($(WERROR),0) CFLAGS += -Werror endif +# Don't fail on fallthrough with newer GCCs. +CFLAGS += -Wno-error=implicit-fallthrough + CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CFLAGS += -I$(srctree)/tools/include/ From 61ceb2881ae20ce661b4cc28cf7369bfccae9086 Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" Date: Wed, 4 Jul 2018 18:08:57 +0300 Subject: [PATCH 4/4] 4.17.x won't boot due to "x86/boot/compressed/64: Handle 5-level paging boot if kernel is above 4G" On Tue, Jul 03, 2018 at 05:21:50PM +0300, Kirill A. Shutemov wrote: > On Tue, Jul 03, 2018 at 03:44:03PM +0300, Kirill A. Shutemov wrote: > > On Tue, Jul 03, 2018 at 01:24:49PM +0200, Gabriel C wrote: > > > 2018-07-01 23:32 GMT+02:00 Benjamin Gilbert : > > > > On Sun, Jul 01, 2018 at 05:15:59PM -0400, Benjamin Gilbert wrote: > > > >> 4.17 kernels built with the CoreOS Container Linux toolchain and kconfig, > > > >> up to and including 4.17.3, fail to boot on AMD64 running in (at least) > > > >> QEMU/KVM. No messages are shown post-GRUB; the VM instantly reboots. > > > >> Reverting commit 194a9749c73d ("x86/boot/compressed/64: Handle 5-level > > > >> paging boot if kernel is above 4G") fixes it. I've attached our kernel > > > >> config for reference, and am happy to test patches, provide sample QCOW > > > >> images, etc. > > > > > > > > > > Also see https://bugzilla.kernel.org/show_bug.cgi?id=200385 , > > > > > > 0a1756bd2897951c03c1cb671bdfd40729ac2177 is acting up > > > too with the same symptoms > > > > I tracked it down to -flto in LDFLAGS. I'll look more into this. > > -flto in LDFLAGS screws up this part of paging_prepare(): +Masahiro, Michal. I've got it wrong. *Any* LDFLAGS option passed to make this way: make LDFLAGS="..." would cause a issue. Even empty. It overrides all assignments to the variable in the makefile. As result the image is built without -pie and linker doesn't generate position independed code. Looks like the patch below helps, but my make-fu is poor. I don't see many override directives in kernel makefiles. It makes me think that there's a better way to fix this. Hm? --- arch/x86/boot/compressed/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index fa42f895fdde7a..4f24baa8cdebb5 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -42,16 +42,16 @@ KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ GCOV_PROFILE := n UBSAN_SANITIZE :=n -LDFLAGS := -m elf_$(UTS_MACHINE) +override LDFLAGS := -m elf_$(UTS_MACHINE) # Compressed kernel should be built as PIE since it may be loaded at any # address by the bootloader. ifeq ($(CONFIG_X86_32),y) -LDFLAGS += $(call ld-option, -pie) $(call ld-option, --no-dynamic-linker) +override LDFLAGS += $(call ld-option, -pie) $(call ld-option, --no-dynamic-linker) else # To build 64-bit compressed kernel as PIE, we disable relocation # overflow check to avoid relocation overflow error with a new linker # command-line option, -z noreloc-overflow. -LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \ +override LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \ && echo "-z noreloc-overflow -pie --no-dynamic-linker") endif LDFLAGS_vmlinux := -T