Compare commits
No commits in common. "z1" and "main" have entirely different histories.
13 changed files with 924 additions and 1195 deletions
File diff suppressed because it is too large
Load diff
25
kexec-tools-SYS_getrandom.patch
Normal file
25
kexec-tools-SYS_getrandom.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
From: Petr Tesarik <ptesarik@suse.com>
|
||||
Subject: Define SYS_getrandom if needed
|
||||
Upstream: never, build fix for SLE12
|
||||
|
||||
SLE12 did not provide a definition for SYS_getrandom.
|
||||
|
||||
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
|
||||
---
|
||||
kexec/arch/arm64/kexec-arm64.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||
@@ -34,6 +34,11 @@
|
||||
#include "mem_regions.h"
|
||||
#include "arch/options.h"
|
||||
|
||||
+#ifndef __NR_getrandom
|
||||
+#define __NR_getrandom 278
|
||||
+__SYSCALL(__NR_getrandom, sys_getrandom)
|
||||
+#endif
|
||||
+
|
||||
#define ROOT_NODE_ADDR_CELLS_DEFAULT 1
|
||||
#define ROOT_NODE_SIZE_CELLS_DEFAULT 1
|
||||
|
84
kexec-tools-add-variant-helper-functions.patch
Normal file
84
kexec-tools-add-variant-helper-functions.patch
Normal file
|
@ -0,0 +1,84 @@
|
|||
From: AKASHI Takahiro <takahiro.akashi@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.akashi@linaro.org>
|
||||
Signed-off-by: Chester Lin <clin@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
|
|
@ -0,0 +1,77 @@
|
|||
From: AKASHI Takahiro <takahiro.akashi@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.akashi@linaro.org>
|
||||
Signed-off-by: Chester Lin <clin@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;
|
||||
}
|
||||
|
|
@ -0,0 +1,247 @@
|
|||
From: AKASHI Takahiro <takahiro.akashi@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.akashi@linaro.org>
|
||||
Signed-off-by: Chester Lin <clin@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;
|
70
kexec-tools-build-multiboot2-for-i386.patch
Normal file
70
kexec-tools-build-multiboot2-for-i386.patch
Normal file
|
@ -0,0 +1,70 @@
|
|||
From: Chris Packham <chris.packham@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.packham@alliedtelesis.co.nz>
|
||||
Signed-off-by: Chester Lin <clin@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);
|
230
kexec-tools-fix-kexec_file_load-error-handling.patch
Normal file
230
kexec-tools-fix-kexec_file_load-error-handling.patch
Normal file
|
@ -0,0 +1,230 @@
|
|||
From 0ec1fd23847ba103f967e3377e2a1b13712cff6e Mon Sep 17 00:00:00 2001
|
||||
From: Petr Tesarik <ptesarik@suse.com>
|
||||
Date: Thu, 12 Mar 2020 20:12:12 +0100
|
||||
Upstream: not yet, patch sent 2020-03-12
|
||||
Subject: Fix kexec_file_load(2) error handling
|
||||
References: bsc#1166105
|
||||
|
||||
The handling of kexec_file_load() error conditions needs some
|
||||
improvement.
|
||||
|
||||
First, on failure, the system call itself returns -1 and sets
|
||||
errno. It is wrong to check the return value itself.
|
||||
|
||||
Second, do_kexec_file_load() mixes different types of error
|
||||
codes (-1, return value of a load method, negative kernel error
|
||||
number). Let it always return one of the reason codes defined in
|
||||
kexec/kexec.h.
|
||||
|
||||
Third, the caller of do_kexec_file_load() cannot know what exactly
|
||||
failed inside that function, so it should not check errno directly.
|
||||
All it needs to know is whether it makes sense to fall back to the
|
||||
other syscall. Add an error code for that purpose (EFALLBACK), and
|
||||
let do_kexec_file_load() decide.
|
||||
|
||||
Fourth, do_kexec_file_load() should not print any error message if
|
||||
it returns EFALLBACK, because the fallback syscall may succeed
|
||||
later, and the user is confused whether the command failed, or not.
|
||||
Move the error message towards the end of main().
|
||||
|
||||
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
|
||||
---
|
||||
kexec/kexec.c | 114 ++++++++++++++++++++++++++++++----------------------------
|
||||
kexec/kexec.h | 1 +
|
||||
2 files changed, 61 insertions(+), 54 deletions(-)
|
||||
|
||||
diff --git a/kexec/kexec.c b/kexec/kexec.c
|
||||
index bc6ab3d..33c1b4b 100644
|
||||
--- a/kexec/kexec.c
|
||||
+++ b/kexec/kexec.c
|
||||
@@ -836,11 +836,21 @@ static int kexec_file_unload(unsigned long kexec_file_flags)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
+ if (!is_kexec_file_load_implemented())
|
||||
+ return EFALLBACK;
|
||||
+
|
||||
ret = kexec_file_load(-1, -1, 0, NULL, kexec_file_flags);
|
||||
if (ret != 0) {
|
||||
- /* The unload failed, print some debugging information */
|
||||
- fprintf(stderr, "kexec_file_load(unload) failed\n: %s\n",
|
||||
- strerror(errno));
|
||||
+ if (errno == ENOSYS) {
|
||||
+ ret = EFALLBACK;
|
||||
+ } else {
|
||||
+ /*
|
||||
+ * The unload failed, print some debugging
|
||||
+ * information */
|
||||
+ fprintf(stderr, "kexec_file_load(unload) failed: %s\n",
|
||||
+ strerror(errno));
|
||||
+ ret = EFAILED;
|
||||
+ }
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1182,15 +1192,13 @@ static int do_kexec_file_load(int fileind, int argc, char **argv,
|
||||
info.file_mode = 1;
|
||||
info.initrd_fd = -1;
|
||||
|
||||
- if (!is_kexec_file_load_implemented()) {
|
||||
- fprintf(stderr, "syscall kexec_file_load not available.\n");
|
||||
- return -ENOSYS;
|
||||
- }
|
||||
+ if (!is_kexec_file_load_implemented())
|
||||
+ return EFALLBACK;
|
||||
|
||||
if (argc - fileind <= 0) {
|
||||
fprintf(stderr, "No kernel specified\n");
|
||||
usage();
|
||||
- return -1;
|
||||
+ return EFAILED;
|
||||
}
|
||||
|
||||
kernel = argv[fileind];
|
||||
@@ -1199,7 +1207,7 @@ static int do_kexec_file_load(int fileind, int argc, char **argv,
|
||||
if (kernel_fd == -1) {
|
||||
fprintf(stderr, "Failed to open file %s:%s\n", kernel,
|
||||
strerror(errno));
|
||||
- return -1;
|
||||
+ return EFAILED;
|
||||
}
|
||||
|
||||
/* slurp in the input kernel */
|
||||
@@ -1225,7 +1233,7 @@ static int do_kexec_file_load(int fileind, int argc, char **argv,
|
||||
if (i == file_types) {
|
||||
fprintf(stderr, "Cannot determine the file type " "of %s\n",
|
||||
kernel);
|
||||
- return -1;
|
||||
+ return EFAILED;
|
||||
}
|
||||
|
||||
ret = file_type[i].load(argc, argv, kernel_buf, kernel_size, &info);
|
||||
@@ -1243,9 +1251,43 @@ static int do_kexec_file_load(int fileind, int argc, char **argv,
|
||||
|
||||
ret = kexec_file_load(kernel_fd, info.initrd_fd, info.command_line_len,
|
||||
info.command_line, info.kexec_flags);
|
||||
- if (ret != 0)
|
||||
- fprintf(stderr, "kexec_file_load failed: %s\n",
|
||||
- strerror(errno));
|
||||
+ if (ret != 0) {
|
||||
+ switch (errno) {
|
||||
+ /*
|
||||
+ * Something failed with signature verification.
|
||||
+ * Reject the image.
|
||||
+ */
|
||||
+ case ELIBBAD:
|
||||
+ case EKEYREJECTED:
|
||||
+ case ENOPKG:
|
||||
+ case ENOKEY:
|
||||
+ case EBADMSG:
|
||||
+ case EMSGSIZE:
|
||||
+ /* Reject by default. */
|
||||
+ default:
|
||||
+ ret = EFAILED;
|
||||
+ break;
|
||||
+
|
||||
+ /* Not implemented. */
|
||||
+ case ENOSYS:
|
||||
+ /*
|
||||
+ * Parsing image or other options failed
|
||||
+ * The image may be invalid or image
|
||||
+ * type may not supported by kernel so
|
||||
+ * retry parsing in kexec-tools.
|
||||
+ */
|
||||
+ case EINVAL:
|
||||
+ case ENOEXEC:
|
||||
+ /*
|
||||
+ * ENOTSUP can be unsupported image
|
||||
+ * type or unsupported PE signature
|
||||
+ * wrapper type, duh.
|
||||
+ */
|
||||
+ case ENOTSUP:
|
||||
+ ret = EFALLBACK;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
close(kernel_fd);
|
||||
return ret;
|
||||
@@ -1496,7 +1538,7 @@ int main(int argc, char *argv[])
|
||||
if (do_unload) {
|
||||
if (do_kexec_file_syscall) {
|
||||
result = kexec_file_unload(kexec_file_flags);
|
||||
- if ((result == -ENOSYS) && do_kexec_fallback)
|
||||
+ if (result == EFALLBACK && do_kexec_fallback)
|
||||
do_kexec_file_syscall = 0;
|
||||
}
|
||||
if (!do_kexec_file_syscall)
|
||||
@@ -1506,46 +1548,8 @@ int main(int argc, char *argv[])
|
||||
if (do_kexec_file_syscall) {
|
||||
result = do_kexec_file_load(fileind, argc, argv,
|
||||
kexec_file_flags);
|
||||
- if (do_kexec_fallback) switch (result) {
|
||||
- /*
|
||||
- * Something failed with signature verification.
|
||||
- * Reject the image.
|
||||
- */
|
||||
- case -ELIBBAD:
|
||||
- case -EKEYREJECTED:
|
||||
- case -ENOPKG:
|
||||
- case -ENOKEY:
|
||||
- case -EBADMSG:
|
||||
- case -EMSGSIZE:
|
||||
- /*
|
||||
- * By default reject or do nothing if
|
||||
- * succeded
|
||||
- */
|
||||
- default: break;
|
||||
- case -ENOSYS: /* not implemented */
|
||||
- /*
|
||||
- * Parsing image or other options failed
|
||||
- * The image may be invalid or image
|
||||
- * type may not supported by kernel so
|
||||
- * retry parsing in kexec-tools.
|
||||
- */
|
||||
- case -EINVAL:
|
||||
- case -ENOEXEC:
|
||||
- /*
|
||||
- * ENOTSUP can be unsupported image
|
||||
- * type or unsupported PE signature
|
||||
- * wrapper type, duh
|
||||
- *
|
||||
- * The kernel sometimes wrongly
|
||||
- * returns ENOTSUPP (524) - ignore
|
||||
- * that. It is not supposed to be seen
|
||||
- * by userspace so seeing it is a
|
||||
- * kernel bug
|
||||
- */
|
||||
- case -ENOTSUP:
|
||||
- do_kexec_file_syscall = 0;
|
||||
- break;
|
||||
- }
|
||||
+ if (result == EFALLBACK && do_kexec_fallback)
|
||||
+ do_kexec_file_syscall = 0;
|
||||
}
|
||||
if (!do_kexec_file_syscall)
|
||||
result = my_load(type, fileind, argc, argv,
|
||||
@@ -1570,6 +1574,8 @@ int main(int argc, char *argv[])
|
||||
if ((result == 0) && do_load_jump_back_helper) {
|
||||
result = my_load_jump_back_helper(kexec_flags, entry);
|
||||
}
|
||||
+ if (result == EFALLBACK)
|
||||
+ fputs("syscall kexec_file_load not available.\n", stderr);
|
||||
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
diff --git a/kexec/kexec.h b/kexec/kexec.h
|
||||
index a97b9ce..28fd129 100644
|
||||
--- a/kexec/kexec.h
|
||||
+++ b/kexec/kexec.h
|
||||
@@ -63,6 +63,7 @@
|
||||
*/
|
||||
#define EFAILED -1 /* default error code */
|
||||
#define ENOCRASHKERNEL -2 /* no memory reserved for crashkernel */
|
||||
+#define EFALLBACK -3 /* fallback to kexec_load(2) may work */
|
||||
|
||||
/*
|
||||
* This function doesn't actually exist. The idea is that when someone
|
||||
--
|
||||
2.16.4
|
||||
|
36
kexec-tools-print-error-if-kexec_file_load-fails.patch
Normal file
36
kexec-tools-print-error-if-kexec_file_load-fails.patch
Normal file
|
@ -0,0 +1,36 @@
|
|||
From: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Date: Wed Mar 16 16:03:05 2022 +0530
|
||||
Subject: kexec-tools: print error if kexec_file_load fails
|
||||
References: bsc#1197176
|
||||
Git-commit: 1d7a308bf7349fcf1627e950159029dfccf85891
|
||||
Upstream: merged
|
||||
|
||||
Commit 4f77da634035 ("kexec-tools: Fix kexec_file_load(2) error
|
||||
handling") introduced EFALLBACK for scenarios where fallbacking back
|
||||
to kexec_load syscall is likely to work and dropped printing error
|
||||
message for these scenarios. But printing error message for other
|
||||
failure scenarios was inadvertently dropped. Restore printing error
|
||||
message for such cases.
|
||||
|
||||
Fixes: 4f77da634035 ("kexec-tools: Fix kexec_file_load(2) error handling")
|
||||
Cc: Petr Tesarik <ptesarik@suse.com>
|
||||
Reported-by: Nageswara R Sastry <rnsastry@linux.ibm.com>
|
||||
Tested-by: Nageswara R Sastry <rnsastry@linux.ibm.com>
|
||||
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
|
||||
Reviewed-by: Petr Tesarik <ptesarik@suse.com>
|
||||
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||
|
||||
---
|
||||
kexec/kexec.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/kexec/kexec.c
|
||||
+++ b/kexec/kexec.c
|
||||
@@ -1265,6 +1265,7 @@ static int do_kexec_file_load(int filein
|
||||
case EMSGSIZE:
|
||||
/* Reject by default. */
|
||||
default:
|
||||
+ fprintf(stderr, "kexec_file_load failed: %s\n", strerror(errno));
|
||||
ret = EFAILED;
|
||||
break;
|
||||
|
54
kexec-tools-reset-getopt-before-falling-back-to-legacy.patch
Normal file
54
kexec-tools-reset-getopt-before-falling-back-to-legacy.patch
Normal file
|
@ -0,0 +1,54 @@
|
|||
From dadafc4664c7b78ea1561ccca33986c9639106ec Mon Sep 17 00:00:00 2001
|
||||
From: Petr Tesarik <ptesarik@suse.com>
|
||||
Date: Fri, 13 Mar 2020 14:54:00 +0100
|
||||
Upstream: not yet, patch sent 2020-03-13
|
||||
Subject: Reset getopt before falling back to legacy syscall
|
||||
References: bsc#1166105
|
||||
|
||||
The modules may need to parse the arguments again after
|
||||
kexec_file_load(2) failed, but getopt is not reset.
|
||||
|
||||
This change fixes the --initrd option on s390x. Without this patch,
|
||||
it will fail to load the initrd on kernels that do not implement
|
||||
kexec_file_load(2).
|
||||
|
||||
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
|
||||
---
|
||||
kexec/kexec.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/kexec/kexec.c b/kexec/kexec.c
|
||||
index 33c1b4b..6601f1f 100644
|
||||
--- a/kexec/kexec.c
|
||||
+++ b/kexec/kexec.c
|
||||
@@ -1538,8 +1538,12 @@ int main(int argc, char *argv[])
|
||||
if (do_unload) {
|
||||
if (do_kexec_file_syscall) {
|
||||
result = kexec_file_unload(kexec_file_flags);
|
||||
- if (result == EFALLBACK && do_kexec_fallback)
|
||||
+ if (result == EFALLBACK && do_kexec_fallback) {
|
||||
+ /* Reset getopt for fallback */
|
||||
+ opterr = 1;
|
||||
+ optind = 1;
|
||||
do_kexec_file_syscall = 0;
|
||||
+ }
|
||||
}
|
||||
if (!do_kexec_file_syscall)
|
||||
result = k_unload(kexec_flags);
|
||||
@@ -1548,8 +1552,12 @@ int main(int argc, char *argv[])
|
||||
if (do_kexec_file_syscall) {
|
||||
result = do_kexec_file_load(fileind, argc, argv,
|
||||
kexec_file_flags);
|
||||
- if (result == EFALLBACK && do_kexec_fallback)
|
||||
+ if (result == EFALLBACK && do_kexec_fallback) {
|
||||
+ /* Reset getopt for fallback */
|
||||
+ opterr = 1;
|
||||
+ optind = 1;
|
||||
do_kexec_file_syscall = 0;
|
||||
+ }
|
||||
}
|
||||
if (!do_kexec_file_syscall)
|
||||
result = my_load(type, fileind, argc, argv,
|
||||
--
|
||||
2.16.4
|
||||
|
31
kexec-tools-s390-Reset-kernel-command-line-on-syscal.patch
Normal file
31
kexec-tools-s390-Reset-kernel-command-line-on-syscal.patch
Normal file
|
@ -0,0 +1,31 @@
|
|||
From: Petr Tesarik <ptesarik@suse.com>
|
||||
Date: Fri, 3 Apr 2020 13:12:00 +0200
|
||||
Subject: kexec-tools: s390: Reset kernel command line on syscall fallback
|
||||
References: bsc#1167868
|
||||
Upstream: submitted 2020-04-03
|
||||
|
||||
The command line is duplicated on s390 if kexec_file_load(2) is not
|
||||
implemented. That's because the corresponding variable is not reset
|
||||
to an empty string before re-parsing the kexec command line.
|
||||
|
||||
Fixes: 9cf721279f6c ("Reset getopt before falling back to legacy syscall")
|
||||
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
|
||||
---
|
||||
kexec/arch/s390/kexec-image.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/kexec/arch/s390/kexec-image.c b/kexec/arch/s390/kexec-image.c
|
||||
index 8b39566..3c24fdf 100644
|
||||
--- a/kexec/arch/s390/kexec-image.c
|
||||
+++ b/kexec/arch/s390/kexec-image.c
|
||||
@@ -112,6 +112,7 @@ image_s390_load(int argc, char **argv, const char *kernel_buf,
|
||||
};
|
||||
static const char short_options[] = KEXEC_OPT_STR "";
|
||||
|
||||
+ command_line[0] = 0;
|
||||
ramdisk = NULL;
|
||||
ramdisk_len = 0;
|
||||
ramdisk_origin = 0;
|
||||
--
|
||||
2.16.4
|
||||
|
25
kexec-tools-video-capability.patch
Normal file
25
kexec-tools-video-capability.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
From: Petr Tesarik <ptesarik@suse.com>
|
||||
Subject: Make sure VIDEO_CAPABILITY_64BIT_BASE is defined
|
||||
Upstream: never, build fix for SLE12
|
||||
|
||||
SLE12 did not provide a definition for VIDEO_CAPABILITY_64BIT_BASE
|
||||
in <linux/screen_info.h>.
|
||||
|
||||
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
|
||||
---
|
||||
kexec/arch/i386/x86-linux-setup.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/kexec/arch/i386/x86-linux-setup.c
|
||||
+++ b/kexec/arch/i386/x86-linux-setup.c
|
||||
@@ -37,6 +37,10 @@
|
||||
#include "x86-linux-setup.h"
|
||||
#include "../../kexec/kexec-syscall.h"
|
||||
|
||||
+#ifndef VIDEO_CAPABILITY_64BIT_BASE
|
||||
+#define VIDEO_CAPABILITY_64BIT_BASE (1 << 1) /* Frame buffer base is 64-bit */
|
||||
+#endif
|
||||
+
|
||||
void init_linux_parameters(struct x86_linux_param_header *real_mode)
|
||||
{
|
||||
/* Fill in the values that are usually provided by the kernel. */
|
|
@ -1,7 +1,3 @@
|
|||
* Thu Mar 16 2023 He Zyppe <210hcl@gmail.com>
|
||||
- Change to 2.0.24 to match RHEL 9.
|
||||
- Removed patches has been merged.
|
||||
- Add RISC-V support.
|
||||
* Wed Apr 13 2022 ptesarik@suse.com
|
||||
- kexec-tools-print-error-if-kexec_file_load-fails.patch: print
|
||||
error if kexec_file_load fails (bsc#1197176).
|
||||
|
|
|
@ -6,23 +6,28 @@
|
|||
|
||||
|
||||
Name: kexec-tools
|
||||
Version: 2.0.24
|
||||
Release: 5
|
||||
Version: 2.0.20
|
||||
Release: 150500.18.3
|
||||
Summary: Tools for loading replacement kernels into memory
|
||||
License: GPL-2.0-or-later
|
||||
Group: System/Kernel
|
||||
URL: https://projects.horms.net/projects/kexec/
|
||||
Source: https://mirrors.ustc.edu.cn/kernel.org/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
|
||||
Source100: https://mirrors.ustc.edu.cn/kernel.org/linux/utils/kernel/kexec/%{name}-%{version}.tar.sign
|
||||
Source101: kexec-tools.keyring
|
||||
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
|
||||
Patch3: %{name}-disable-test.patch
|
||||
Patch4: %{name}-vmcoreinfo-in-xen.patch
|
||||
# https://patchwork.kernel.org/project/linux-riscv/patch/20190416123233.4779-1-mick@ics.forth.gr/
|
||||
Patch5: RISC-V-Add-support-for-kexec-on-kexec-tools.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
|
||||
Patch9: %{name}-video-capability.patch
|
||||
Patch10: %{name}-SYS_getrandom.patch
|
||||
Patch11: %{name}-fix-kexec_file_load-error-handling.patch
|
||||
Patch12: %{name}-reset-getopt-before-falling-back-to-legacy.patch
|
||||
Patch13: %{name}-s390-Reset-kernel-command-line-on-syscal.patch
|
||||
Patch14: %{name}-print-error-if-kexec_file_load-fails.patch
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: systemd-rpm-macros
|
||||
|
@ -31,7 +36,7 @@ BuildRequires: zlib-devel
|
|||
#!BuildIgnore: gcc-PIE
|
||||
Requires: perl-Bootloader
|
||||
Requires(post): suse-module-tools
|
||||
Requires(postun):suse-module-tools
|
||||
Requires(postun): suse-module-tools
|
||||
%{?systemd_requires}
|
||||
%ifarch x86_64
|
||||
BuildRequires: pkgconfig
|
||||
|
@ -46,7 +51,18 @@ the loaded kernel after it panics.
|
|||
|
||||
%prep
|
||||
%setup -q
|
||||
%autopatch -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
|
||||
%build
|
||||
autoreconf -fvi
|
||||
|
@ -54,7 +70,7 @@ export CFLAGS="%{optflags} -fPIC"
|
|||
export BUILD_CFLAGS="%{optflags}"
|
||||
export LDFLAGS="-pie"
|
||||
%configure
|
||||
%make_build
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
@ -64,10 +80,10 @@ install -m 0755 %{SOURCE1} %{buildroot}/%{_sbindir}
|
|||
mkdir -p %{buildroot}/%{_unitdir}
|
||||
install -m644 %{SOURCE3} %{buildroot}/%{_unitdir}
|
||||
ln -s service %{buildroot}%{_sbindir}/rckexec-load
|
||||
%if 0%{?suse_version} < 1550
|
||||
#UsrMerge
|
||||
mkdir -p %{buildroot}/sbin
|
||||
ln -s %{_sbindir}/kexec %{buildroot}/sbin
|
||||
%endif
|
||||
#EndUsrMerge
|
||||
|
||||
%post
|
||||
%service_add_post kexec-load.service
|
||||
|
@ -86,15 +102,29 @@ ln -s %{_sbindir}/kexec %{buildroot}/sbin
|
|||
%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
|
||||
%license COPYING
|
||||
%doc AUTHORS News TODO doc
|
||||
%{_mandir}/man*/*
|
||||
%if 0%{?suse_version} < 1550
|
||||
#UsrMerge
|
||||
/sbin/kexec
|
||||
%endif
|
||||
#EndUsrMerge
|
||||
%{_sbindir}/rckexec-load
|
||||
%{_sbindir}/kexec
|
||||
%{_sbindir}/kexec-bootloader
|
||||
%{_sbindir}/vmcore-dmesg
|
||||
%{_unitdir}/kexec-load.service
|
||||
|
||||
%changelog
|
||||
|
|
Loading…
Add table
Reference in a new issue