Hello community,

here is the log from the commit of package kexec-tools for openSUSE:Leap:15.2 
checked in at 2020-02-16 18:25:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/kexec-tools (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.kexec-tools.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kexec-tools"

Sun Feb 16 18:25:38 2020 rev:42 rq:769907 version:2.0.20

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/kexec-tools/kexec-tools.changes        
2020-01-15 15:15:45.254253128 +0100
+++ /work/SRC/openSUSE:Leap:15.2/.kexec-tools.new.26092/kexec-tools.changes     
2020-02-16 18:25:41.638635498 +0100
@@ -1,0 +2,76 @@
+Fri Jan 10 06:02:42 UTC 2020 - Chester Lin <c...@suse.com>
+
+- Fix compiling errors of multiboot2_x86_* functions for i586
+  * kexec-tools-build-multiboot2-for-i386.patch
+
+-------------------------------------------------------------------
+Mon Dec 16 15:45:05 UTC 2019 - Chester Lin <c...@suse.com>
+
+- Bump to version 2.0.20
+  Changelog: 
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/log/?id=refs/tags/v2.0.19..v2.0.20
 
+- Backport a upstream patch series: [jsc#SLE-9032]
+  Subject: [PATCH v2 0/3] arm64: handle "reserved" entries in /proc/iomem
+  * kexec-tools-add-variant-helper-functions.patch
+  * 
kexec-tools-arm64-kexec-allocate-memory-space-avoiding-reserved-regions.patch
+  * kexec-tools-arm64-kdump-deal-with-resource-entries-in-proc-iomem.patch
+
+-------------------------------------------------------------------
+Fri Jun 14 12:11:18 UTC 2019 - Petr Tesarik <ptesa...@suse.com>
+
+- Bump to version 2.0.19
+  Changelog: 
http://git.kernel.org/cgit/utils/kernel/kexec/kexec-tools.git/log/?id=refs/tags/v2.0.18..v2.0.19
+
+-------------------------------------------------------------------
+Mon Jan 14 15:47:10 CET 2019 - ku...@suse.de
+
+- Use %license instead of %doc [bsc#1082318]
+
+-------------------------------------------------------------------
+Thu Nov  1 20:58:20 UTC 2018 - ptesa...@suse.com
+
+- Remove bogus Url RPM tag: The project does not have a home page.
+
+-------------------------------------------------------------------
+Thu Nov  1 14:58:41 UTC 2018 - ptesa...@suse.com
+
+- Bump to version 2.0.18
+  Changelog: 
http://git.kernel.org/cgit/utils/kernel/kexec/kexec-tools.git/log/?id=refs/tags/v2.0.17..v2.0.18
+- Drop patches from upstream git:
+  * kexec-tools-fix-for-Unhandled-rela-relocation-R_X86_64_PLT32.patch
+- Remove the confusing kdump binary (no longer in upstream).
+
+-------------------------------------------------------------------
+Mon Sep 10 14:27:09 UTC 2018 - Alberto Planas Dominguez <apla...@suse.com>
+
+- kexec-tools-fix-for-Unhandled-rela-relocation-R_X86_64_PLT32.patch
+  Upstream backport.
+
+  In response to a change in binutils, commit b21ebf2fb4c
+  (x86: Treat R_X86_64_PLT32 as R_X86_64_PC32) was applied to
+  the linux kernel during the 4.16 development cycle and has
+  since been backported to earlier stable kernel series. The
+  change results in the failure message in $SUBJECT when
+  rebooting via kexec.
+
+  Fix this by replicating the change in kexec. 
+
+-------------------------------------------------------------------
+Thu Apr 19 11:54:10 UTC 2018 - ptesa...@suse.com
+
+- Bump to version 2.0.17
+  Changelog: 
http://git.kernel.org/cgit/utils/kernel/kexec/kexec-tools.git/log/?id=refs/tags/v2.0.16..v2.0.17
+- Drop kexec-tools-xen-static.patch: upstream uses run-time dynamic
+  linking to address the same issue.
+- Drop all patches from upstream git:
+  * kexec-tools-add-a-helper-function-to-add-ranges.patch
+  * kexec-tools-ppc64-parse-ibm-dynamic-memory.patch
+  * kexec-tools-ppc64-leverage-kexec_file_load-support.patch
+  * kexec-tools-Return-ENOSYS-when-kexec-does-not-know.patch
+  * kexec-tools-Fix-option-checks-to-take-KEXEC_FILE_LOAD.patch
+  * kexec-tools-Do-not-special-case-the-s-option.patch
+  * kexec-tools-Add-option-to-revert-s.patch
+  * kexec-tools-Add-option-to-fall-back-to-KEXEC_LOAD.patch
+  * kexec-tools-Document-s-c-and-a-options-in-the-man-page.patch
+  * kexec-tools-fix-kexec-p-segfault.patch
+
+-------------------------------------------------------------------

Old:
----
  kexec-tools-2.0.16.tar.gz
  kexec-tools-Add-option-to-fall-back-to-KEXEC_LOAD.patch
  kexec-tools-Add-option-to-revert-s.patch
  kexec-tools-Do-not-special-case-the-s-option.patch
  kexec-tools-Document-s-c-and-a-options-in-the-man-page.patch
  kexec-tools-Fix-option-checks-to-take-KEXEC_FILE_LOAD.patch
  kexec-tools-Return-ENOSYS-when-kexec-does-not-know.patch
  kexec-tools-add-a-helper-function-to-add-ranges.patch
  kexec-tools-fix-kexec-p-segfault.patch
  kexec-tools-ppc64-leverage-kexec_file_load-support.patch
  kexec-tools-ppc64-parse-ibm-dynamic-memory.patch
  kexec-tools-xen-static.patch

New:
----
  kexec-tools-2.0.20.tar.xz
  kexec-tools-add-variant-helper-functions.patch
  kexec-tools-arm64-kdump-deal-with-resource-entries-in-proc-iomem.patch
  kexec-tools-arm64-kexec-allocate-memory-space-avoiding-reserved-regions.patch
  kexec-tools-build-multiboot2-for-i386.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kexec-tools.spec ++++++
--- /var/tmp/diff_new_pack.HuuUM2/_old  2020-02-16 18:25:42.310635850 +0100
+++ /var/tmp/diff_new_pack.HuuUM2/_new  2020-02-16 18:25:42.318635854 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package kexec-tools
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,36 +12,28 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           kexec-tools
-Version:        2.0.16
+Version:        2.0.20
 Release:        0
 Summary:        Tools for loading replacement kernels into memory
-License:        GPL-2.0+
+License:        GPL-2.0-or-later
 Group:          System/Kernel
-Url:            
ftp://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.bz2
-Source:         
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/snapshot/%{name}-%{version}.tar.gz
+Source:         
https://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
 Source1:        kexec-bootloader
 Source2:        kexec-bootloader.8
 Source3:        kexec-load.service
 Source4:        %{name}-rpmlintrc
-Patch1:         %{name}-xen-static.patch
 Patch2:         %{name}-xen-balloon-up.patch
 Patch3:         %{name}-disable-test.patch
-Patch4:         %{name}-add-a-helper-function-to-add-ranges.patch
-Patch5:         %{name}-ppc64-parse-ibm-dynamic-memory.patch
-Patch6:         %{name}-ppc64-leverage-kexec_file_load-support.patch
-Patch7:         %{name}-Return-ENOSYS-when-kexec-does-not-know.patch
-Patch8:         %{name}-Fix-option-checks-to-take-KEXEC_FILE_LOAD.patch
-Patch9:         %{name}-Do-not-special-case-the-s-option.patch
-Patch10:        %{name}-Add-option-to-revert-s.patch
-Patch11:        %{name}-Add-option-to-fall-back-to-KEXEC_LOAD.patch
-Patch12:        %{name}-Document-s-c-and-a-options-in-the-man-page.patch
-Patch13:        %{name}-fix-kexec-p-segfault.patch
-Patch14:        %{name}-vmcoreinfo-in-xen.patch
+Patch4:         %{name}-vmcoreinfo-in-xen.patch
+Patch5:         %{name}-add-variant-helper-functions.patch
+Patch6:         
%{name}-arm64-kexec-allocate-memory-space-avoiding-reserved-regions.patch
+Patch7:         
%{name}-arm64-kdump-deal-with-resource-entries-in-proc-iomem.patch
+Patch8:         %{name}-build-multiboot2-for-i386.patch
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  systemd-rpm-macros
@@ -65,7 +57,6 @@
 
 %prep
 %setup -q
-%patch1 -p1
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
@@ -73,12 +64,6 @@
 %patch6 -p1
 %patch7 -p1
 %patch8 -p1
-%patch9 -p1
-%patch10 -p1
-%patch11 -p1
-%patch12 -p1
-%patch13 -p1
-%patch14 -p1
 
 %build
 autoreconf -fvi
@@ -90,7 +75,6 @@
 %install
 %make_install
 install -c -m 0644 %{SOURCE2} %{buildroot}/%{_mandir}/man8
-rm -f %{buildroot}/%{_mandir}/man8/kdump.8
 mkdir -p %{buildroot}/%{_sbindir}
 install -m 0755 %{SOURCE1} %{buildroot}/%{_sbindir}
 mkdir -p %{buildroot}/%{_unitdir}
@@ -98,7 +82,6 @@
 ln -s service %{buildroot}%{_sbindir}/rckexec-load
 #UsrMerge
 mkdir -p %{buildroot}/sbin
-ln -s %{_sbindir}/kdump %{buildroot}/sbin
 ln -s %{_sbindir}/kexec %{buildroot}/sbin
 #EndUsrMerge
 
@@ -119,15 +102,26 @@
 %posttrans
 %{?regenerate_initrd_posttrans}
 
+# Compatibility cruft
+# there is no %license prior to SLE12
+%if %{undefined _defaultlicensedir}
+%define license %doc
+%else
+# filesystem before SLE12 SP3 lacks /usr/share/licenses
+%if 0%(test ! -d %{_defaultlicensedir} && echo 1)
+%define _defaultlicensedir %_defaultdocdir
+%endif
+%endif
+# End of compatibility cruft
+
 %files
-%doc AUTHORS COPYING News TODO doc
+%license COPYING
+%doc AUTHORS News TODO doc
 %{_mandir}/man*/*
 #UsrMerge
-/sbin/kdump
 /sbin/kexec
 #EndUsrMerge
 %{_sbindir}/rckexec-load
-%{_sbindir}/kdump
 %{_sbindir}/kexec
 %{_sbindir}/kexec-bootloader
 %{_sbindir}/vmcore-dmesg

++++++ kexec-tools-add-variant-helper-functions.patch ++++++
From: AKASHI Takahiro <takahiro.aka...@linaro.org>
Date: Fri, 11 Jan 2019 01:59:44 +0900
Subject: kexec: add variant helper functions for handling memory regions
References: jsc#SLE-9943
Upstream: not yet, it's under review in upstream

mem_regions_alloc_and_add() and mem_regions_alloc_and_exclude() are
functionally equivalent to, respectively, mem_regions_add() and
mem_regions_exclude() except the formers will re-allocate memory
dynamically when no more entries are available in 'ranges' array.

Signed-off-by: AKASHI Takahiro <takahiro.aka...@linaro.org>
Signed-off-by: Chester Lin <c...@suse.com>
---
 kexec/mem_regions.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 kexec/mem_regions.h |  7 +++++++
 2 files changed, 49 insertions(+)

diff --git a/kexec/mem_regions.c b/kexec/mem_regions.c
index 50c8abccb93a..ad7d3f13fd84 100644
--- a/kexec/mem_regions.c
+++ b/kexec/mem_regions.c
@@ -125,3 +125,45 @@ int mem_regions_exclude(struct memory_ranges *ranges,
        }
        return 0;
 }
+
+#define KEXEC_MEMORY_RANGES 16
+
+int mem_regions_alloc_and_add(struct memory_ranges *ranges,
+                             unsigned long long base,
+                             unsigned long long length, int type)
+{
+       void *new_ranges;
+
+       if (ranges->size >= ranges->max_size) {
+               new_ranges = realloc(ranges->ranges,
+                               sizeof(struct memory_range) *
+                               (ranges->max_size + KEXEC_MEMORY_RANGES));
+               if (!new_ranges)
+                       return -1;
+
+               ranges->ranges = new_ranges;
+               ranges->max_size += KEXEC_MEMORY_RANGES;
+       }
+
+       return mem_regions_add(ranges, base, length, type);
+}
+
+int mem_regions_alloc_and_exclude(struct memory_ranges *ranges,
+                                 const struct memory_range *range)
+{
+       void *new_ranges;
+
+       /* for safety, we should have at least one free entry in ranges */
+       if (ranges->size >= ranges->max_size) {
+               new_ranges = realloc(ranges->ranges,
+                               sizeof(struct memory_range) *
+                               (ranges->max_size + KEXEC_MEMORY_RANGES));
+               if (!new_ranges)
+                       return -1;
+
+               ranges->ranges = new_ranges;
+               ranges->max_size += KEXEC_MEMORY_RANGES;
+       }
+
+       return mem_regions_exclude(ranges, range);
+}
diff --git a/kexec/mem_regions.h b/kexec/mem_regions.h
index ae9e972b0206..e306d67e3261 100644
--- a/kexec/mem_regions.h
+++ b/kexec/mem_regions.h
@@ -12,4 +12,11 @@ int mem_regions_exclude(struct memory_ranges *ranges,
 int mem_regions_add(struct memory_ranges *ranges, unsigned long long base,
                     unsigned long long length, int type);
 
+int mem_regions_alloc_and_exclude(struct memory_ranges *ranges,
+                                 const struct memory_range *range);
+
+int mem_regions_alloc_and_add(struct memory_ranges *ranges,
+                             unsigned long long base,
+                             unsigned long long length, int type);
+
 #endif
++++++ kexec-tools-arm64-kdump-deal-with-resource-entries-in-proc-iomem.patch 
++++++
From: AKASHI Takahiro <takahiro.aka...@linaro.org>
Date: Fri, 11 Jan 2019 01:59:46 +0900
Subject: arm64: kdump: deal with a lot of resource entries in /proc/iomem
References: jsc#SLE-9943
Upstream: not yet, it's under review in upstream

As described in the commit ("arm64: kexec: allocate memory space avoiding
reserved regions"), /proc/iomem now has a lot of "reserved" entries, and
it's not just enough to have a fixed size of memory range array.

With this patch, kdump is allowed to handle arbitrary number of memory
ranges, using mem_regions_alloc_and_xxx() functions.

Signed-off-by: AKASHI Takahiro <takahiro.aka...@linaro.org>
Signed-off-by: Chester Lin <c...@suse.com>
---
 kexec/arch/arm64/crashdump-arm64.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/kexec/arch/arm64/crashdump-arm64.c 
b/kexec/arch/arm64/crashdump-arm64.c
index 4fd7aa8fd43c..38d1a0f3000d 100644
--- a/kexec/arch/arm64/crashdump-arm64.c
+++ b/kexec/arch/arm64/crashdump-arm64.c
@@ -23,13 +23,8 @@
 #include "kexec-elf.h"
 #include "mem_regions.h"
 
-/* memory ranges on crashed kernel */
-static struct memory_range system_memory_ranges[CRASH_MAX_MEMORY_RANGES];
-static struct memory_ranges system_memory_rgns = {
-       .size = 0,
-       .max_size = CRASH_MAX_MEMORY_RANGES,
-       .ranges = system_memory_ranges,
-};
+/* memory ranges of crashed kernel */
+static struct memory_ranges system_memory_rgns;
 
 /* memory range reserved for crashkernel */
 struct memory_range crash_reserved_mem;
@@ -82,7 +77,7 @@ static uint64_t get_kernel_page_offset(void)
  *
  * 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, respectively, system_memory_ranges and crash_reserved_mem.
+ * variables, respectively, system_memory_rgns and usablemem_rgns.
  */
 
 static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr),
@@ -90,11 +85,11 @@ static int iomem_range_callback(void *UNUSED(data), int 
UNUSED(nr),
                                unsigned long long length)
 {
        if (strncmp(str, CRASH_KERNEL, strlen(CRASH_KERNEL)) == 0)
-               return mem_regions_add(&usablemem_rgns,
-                                      base, length, RANGE_RAM);
+               return mem_regions_alloc_and_add(&usablemem_rgns,
+                                               base, length, RANGE_RAM);
        else if (strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) == 0)
-               return mem_regions_add(&system_memory_rgns,
-                                      base, length, RANGE_RAM);
+               return mem_regions_alloc_and_add(&system_memory_rgns,
+                                               base, length, RANGE_RAM);
        else if (strncmp(str, KERNEL_CODE, strlen(KERNEL_CODE)) == 0)
                elf_info.kern_paddr_start = base;
        else if (strncmp(str, KERNEL_DATA, strlen(KERNEL_DATA)) == 0)
@@ -135,9 +130,9 @@ static int crash_get_memory_ranges(void)
 
        dbgprint_mem_range("Reserved memory range", &crash_reserved_mem, 1);
 
-       if (mem_regions_exclude(&system_memory_rgns, &crash_reserved_mem)) {
-               fprintf(stderr,
-                       "Error: Number of crash memory ranges excedeed the max 
limit\n");
+       if (mem_regions_alloc_and_exclude(&system_memory_rgns,
+                                               &crash_reserved_mem)) {
+               fprintf(stderr, "Cannot allocate memory for ranges\n");
                return -ENOMEM;
        }
 
++++++ 
kexec-tools-arm64-kexec-allocate-memory-space-avoiding-reserved-regions.patch 
++++++
From: AKASHI Takahiro <takahiro.aka...@linaro.org>
Date: Fri, 11 Jan 2019 01:59:45 +0900
Subject: arm64: kexec: allocate memory space avoiding reserved regions
References: jsc#SLE-9943
Upstream: not yet, it's under review in upstream

On UEFI/ACPI-only system, some memory regions, including but not limited
to UEFI memory map and ACPI tables, must be preserved across kexec'ing.
Otherwise, they can be corrupted and result in early failure in booting
a new kernel.

In recent kernels, /proc/iomem now has an extended file format like:
        40000000-5871ffff : System RAM
          41800000-426affff : Kernel code
          426b0000-42aaffff : reserved
          42ab0000-42c64fff : Kernel data
          54400000-583fffff : Crash kernel
          58590000-585effff : reserved
          58700000-5871ffff : reserved
        58720000-58b5ffff : reserved
        58b60000-5be3ffff : System RAM
          58b61000-58b61fff : reserved
          59a77000-59a77fff : reserved
        5be40000-5becffff : reserved
        5bed0000-5bedffff : System RAM
        5bee0000-5bffffff : reserved
        5c000000-5fffffff : System RAM
          5da00000-5e9fffff : reserved
          5ec00000-5edfffff : reserved
          5ef6a000-5ef6afff : reserved
          5ef6b000-5efcafff : reserved
          5efcd000-5efcffff : reserved
          5efd0000-5effffff : reserved
          5f000000-5fffffff : reserved

where the "reserved" entries at the top level or under System RAM (and
its descendant resources) are ones of such kind and should not be regarded
as usable memory ranges where several free spaces for loading kexec data
will be allocated.

With this patch, get_memory_ranges() will handle this format of file
correctly. Note that, for safety, unknown regions, in addition to
"reserved" ones, will also be excluded.

Signed-off-by: AKASHI Takahiro <takahiro.aka...@linaro.org>
Signed-off-by: Chester Lin <c...@suse.com>
---
 kexec/arch/arm64/kexec-arm64.c | 146 ++++++++++++++++++++-------------
 1 file changed, 87 insertions(+), 59 deletions(-)

diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
index 1cde75d1a771..2e923b54f5b1 100644
--- a/kexec/arch/arm64/kexec-arm64.c
+++ b/kexec/arch/arm64/kexec-arm64.c
@@ -10,7 +10,9 @@
 #include <inttypes.h>
 #include <libfdt.h>
 #include <limits.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <linux/elf-em.h>
 #include <elf.h>
@@ -29,6 +31,7 @@
 #include "fs2dt.h"
 #include "iomem.h"
 #include "kexec-syscall.h"
+#include "mem_regions.h"
 #include "arch/options.h"
 
 #define ROOT_NODE_ADDR_CELLS_DEFAULT 1
@@ -899,19 +902,33 @@ int get_phys_base_from_pt_load(unsigned long *phys_offset)
        return 0;
 }
 
+static bool to_be_excluded(char *str)
+{
+       if (!strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) ||
+           !strncmp(str, KERNEL_CODE, strlen(KERNEL_CODE)) ||
+           !strncmp(str, KERNEL_DATA, strlen(KERNEL_DATA)) ||
+           !strncmp(str, CRASH_KERNEL, strlen(CRASH_KERNEL)))
+               return false;
+       else
+               return true;
+}
+
 /**
- * get_memory_ranges_iomem_cb - Helper for get_memory_ranges_iomem.
+ * get_memory_ranges - Try to get the memory ranges from
+ * /proc/iomem.
  */
-
-static int get_memory_ranges_iomem_cb(void *data, int nr, char *str,
-       unsigned long long base, unsigned long long length)
+int get_memory_ranges(struct memory_range **range, int *ranges,
+       unsigned long kexec_flags)
 {
-       int ret;
        unsigned long phys_offset = UINT64_MAX;
-       struct memory_range *r;
-
-       if (nr >= KEXEC_SEGMENT_MAX)
-               return -1;
+       FILE *fp;
+       const char *iomem = proc_iomem();
+       char line[MAX_LINE], *str;
+       unsigned long long start, end;
+       int n, consumed;
+       struct memory_ranges memranges;
+       struct memory_range *last, excl_range;
+       int ret;
 
        if (!try_read_phys_offset_from_kcore) {
                /* Since kernel version 4.19, 'kcore' contains
@@ -945,17 +962,65 @@ static int get_memory_ranges_iomem_cb(void *data, int nr, 
char *str,
                try_read_phys_offset_from_kcore = true;
        }
 
-       r = (struct memory_range *)data + nr;
+       fp = fopen(iomem, "r");
+       if (!fp)
+               die("Cannot open %s\n", iomem);
+
+       memranges.ranges = NULL;
+       memranges.size = memranges.max_size  = 0;
+
+       while (fgets(line, sizeof(line), fp) != 0) {
+               n = sscanf(line, "%llx-%llx : %n", &start, &end, &consumed);
+               if (n != 2)
+                       continue;
+               str = line + consumed;
+
+               if (!strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM))) {
+                       ret = mem_regions_alloc_and_add(&memranges,
+                                       start, end - start + 1, RANGE_RAM);
+                       if (ret) {
+                               fprintf(stderr,
+                                       "Cannot allocate memory for ranges\n");
+                               return -ENOMEM;
+                       }
 
-       if (!strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)))
-               r->type = RANGE_RAM;
-       else if (!strncmp(str, IOMEM_RESERVED, strlen(IOMEM_RESERVED)))
-               r->type = RANGE_RESERVED;
-       else
-               return 1;
+                       dbgprintf("%s:+[%d] %016llx - %016llx\n", __func__,
+                               memranges.size - 1,
+                               memranges.ranges[memranges.size - 1].start,
+                               memranges.ranges[memranges.size - 1].end);
+               } else if (to_be_excluded(str)) {
+                       if (!memranges.size)
+                               continue;
+
+                       /*
+                        * Note: mem_regions_exclude() doesn't guarantee
+                        * that the ranges are sorted out, but as long as
+                        * we cope with /proc/iomem, we only operate on
+                        * the last entry and so it is safe.
+                        */
 
-       r->start = base;
-       r->end = base + length - 1;
+                       /* The last System RAM range */
+                       last = &memranges.ranges[memranges.size - 1];
+
+                       if (last->end < start)
+                               /* New resource outside of System RAM */
+                               continue;
+                       if (end < last->start)
+                               /* Already excluded by parent resource */
+                               continue;
+
+                       excl_range.start = start;
+                       excl_range.end = end;
+                       mem_regions_alloc_and_exclude(&memranges, &excl_range);
+                       dbgprintf("%s:-      %016llx - %016llx\n",
+                                       __func__, start, end);
+               }
+       }
+
+       fclose(fp);
+
+       *range = memranges.ranges;
+       *ranges = memranges.size;
 
        /* As a fallback option, we can try determining the PHYS_OFFSET
         * value from the '/proc/iomem' entries as well.
@@ -976,52 +1041,15 @@ static int get_memory_ranges_iomem_cb(void *data, int 
nr, char *str,
         * between the user-space and kernel space 'PHYS_OFFSET'
         * value.
         */
-       set_phys_offset(r->start, "iomem");
+       if (memranges.size)
+               set_phys_offset(memranges.ranges[0].start, "iomem");
 
-       dbgprintf("%s: %016llx - %016llx : %s", __func__, r->start,
-               r->end, str);
+       dbgprint_mem_range("System RAM ranges;",
+                               memranges.ranges, memranges.size);
 
        return 0;
 }
 
-/**
- * get_memory_ranges_iomem - Try to get the memory ranges from
- * /proc/iomem.
- */
-
-static int get_memory_ranges_iomem(struct memory_range *array,
-       unsigned int *count)
-{
-       *count = kexec_iomem_for_each_line(NULL,
-               get_memory_ranges_iomem_cb, array);
-
-       if (!*count) {
-               dbgprintf("%s: failed: No RAM found.\n", __func__);
-               return EFAILED;
-       }
-
-       return 0;
-}
-
-/**
- * get_memory_ranges - Try to get the memory ranges some how.
- */
-
-int get_memory_ranges(struct memory_range **range, int *ranges,
-       unsigned long kexec_flags)
-{
-       static struct memory_range array[KEXEC_SEGMENT_MAX];
-       unsigned int count;
-       int result;
-
-       result = get_memory_ranges_iomem(array, &count);
-
-       *range = result ? NULL : array;
-       *ranges = result ? 0 : count;
-
-       return result;
-}
-
 int arch_compat_trampoline(struct kexec_info *info)
 {
        return 0;
++++++ kexec-tools-build-multiboot2-for-i386.patch ++++++
From: Chris Packham <chris.pack...@alliedtelesis.co.nz>
Date: Sun, 17 Nov 2019 15:52:15 -0800
Subject: kexec: build multiboot2 for i386
References: jsc#SLE-9943
Upstream: Queued, 
http://lists.infradead.org/pipermail/kexec/2020-January/024311.html

This addresses the following compilation issues when building for i386.

 kexec/arch/i386/kexec-x86.c:39:22: error: 'multiboot2_x86_probe' undeclared 
here (not in a function); did you mean 'multiboot_x86_probe'?
   { "multiboot2-x86", multiboot2_x86_probe, multiboot2_x86_load,
                       ^~~~~~~~~~~~~~~~~~~~
                       multiboot_x86_probe
 kexec/arch/i386/kexec-x86.c:39:44: error: 'multiboot2_x86_load' undeclared 
here (not in a function); did you mean 'multiboot_x86_load'?
   { "multiboot2-x86", multiboot2_x86_probe, multiboot2_x86_load,
                                             ^~~~~~~~~~~~~~~~~~~
                                             multiboot_x86_load
 kexec/arch/i386/kexec-x86.c:40:4: error: 'multiboot2_x86_usage' undeclared 
here (not in a function); did you mean 'multiboot_x86_usage'?
     multiboot2_x86_usage },
     ^~~~~~~~~~~~~~~~~~~~
     multiboot_x86_usage
 make: *** [Makefile:114: kexec/arch/i386/kexec-x86.o] Error 1
 make: *** Waiting for unfinished jobs....

Signed-off-by: Chris Packham <chris.pack...@alliedtelesis.co.nz>
Signed-off-by: Chester Lin <c...@suse.com>
---
I wasn't sure whether this should be fixed by linking with kexec-mb2-x86.o or
by removing the code from kexec-x86.c. I went for the former but I'd happily
change to the latter.

 kexec/arch/i386/Makefile    | 2 +-
 kexec/arch/i386/kexec-x86.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/kexec/arch/i386/Makefile b/kexec/arch/i386/Makefile
index 105cefd..f486103 100644
--- a/kexec/arch/i386/Makefile
+++ b/kexec/arch/i386/Makefile
@@ -7,6 +7,7 @@ i386_KEXEC_SRCS += kexec/arch/i386/kexec-elf-x86.c
 i386_KEXEC_SRCS += kexec/arch/i386/kexec-elf-rel-x86.c
 i386_KEXEC_SRCS += kexec/arch/i386/kexec-bzImage.c
 i386_KEXEC_SRCS += kexec/arch/i386/kexec-multiboot-x86.c
+i386_KEXEC_SRCS += kexec/arch/i386/kexec-mb2-x86.c
 i386_KEXEC_SRCS += kexec/arch/i386/kexec-beoboot-x86.c
 i386_KEXEC_SRCS += kexec/arch/i386/kexec-nbi.c
 i386_KEXEC_SRCS += kexec/arch/i386/x86-linux-setup.c
@@ -14,7 +15,6 @@ i386_KEXEC_SRCS += kexec/arch/i386/crashdump-x86.c
 
 dist += kexec/arch/i386/Makefile $(i386_KEXEC_SRCS)                    \
        kexec/arch/i386/crashdump-x86.h                                 \
-       kexec/arch/i386/kexec-mb2-x86.c                                 \
        kexec/arch/i386/kexec-x86.h                                     \
        kexec/arch/i386/x86-linux-setup.h                               \
        kexec/arch/i386/include/arch/options.h
diff --git a/kexec/arch/i386/kexec-x86.h b/kexec/arch/i386/kexec-x86.h
index 1b58c3b..0f941df 100644
--- a/kexec/arch/i386/kexec-x86.h
+++ b/kexec/arch/i386/kexec-x86.h
@@ -60,6 +60,11 @@ int multiboot_x86_load(int argc, char **argv, const char 
*buf, off_t len,
        struct kexec_info *info);
 void multiboot_x86_usage(void);
 
+int multiboot2_x86_load(int argc, char **argv, const char *buf, off_t len,
+                       struct kexec_info *info);
+void multiboot2_x86_usage(void);
+int multiboot2_x86_probe(const char *buf, off_t buf_len);
+
 int elf_x86_probe(const char *buf, off_t len);
 int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
        struct kexec_info *info);
++++++ kexec-tools-disable-test.patch ++++++
--- /var/tmp/diff_new_pack.HuuUM2/_old  2020-02-16 18:25:42.382635888 +0100
+++ /var/tmp/diff_new_pack.HuuUM2/_new  2020-02-16 18:25:42.386635890 +0100
@@ -8,14 +8,12 @@
  Makefile.in |    7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
 
-Index: kexec-tools-2.0.14/Makefile.in
-===================================================================
---- kexec-tools-2.0.14.orig/Makefile.in
-+++ kexec-tools-2.0.14/Makefile.in
-@@ -178,8 +178,11 @@ PSRCS:=$(foreach s, $(SRCS), $(PACKAGE_N
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -173,8 +173,11 @@ PSRCS:=$(foreach s, $(SRCS), $(PACKAGE_N
  PGSRCS:=$(foreach s, $(GENERATED_SRCS), 
$(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
  
- MAN_PAGES:=$(KEXEC_MANPAGE) $(KDUMP_MANPAGE) $(VMCORE_DMESG_MANPAGE)
+ MAN_PAGES:=$(KEXEC_MANPAGE) $(VMCORE_DMESG_MANPAGE)
 -BINARIES_i386:=$(KEXEC_TEST)
 -BINARIES_x86_64:=$(KEXEC_TEST)
 +# Dont' build kexec_test
@@ -23,6 +21,6 @@
 +#BINARIES_x86_64:=$(KEXEC_TEST)
 +BINARIES_i386:=
 +BINARIES_x86_64:=
- BINARIES:=$(KEXEC) $(KDUMP) $(VMCORE_DMESG) $(BINARIES_$(ARCH))
+ BINARIES:=$(KEXEC) $(VMCORE_DMESG) $(BINARIES_$(ARCH))
  
- TARGETS:=$(BINARIES) $(MAN_PAGES)
+ UNINSTALL_KDUMP = $(sbindir)/kdump


Reply via email to