Hello community, here is the log from the commit of package kexec-tools for openSUSE:Factory checked in at 2016-06-14 23:06:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kexec-tools (Old) and /work/SRC/openSUSE:Factory/.kexec-tools.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kexec-tools" Changes: -------- --- /work/SRC/openSUSE:Factory/kexec-tools/kexec-tools.changes 2015-12-18 21:52:39.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.kexec-tools.new/kexec-tools.changes 2016-06-14 23:06:28.000000000 +0200 @@ -1,0 +2,18 @@ +Fri Jun 3 18:16:51 UTC 2016 - [email protected] + +- Update to version 2.0.12 (FATE#320915, bsc#980545) + Changelog: http://git.kernel.org/cgit/utils/kernel/kexec/kexec-tools.git/log/?id=refs/tags/v2.0.10..v2.0.12 + + Drop following patches (upstream): + kexec-tools-load-crash-kernel-high.patch + +- Fix pkg-config to check >= 4.7 rather than > 4.6 for xenlight + +- Specifically name Files in specfile rather than using glob. + +------------------------------------------------------------------- +Tue May 3 15:17:15 UTC 2016 - [email protected] + +- Adjust linking to libxenctrl to xen-4.7 API + +------------------------------------------------------------------- Old: ---- kexec-tools-2.0.10.tar.xz kexec-tools-load-crash-kernel-high.patch New: ---- kexec-tools-2.0.12.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kexec-tools.spec ++++++ --- /var/tmp/diff_new_pack.UTC5ua/_old 2016-06-14 23:06:28.000000000 +0200 +++ /var/tmp/diff_new_pack.UTC5ua/_new 2016-06-14 23:06:28.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package kexec-tools # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -28,7 +28,7 @@ Summary: Tools for fast kernel loading License: GPL-2.0+ Group: System/Kernel -Version: 2.0.10 +Version: 2.0.12 Release: 0 Source: ftp://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz Source1: kexec-bootloader @@ -40,7 +40,6 @@ Patch3: %{name}-disable-test.patch Patch4: %{name}-enable-aarch64.patch Patch5: %{name}-enable-aarch64-fixup.patch -Patch6: %{name}-load-crash-kernel-high.patch Url: ftp://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -50,6 +49,7 @@ BuildRequires: libxslt BuildRequires: zlib-devel %ifarch x86_64 +BuildRequires: pkg-config BuildRequires: xen-devel %endif ExclusiveArch: ppc64le aarch64 %ix86 x86_64 ia64 ppc ppc64 s390 s390x %arm sh mips mipsel m68k @@ -67,7 +67,6 @@ %patch3 -p1 %patch4 -p1 %patch5 -p1 -%patch6 -p1 %build # disable as-needed @@ -125,10 +124,13 @@ %doc AUTHORS COPYING News TODO doc %doc %{_mandir}/man*/* #UsrMerge -/sbin/* +/sbin/kdump +/sbin/kexec #EndUsrMerge -%{_sbindir}/* +%{_sbindir}/kdump +%{_sbindir}/kexec %{_sbindir}/kexec-bootloader +%{_sbindir}/vmcore-dmesg %{_unitdir}/kexec-load.service %changelog ++++++ kexec-tools-2.0.10.tar.xz -> kexec-tools-2.0.12.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/configure new/kexec-tools-2.0.12/configure --- old/kexec-tools-2.0.10/configure 2015-06-25 12:09:47.000000000 +0200 +++ new/kexec-tools-2.0.12/configure 2016-03-22 02:08:10.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for kexec-tools 2.0.10. +# Generated by GNU Autoconf 2.69 for kexec-tools 2.0.12. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ # Identity of this package. PACKAGE_NAME='kexec-tools' PACKAGE_TARNAME='kexec-tools' -PACKAGE_VERSION='2.0.10' -PACKAGE_STRING='kexec-tools 2.0.10' +PACKAGE_VERSION='2.0.12' +PACKAGE_STRING='kexec-tools 2.0.12' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1268,7 +1268,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures kexec-tools 2.0.10 to adapt to many kinds of systems. +\`configure' configures kexec-tools 2.0.12 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1334,7 +1334,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of kexec-tools 2.0.10:";; + short | recursive ) echo "Configuration of kexec-tools 2.0.12:";; esac cat <<\_ACEOF @@ -1424,7 +1424,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -kexec-tools configure 2.0.10 +kexec-tools configure 2.0.12 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1722,7 +1722,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by kexec-tools $as_me 2.0.10, which was +It was created by kexec-tools $as_me 2.0.12, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2898,12 +2898,6 @@ -cat >>confdefs.h <<_ACEOF -#define PACKAGE_DATE "`date '+%d %B %Y'`" -_ACEOF - - - # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 @@ -3021,6 +3015,7 @@ ;; powerpc ) ARCH="ppc" + SUBARCH="BE" ;; powerpc64 ) ARCH="ppc64" @@ -5330,7 +5325,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by kexec-tools $as_me 2.0.10, which was +This file was extended by kexec-tools $as_me 2.0.12, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5392,7 +5387,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -kexec-tools config.status 2.0.10 +kexec-tools config.status 2.0.12 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/configure.ac new/kexec-tools-2.0.12/configure.ac --- old/kexec-tools-2.0.10/configure.ac 2015-06-25 12:09:23.000000000 +0200 +++ new/kexec-tools-2.0.12/configure.ac 2016-03-22 02:07:37.000000000 +0100 @@ -4,15 +4,12 @@ dnl dnl ---Required -AC_INIT(kexec-tools, 2.0.10) +AC_INIT(kexec-tools, 2.0.12) AC_CONFIG_AUX_DIR(./config) AC_CONFIG_HEADERS([include/config.h]) AC_LANG(C) AC_PROG_CC -AC_DEFINE_UNQUOTED(PACKAGE_DATE, "`date '+%d %B %Y'`", - [Define to the release date of this package]) - dnl -- Compilation platform configuration dnl -- the host specifices the host machine for the kexec binary, the @@ -27,6 +24,7 @@ ;; powerpc ) ARCH="ppc" + SUBARCH="BE" ;; powerpc64 ) ARCH="ppc64" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/include/config.h new/kexec-tools-2.0.12/include/config.h --- old/kexec-tools-2.0.10/include/config.h 2015-06-25 12:09:59.000000000 +0200 +++ new/kexec-tools-2.0.12/include/config.h 2016-03-22 02:08:17.000000000 +0100 @@ -11,7 +11,7 @@ /* #undef HAVE_LIBLZMA */ /* Define to 1 if you have the `xenctrl' library (-lxenctrl). */ -/* #undef HAVE_LIBXENCTRL */ +#define HAVE_LIBXENCTRL 1 /* Define to 1 if you have the `z' library (-lz). */ #define HAVE_LIBZ 1 @@ -43,14 +43,11 @@ /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "" -/* Define to the release date of this package */ -#define PACKAGE_DATE "25 June 2015" - /* Define to the full name of this package. */ #define PACKAGE_NAME "kexec-tools" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "kexec-tools 2.0.10" +#define PACKAGE_STRING "kexec-tools 2.0.12" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "kexec-tools" @@ -59,7 +56,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "2.0.10" +#define PACKAGE_VERSION "2.0.12" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/include/config.h.in new/kexec-tools-2.0.12/include/config.h.in --- old/kexec-tools-2.0.10/include/config.h.in 2015-02-25 05:38:46.000000000 +0100 +++ new/kexec-tools-2.0.12/include/config.h.in 2016-03-22 02:08:10.000000000 +0100 @@ -42,9 +42,6 @@ /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT -/* Define to the release date of this package */ -#undef PACKAGE_DATE - /* Define to the full name of this package. */ #undef PACKAGE_NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/include/x86/x86-linux.h new/kexec-tools-2.0.12/include/x86/x86-linux.h --- old/kexec-tools-2.0.10/include/x86/x86-linux.h 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/include/x86/x86-linux.h 2015-11-27 01:29:53.000000000 +0100 @@ -21,6 +21,8 @@ #define E820_RESERVED 2 #define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ #define E820_NVS 4 +#define E820_PMEM 7 +#define E820_PRAM 12 } __attribute__((packed)); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/arm/include/arch/options.h new/kexec-tools-2.0.12/kexec/arch/arm/include/arch/options.h --- old/kexec-tools-2.0.10/kexec/arch/arm/include/arch/options.h 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/arch/arm/include/arch/options.h 2015-10-30 00:35:36.000000000 +0100 @@ -1,7 +1,8 @@ #ifndef KEXEC_ARCH_ARM_OPTIONS_H #define KEXEC_ARCH_ARM_OPTIONS_H -#define OPT_ARCH_MAX (OPT_MAX+0) +#define OPT_DT_NO_OLD_ROOT (OPT_MAX+0) +#define OPT_ARCH_MAX (OPT_MAX+1) #define OPT_APPEND 'a' #define OPT_RAMDISK 'r' @@ -15,6 +16,7 @@ */ #define KEXEC_ARCH_OPTIONS \ KEXEC_OPTIONS \ + { "dt-no-old-root", 0, 0, OPT_DT_NO_OLD_ROOT }, \ #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/arm/kexec-arm.c new/kexec-tools-2.0.12/kexec/arch/arm/kexec-arm.c --- old/kexec-tools-2.0.10/kexec/arch/arm/kexec-arm.c 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/arch/arm/kexec-arm.c 2015-11-24 08:04:10.000000000 +0100 @@ -12,10 +12,12 @@ #include <stdint.h> #include <string.h> #include <getopt.h> +#include <unistd.h> #include "../../kexec.h" #include "../../kexec-syscall.h" #include "kexec-arm.h" #include <arch/options.h> +#include "../../fs2dt.h" #define MAX_MEMORY_RANGES 64 #define MAX_LINE 160 @@ -89,11 +91,37 @@ " including the .bss section, as reported\n" " by 'arm-linux-size vmlinux'. If not\n" " specified, this value is implicitly set\n" - " to the compressed images size * 4.\n"); + " to the compressed images size * 4.\n" + " --dt-no-old-root\n" + " do not reuse old kernel root= param.\n" + " while creating flatten device tree.\n"); } int arch_process_options(int argc, char **argv) { + /* We look for all options so getopt_long doesn't start reordering + * argv[] before file_type[n].load() gets a look in. + */ + static const struct option options[] = { + KEXEC_ALL_OPTIONS + { 0, 0, NULL, 0 }, + }; + static const char short_options[] = KEXEC_ALL_OPT_STR; + int opt; + + opterr = 0; /* Don't complain about unrecognized options here */ + while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { + switch(opt) { + case OPT_DT_NO_OLD_ROOT: + dt_no_old_root = 1; + break; + default: + break; + } + } + /* Reset getopt for the next pass; called in other source modules */ + opterr = 1; + optind = 1; return 0; } @@ -110,3 +138,9 @@ void arch_update_purgatory(struct kexec_info *UNUSED(info)) { } + +/* return 1 if /sys/firmware/fdt exists, otherwise return 0 */ +int have_sysfs_fdt(void) +{ + return !access(SYSFS_FDT, F_OK); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/arm/kexec-arm.h new/kexec-tools-2.0.12/kexec/arch/arm/kexec-arm.h --- old/kexec-tools-2.0.10/kexec/arch/arm/kexec-arm.h 2013-11-19 02:05:49.000000000 +0100 +++ new/kexec-tools-2.0.12/kexec/arch/arm/kexec-arm.h 2015-11-24 08:04:10.000000000 +0100 @@ -3,6 +3,7 @@ #include <sys/types.h> +#define SYSFS_FDT "/sys/firmware/fdt" #define BOOT_BLOCK_VERSION 17 #define BOOT_BLOCK_LAST_COMP_VERSION 16 @@ -16,5 +17,6 @@ int uImage_arm_probe(const char *buf, off_t len); int uImage_arm_load(int argc, char **argv, const char *buf, off_t len, struct kexec_info *info); +extern int have_sysfs_fdt(void); #endif /* KEXEC_ARM_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/arm/kexec-zImage-arm.c new/kexec-tools-2.0.12/kexec/arch/arm/kexec-zImage-arm.c --- old/kexec-tools-2.0.10/kexec/arch/arm/kexec-zImage-arm.c 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/arch/arm/kexec-zImage-arm.c 2015-11-24 08:04:10.000000000 +0100 @@ -139,6 +139,38 @@ return (struct tag *) buf; } +static +int create_mem32_tag(struct tag_mem32 *tag_mem32) +{ + const char fn[]= "/proc/device-tree/memory/reg"; + uint32_t tmp[2]; + FILE *fp; + + fp = fopen(fn, "r"); + if (!fp) { + fprintf(stderr, "Cannot open %s: %m\n", fn); + return -1; + } + + if (fread(tmp, sizeof(tmp[0]), 2, fp) != 2) { + fprintf(stderr, "Short read %s\n", fn); + fclose(fp); + return -1; + } + + if (ferror(fp)) { + fprintf(stderr, "Cannot read %s: %m\n", fn); + fclose(fp); + return -1; + } + + /* atags_mem32 has base/size fields reversed! */ + tag_mem32->size = be32_to_cpu(tmp[1]); + tag_mem32->start = be32_to_cpu(tmp[0]); + + fclose(fp); + return 0; +} static int atag_arm_load(struct kexec_info *info, unsigned long base, @@ -182,6 +214,12 @@ params->hdr.size = 2; params->hdr.tag = ATAG_CORE; params = tag_next(params); + + if (!create_mem32_tag(¶ms->u.mem)) { + params->hdr.size = 4; + params->hdr.tag = ATAG_MEM; + params = tag_next(params); + } } if (initrd) { @@ -358,6 +396,14 @@ return -1; } + if (!use_atags && !dtb_file) { + int f; + + f = have_sysfs_fdt(); + if (f) + dtb_file = SYSFS_FDT; + } + if (command_line) { command_line_len = strlen(command_line) + 1; if (command_line_len > COMMAND_LINE_SIZE) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/i386/crashdump-x86.c new/kexec-tools-2.0.12/kexec/arch/i386/crashdump-x86.c --- old/kexec-tools-2.0.10/kexec/arch/i386/crashdump-x86.c 2015-02-25 05:41:32.000000000 +0100 +++ new/kexec-tools-2.0.12/kexec/arch/i386/crashdump-x86.c 2015-12-01 07:21:02.000000000 +0100 @@ -21,6 +21,7 @@ #define _XOPEN_SOURCE 600 #define _BSD_SOURCE +#define _DEFAULT_SOURCE #include <fcntl.h> #include <stdio.h> @@ -301,6 +302,10 @@ type = RANGE_ACPI; } else if(memcmp(str,"ACPI Non-volatile Storage\n",26) == 0 ) { type = RANGE_ACPI_NVS; + } else if(memcmp(str,"Persistent Memory (legacy)\n",27) == 0 ) { + type = RANGE_PRAM; + } else if(memcmp(str,"Persistent Memory\n",18) == 0 ) { + type = RANGE_PMEM; } else if(memcmp(str,"reserved\n",9) == 0 ) { type = RANGE_RESERVED; } else if (memcmp(str, "GART\n", 5) == 0) { @@ -640,6 +645,8 @@ strcat (str_mmap, "K$"); else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS) strcat (str_mmap, "K#"); + else if (type == RANGE_PRAM) + strcat (str_mmap, "K!"); ultoa(startk, str_tmp); strcat (str_mmap, str_tmp); @@ -674,10 +681,11 @@ endk = (memmap_p[i].end + 1)/1024; type = memmap_p[i].type; - /* Only adding memory regions of RAM and ACPI */ + /* Only adding memory regions of RAM and ACPI and Persistent Mem */ if (type != RANGE_RAM && type != RANGE_ACPI && - type != RANGE_ACPI_NVS) + type != RANGE_ACPI_NVS && + type != RANGE_PRAM) continue; if (type == RANGE_ACPI || type == RANGE_ACPI_NVS) @@ -997,7 +1005,9 @@ unsigned long start, end, size, type; if ( !( mem_range[i].type == RANGE_ACPI || mem_range[i].type == RANGE_ACPI_NVS - || mem_range[i].type == RANGE_RESERVED)) + || mem_range[i].type == RANGE_RESERVED + || mem_range[i].type == RANGE_PMEM + || mem_range[i].type == RANGE_PRAM)) continue; start = mem_range[i].start; end = mem_range[i].end; @@ -1017,24 +1027,17 @@ return 0; } -int get_max_crash_kernel_limit(uint64_t *start, uint64_t *end) +/* On x86, the kernel may make a low reservation in addition to the + * normal reservation. However, the kernel refuses to load the panic + * kernel to low memory, so always choose the highest range. + */ +int get_crash_kernel_load_range(uint64_t *start, uint64_t *end) { - int i, idx = -1; - unsigned long sz_max = 0, sz; - if (!crash_reserved_mem_nr) return -1; - for (i = crash_reserved_mem_nr - 1; i >= 0; i--) { - sz = crash_reserved_mem[i].end - crash_reserved_mem[i].start +1; - if (sz <= sz_max) - continue; - sz_max = sz; - idx = i; - } - - *start = crash_reserved_mem[idx].start; - *end = crash_reserved_mem[idx].end; + *start = crash_reserved_mem[crash_reserved_mem_nr - 1].start; + *end = crash_reserved_mem[crash_reserved_mem_nr - 1].end; return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/i386/kexec-x86-common.c new/kexec-tools-2.0.12/kexec/arch/i386/kexec-x86-common.c --- old/kexec-tools-2.0.10/kexec/arch/i386/kexec-x86-common.c 2015-03-20 01:44:41.000000000 +0100 +++ new/kexec-tools-2.0.12/kexec/arch/i386/kexec-x86-common.c 2015-11-30 00:52:07.000000000 +0100 @@ -19,6 +19,7 @@ #define _XOPEN_SOURCE 600 #define _BSD_SOURCE +#define _DEFAULT_SOURCE #include <fcntl.h> #include <stddef.h> @@ -43,6 +44,12 @@ #include <xenctrl.h> #endif /* HAVE_LIBXENCTRL */ +/* Used below but not present in (older?) xenctrl.h */ +#ifndef E820_PMEM +#define E820_PMEM 7 +#define E820_PRAM 12 +#endif + static struct memory_range memory_range[MAX_MEMORY_RANGES]; /** @@ -94,6 +101,12 @@ else if (memcmp(str, "ACPI Non-volatile Storage\n", 26) == 0) { type = RANGE_ACPI_NVS; } + else if (memcmp(str, "Persistent Memory (legacy)\n", 27) == 0) { + type = RANGE_PRAM; + } + else if (memcmp(str, "Persistent Memory\n", 18) == 0) { + type = RANGE_PMEM; + } else { continue; } @@ -149,6 +162,10 @@ return RANGE_ACPI; case E820_NVS: return RANGE_ACPI_NVS; + case E820_PMEM: + return RANGE_PMEM; + case E820_PRAM: + return RANGE_PRAM; case E820_RESERVED: default: return RANGE_RESERVED; @@ -361,9 +378,9 @@ !(kexec_flags & KEXEC_PRESERVE_CONTEXT)) { uint64_t start, end; - ret = get_max_crash_kernel_limit(&start, &end); + ret = get_crash_kernel_load_range(&start, &end); if (ret != 0) { - fprintf(stderr, "get_max_crash_kernel_limit failed.\n"); + fprintf(stderr, "get_crash_kernel_load_range failed.\n"); return -1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/i386/x86-linux-setup.c new/kexec-tools-2.0.12/kexec/arch/i386/x86-linux-setup.c --- old/kexec-tools-2.0.10/kexec/arch/i386/x86-linux-setup.c 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/arch/i386/x86-linux-setup.c 2015-09-02 03:03:16.000000000 +0200 @@ -705,6 +705,12 @@ case RANGE_ACPI_NVS: e820[i].type = E820_NVS; break; + case RANGE_PMEM: + e820[i].type = E820_PMEM; + break; + case RANGE_PRAM: + e820[i].type = E820_PRAM; + break; default: case RANGE_RESERVED: e820[i].type = E820_RESERVED; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/ppc/fs2dt.c new/kexec-tools-2.0.12/kexec/arch/ppc/fs2dt.c --- old/kexec-tools-2.0.10/kexec/arch/ppc/fs2dt.c 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/arch/ppc/fs2dt.c 2015-11-26 03:15:35.000000000 +0100 @@ -30,6 +30,7 @@ #include <stdio.h> #include "../../kexec.h" #include "kexec-ppc.h" +#include "types.h" #define MAXPATH 1024 /* max path name length */ #define NAMESPACE 16384 /* max bytes for property names */ @@ -296,6 +297,8 @@ { char *str1 = (*(struct dirent **)dentry1)->d_name; char *str2 = (*(struct dirent **)dentry2)->d_name; + char *p1, *p2; + int res = 0, max_len; /* * strcmp scans from left to right and fails to idetify for some @@ -303,11 +306,21 @@ * Therefore, we get the wrong sorted order like memory@10000000 and * memory@f000000. */ - if (strchr(str1, '@') && strchr(str2, '@') && - (strlen(str1) > strlen(str2))) - return 1; + if ((p1 = strchr(str1, '@')) && (p2 = strchr(str2, '@'))) { + max_len = max(p1 - str1, p2 - str2); + if ((res = strncmp(str1, str2, max_len)) == 0) { + /* prefix is equal - compare part after '@' by length */ + p1++; p2++; + res = strlen(p1) - strlen(p2); + if (res == 0) + /* equal length, compare by strcmp() */ + res = strcmp(p1,p2); + } + } else { + res = strcmp(str1, str2); + } - return strcmp(str1, str2); + return res; } /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/ppc64/Makefile new/kexec-tools-2.0.12/kexec/arch/ppc64/Makefile --- old/kexec-tools-2.0.10/kexec/arch/ppc64/Makefile 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/arch/ppc64/Makefile 2016-03-18 08:55:43.000000000 +0100 @@ -1,11 +1,15 @@ # # kexec ppc64 (linux booting linux) # +include $(srcdir)/kexec/libfdt/Makefile.libfdt + ppc64_KEXEC_SRCS = kexec/arch/ppc64/kexec-elf-rel-ppc64.c ppc64_KEXEC_SRCS += kexec/arch/ppc64/kexec-zImage-ppc64.c ppc64_KEXEC_SRCS += kexec/arch/ppc64/kexec-elf-ppc64.c ppc64_KEXEC_SRCS += kexec/arch/ppc64/kexec-ppc64.c ppc64_KEXEC_SRCS += kexec/arch/ppc64/crashdump-ppc64.c +ppc64_KEXEC_SRCS += kexec/arch/ppc64/fdt.c +ppc64_KEXEC_SRCS += $(LIBFDT_SRCS:%=kexec/libfdt/%) ppc64_ARCH_REUSE_INITRD = @@ -13,7 +17,10 @@ ppc64_FS2DT_INCLUDE = -include $(srcdir)/kexec/arch/ppc64/crashdump-ppc64.h \ -include $(srcdir)/kexec/arch/ppc64/kexec-ppc64.h +ppc64_CPPFLAGS = -I$(srcdir)/kexec/libfdt + dist += kexec/arch/ppc64/Makefile $(ppc64_KEXEC_SRCS) \ kexec/arch/ppc64/kexec-ppc64.h kexec/arch/ppc64/crashdump-ppc64.h \ + kexec/arch/ppc64/include/arch/fdt.h \ kexec/arch/ppc64/include/arch/options.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/ppc64/crashdump-ppc64.c new/kexec-tools-2.0.12/kexec/arch/ppc64/crashdump-ppc64.c --- old/kexec-tools-2.0.10/kexec/arch/ppc64/crashdump-ppc64.c 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/arch/ppc64/crashdump-ppc64.c 2015-10-16 03:46:26.000000000 +0200 @@ -33,6 +33,7 @@ #include "../../kexec-syscall.h" #include "../../crashdump.h" #include "kexec-ppc64.h" +#include "../../fs2dt.h" #include "crashdump-ppc64.h" static struct crash_elf_info elf_info64 = @@ -187,7 +188,7 @@ DIR *dir, *dmem; FILE *file; struct dirent *dentry, *mentry; - int i, n, crash_rng_len = 0; + int n, crash_rng_len = 0; unsigned long long start, end; int page_size; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/ppc64/fdt.c new/kexec-tools-2.0.12/kexec/arch/ppc64/fdt.c --- old/kexec-tools-2.0.10/kexec/arch/ppc64/fdt.c 1970-01-01 01:00:00.000000000 +0100 +++ new/kexec-tools-2.0.12/kexec/arch/ppc64/fdt.c 2015-12-08 07:00:10.000000000 +0100 @@ -0,0 +1,78 @@ +/* + * ppc64 fdt fixups + * + * Copyright 2015 Freescale Semiconductor, Inc. + * + * 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). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <arch/fdt.h> +#include <libfdt.h> +#include <stdio.h> +#include <stdlib.h> + +/* + * Let the kernel know it booted from kexec, as some things (e.g. + * secondary CPU release) may work differently. + */ +static int fixup_kexec_prop(void *fdt) +{ + int err, nodeoffset; + + nodeoffset = fdt_subnode_offset(fdt, 0, "chosen"); + if (nodeoffset < 0) + nodeoffset = fdt_add_subnode(fdt, 0, "chosen"); + if (nodeoffset < 0) { + printf("%s: add /chosen %s\n", __func__, + fdt_strerror(nodeoffset)); + return -1; + } + + err = fdt_setprop(fdt, nodeoffset, "linux,booted-from-kexec", + NULL, 0); + if (err < 0) { + printf("%s: couldn't write linux,booted-from-kexec: %s\n", + __func__, fdt_strerror(err)); + return -1; + } + + return 0; +} + + +/* + * For now, assume that the added content fits in the file. + * This should be the case when flattening from /proc/device-tree, + * and when passing in a dtb, dtc can be told to add padding. + */ +int fixup_dt(char **fdt, off_t *size) +{ + int ret; + + *size += 4096; + *fdt = realloc(*fdt, *size); + if (!*fdt) { + fprintf(stderr, "%s: out of memory\n", __func__); + return -1; + } + + ret = fdt_open_into(*fdt, *fdt, *size); + if (ret < 0) { + fprintf(stderr, "%s: fdt_open_into: %s\n", __func__, + fdt_strerror(ret)); + return -1; + } + + ret = fixup_kexec_prop(*fdt); + if (ret < 0) + return ret; + + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/ppc64/include/arch/fdt.h new/kexec-tools-2.0.12/kexec/arch/ppc64/include/arch/fdt.h --- old/kexec-tools-2.0.10/kexec/arch/ppc64/include/arch/fdt.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kexec-tools-2.0.12/kexec/arch/ppc64/include/arch/fdt.h 2015-12-08 07:01:12.000000000 +0100 @@ -0,0 +1,8 @@ +#ifndef KEXEC_ARCH_PPC64_FDT +#define KEXEC_ARCH_PPC64_FDT + +#include <sys/types.h> + +int fixup_dt(char **fdt, off_t *size); + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/ppc64/include/arch/options.h new/kexec-tools-2.0.12/kexec/arch/ppc64/include/arch/options.h --- old/kexec-tools-2.0.10/kexec/arch/ppc64/include/arch/options.h 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/arch/ppc64/include/arch/options.h 2015-10-30 00:35:36.000000000 +0100 @@ -2,7 +2,8 @@ #define KEXEC_ARCH_PPC64_OPTIONS_H #define OPT_ELF64_CORE (OPT_MAX+0) -#define OPT_ARCH_MAX (OPT_MAX+1) +#define OPT_DT_NO_OLD_ROOT (OPT_MAX+1) +#define OPT_ARCH_MAX (OPT_MAX+2) /* All 'local' loader options: */ #define OPT_APPEND (OPT_ARCH_MAX+0) @@ -14,6 +15,7 @@ #define KEXEC_ARCH_OPTIONS \ KEXEC_OPTIONS \ { "elf64-core-headers", 0, 0, OPT_ELF64_CORE }, \ + { "dt-no-old-root", 0, 0, OPT_DT_NO_OLD_ROOT }, \ #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/ppc64/kexec-elf-ppc64.c new/kexec-tools-2.0.12/kexec/arch/ppc64/kexec-elf-ppc64.c --- old/kexec-tools-2.0.10/kexec/arch/ppc64/kexec-elf-ppc64.c 2015-02-09 06:53:22.000000000 +0100 +++ new/kexec-tools-2.0.12/kexec/arch/ppc64/kexec-elf-ppc64.c 2015-12-08 07:00:10.000000000 +0100 @@ -37,6 +37,8 @@ #include "kexec-ppc64.h" #include "../../fs2dt.h" #include "crashdump-ppc64.h" +#include <libfdt.h> +#include <arch/fdt.h> #include <arch/options.h> uint64_t initrd_base, initrd_size; @@ -97,7 +99,6 @@ struct mem_ehdr ehdr; char *cmdline, *modified_cmdline = NULL; const char *devicetreeblob; - int cmdline_len, modified_cmdline_len; uint64_t max_addr, hole_addr; char *seg_buf = NULL; off_t seg_size = 0; @@ -107,7 +108,6 @@ uint64_t *rsvmap_ptr; struct bootblock *bb_ptr; #endif - int i; int result, opt; uint64_t my_kernel, my_dt_offset; uint64_t my_opal_base = 0, my_opal_entry = 0; @@ -162,10 +162,7 @@ } } - cmdline_len = 0; - if (cmdline) - cmdline_len = strlen(cmdline) + 1; - else + if (!cmdline) fprintf(stdout, "Warning: append= option is not passed. Using the first kernel root partition\n"); if (ramdisk && reuse_initrd) @@ -181,7 +178,6 @@ strncpy(modified_cmdline, cmdline, COMMAND_LINE_SIZE); modified_cmdline[COMMAND_LINE_SIZE - 1] = '\0'; } - modified_cmdline_len = strlen(modified_cmdline); } /* Parse the Elf file */ @@ -219,7 +215,6 @@ return -1; /* Use new command line. */ cmdline = modified_cmdline; - cmdline_len = strlen(modified_cmdline) + 1; } /* Add v2wrap to the current image */ @@ -249,6 +244,11 @@ /* create from fs2dt */ create_flatten_tree(&seg_buf, &seg_size, cmdline); } + + result = fixup_dt(&seg_buf, &seg_size); + if (result < 0) + return result; + my_dt_offset = add_buffer(info, seg_buf, seg_size, seg_size, 0, 0, max_addr, -1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/ppc64/kexec-ppc64.c new/kexec-tools-2.0.12/kexec/arch/ppc64/kexec-ppc64.c --- old/kexec-tools-2.0.10/kexec/arch/ppc64/kexec-ppc64.c 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/arch/ppc64/kexec-ppc64.c 2015-10-30 00:35:36.000000000 +0100 @@ -869,6 +869,8 @@ void arch_usage(void) { fprintf(stderr, " --elf64-core-headers Prepare core headers in ELF64 format\n"); + fprintf(stderr, " --dt-no-old-root Do not reuse old kernel root= param.\n" \ + " while creating flatten device tree.\n"); } struct arch_options_t arch_options = { @@ -895,6 +897,9 @@ case OPT_ELF64_CORE: arch_options.core_header_type = CORE_TYPE_ELF64; break; + case OPT_DT_NO_OLD_ROOT: + dt_no_old_root = 1; + break; } } /* Reset getopt for the next pass; called in other source modules */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/arch/s390/kexec-image.c new/kexec-tools-2.0.12/kexec/arch/s390/kexec-image.c --- old/kexec-tools-2.0.10/kexec/arch/s390/kexec-image.c 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/arch/s390/kexec-image.c 2015-11-09 02:58:53.000000000 +0100 @@ -101,7 +101,7 @@ * we load the ramdisk directly behind the image with 1 MiB alignment. */ if (ramdisk) { - rd_buffer = slurp_file(ramdisk, &ramdisk_len); + rd_buffer = slurp_file_mmap(ramdisk, &ramdisk_len); if (rd_buffer == NULL) { fprintf(stderr, "Could not read ramdisk.\n"); return -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/crashdump-elf.c new/kexec-tools-2.0.12/kexec/crashdump-elf.c --- old/kexec-tools-2.0.10/kexec/crashdump-elf.c 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/crashdump-elf.c 2015-09-25 07:38:29.000000000 +0200 @@ -141,11 +141,12 @@ count_cpu = nr_cpus; for (i = 0; count_cpu > 0; i++) { - if (get_note_info(i, ¬es_addr, ¬es_len) < 0) { - /* This cpu is not present. Skip it. */ - continue; - } + int ret; + + ret = get_note_info(i, ¬es_addr, ¬es_len); count_cpu--; + if (ret < 0) /* This cpu is not present. Skip it. */ + continue; phdr = (PHDR *) bufp; bufp += sizeof(PHDR); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/firmware_memmap.c new/kexec-tools-2.0.12/kexec/firmware_memmap.c --- old/kexec-tools-2.0.10/kexec/firmware_memmap.c 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/firmware_memmap.c 2015-09-02 03:03:16.000000000 +0200 @@ -168,6 +168,10 @@ range->type = RANGE_ACPI_NVS; else if (strcmp(type, "Uncached RAM") == 0) range->type = RANGE_UNCACHED; + else if (strcmp(type, "Persistent Memory (legacy)") == 0) + range->type = RANGE_PRAM; + else if (strcmp(type, "Persistent Memory") == 0) + range->type = RANGE_PMEM; else { fprintf(stderr, "Unknown type (%s) while parsing %s. Please " "report this as bug. Using RANGE_RESERVED now.\n", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/fs2dt.c new/kexec-tools-2.0.12/kexec/fs2dt.c --- old/kexec-tools-2.0.10/kexec/fs2dt.c 2015-02-18 22:27:00.000000000 +0100 +++ new/kexec-tools-2.0.12/kexec/fs2dt.c 2016-03-02 01:14:15.000000000 +0100 @@ -39,7 +39,7 @@ #define MEMRESERVE 256 /* max number of reserved memory blocks */ #define MEM_RANGE_CHUNK_SZ 2048 /* Initial num dwords for mem ranges */ -static char pathname[MAXPATH], *pathstart; +static char pathname[MAXPATH]; static char propnames[NAMESPACE] = { 0 }; static unsigned *dt_base, *dt; static unsigned int dt_cur_size; @@ -53,6 +53,7 @@ /* Used for enabling printing message from purgatory code * Only has implemented for PPC64 */ int my_debug; +int dt_no_old_root; /* This provides the behaviour of hte existing ppc64 implementation */ static void pad_structure_block(size_t len) { @@ -511,6 +512,37 @@ return strcmp(str1, str2); } +/* grab root= from the old command line */ +static void dt_copy_old_root_param(void) +{ + FILE *fp; + char filename[MAXPATH]; + char *last_cmdline = NULL; + char *p, *old_param; + size_t len = 0; + + strcpy(filename, pathname); + strcat(filename, "bootargs"); + fp = fopen(filename, "r"); + if (fp) { + if (getline(&last_cmdline, &len, fp) == -1) + die("unable to read %s\n", filename); + + p = strstr(last_cmdline, "root="); + if (p) { + old_param = strtok(p, " "); + len = strlen(local_cmdline); + if (len != 0) + strcat(local_cmdline, " "); + strcat(local_cmdline, old_param); + } + } + if (last_cmdline) + free(last_cmdline); + + fclose(fp); +} + /* * put a node (directory) in the property structure. first properties * then children. @@ -545,7 +577,8 @@ strcpy((void *)dt, *basename ? basename : ""); dt += ((plen + 4)/4); - strcat(pathname, "/"); + if (*basename) + strcat(pathname, "/"); dn = pathname + strlen(pathname); putprops(dn, namelist, numlist); @@ -579,8 +612,11 @@ reserve(initrd_base, initrd_size); } - /* Add cmdline to the second kernel. Check to see if the new - * cmdline has a root=. If not, use the old root= cmdline. */ + /* + * Add cmdline to the second kernel. Use the old root= cmdline if there + * is no root= in the new command line and there's no --dt-no-old-root + * option being used. + */ if (!strcmp(basename,"chosen/")) { size_t result; size_t cmd_len = 0; @@ -598,30 +634,9 @@ param = strstr(local_cmdline, "root="); } - /* ... if not, grab root= from the old command line */ - if (!param) { - FILE *fp; - char *last_cmdline = NULL; - char *old_param; - - strcpy(filename, pathname); - strcat(filename, "bootargs"); - fp = fopen(filename, "r"); - if (fp) { - if (getline(&last_cmdline, &cmd_len, fp) == -1) - die("unable to read %s\n", filename); - - param = strstr(last_cmdline, "root="); - if (param) { - old_param = strtok(param, " "); - if (cmd_len != 0) - strcat(local_cmdline, " "); - strcat(local_cmdline, old_param); - } - } - if (last_cmdline) - free(last_cmdline); - } + if (!param && !dt_no_old_root) + dt_copy_old_root_param(); + strcat(local_cmdline, " "); cmd_len = strlen(local_cmdline); cmd_len = cmd_len + 1; @@ -642,15 +657,19 @@ * code can print 'I'm in purgatory' message. Currently only * pseries/hvcterminal is supported. */ - snprintf(filename, MAXPATH, "%slinux,stdout-path", pathname); + snprintf(filename, MAXPATH, "%sstdout-path", pathname); fd = open(filename, O_RDONLY); if (fd == -1) { - printf("Unable to find %s, printing from purgatory is diabled\n", - filename); - goto no_debug; + snprintf(filename, MAXPATH, "%slinux,stdout-path", pathname); + fd = open(filename, O_RDONLY); + if (fd == -1) { + printf("Unable to find %s[linux,]stdout-path, printing from purgatory is disabled\n", + pathname); + goto no_debug; + } } if (fstat(fd, &statbuf)) { - printf("Unable to stat %s, printing from purgatory is diabled\n", + printf("Unable to stat %s, printing from purgatory is disabled\n", filename); close(fd); goto no_debug; @@ -666,19 +685,19 @@ result = read(fd, buff, statbuf.st_size); close(fd); if (result <= 0) { - printf("Unable to read %s, printing from purgatory is diabled\n", + printf("Unable to read %s, printing from purgatory is disabled\n", filename); goto no_debug; } snprintf(filename, MAXPATH, "/proc/device-tree/%s/compatible", buff); fd = open(filename, O_RDONLY); if (fd == -1) { - printf("Unable to find %s printing from purgatory is diabled\n", + printf("Unable to find %s printing from purgatory is disabled\n", filename); goto no_debug; } if (fstat(fd, &statbuf)) { - printf("Unable to stat %s printing from purgatory is diabled\n", + printf("Unable to stat %s printing from purgatory is disabled\n", filename); close(fd); goto no_debug; @@ -788,8 +807,6 @@ { strcpy(pathname, "/proc/device-tree/"); - pathstart = pathname + strlen(pathname); - dt_cur_size = INIT_TREE_WORDS; dt_base = malloc(dt_cur_size*4); if (!dt_base) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/fs2dt.h new/kexec-tools-2.0.12/kexec/fs2dt.h --- old/kexec-tools-2.0.10/kexec/fs2dt.h 2013-11-19 02:05:49.000000000 +0100 +++ new/kexec-tools-2.0.12/kexec/fs2dt.h 2015-10-30 00:35:36.000000000 +0100 @@ -31,6 +31,7 @@ /* Used for enabling printing message from purgatory code * Only has implemented for PPC64 */ int my_debug; +extern int dt_no_old_root; void reserve(unsigned long long where, unsigned long long length); void create_flatten_tree(char **, off_t *, const char *); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/kexec-uImage.c new/kexec-tools-2.0.12/kexec/kexec-uImage.c --- old/kexec-tools-2.0.10/kexec/kexec-uImage.c 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/kexec-uImage.c 2015-11-17 18:30:30.000000000 +0100 @@ -224,7 +224,7 @@ return 0; } #else -static int uImage_gz_load(const char *UNUSED(buf), off_t UNUSED(len), +static int uImage_gz_load(const unsigned char *UNUSED(buf), off_t UNUSED(len), struct Image_info *UNUSED(image)) { return -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/kexec.c new/kexec-tools-2.0.12/kexec/kexec.c --- old/kexec-tools-2.0.10/kexec/kexec.c 2015-04-15 03:07:06.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/kexec.c 2015-12-01 07:21:02.000000000 +0100 @@ -26,9 +26,12 @@ #include <stdlib.h> #include <errno.h> #include <limits.h> +#include <sys/ioctl.h> +#include <sys/mount.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/reboot.h> +#include <sys/mman.h> #include <unistd.h> #include <fcntl.h> #ifndef _O_BINARY @@ -514,7 +517,8 @@ return buf; } -char *slurp_file(const char *filename, off_t *r_size) +static char *slurp_file_generic(const char *filename, off_t *r_size, + int use_mmap) { int fd; char *buf; @@ -552,12 +556,24 @@ if (err < 0) die("Can not seek to the begin of file %s: %s\n", filename, strerror(errno)); + buf = slurp_fd(fd, filename, size, &nread); + } else if (S_ISBLK(stats.st_mode)) { + err = ioctl(fd, BLKGETSIZE64, &size); + if (err < 0) + die("Can't retrieve size of block device %s: %s\n", + filename, strerror(errno)); + buf = slurp_fd(fd, filename, size, &nread); } else { size = stats.st_size; + if (use_mmap) { + buf = mmap(NULL, size, PROT_READ|PROT_WRITE, + MAP_PRIVATE, fd, 0); + nread = size; + } else { + buf = slurp_fd(fd, filename, size, &nread); + } } - - buf = slurp_fd(fd, filename, size, &nread); - if (!buf) + if ((use_mmap && (buf == MAP_FAILED)) || (!use_mmap && (buf == NULL))) die("Cannot read %s", filename); if (nread != size) @@ -567,6 +583,23 @@ return buf; } +/* + * Read file into malloced buffer. + */ +char *slurp_file(const char *filename, off_t *r_size) +{ + return slurp_file_generic(filename, r_size, 0); +} + +/* + * Map "normal" file or read "character device" into malloced buffer. + * You must not use free, realloc, etc. for the returned buffer. + */ +char *slurp_file_mmap(const char *filename, off_t *r_size) +{ + return slurp_file_generic(filename, r_size, 1); +} + /* This functions reads either specified number of bytes from the file or lesser if EOF is met. */ @@ -897,7 +930,7 @@ static void version(void) { - printf(PACKAGE_STRING " released " PACKAGE_DATE "\n"); + printf(PACKAGE_STRING "\n"); } void usage(void) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec/kexec.h new/kexec-tools-2.0.12/kexec/kexec.h --- old/kexec-tools-2.0.10/kexec/kexec.h 2015-04-15 03:05:59.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec/kexec.h 2015-12-01 07:21:02.000000000 +0100 @@ -136,6 +136,8 @@ #define RANGE_ACPI 2 #define RANGE_ACPI_NVS 3 #define RANGE_UNCACHED 4 +#define RANGE_PMEM 6 +#define RANGE_PRAM 11 }; struct memory_ranges { @@ -251,6 +253,7 @@ extern void *xmalloc(size_t size); extern void *xrealloc(void *ptr, size_t size); extern char *slurp_file(const char *filename, off_t *r_size); +extern char *slurp_file_mmap(const char *filename, off_t *r_size); extern char *slurp_file_len(const char *filename, off_t size, off_t *nread); extern char *slurp_decompress_file(const char *filename, off_t *r_size); extern unsigned long virt_to_phys(unsigned long addr); @@ -286,7 +289,7 @@ int arch_compat_trampoline(struct kexec_info *info); void arch_update_purgatory(struct kexec_info *info); int is_crashkernel_mem_reserved(void); -int get_max_crash_kernel_limit(uint64_t *start, uint64_t *end); +int get_crash_kernel_load_range(uint64_t *start, uint64_t *end); char *get_command_line(void); int kexec_iomem_for_each_line(char *match, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/kexec-tools.spec new/kexec-tools-2.0.12/kexec-tools.spec --- old/kexec-tools-2.0.10/kexec-tools.spec 2015-06-25 12:14:23.000000000 +0200 +++ new/kexec-tools-2.0.12/kexec-tools.spec 2016-03-22 02:10:46.000000000 +0100 @@ -1,6 +1,6 @@ Summary: Load one kernel from another Name: kexec-tools -Version: 2.0.10 +Version: 2.0.12 Release: 0 License: GPL Group: Development/Tools diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/purgatory/arch/ppc64/v2wrap.S new/kexec-tools-2.0.12/purgatory/arch/ppc64/v2wrap.S --- old/kexec-tools-2.0.10/purgatory/arch/ppc64/v2wrap.S 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/purgatory/arch/ppc64/v2wrap.S 2015-11-02 03:03:49.000000000 +0100 @@ -114,10 +114,24 @@ LOADADDR(6,run_at_load) # the load flag lwz 7,0(6) # possibly patched by kexec-elf-ppc64 stw 7,0x5c(4) # and patch it into the kernel - li 5,0 # r5 will be 0 for kernel - mtctr 4 # prepare branch too mr 3,16 # restore dt address - # skip cache flush, do we care? + mfmsr 5 + andi. 10,5,1 # test MSR_LE + bne little_endian + li 5,0 # r5 will be 0 for kernel + mtctr 4 # prepare branch to bctr # start kernel + +little_endian: # book3s-only + mtsrr0 4 # prepare branch to + + clrrdi 5,5,1 # clear MSR_LE + mtsrr1 5 + + li 5,0 # r5 will be 0 for kernel + + # skip cache flush, do we care? + + rfid # update MSR and start kernel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kexec-tools-2.0.10/vmcore-dmesg/vmcore-dmesg.c new/kexec-tools-2.0.12/vmcore-dmesg/vmcore-dmesg.c --- old/kexec-tools-2.0.10/vmcore-dmesg/vmcore-dmesg.c 2014-10-14 06:58:06.000000000 +0200 +++ new/kexec-tools-2.0.12/vmcore-dmesg/vmcore-dmesg.c 2015-12-09 05:00:27.000000000 +0100 @@ -540,6 +540,12 @@ exit(53); } + /* + * To collect full dmesg including the part before `dmesg -c` is useful + * for later debugging. Use same logic as what crash utility is using. + */ + logged_chars = log_end < log_buf_len ? log_end : log_buf_len; + write_to_stdout(buf + (log_buf_len - logged_chars), logged_chars); } ++++++ kexec-tools-xen-static.patch ++++++ --- /var/tmp/diff_new_pack.UTC5ua/_old 2016-06-14 23:06:29.000000000 +0200 +++ /var/tmp/diff_new_pack.UTC5ua/_new 2016-06-14 23:06:29.000000000 +0200 @@ -9,18 +9,27 @@ ================================================================================ --- - configure.ac | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) + configure.ac | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) --- a/configure.ac +++ b/configure.ac -@@ -164,7 +164,8 @@ fi +@@ -163,9 +163,17 @@ fi + dnl find Xen control stack libraries if test "$with_xen" = yes ; then ++ if pkg-config --exists 'xenlight >= 4.7' ; then AC_CHECK_HEADER(xenctrl.h, - [AC_CHECK_LIB(xenctrl, xc_kexec_load, , + [AC_CHECK_LIB(xenctrl, xc_kexec_load, -+ [AC_DEFINE([HAVE_LIBXENCTRL], [1], [libxenctrl]) [LIBS="-Wl,-Bstatic -lxenctrl -Wl,-Bdynamic -lpthread -ldl $LIBS"]], ++ [AC_DEFINE([HAVE_LIBXENCTRL], [1], [libxenctrl]) [LIBS="-Wl,-Bstatic -lxenctrl -lxencall -lxentoollog -lxenforeignmemory -Wl,-Bdynamic -lpthread -ldl $LIBS"]], AC_MSG_NOTICE([Xen support disabled]))]) ++ else ++ AC_CHECK_HEADER(xenctrl.h, ++ [AC_CHECK_LIB(xenctrl, xc_kexec_load, ++ [AC_DEFINE([HAVE_LIBXENCTRL], [1], [libxenctrl]) [LIBS="-Wl,-Bstatic -lxenctrl -Wl,-Bdynamic -lpthread -ldl $LIBS"]], ++ AC_MSG_NOTICE([Xen support disabled]))]) ++ fi fi + dnl ---Sanity checks
