diff options
Diffstat (limited to 'meta/recipes-kernel/kexec')
12 files changed, 273 insertions, 1005 deletions
diff --git a/meta/recipes-kernel/kexec/kexec-tools.inc b/meta/recipes-kernel/kexec/kexec-tools.inc deleted file mode 100644 index c689bec1f9..0000000000 --- a/meta/recipes-kernel/kexec/kexec-tools.inc +++ /dev/null @@ -1,38 +0,0 @@ -SUMMARY = "Kexec fast reboot tools" -DESCRIPTION = "Kexec is a fast reboot feature that lets you reboot to a new Linux kernel" -AUTHOR = "Eric Biederman" -HOMEPAGE = "http://kernel.org/pub/linux/utils/kernel/kexec/" -SECTION = "kernel/userland" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://COPYING;md5=ea5bed2f60d357618ca161ad539f7c0a \ - file://kexec/kexec.c;beginline=1;endline=20;md5=af10f6ae4a8715965e648aa687ad3e09" -DEPENDS = "zlib xz" - -SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz \ - file://kdump \ - file://kdump.conf \ - file://kdump.service \ -" - -PR = "r1" - -inherit autotools - -COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|powerpc.*|mips.*)-(linux|freebsd.*)' - -INSANE_SKIP_${PN} = "arch" - -do_compile_prepend() { - # Remove the prepackaged config.h from the source tree as it overrides - # the same file generated by configure and placed in the build tree - rm -f ${S}/include/config.h - - # Remove the '*.d' file to make sure the recompile is OK - for dep in `find ${B} -type f -name '*.d'`; do - dep_no_d="`echo $dep | sed 's#.d$##'`" - # Remove file.d when there is a file.o - if [ -f "$dep_no_d.o" ]; then - rm -f $dep - fi - done -} diff --git a/meta/recipes-kernel/kexec/kexec-tools/0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch b/meta/recipes-kernel/kexec/kexec-tools/0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch new file mode 100644 index 0000000000..ddc1519126 --- /dev/null +++ b/meta/recipes-kernel/kexec/kexec-tools/0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch @@ -0,0 +1,70 @@ +From d48ec5e1a5fb7907520dee71b1d94045486a0c29 Mon Sep 17 00:00:00 2001 +From: Alexander Kamensky <alexander.kamensky42@gmail.com> +Date: Thu, 12 Nov 2020 12:56:46 -0800 +Subject: [PATCH] arm64: kexec: disabled check if kaslr-seed dtb property was + wiped + +Kexec when loading arm64 kernel checks if chosen/kaslr-seed dtb property is +wiped. It's a good assertion to verify proper behavior of kernel. However, +if bootloader creates and fills kaslr-seed property and kernel is not +configured with CONFIG_RANDOMIZE_BASE then logic of reading and wiping +kaslr-seed does not run. As a result kaslr-seed property is not zero and when +kexec tries to load secondary kernel it fails with the following message: + +setup_2nd_dtb: kaslr-seed is not wiped to 0. +kexec: setup_2nd_dtb failed. +kexec: load failed. + +This was observed on Yocto Project on qemuarm64 machine with 5.8 kernel, +qemu 5.1.0. Qemu created kaslr-seed property but kernel was not configured +with CONFIG_RANDOMIZE_BASE. + +Although check has some value, there is a use-case where it breaks kexec, +this patch removes it. + +Note in described use-case the fact that kaslr-seed is not wiped and user +readable through /sys/firmware/fdt or +/sys/firmware/devicetree/base/chosen/kaslr-seed is not a security problem +as kaslr is disabled anyway. + +Signed-off-by: Alexander Kamensky <alexander.kamensky42@gmail.com> +Upstream-Status: Submitted [http://lists.infradead.org/pipermail/kexec/2020-November/021740.html] +--- + kexec/arch/arm64/kexec-arm64.c | 14 +------------- + 1 file changed, 1 insertion(+), 13 deletions(-) + +diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c +index ec6df4b..10238d9 100644 +--- a/kexec/arch/arm64/kexec-arm64.c ++++ b/kexec/arch/arm64/kexec-arm64.c +@@ -503,7 +503,7 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash) + int len, range_len; + int nodeoffset; + int new_size; +- int i, result, kaslr_seed; ++ int i, result; + + result = fdt_check_header(dtb->buf); + +@@ -576,18 +576,6 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash) + return result; + } + } else { +- kaslr_seed = fdt64_to_cpu(*prop); +- +- /* kaslr_seed must be wiped clean by primary +- * kernel during boot +- */ +- if (kaslr_seed != 0) { +- dbgprintf("%s: kaslr-seed is not wiped to 0.\n", +- __func__); +- result = -EINVAL; +- goto on_error; +- } +- + /* + * Invoke the getrandom system call with + * GRND_NONBLOCK, to make sure we +-- +2.25.1 + diff --git a/meta/recipes-kernel/kexec/kexec-tools/0002-powerpc-change-the-memory-size-limit.patch b/meta/recipes-kernel/kexec/kexec-tools/0001-powerpc-change-the-memory-size-limit.patch index dc97d930e9..029650f35c 100644 --- a/meta/recipes-kernel/kexec/kexec-tools/0002-powerpc-change-the-memory-size-limit.patch +++ b/meta/recipes-kernel/kexec/kexec-tools/0001-powerpc-change-the-memory-size-limit.patch @@ -1,4 +1,4 @@ -From b19b68eab567aa534cf8dec79fe18e3dc0e14043 Mon Sep 17 00:00:00 2001 +From 211cae4b6a02a4d9d37bfcd76f3702696e095fc3 Mon Sep 17 00:00:00 2001 From: Quanyang Wang <quanyang.wang@windriver.com> Date: Tue, 16 Jun 2015 12:59:57 +0800 Subject: [PATCH] powerpc: change the memory size limit @@ -20,11 +20,11 @@ Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com> kexec/arch/ppc/kexec-ppc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -Index: kexec-tools-2.0.10/kexec/arch/ppc/kexec-ppc.h -=================================================================== ---- kexec-tools-2.0.10.orig/kexec/arch/ppc/kexec-ppc.h -+++ kexec-tools-2.0.10/kexec/arch/ppc/kexec-ppc.h -@@ -42,7 +42,7 @@ void dol_ppc_usage(void); +diff --git a/kexec/arch/ppc/kexec-ppc.h b/kexec/arch/ppc/kexec-ppc.h +index 04e728e..6bae9ec 100644 +--- a/kexec/arch/ppc/kexec-ppc.h ++++ b/kexec/arch/ppc/kexec-ppc.h +@@ -44,7 +44,7 @@ void dol_ppc_usage(void); * During inital setup the kernel does not map the whole memory but a part of * it. On Book-E that is 64MiB, 601 24MiB or 256MiB (if possible). */ diff --git a/meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-Pass-r-directly-to-linker.patch b/meta/recipes-kernel/kexec/kexec-tools/0002-purgatory-Pass-r-directly-to-linker.patch index bfd077daf0..a537ac2f0b 100644 --- a/meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-Pass-r-directly-to-linker.patch +++ b/meta/recipes-kernel/kexec/kexec-tools/0002-purgatory-Pass-r-directly-to-linker.patch @@ -1,4 +1,4 @@ -From a1135b3170963ba956f2364c1283864c35541295 Mon Sep 17 00:00:00 2001 +From e5bc9fbd6029057a4e3815a5326af5bd83a450e6 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Mon, 7 Sep 2015 07:59:45 +0000 Subject: [PATCH] purgatory: Pass -r directly to linker @@ -8,14 +8,15 @@ where as gcc knows how to deal with it and passes it down to linker unfiltered Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- + Upstream-Status: Pending +--- purgatory/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/purgatory/Makefile b/purgatory/Makefile -index 2b5c061..b251353 100644 +index 4d2d071..6673423 100644 --- a/purgatory/Makefile +++ b/purgatory/Makefile @@ -61,7 +61,7 @@ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ @@ -27,6 +28,3 @@ index 2b5c061..b251353 100644 -Wl,-Map=$(PURGATORY_MAP) $(PURGATORY): $(PURGATORY_OBJS) --- -2.5.1 - diff --git a/meta/recipes-kernel/kexec/kexec-tools/0010-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch b/meta/recipes-kernel/kexec/kexec-tools/0003-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch index 6c6c66d885..e874a8b4f1 100644 --- a/meta/recipes-kernel/kexec/kexec-tools/0010-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch +++ b/meta/recipes-kernel/kexec/kexec-tools/0003-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch @@ -1,4 +1,4 @@ -From 78e497fb69950665e639cfab8f4fb50cc404a1eb Mon Sep 17 00:00:00 2001 +From b62c1da8f8e641397add10367ee9c4cfdedb1cc0 Mon Sep 17 00:00:00 2001 From: Haiqing Bai <Haiqing.Bai@windriver.com> Date: Mon, 9 Jan 2017 15:26:29 +0800 Subject: [PATCH] kexec: ARM: Fix add_buffer_phys_virt() align issue @@ -12,15 +12,16 @@ Upstream-Status: Pending Suggested-By:fredrik.markstrom@gmail.com Signed-off-by: Haiqing Bai <Haiqing.Bai@windriver.com> + --- kexec/arch/arm/crashdump-arm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c -index 245c21a..12139c3 100644 +index 1ec1826..cc20f63 100644 --- a/kexec/arch/arm/crashdump-arm.c +++ b/kexec/arch/arm/crashdump-arm.c -@@ -240,6 +240,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) +@@ -242,6 +242,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) void *buf; int err; int last_ranges; @@ -28,7 +29,7 @@ index 245c21a..12139c3 100644 /* * First fetch all the memory (RAM) ranges that we are going to pass to -@@ -281,6 +282,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) +@@ -283,6 +284,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) /* for support LPAE enabled kernel*/ elf_info.class = ELFCLASS64; @@ -36,7 +37,7 @@ index 245c21a..12139c3 100644 err = crash_create_elf64_headers(info, &elf_info, usablemem_rgns.ranges, -@@ -302,8 +304,9 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) +@@ -304,8 +306,9 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) * 1MB) so that available memory passed in kernel command line will be * aligned to 1MB. This is because kernel create_mapping() wants memory * regions to be aligned to SECTION_SIZE. @@ -47,6 +48,3 @@ index 245c21a..12139c3 100644 crash_kernel_mem.start, crash_kernel_mem.end, -1, 0); --- -1.9.1 - diff --git a/meta/recipes-kernel/kexec/kexec-tools/0001-Disable-PIE-during-link.patch b/meta/recipes-kernel/kexec/kexec-tools/0005-Disable-PIE-during-link.patch index 3f2f85e337..6a21744ac1 100644 --- a/meta/recipes-kernel/kexec/kexec-tools/0001-Disable-PIE-during-link.patch +++ b/meta/recipes-kernel/kexec/kexec-tools/0005-Disable-PIE-during-link.patch @@ -1,4 +1,4 @@ -From ea7be6d71b85880e8e8a2c8a4f49a696c5f31ae4 Mon Sep 17 00:00:00 2001 +From 494888bcc3bbf070dfce1b2686ee34c8619aa33d Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Sat, 10 Jun 2017 11:18:49 -0700 Subject: [PATCH] Disable PIE during link @@ -9,15 +9,16 @@ just need to match it with linker flags Upstream-Status: Pending Signed-off-by: Khem Raj <raj.khem@gmail.com> + --- purgatory/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/purgatory/Makefile b/purgatory/Makefile -index 564bdb7..a08e41f 100644 +index 6673423..a7405ea 100644 --- a/purgatory/Makefile +++ b/purgatory/Makefile -@@ -59,7 +59,7 @@ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ +@@ -60,7 +60,7 @@ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ -Iinclude \ -I$(shell $(CC) -print-file-name=include) $(PURGATORY): LDFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS)\ @@ -26,6 +27,3 @@ index 564bdb7..a08e41f 100644 -nodefaultlibs -e purgatory_start -Wl,-r \ -Wl,-Map=$(PURGATORY_MAP) --- -2.13.1 - diff --git a/meta/recipes-kernel/kexec/kexec-tools/Fix-building-on-x86_64-with-binutils-2.41.patch b/meta/recipes-kernel/kexec/kexec-tools/Fix-building-on-x86_64-with-binutils-2.41.patch new file mode 100644 index 0000000000..4894f044fc --- /dev/null +++ b/meta/recipes-kernel/kexec/kexec-tools/Fix-building-on-x86_64-with-binutils-2.41.patch @@ -0,0 +1,95 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michel Lind <salimma@fedoraproject.org> +Date: Tue, 30 Jan 2024 04:14:31 -0600 +Subject: [PATCH] Fix building on x86_64 with binutils 2.41 + +Newer versions of the GNU assembler (observed with binutils 2.41) will +complain about the ".arch i386" in files assembled with "as --64", +with the message "Error: 64bit mode not supported on 'i386'". + +Fix by moving ".arch i386" below the relevant ".code32" directive, so +that the assembler is no longer expecting 64-bit instructions to be used +by the time that the ".arch i386" directive is encountered. + +Based on similar iPXE fix: +https://github.com/ipxe/ipxe/commit/6ca597eee + +Signed-off-by: Michel Lind <michel@michel-slm.name> +Signed-off-by: Simon Horman <horms@kernel.org> + +Upstream-Status: Backport [https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?h=main&id=328de8e00e298f00d7ba6b25dc3950147e9642e6] +Signed-off-by: Yoann Congal <yoann.congal@smile.fr> +--- + purgatory/arch/i386/entry32-16-debug.S | 2 +- + purgatory/arch/i386/entry32-16.S | 2 +- + purgatory/arch/i386/entry32.S | 2 +- + purgatory/arch/i386/setup-x86.S | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/purgatory/arch/i386/entry32-16-debug.S b/purgatory/arch/i386/entry32-16-debug.S +index 5167944..12e1164 100644 +--- a/purgatory/arch/i386/entry32-16-debug.S ++++ b/purgatory/arch/i386/entry32-16-debug.S +@@ -25,10 +25,10 @@ + .globl entry16_debug_pre32 + .globl entry16_debug_first32 + .globl entry16_debug_old_first32 +- .arch i386 + .balign 16 + entry16_debug: + .code32 ++ .arch i386 + /* Compute where I am running at (assumes esp valid) */ + call 1f + 1: popl %ebx +diff --git a/purgatory/arch/i386/entry32-16.S b/purgatory/arch/i386/entry32-16.S +index c051aab..eace095 100644 +--- a/purgatory/arch/i386/entry32-16.S ++++ b/purgatory/arch/i386/entry32-16.S +@@ -20,10 +20,10 @@ + #undef i386 + .text + .globl entry16, entry16_regs +- .arch i386 + .balign 16 + entry16: + .code32 ++ .arch i386 + /* Compute where I am running at (assumes esp valid) */ + call 1f + 1: popl %ebx +diff --git a/purgatory/arch/i386/entry32.S b/purgatory/arch/i386/entry32.S +index f7a494f..8ce9e31 100644 +--- a/purgatory/arch/i386/entry32.S ++++ b/purgatory/arch/i386/entry32.S +@@ -20,10 +20,10 @@ + #undef i386 + + .text +- .arch i386 + .globl entry32, entry32_regs + entry32: + .code32 ++ .arch i386 + + /* Setup a gdt that should that is generally usefully */ + lgdt %cs:gdt +diff --git a/purgatory/arch/i386/setup-x86.S b/purgatory/arch/i386/setup-x86.S +index 201bb2c..a212eed 100644 +--- a/purgatory/arch/i386/setup-x86.S ++++ b/purgatory/arch/i386/setup-x86.S +@@ -21,10 +21,10 @@ + #undef i386 + + .text +- .arch i386 + .globl purgatory_start + purgatory_start: + .code32 ++ .arch i386 + + /* Load a gdt so I know what the segment registers are */ + lgdt %cs:gdt +-- +2.39.2 + diff --git a/meta/recipes-kernel/kexec/kexec-tools/kdump.service b/meta/recipes-kernel/kexec/kexec-tools/kdump.service index 4e65a46ac4..b4a2c0611d 100644 --- a/meta/recipes-kernel/kexec/kexec-tools/kdump.service +++ b/meta/recipes-kernel/kexec/kexec-tools/kdump.service @@ -1,6 +1,8 @@ [Unit] Description=Reboot and dump vmcore via kexec DefaultDependencies=no +Requires=sysinit.target +After=sysinit.target [Service] Type=oneshot diff --git a/meta/recipes-kernel/kexec/kexec-tools/kexec-aarch64.patch b/meta/recipes-kernel/kexec/kexec-tools/kexec-aarch64.patch deleted file mode 100644 index b03f582576..0000000000 --- a/meta/recipes-kernel/kexec/kexec-tools/kexec-aarch64.patch +++ /dev/null @@ -1,801 +0,0 @@ -From: Geoff Levand <geoff@infradead.org> -Date: Mon, 15 Jul 2013 23:32:36 +0000 (-0700) -Subject: Add arm64 support -X-Git-Url: https://git.linaro.org/gitweb?p=people%2Fgeoff%2Fkexec-tools.git;a=commitdiff_plain;h=fbf5ac6c2c70ec0f6da2b9ff563e573999752c01 - -Add arm64 support - -Signed-off-by: Geoff Levand <geoff@infradead.org> - -Get patch from: -https://fedorapeople.org/~hrw/aarch64/for-fedora/kexec-aarch64.patch - -Upstream-Status: Pending - -Signed-off-by: Kai Kang <kai.kang@windriver.com> ---- - ---- - configure.ac | 3 - kexec/Makefile | 1 - kexec/arch/arm64/Makefile | 13 + - kexec/arch/arm64/crashdump-arm64.c | 305 ++++++++++++++++++++++++++++++++ - kexec/arch/arm64/include/arch/options.h | 26 ++ - kexec/arch/arm64/kexec-arm64.c | 177 ++++++++++++++++++ - kexec/arch/arm64/kexec-arm64.h | 20 ++ - kexec/arch/arm64/kexec-elf-arm64.c | 114 +++++++++++ - kexec/kexec-syscall.h | 9 - kexec/kexec.c | 2 - purgatory/arch/arm64/Makefile | 7 - 11 files changed, 675 insertions(+), 2 deletions(-) - -Index: kexec-tools-2.0.10/configure.ac -=================================================================== ---- kexec-tools-2.0.10.orig/configure.ac -+++ kexec-tools-2.0.10/configure.ac -@@ -36,6 +36,9 @@ case $target_cpu in - ARCH="ppc64" - SUBARCH="LE" - ;; -+ aarch64* ) -+ ARCH="arm64" -+ ;; - arm* ) - ARCH="arm" - ;; -Index: kexec-tools-2.0.10/kexec/Makefile -=================================================================== ---- kexec-tools-2.0.10.orig/kexec/Makefile -+++ kexec-tools-2.0.10/kexec/Makefile -@@ -71,6 +71,7 @@ KEXEC_SRCS += $($(ARCH)_FS2DT) - - include $(srcdir)/kexec/arch/alpha/Makefile - include $(srcdir)/kexec/arch/arm/Makefile -+include $(srcdir)/kexec/arch/arm64/Makefile - include $(srcdir)/kexec/arch/i386/Makefile - include $(srcdir)/kexec/arch/ia64/Makefile - include $(srcdir)/kexec/arch/m68k/Makefile -Index: kexec-tools-2.0.10/kexec/arch/arm64/Makefile -=================================================================== ---- /dev/null -+++ kexec-tools-2.0.10/kexec/arch/arm64/Makefile -@@ -0,0 +1,13 @@ -+ -+arm64_KEXEC_SRCS += \ -+ kexec/arch/arm64/kexec-arm64.c \ -+ kexec/arch/arm64/kexec-elf-arm64.c \ -+ kexec/arch/arm64/crashdump-arm64.c -+ -+arm64_ARCH_REUSE_INITRD = -+arm64_ADD_SEGMENT = -+arm64_VIRT_TO_PHYS = -+ -+dist += $(arm64_KEXEC_SRCS) \ -+ kexec/arch/arm64/Makefile \ -+ kexec/arch/arm64/kexec-arm64.h -Index: kexec-tools-2.0.10/kexec/arch/arm64/crashdump-arm64.c -=================================================================== ---- /dev/null -+++ kexec-tools-2.0.10/kexec/arch/arm64/crashdump-arm64.c -@@ -0,0 +1,305 @@ -+/* -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation (version 2 of the License). -+ */ -+ -+#include "../../kexec.h" -+#include "../../kexec-elf.h" -+#include "../../crashdump.h" -+ -+int is_crashkernel_mem_reserved(void) -+{ -+ return 0; -+} -+ -+#if 0 -+/* -+ * Used to save various memory ranges/regions needed for the captured -+ * kernel to boot. (lime memmap= option in other archs) -+ */ -+static struct memory_range crash_memory_ranges[CRASH_MAX_MEMORY_RANGES]; -+struct memory_ranges usablemem_rgns = { -+ .size = 0, -+ .ranges = crash_memory_ranges, -+}; -+ -+/* memory range reserved for crashkernel */ -+static struct memory_range crash_reserved_mem; -+ -+static struct crash_elf_info elf_info = { -+ .class = ELFCLASS32, -+ .data = ELFDATA2LSB, -+ .machine = EM_ARM, -+ .page_offset = PAGE_OFFSET, -+}; -+ -+unsigned long phys_offset; -+ -+/** -+ * crash_range_callback() - callback called for each iomem region -+ * @data: not used -+ * @nr: not used -+ * @str: name of the memory region -+ * @base: start address of the memory region -+ * @length: size of the memory region -+ * -+ * This function is called once for each memory region found in /proc/iomem. It -+ * locates system RAM and crashkernel reserved memory and places these to -+ * variables: @crash_memory_ranges and @crash_reserved_mem. Number of memory -+ * regions is placed in @crash_memory_nr_ranges. -+ */ -+static int crash_range_callback(void *UNUSED(data), int UNUSED(nr), -+ char *str, unsigned long base, -+ unsigned long length) -+{ -+ struct memory_range *range; -+ -+ if (usablemem_rgns.size >= CRASH_MAX_MEMORY_RANGES) -+ return 1; -+ -+ range = usablemem_rgns.ranges + usablemem_rgns.size; -+ -+ if (strncmp(str, "System RAM\n", 11) == 0) { -+ range->start = base; -+ range->end = base + length - 1; -+ range->type = RANGE_RAM; -+ usablemem_rgns.size++; -+ } else if (strncmp(str, "Crash kernel\n", 13) == 0) { -+ crash_reserved_mem.start = base; -+ crash_reserved_mem.end = base + length - 1; -+ crash_reserved_mem.type = RANGE_RAM; -+ } -+ -+ return 0; -+} -+ -+/** -+ * crash_exclude_range() - excludes memory region reserved for crashkernel -+ * -+ * Function locates where crashkernel reserved memory is and removes that region -+ * from the available memory regions. -+ */ -+static void crash_exclude_range(void) -+{ -+ const struct memory_range *range = &crash_reserved_mem; -+ int i; -+ -+ for (i = 0; i < usablemem_rgns.size; i++) { -+ struct memory_range *r = usablemem_rgns.ranges + i; -+ -+ /* -+ * We assume that crash area is fully contained in -+ * some larger memory area. -+ */ -+ if (r->start <= range->start && r->end >= range->end) { -+ struct memory_range *new; -+ /* -+ * Let's split this area into 2 smaller ones and -+ * remove excluded range from between. First create -+ * new entry for the remaining area. -+ */ -+ new = usablemem_rgns.ranges + usablemem_rgns.size; -+ new->start = range->end + 1; -+ new->end = r->end; -+ usablemem_rgns.size++; -+ /* -+ * Next update this area to end before excluded range. -+ */ -+ r->end = range->start - 1; -+ break; -+ } -+ } -+} -+ -+static int range_cmp(const void *a1, const void *a2) -+{ -+ const struct memory_range *r1 = a1; -+ const struct memory_range *r2 = a2; -+ -+ if (r1->start > r2->start) -+ return 1; -+ if (r1->start < r2->start) -+ return -1; -+ -+ return 0; -+} -+ -+/** -+ * crash_get_memory_ranges() - read system physical memory -+ * -+ * Function reads through system physical memory and stores found memory regions -+ * in @crash_memory_ranges. Number of memory regions found is placed in -+ * @crash_memory_nr_ranges. Regions are sorted in ascending order. -+ * -+ * Returns %0 in case of success and %-1 otherwise (errno is set). -+ */ -+static int crash_get_memory_ranges(void) -+{ -+ /* -+ * First read all memory regions that can be considered as -+ * system memory including the crash area. -+ */ -+ kexec_iomem_for_each_line(NULL, crash_range_callback, NULL); -+ -+ if (usablemem_rgns.size < 1) { -+ errno = EINVAL; -+ return -1; -+ } -+ -+ /* -+ * Exclude memory reserved for crashkernel (this may result a split memory -+ * region). -+ */ -+ crash_exclude_range(); -+ -+ /* -+ * Make sure that the memory regions are sorted. -+ */ -+ qsort(usablemem_rgns.ranges, usablemem_rgns.size, -+ sizeof(*usablemem_rgns.ranges), range_cmp); -+ -+ return 0; -+} -+ -+/** -+ * cmdline_add_elfcorehdr() - adds elfcorehdr= to @cmdline -+ * @cmdline: buffer where parameter is placed -+ * @elfcorehdr: physical address of elfcorehdr -+ * -+ * Function appends 'elfcorehdr=start' at the end of the command line given in -+ * @cmdline. Note that @cmdline must be at least %COMMAND_LINE_SIZE bytes long -+ * (inclunding %NUL). -+ */ -+static void cmdline_add_elfcorehdr(char *cmdline, unsigned long elfcorehdr) -+{ -+ char buf[COMMAND_LINE_SIZE]; -+ int buflen; -+ -+ buflen = snprintf(buf, sizeof(buf), "%s elfcorehdr=%#lx", -+ cmdline, elfcorehdr); -+ if (buflen < 0) -+ die("Failed to construct elfcorehdr= command line parameter\n"); -+ if (buflen >= sizeof(buf)) -+ die("Command line overflow\n"); -+ -+ (void) strncpy(cmdline, buf, COMMAND_LINE_SIZE); -+ cmdline[COMMAND_LINE_SIZE - 1] = '\0'; -+} -+ -+/** -+ * cmdline_add_mem() - adds mem= parameter to kernel command line -+ * @cmdline: buffer where parameter is placed -+ * @size: size of the kernel reserved memory (in bytes) -+ * -+ * This function appends 'mem=size' at the end of the command line given in -+ * @cmdline. Note that @cmdline must be at least %COMMAND_LINE_SIZE bytes long -+ * (including %NUL). -+ */ -+static void cmdline_add_mem(char *cmdline, unsigned long size) -+{ -+ char buf[COMMAND_LINE_SIZE]; -+ int buflen; -+ -+ buflen = snprintf(buf, sizeof(buf), "%s mem=%ldK", cmdline, size >> 10); -+ if (buflen < 0) -+ die("Failed to construct mem= command line parameter\n"); -+ if (buflen >= sizeof(buf)) -+ die("Command line overflow\n"); -+ -+ (void) strncpy(cmdline, buf, COMMAND_LINE_SIZE); -+ cmdline[COMMAND_LINE_SIZE - 1] = '\0'; -+} -+ -+static unsigned long long range_size(const struct memory_range *r) -+{ -+ return r->end - r->start + 1; -+} -+ -+static void dump_memory_ranges(void) -+{ -+ int i; -+ -+ if (!kexec_debug) -+ return; -+ -+ dbgprintf("crashkernel: [%#llx - %#llx] (%ldM)\n", -+ crash_reserved_mem.start, crash_reserved_mem.end, -+ (unsigned long)range_size(&crash_reserved_mem) >> 20); -+ -+ for (i = 0; i < usablemem_rgns.size; i++) { -+ struct memory_range *r = usablemem_rgns.ranges + i; -+ dbgprintf("memory range: [%#llx - %#llx] (%ldM)\n", -+ r->start, r->end, (unsigned long)range_size(r) >> 20); -+ } -+} -+ -+/** -+ * load_crashdump_segments() - loads additional segments needed for kdump -+ * @info: kexec info structure -+ * @mod_cmdline: kernel command line -+ * -+ * This function loads additional segments which are needed for the dump capture -+ * kernel. It also updates kernel command line passed in @mod_cmdline to have -+ * right parameters for the dump capture kernel. -+ * -+ * Return %0 in case of success and %-1 in case of error. -+ */ -+int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) -+{ -+ unsigned long elfcorehdr; -+ unsigned long bufsz; -+ void *buf; -+ int err; -+ -+ /* -+ * First fetch all the memory (RAM) ranges that we are going to pass to -+ * the crashdump kernel during panic. -+ */ -+ err = crash_get_memory_ranges(); -+ if (err) -+ return err; -+ -+ /* -+ * Now that we have memory regions sorted, we can use first memory -+ * region as PHYS_OFFSET. -+ */ -+ phys_offset = usablemem_rgns.ranges->start; -+ dbgprintf("phys_offset: %#lx\n", phys_offset); -+ -+ err = crash_create_elf32_headers(info, &elf_info, -+ usablemem_rgns.ranges, -+ usablemem_rgns.size, &buf, &bufsz, -+ ELF_CORE_HEADER_ALIGN); -+ if (err) -+ return err; -+ -+ /* -+ * We allocate ELF core header from the end of the memory area reserved -+ * for the crashkernel. We align the header to SECTION_SIZE (which is -+ * 1MB) so that available memory passed in kernel command line will be -+ * aligned to 1MB. This is because kernel create_mapping() wants memory -+ * regions to be aligned to SECTION_SIZE. -+ */ -+ elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << 20, -+ crash_reserved_mem.start, -+ crash_reserved_mem.end, -1, 0); -+ -+ dbgprintf("elfcorehdr: %#lx\n", elfcorehdr); -+ cmdline_add_elfcorehdr(mod_cmdline, elfcorehdr); -+ -+ /* -+ * Add 'mem=size' parameter to dump capture kernel command line. This -+ * prevents the dump capture kernel from using any other memory regions -+ * which belong to the primary kernel. -+ */ -+ cmdline_add_mem(mod_cmdline, elfcorehdr - crash_reserved_mem.start); -+ -+ dump_memory_ranges(); -+ dbgprintf("kernel command line: \"%s\"\n", mod_cmdline); -+ -+ return 0; -+} -+ -+#endif -+ -Index: kexec-tools-2.0.10/kexec/arch/arm64/include/arch/options.h -=================================================================== ---- /dev/null -+++ kexec-tools-2.0.10/kexec/arch/arm64/include/arch/options.h -@@ -0,0 +1,26 @@ -+#ifndef KEXEC_ARCH_ARM64_OPTIONS_H -+#define KEXEC_ARCH_ARM64_OPTIONS_H -+ -+//#define OPT_ARCH_MAX ((OPT_MAX)+0) -+ -+#define OPT_APPEND ((OPT_MAX)+0) -+#define OPT_RAMDISK ((OPT_MAX)+1) -+#define OPT_DTB ((OPT_MAX)+2) -+ -+#define OPT_ARCH_MAX ((OPT_MAX)+3) -+ -+ -+#define KEXEC_ARCH_OPTIONS \ -+ KEXEC_OPTIONS \ -+ { "append", 1, NULL, OPT_APPEND }, \ -+ { "command-line", 1, NULL, OPT_APPEND }, \ -+ { "dtb", 1, NULL, OPT_DTB }, \ -+ { "initrd", 1, NULL, OPT_RAMDISK }, \ -+ { "ramdisk", 1, NULL, OPT_RAMDISK }, \ -+ -+#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR /* Only accept long arch options. */ -+ -+#define KEXEC_ALL_OPTIONS KEXEC_ARCH_OPTIONS -+#define KEXEC_ALL_OPT_STR KEXEC_ARCH_OPT_STR -+ -+#endif /* KEXEC_ARCH_ARM64_OPTIONS_H */ -Index: kexec-tools-2.0.10/kexec/arch/arm64/kexec-arm64.c -=================================================================== ---- /dev/null -+++ kexec-tools-2.0.10/kexec/arch/arm64/kexec-arm64.c -@@ -0,0 +1,177 @@ -+/* -+ * ARM64 kexec support. -+ */ -+ -+#define _GNU_SOURCE -+ -+#include <errno.h> -+#include <stddef.h> -+ -+//#include <linux/kexec.h> -+ -+#include "../../kexec.h" -+#include "../../kexec-syscall.h" -+#include "kexec-arm64.h" -+ -+ -+void arch_usage(void) -+{ -+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__); -+ -+ printf( -+" --append=STRING Set the kernel command line to STRING.\n" -+" --command-line=STRING Set the kernel command line to STRING.\n" -+" --dtb=FILE Use FILE as the device tree blob.\n" -+" --initrd=FILE Use FILE as the kernel initial ramdisk.\n" -+" --ramdisk=FILE Use FILE as the kernel initial ramdisk.\n"); -+ -+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__); -+} -+ -+int arch_process_options(int UNUSED(argc), char **UNUSED(argv)) -+{ -+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__); -+ return 0; -+} -+ -+const struct arch_map_entry arches[] = { -+ { "aarch64", KEXEC_ARCH_ARM64 }, -+ { NULL, 0 }, -+}; -+ -+void arch_update_purgatory(struct kexec_info *UNUSED(info)) -+{ -+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__); -+} -+ -+unsigned long virt_to_phys(unsigned long addr) -+{ -+ fprintf(stderr, "%s:%d: %016lx -> %016lx\n", __func__, __LINE__, addr, -+ addr + 0x080000000UL); -+ return addr + 0x080000000UL; -+} -+ -+void add_segment(struct kexec_info *info, const void *buf, size_t bufsz, -+ unsigned long base, size_t memsz) -+{ -+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__); -+ add_segment_phys_virt(info, buf, bufsz, base, memsz, 1); -+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__); -+} -+ -+static int get_memory_ranges_1(struct memory_range **range, int *ranges, -+ unsigned long kexec_flags) -+{ -+ static struct memory_range memory_range[KEXEC_SEGMENT_MAX]; -+ const char *iomem; -+ int range_count = 0; -+ char line[MAX_LINE]; -+ FILE *fp; -+ -+ iomem = proc_iomem(); -+ fp = fopen(iomem, "r"); -+ -+ if (!fp) { -+ fprintf(stderr, "Cannot open %s: %s\n", -+ iomem, strerror(errno)); -+ return -1; -+ } -+ -+ dbgprintf("memory ranges:\n"); -+ -+ while(fgets(line, sizeof(line), fp) != 0) { -+ struct memory_range r; -+ char *str; -+ int consumed; -+ -+ if (range_count >= KEXEC_SEGMENT_MAX) -+ break; -+ -+ if (sscanf(line, "%Lx-%Lx : %n", &r.start, &r.end, &consumed) -+ != 2) -+ continue; -+ -+ str = line + consumed; -+ r.end++; -+ -+ if (memcmp(str, "System RAM\n", 11)) { -+ dbgprintf(" Skip: %016Lx - %016Lx : %s", r.start, r.end, -+ str); -+ continue; -+ } -+ -+ r.type = RANGE_RAM; -+ memory_range[range_count] = r; -+ range_count++; -+ -+ dbgprintf(" Add: %016Lx - %016Lx : %s", r.start, r.end, str); -+ } -+ -+ fclose(fp); -+ *range = memory_range; -+ *ranges = range_count; -+ -+ return 0; -+} -+ -+static int get_memory_ranges_2(struct memory_range **range, int *ranges, -+ unsigned long UNUSED(kexec_flags)) -+{ -+ static struct memory_range memory_range[2]; -+ -+ memory_range[0].start = 0x080000000; -+ memory_range[0].end = 0x100000000; -+ memory_range[0].type = RANGE_RAM; -+ -+ memory_range[1].start = 0x900000000; -+ memory_range[1].end = 0x880000000; -+ memory_range[1].type = RANGE_RAM; -+ -+ *range = memory_range; -+ *ranges = sizeof(memory_range) / sizeof(memory_range[0]); -+ -+ return 0; -+} -+ -+int get_memory_ranges(struct memory_range **range, int *ranges, -+ unsigned long kexec_flags) -+{ -+ /* FIXME: Should get this info from device tree. */ -+ -+ return get_memory_ranges_1(range, ranges, kexec_flags); -+} -+ -+struct file_type file_type[] = { -+ { "elf-arm64", elf_arm64_probe, elf_arm64_load, elf_arm64_usage }, -+}; -+ -+int file_types = sizeof(file_type) / sizeof(file_type[0]); -+ -+int arch_compat_trampoline(struct kexec_info *info) -+{ -+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__); -+ return 0; -+} -+ -+void arch_reuse_initrd(void) -+{ -+} -+ -+int machine_verify_elf_rel(struct mem_ehdr *ehdr) -+{ -+ (void)ehdr; -+ -+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__); -+ return 0; -+} -+ -+void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type, -+ void *location, unsigned long address, unsigned long value) -+{ -+ (void)ehdr; -+ (void)r_type; -+ (void)location; -+ (void)address; -+ (void)value; -+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__); -+} -Index: kexec-tools-2.0.10/kexec/arch/arm64/kexec-arm64.h -=================================================================== ---- /dev/null -+++ kexec-tools-2.0.10/kexec/arch/arm64/kexec-arm64.h -@@ -0,0 +1,20 @@ -+/* -+ * ARM64 kexec support. -+ */ -+ -+#if !defined(KEXEC_ARM64_H) -+#define KEXEC_ARM64_H -+ -+/* #include <linux/kexec.h> FIXME: this is broken */ -+#include <sys/types.h> -+ -+#include "../../kexec.h" -+ -+#define KEXEC_SEGMENT_MAX 16 /* FIXME: this should come from <linux/kexec.h> */ -+ -+int elf_arm64_probe(const char *buf, off_t len); -+int elf_arm64_load(int argc, char **argv, const char *buf, off_t len, -+ struct kexec_info *info); -+void elf_arm64_usage(void); -+ -+#endif -\ No newline at end of file -Index: kexec-tools-2.0.10/kexec/arch/arm64/kexec-elf-arm64.c -=================================================================== ---- /dev/null -+++ kexec-tools-2.0.10/kexec/arch/arm64/kexec-elf-arm64.c -@@ -0,0 +1,114 @@ -+/* -+ * ARM64 kexec support. -+ */ -+ -+#define _GNU_SOURCE -+ -+#include <elf.h> -+#include <getopt.h> -+ -+#include "../../kexec-syscall.h" -+ -+#include "kexec-arm64.h" -+#include "arch/options.h" -+ -+#if !defined(EM_AARCH64) -+# define EM_AARCH64 183 -+#endif -+ -+int elf_arm64_probe(const char *buf, off_t len) -+{ -+ int result; -+ struct mem_ehdr ehdr; -+ -+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__); -+ -+ result = build_elf_exec_info(buf, len, &ehdr, 0); -+ -+ if (result < 0) { -+ dbgprintf("Not an ELF executable\n"); -+ goto out; -+ } -+ -+ if (ehdr.e_machine != EM_AARCH64) { -+ dbgprintf("Not an AARCH64 executable\n"); -+ result = -1; -+ goto out; -+ } -+ -+ result = 0; -+ -+out: -+ free_elf_info(&ehdr); -+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__); -+ return result; -+} -+ -+int elf_arm64_load(int argc, char **argv, const char *buf, off_t len, -+ struct kexec_info *info) -+{ -+ static const struct option options[] = { -+ KEXEC_ARCH_OPTIONS -+ { 0 } -+ }; -+ static const char short_options[] = KEXEC_OPT_STR ""; -+ const char *command_line = NULL; -+ unsigned int command_line_len = 0; -+ const char *ramdisk = NULL; -+ const char *dtb = NULL; -+ int opt; -+ struct mem_ehdr ehdr; -+ int result; -+ -+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__); -+ -+ while ((opt = getopt_long(argc, argv, short_options, options, 0)) -+ != -1) { -+ switch (opt) { -+ default: -+ if (opt < OPT_MAX) /* Ignore core options */ -+ break; -+ case OPT_APPEND: -+ command_line = optarg; -+ command_line_len = strlen(command_line) + 1; -+ break; -+ case OPT_RAMDISK: -+ ramdisk = optarg; -+ break; -+ case OPT_DTB: -+ dtb = optarg; -+ break; -+ } -+ } -+ -+ fprintf(stderr, "%s:%d: command_line: %s\n", __func__, __LINE__, command_line); -+ fprintf(stderr, "%s:%d: ramdisk: %s\n", __func__, __LINE__, ramdisk); -+ fprintf(stderr, "%s:%d: dtb: %s\n", __func__, __LINE__, dtb); -+ -+ if (info->kexec_flags & KEXEC_ON_CRASH) { -+ fprintf(stderr, "kexec: kdump not yet supported on arm64\n"); -+ return -1; -+ } -+ -+ result = build_elf_exec_info(buf, len, &ehdr, 0); -+ -+ if (result < 0) { -+ free_elf_info(&ehdr); -+ fprintf(stderr, "%s:%d: free_elf_info failed\n", __func__, -+ __LINE__); -+ return result; -+ } -+ -+ elf_exec_build_load(info, &ehdr, buf, len, 0); -+ -+ info->entry = (void*)0x80080000UL; // FIXME -+ -+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__); -+ return 0; -+} -+ -+void elf_arm64_usage(void) -+{ -+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__); -+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__); -+} -Index: kexec-tools-2.0.10/kexec/kexec-syscall.h -=================================================================== ---- kexec-tools-2.0.10.orig/kexec/kexec-syscall.h -+++ kexec-tools-2.0.10/kexec/kexec-syscall.h -@@ -39,8 +39,8 @@ - #ifdef __s390__ - #define __NR_kexec_load 277 - #endif --#ifdef __arm__ --#define __NR_kexec_load __NR_SYSCALL_BASE + 347 -+#if defined(__arm__) || defined(__arm64__) -+#define __NR_kexec_load __NR_SYSCALL_BASE + 347 - #endif - #if defined(__mips__) - #define __NR_kexec_load 4311 -@@ -108,6 +108,8 @@ static inline long kexec_file_load(int k - #define KEXEC_ARCH_PPC64 (21 << 16) - #define KEXEC_ARCH_IA_64 (50 << 16) - #define KEXEC_ARCH_ARM (40 << 16) -+#define KEXEC_ARCH_ARM64 (183 << 16) -+/* #define KEXEC_ARCH_AARCH64 (183 << 16) */ - #define KEXEC_ARCH_S390 (22 << 16) - #define KEXEC_ARCH_SH (42 << 16) - #define KEXEC_ARCH_MIPS_LE (10 << 16) -@@ -153,5 +155,8 @@ static inline long kexec_file_load(int k - #ifdef __m68k__ - #define KEXEC_ARCH_NATIVE KEXEC_ARCH_68K - #endif -+#if defined(__arm64__) -+#define KEXEC_ARCH_NATIVE KEXEC_ARCH_ARM64 -+#endif - - #endif /* KEXEC_SYSCALL_H */ -Index: kexec-tools-2.0.10/kexec/kexec.c -=================================================================== ---- kexec-tools-2.0.10.orig/kexec/kexec.c -+++ kexec-tools-2.0.10/kexec/kexec.c -@@ -664,6 +664,8 @@ static int my_load(const char *type, int - memset(&info, 0, sizeof(info)); - info.kexec_flags = kexec_flags; - -+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__); -+ - result = 0; - if (argc - fileind <= 0) { - fprintf(stderr, "No kernel specified\n"); -Index: kexec-tools-2.0.10/purgatory/arch/arm64/Makefile -=================================================================== ---- /dev/null -+++ kexec-tools-2.0.10/purgatory/arch/arm64/Makefile -@@ -0,0 +1,7 @@ -+# -+# Purgatory arm64 -+# -+ -+arm64_PURGATORY_SRCS = -+ -+dist += purgatory/arch/arm64/Makefile $(arm64_PURGATORY_SRCS) diff --git a/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch b/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch deleted file mode 100644 index 26d18eb6fe..0000000000 --- a/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch +++ /dev/null @@ -1,88 +0,0 @@ -x86_64: Add support to build kexec-tools with x32 ABI - -Summary of changes, - -configure.ac: Add test for detect x32 ABI. -purgatory/arch/x86_64/Makefile: Not use mcmodel large when - x32 ABI is set. -kexec/arch/x86_64/kexec-elf-rel-x86_64.c: When x32 ABI is set - use ELFCLASS32 instead of ELFCLASS64. -kexec/kexec-syscall.h: Add correct syscall number for x32 ABI. - -Upstream-Status: Submitted - -Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> -Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> - ---- - configure.ac | 9 +++++++++ - kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 4 ++++ - kexec/kexec-syscall.h | 4 ++++ - purgatory/arch/x86_64/Makefile | 4 +++- - 4 files changed, 20 insertions(+), 1 deletion(-) - -Index: kexec-tools-2.0.10/configure.ac -=================================================================== ---- kexec-tools-2.0.10.orig/configure.ac -+++ kexec-tools-2.0.10/configure.ac -@@ -56,6 +56,15 @@ case $target_cpu in - ;; - ia64|x86_64|alpha|m68k ) - ARCH="$target_cpu" -+ -+ dnl ---Test for x32 ABI in x86_64 -+ if test "x$ARCH" = "xx86_64" ; then -+ AC_EGREP_CPP(x32_test, -+ [#if defined(__x86_64__) && defined (__ILP32__) -+ x32_test -+ #endif -+ ], SUBARCH='x32', SUBARCH='64') -+ fi - ;; - * ) - AC_MSG_ERROR([unsupported architecture $target_cpu]) -Index: kexec-tools-2.0.10/kexec/arch/x86_64/kexec-elf-rel-x86_64.c -=================================================================== ---- kexec-tools-2.0.10.orig/kexec/arch/x86_64/kexec-elf-rel-x86_64.c -+++ kexec-tools-2.0.10/kexec/arch/x86_64/kexec-elf-rel-x86_64.c -@@ -8,7 +8,11 @@ int machine_verify_elf_rel(struct mem_eh - if (ehdr->ei_data != ELFDATA2LSB) { - return 0; - } -+#ifdef __ILP32__ -+ if (ehdr->ei_class != ELFCLASS32) { -+#else - if (ehdr->ei_class != ELFCLASS64) { -+#endif - return 0; - } - if (ehdr->e_machine != EM_X86_64) { -Index: kexec-tools-2.0.10/kexec/kexec-syscall.h -=================================================================== ---- kexec-tools-2.0.10.orig/kexec/kexec-syscall.h -+++ kexec-tools-2.0.10/kexec/kexec-syscall.h -@@ -31,8 +31,12 @@ - #define __NR_kexec_load 268 - #endif - #ifdef __x86_64__ -+#ifdef __ILP32__ -+#define __NR_kexec_load 528 -+#else - #define __NR_kexec_load 246 - #endif -+#endif - #ifdef __s390x__ - #define __NR_kexec_load 277 - #endif -Index: kexec-tools-2.0.10/purgatory/arch/x86_64/Makefile -=================================================================== ---- kexec-tools-2.0.10.orig/purgatory/arch/x86_64/Makefile -+++ kexec-tools-2.0.10/purgatory/arch/x86_64/Makefile -@@ -23,4 +23,6 @@ x86_64_PURGATORY_SRCS += purgatory/arch/ - x86_64_PURGATORY_SRCS += purgatory/arch/i386/vga.c - x86_64_PURGATORY_SRCS += purgatory/arch/i386/pic.c - --x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large -+ifeq ($(SUBARCH),64) -+ x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large -+endif diff --git a/meta/recipes-kernel/kexec/kexec-tools_2.0.15.bb b/meta/recipes-kernel/kexec/kexec-tools_2.0.15.bb deleted file mode 100644 index 6bd9025e6f..0000000000 --- a/meta/recipes-kernel/kexec/kexec-tools_2.0.15.bb +++ /dev/null @@ -1,52 +0,0 @@ -require kexec-tools.inc -export LDFLAGS = "-L${STAGING_LIBDIR}" -EXTRA_OECONF = " --with-zlib=yes" - -SRC_URI += "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz \ - file://0002-powerpc-change-the-memory-size-limit.patch \ - file://0001-purgatory-Pass-r-directly-to-linker.patch \ - file://0010-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch \ - file://kexec-x32.patch \ - file://0001-Disable-PIE-during-link.patch \ - " - -SRC_URI[md5sum] = "78906fdc255656fa2b9996c8acb3ef62" -SRC_URI[sha256sum] = "42dbd0dab9964cd1ed89fa4571c8d13191eb7132b361ade5ac44517c91ecb97e" - -SECURITY_PIE_CFLAGS_remove = "-fPIE -pie" - -PACKAGES =+ "kexec kdump vmcore-dmesg" - -ALLOW_EMPTY_${PN} = "1" -RRECOMMENDS_${PN} = "kexec kdump vmcore-dmesg" - -FILES_kexec = "${sbindir}/kexec" -FILES_kdump = "${sbindir}/kdump \ - ${sysconfdir}/sysconfig/kdump.conf \ - ${sysconfdir}/init.d/kdump \ - ${libexecdir}/kdump-helper \ - ${systemd_unitdir}/system/kdump.service \ -" - -FILES_vmcore-dmesg = "${sbindir}/vmcore-dmesg" - -inherit update-rc.d systemd - -INITSCRIPT_PACKAGES = "kdump" -INITSCRIPT_NAME_kdump = "kdump" -INITSCRIPT_PARAMS_kdump = "start 56 2 3 4 5 . stop 56 0 1 6 ." - -do_install_append () { - install -d ${D}${sysconfdir}/sysconfig - install -m 0644 ${WORKDIR}/kdump.conf ${D}${sysconfdir}/sysconfig - - if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then - install -D -m 0755 ${WORKDIR}/kdump ${D}${sysconfdir}/init.d/kdump - fi - - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -D -m 0755 ${WORKDIR}/kdump ${D}${libexecdir}/kdump-helper - install -D -m 0644 ${WORKDIR}/kdump.service ${D}${systemd_unitdir}/system/kdump.service - sed -i -e 's,@LIBEXECDIR@,${libexecdir},g' ${D}${systemd_unitdir}/system/kdump.service - fi -} diff --git a/meta/recipes-kernel/kexec/kexec-tools_2.0.28.bb b/meta/recipes-kernel/kexec/kexec-tools_2.0.28.bb new file mode 100644 index 0000000000..dec821ea88 --- /dev/null +++ b/meta/recipes-kernel/kexec/kexec-tools_2.0.28.bb @@ -0,0 +1,86 @@ + +SUMMARY = "Kexec fast reboot tools" +DESCRIPTION = "Kexec is a fast reboot feature that lets you reboot to a new Linux kernel" +HOMEPAGE = "http://kernel.org/pub/linux/utils/kernel/kexec/" +SECTION = "kernel/userland" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=ea5bed2f60d357618ca161ad539f7c0a \ + file://kexec/kexec.c;beginline=1;endline=20;md5=af10f6ae4a8715965e648aa687ad3e09" +DEPENDS = "zlib xz" + +SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz \ + file://kdump \ + file://kdump.conf \ + file://kdump.service \ + file://0001-powerpc-change-the-memory-size-limit.patch \ + file://0002-purgatory-Pass-r-directly-to-linker.patch \ + file://0003-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch \ + file://0005-Disable-PIE-during-link.patch \ + file://0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch \ + file://Fix-building-on-x86_64-with-binutils-2.41.patch \ + " + +SRC_URI[sha256sum] = "f33d2660b3e38d25a127e87097978e0f7a9a73ab5151a29eb80974d169ff6a29" + +inherit autotools update-rc.d systemd + +export LDFLAGS = "-L${STAGING_LIBDIR}" +EXTRA_OECONF = " --with-zlib=yes" + +do_compile:prepend() { + # Remove the prepackaged config.h from the source tree as it overrides + # the same file generated by configure and placed in the build tree + rm -f ${S}/include/config.h + + # Remove the '*.d' file to make sure the recompile is OK + for dep in `find ${B} -type f -name '*.d'`; do + dep_no_d="`echo $dep | sed 's#.d$##'`" + # Remove file.d when there is a file.o + if [ -f "$dep_no_d.o" ]; then + rm -f $dep + fi + done +} + +do_install:append () { + install -d ${D}${sysconfdir}/sysconfig + install -m 0644 ${WORKDIR}/kdump.conf ${D}${sysconfdir}/sysconfig + + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -D -m 0755 ${WORKDIR}/kdump ${D}${sysconfdir}/init.d/kdump + fi + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -D -m 0755 ${WORKDIR}/kdump ${D}${libexecdir}/kdump-helper + install -D -m 0644 ${WORKDIR}/kdump.service ${D}${systemd_system_unitdir}/kdump.service + sed -i -e 's,@LIBEXECDIR@,${libexecdir},g' ${D}${systemd_system_unitdir}/kdump.service + fi +} + +PACKAGES =+ "kexec kdump vmcore-dmesg" + +ALLOW_EMPTY:${PN} = "1" +RRECOMMENDS:${PN} = "kexec kdump vmcore-dmesg" + +FILES:kexec = "${sbindir}/kexec" +FILES:kdump = "${sbindir}/kdump \ + ${sysconfdir}/sysconfig/kdump.conf \ + ${sysconfdir}/init.d/kdump \ + ${libexecdir}/kdump-helper \ + ${systemd_system_unitdir}/kdump.service \ +" + +FILES:vmcore-dmesg = "${sbindir}/vmcore-dmesg" + +INITSCRIPT_PACKAGES = "kdump" +INITSCRIPT_NAME:kdump = "kdump" +INITSCRIPT_PARAMS:kdump = "start 56 2 3 4 5 . stop 56 0 1 6 ." + +SYSTEMD_PACKAGES = "kdump" +SYSTEMD_SERVICE:kdump = "kdump.service" + +SECURITY_PIE_CFLAGS:remove = "-fPIE -pie" + +COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|powerpc.*|mips.*)-(linux|freebsd.*)' + +INSANE_SKIP:${PN} = "arch" |