Complete Yocto mirror with license table for TQMa6UL (2038-compliance)
- 264 license table entries with exact download URLs (224/264 resolved) - Complete sources/ directory with all BitBake recipes - Build configuration: tqma6ul-multi-mba6ulx, spaetzle (musl) - Full traceability for Softwarefreigabeantrag - GCC 13.4.0, Linux 6.6.102, U-Boot 2023.04, musl 1.2.4 - License distribution: GPL-2.0 (24), MIT (23), GPL-2.0+ (18), BSD-3 (16)
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
From d48ec5e1a5fb7907520dee71b1d94045486a0c29 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Kamensky <alexander.kamensky42@gmail.com>
|
||||
Date: Thu, 12 Nov 2020 12:56:46 -0800
|
||||
Subject: [PATCH] arm64: kexec: disabled check if kaslr-seed dtb property was
|
||||
wiped
|
||||
|
||||
Kexec when loading arm64 kernel checks if chosen/kaslr-seed dtb property is
|
||||
wiped. It's a good assertion to verify proper behavior of kernel. However,
|
||||
if bootloader creates and fills kaslr-seed property and kernel is not
|
||||
configured with CONFIG_RANDOMIZE_BASE then logic of reading and wiping
|
||||
kaslr-seed does not run. As a result kaslr-seed property is not zero and when
|
||||
kexec tries to load secondary kernel it fails with the following message:
|
||||
|
||||
setup_2nd_dtb: kaslr-seed is not wiped to 0.
|
||||
kexec: setup_2nd_dtb failed.
|
||||
kexec: load failed.
|
||||
|
||||
This was observed on Yocto Project on qemuarm64 machine with 5.8 kernel,
|
||||
qemu 5.1.0. Qemu created kaslr-seed property but kernel was not configured
|
||||
with CONFIG_RANDOMIZE_BASE.
|
||||
|
||||
Although check has some value, there is a use-case where it breaks kexec,
|
||||
this patch removes it.
|
||||
|
||||
Note in described use-case the fact that kaslr-seed is not wiped and user
|
||||
readable through /sys/firmware/fdt or
|
||||
/sys/firmware/devicetree/base/chosen/kaslr-seed is not a security problem
|
||||
as kaslr is disabled anyway.
|
||||
|
||||
Signed-off-by: Alexander Kamensky <alexander.kamensky42@gmail.com>
|
||||
Upstream-Status: Submitted [http://lists.infradead.org/pipermail/kexec/2020-November/021740.html]
|
||||
---
|
||||
kexec/arch/arm64/kexec-arm64.c | 14 +-------------
|
||||
1 file changed, 1 insertion(+), 13 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
|
||||
index ec6df4b..10238d9 100644
|
||||
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||
@@ -503,7 +503,7 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash)
|
||||
int len, range_len;
|
||||
int nodeoffset;
|
||||
int new_size;
|
||||
- int i, result, kaslr_seed;
|
||||
+ int i, result;
|
||||
|
||||
result = fdt_check_header(dtb->buf);
|
||||
|
||||
@@ -576,18 +576,6 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash)
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
- kaslr_seed = fdt64_to_cpu(*prop);
|
||||
-
|
||||
- /* kaslr_seed must be wiped clean by primary
|
||||
- * kernel during boot
|
||||
- */
|
||||
- if (kaslr_seed != 0) {
|
||||
- dbgprintf("%s: kaslr-seed is not wiped to 0.\n",
|
||||
- __func__);
|
||||
- result = -EINVAL;
|
||||
- goto on_error;
|
||||
- }
|
||||
-
|
||||
/*
|
||||
* Invoke the getrandom system call with
|
||||
* GRND_NONBLOCK, to make sure we
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 211cae4b6a02a4d9d37bfcd76f3702696e095fc3 Mon Sep 17 00:00:00 2001
|
||||
From: Quanyang Wang <quanyang.wang@windriver.com>
|
||||
Date: Tue, 16 Jun 2015 12:59:57 +0800
|
||||
Subject: [PATCH] powerpc: change the memory size limit
|
||||
|
||||
When run "kexec" in powerpc board, the kexec has a limit that
|
||||
the kernel text and bss size must be less than 24M. But now
|
||||
some kernel size exceed the limit. So we need to change the limit,
|
||||
else will get the error log as below:
|
||||
|
||||
my_load:669: do
|
||||
Could not find a free area of memory of 0x12400 bytes...
|
||||
Could not find a free area of memory of 0x13000 bytes...
|
||||
locate_hole failed
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
|
||||
---
|
||||
kexec/arch/ppc/kexec-ppc.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kexec/arch/ppc/kexec-ppc.h b/kexec/arch/ppc/kexec-ppc.h
|
||||
index 04e728e..6bae9ec 100644
|
||||
--- a/kexec/arch/ppc/kexec-ppc.h
|
||||
+++ b/kexec/arch/ppc/kexec-ppc.h
|
||||
@@ -44,7 +44,7 @@ void dol_ppc_usage(void);
|
||||
* During inital setup the kernel does not map the whole memory but a part of
|
||||
* it. On Book-E that is 64MiB, 601 24MiB or 256MiB (if possible).
|
||||
*/
|
||||
-#define KERNEL_ACCESS_TOP (24 * 1024 * 1024)
|
||||
+#define KERNEL_ACCESS_TOP (36 * 1024 * 1024)
|
||||
|
||||
/* boot block version 17 as defined by the linux kernel */
|
||||
struct bootblock {
|
||||
@@ -0,0 +1,54 @@
|
||||
From 32c8ffa7ace6f1b7e63f9ddffab00b00c36a7b57 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Wed, 15 May 2024 21:18:08 -0700
|
||||
Subject: [PATCH] x86-linux-setup.c: Use POSIX basename API
|
||||
|
||||
Musl C library only supports POSIX basename function. while glibc has
|
||||
both GNU extention as well as POSIX basename implemented. Switch to
|
||||
using posix version, so it can work across musl and glibc
|
||||
|
||||
basename prototype has been removed from string.h from latest musl [1]
|
||||
compilers e.g. clang-18/GCC-14 flags the absense of prototype as error.
|
||||
therefore include libgen.h for providing it.
|
||||
|
||||
[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
|
||||
|
||||
Upstream-Status: Submitted [https://lists.infradead.org/pipermail/kexec/2024-May/030034.html]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
kexec/arch/i386/x86-linux-setup.c | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
|
||||
index 9a281dc..73251b9 100644
|
||||
--- a/kexec/arch/i386/x86-linux-setup.c
|
||||
+++ b/kexec/arch/i386/x86-linux-setup.c
|
||||
@@ -14,6 +14,7 @@
|
||||
*
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
+#include <libgen.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -329,12 +330,14 @@ static int add_edd_entry(struct x86_linux_param_header *real_mode,
|
||||
memset(edd_info, 0, sizeof(struct edd_info));
|
||||
|
||||
/* extract the device number */
|
||||
- if (sscanf(basename(sysfs_name), "int13_dev%hhx", &devnum) != 1) {
|
||||
+ char* sysfs_name_copy = strdup(sysfs_name);
|
||||
+ if (sscanf(basename(sysfs_name_copy), "int13_dev%hhx", &devnum) != 1) {
|
||||
fprintf(stderr, "Invalid format of int13_dev dir "
|
||||
- "entry: %s\n", basename(sysfs_name));
|
||||
+ "entry: %s\n", basename(sysfs_name_copy));
|
||||
+ free(sysfs_name_copy);
|
||||
return -1;
|
||||
}
|
||||
-
|
||||
+ free(sysfs_name_copy);
|
||||
/* if there's a MBR signature, then add it */
|
||||
if (file_scanf(sysfs_name, "mbr_signature", "0x%x", &mbr_sig) == 1) {
|
||||
real_mode->edd_mbr_sig_buffer[*current_mbr] = mbr_sig;
|
||||
--
|
||||
2.45.1
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From e5bc9fbd6029057a4e3815a5326af5bd83a450e6 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 7 Sep 2015 07:59:45 +0000
|
||||
Subject: [PATCH] purgatory: Pass -r directly to linker
|
||||
|
||||
This helps compiling with clang since -r is not a known option for clang
|
||||
where as gcc knows how to deal with it and passes it down to linker
|
||||
unfiltered
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
---
|
||||
purgatory/Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/purgatory/Makefile b/purgatory/Makefile
|
||||
index 4d2d071..6673423 100644
|
||||
--- a/purgatory/Makefile
|
||||
+++ b/purgatory/Makefile
|
||||
@@ -61,7 +61,7 @@ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
|
||||
-I$(shell $(CC) -print-file-name=include)
|
||||
$(PURGATORY): LDFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS)\
|
||||
-Wl,--no-undefined -nostartfiles -nostdlib \
|
||||
- -nodefaultlibs -e purgatory_start -r \
|
||||
+ -nodefaultlibs -e purgatory_start -Wl,-r \
|
||||
-Wl,-Map=$(PURGATORY_MAP)
|
||||
|
||||
$(PURGATORY): $(PURGATORY_OBJS)
|
||||
@@ -0,0 +1,50 @@
|
||||
From b62c1da8f8e641397add10367ee9c4cfdedb1cc0 Mon Sep 17 00:00:00 2001
|
||||
From: Haiqing Bai <Haiqing.Bai@windriver.com>
|
||||
Date: Mon, 9 Jan 2017 15:26:29 +0800
|
||||
Subject: [PATCH] kexec: ARM: Fix add_buffer_phys_virt() align issue
|
||||
|
||||
When "CONFIG_ARM_LPAE" is enabled,3 level page table
|
||||
is used by MMU, the "SECTION_SIZE" is defined with
|
||||
(1 << 21), but 'add_buffer_phys_virt()' hardcode this
|
||||
to (1 << 20).
|
||||
|
||||
Upstream-Status: Submitted [via email to horms@kernel.org,http://lists.infradead.org/pipermail/kexec/2024-April/029903.html]
|
||||
|
||||
Suggested-By:fredrik.markstrom@gmail.com
|
||||
Signed-off-by: Haiqing Bai <Haiqing.Bai@windriver.com>
|
||||
|
||||
---
|
||||
kexec/arch/arm/crashdump-arm.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
|
||||
index 1ec1826..cc20f63 100644
|
||||
--- a/kexec/arch/arm/crashdump-arm.c
|
||||
+++ b/kexec/arch/arm/crashdump-arm.c
|
||||
@@ -242,6 +242,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
|
||||
void *buf;
|
||||
int err;
|
||||
int last_ranges;
|
||||
+ unsigned short align_bit_shift = 20;
|
||||
|
||||
/*
|
||||
* First fetch all the memory (RAM) ranges that we are going to pass to
|
||||
@@ -283,6 +284,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
|
||||
|
||||
/* for support LPAE enabled kernel*/
|
||||
elf_info.class = ELFCLASS64;
|
||||
+ align_bit_shift = 21;
|
||||
|
||||
err = crash_create_elf64_headers(info, &elf_info,
|
||||
usablemem_rgns.ranges,
|
||||
@@ -304,8 +306,9 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
|
||||
* 1MB) so that available memory passed in kernel command line will be
|
||||
* aligned to 1MB. This is because kernel create_mapping() wants memory
|
||||
* regions to be aligned to SECTION_SIZE.
|
||||
+ * The SECTION_SIZE of LPAE kernel is '1UL << 21' defined in pgtable-3level.h
|
||||
*/
|
||||
- elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << 20,
|
||||
+ elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << align_bit_shift,
|
||||
crash_kernel_mem.start,
|
||||
crash_kernel_mem.end, -1, 0);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From 494888bcc3bbf070dfce1b2686ee34c8619aa33d Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sat, 10 Jun 2017 11:18:49 -0700
|
||||
Subject: [PATCH] Disable PIE during link
|
||||
|
||||
We have explcitly disabled PIE during compile so we
|
||||
just need to match it with linker flags
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
purgatory/Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/purgatory/Makefile b/purgatory/Makefile
|
||||
index 6673423..a7405ea 100644
|
||||
--- a/purgatory/Makefile
|
||||
+++ b/purgatory/Makefile
|
||||
@@ -60,7 +60,7 @@ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
|
||||
-Iinclude \
|
||||
-I$(shell $(CC) -print-file-name=include)
|
||||
$(PURGATORY): LDFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS)\
|
||||
- -Wl,--no-undefined -nostartfiles -nostdlib \
|
||||
+ -Wl,--no-undefined -no-pie -nostartfiles -nostdlib \
|
||||
-nodefaultlibs -e purgatory_start -Wl,-r \
|
||||
-Wl,-Map=$(PURGATORY_MAP)
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Michel Lind <salimma@fedoraproject.org>
|
||||
Date: Tue, 30 Jan 2024 04:14:31 -0600
|
||||
Subject: [PATCH] Fix building on x86_64 with binutils 2.41
|
||||
|
||||
Newer versions of the GNU assembler (observed with binutils 2.41) will
|
||||
complain about the ".arch i386" in files assembled with "as --64",
|
||||
with the message "Error: 64bit mode not supported on 'i386'".
|
||||
|
||||
Fix by moving ".arch i386" below the relevant ".code32" directive, so
|
||||
that the assembler is no longer expecting 64-bit instructions to be used
|
||||
by the time that the ".arch i386" directive is encountered.
|
||||
|
||||
Based on similar iPXE fix:
|
||||
https://github.com/ipxe/ipxe/commit/6ca597eee
|
||||
|
||||
Signed-off-by: Michel Lind <michel@michel-slm.name>
|
||||
Signed-off-by: Simon Horman <horms@kernel.org>
|
||||
|
||||
Upstream-Status: Backport [https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?h=main&id=328de8e00e298f00d7ba6b25dc3950147e9642e6]
|
||||
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
|
||||
---
|
||||
purgatory/arch/i386/entry32-16-debug.S | 2 +-
|
||||
purgatory/arch/i386/entry32-16.S | 2 +-
|
||||
purgatory/arch/i386/entry32.S | 2 +-
|
||||
purgatory/arch/i386/setup-x86.S | 2 +-
|
||||
4 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/purgatory/arch/i386/entry32-16-debug.S b/purgatory/arch/i386/entry32-16-debug.S
|
||||
index 5167944..12e1164 100644
|
||||
--- a/purgatory/arch/i386/entry32-16-debug.S
|
||||
+++ b/purgatory/arch/i386/entry32-16-debug.S
|
||||
@@ -25,10 +25,10 @@
|
||||
.globl entry16_debug_pre32
|
||||
.globl entry16_debug_first32
|
||||
.globl entry16_debug_old_first32
|
||||
- .arch i386
|
||||
.balign 16
|
||||
entry16_debug:
|
||||
.code32
|
||||
+ .arch i386
|
||||
/* Compute where I am running at (assumes esp valid) */
|
||||
call 1f
|
||||
1: popl %ebx
|
||||
diff --git a/purgatory/arch/i386/entry32-16.S b/purgatory/arch/i386/entry32-16.S
|
||||
index c051aab..eace095 100644
|
||||
--- a/purgatory/arch/i386/entry32-16.S
|
||||
+++ b/purgatory/arch/i386/entry32-16.S
|
||||
@@ -20,10 +20,10 @@
|
||||
#undef i386
|
||||
.text
|
||||
.globl entry16, entry16_regs
|
||||
- .arch i386
|
||||
.balign 16
|
||||
entry16:
|
||||
.code32
|
||||
+ .arch i386
|
||||
/* Compute where I am running at (assumes esp valid) */
|
||||
call 1f
|
||||
1: popl %ebx
|
||||
diff --git a/purgatory/arch/i386/entry32.S b/purgatory/arch/i386/entry32.S
|
||||
index f7a494f..8ce9e31 100644
|
||||
--- a/purgatory/arch/i386/entry32.S
|
||||
+++ b/purgatory/arch/i386/entry32.S
|
||||
@@ -20,10 +20,10 @@
|
||||
#undef i386
|
||||
|
||||
.text
|
||||
- .arch i386
|
||||
.globl entry32, entry32_regs
|
||||
entry32:
|
||||
.code32
|
||||
+ .arch i386
|
||||
|
||||
/* Setup a gdt that should that is generally usefully */
|
||||
lgdt %cs:gdt
|
||||
diff --git a/purgatory/arch/i386/setup-x86.S b/purgatory/arch/i386/setup-x86.S
|
||||
index 201bb2c..a212eed 100644
|
||||
--- a/purgatory/arch/i386/setup-x86.S
|
||||
+++ b/purgatory/arch/i386/setup-x86.S
|
||||
@@ -21,10 +21,10 @@
|
||||
#undef i386
|
||||
|
||||
.text
|
||||
- .arch i386
|
||||
.globl purgatory_start
|
||||
purgatory_start:
|
||||
.code32
|
||||
+ .arch i386
|
||||
|
||||
/* Load a gdt so I know what the segment registers are */
|
||||
lgdt %cs:gdt
|
||||
--
|
||||
2.39.2
|
||||
|
||||
145
sources/poky/meta/recipes-kernel/kexec/kexec-tools/kdump
Executable file
145
sources/poky/meta/recipes-kernel/kexec/kexec-tools/kdump
Executable file
@@ -0,0 +1,145 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# kdump
|
||||
#
|
||||
# Description: The kdump script provides the support:
|
||||
# 1. Load a kdump kernel image into memory;
|
||||
# 2. Copy away vmcore when system panic.
|
||||
#
|
||||
|
||||
#default
|
||||
KEXEC=/usr/sbin/kexec
|
||||
KEXEC_ARGS="-p"
|
||||
|
||||
MAKEDUMPFILE=/usr/bin/makedumpfile
|
||||
MAKEDUMPFILE_ARGS="-E -d 1"
|
||||
|
||||
LOGGER="logger -p info -t kdump"
|
||||
|
||||
if [ -f /etc/sysconfig/kdump.conf ]; then
|
||||
. /etc/sysconfig/kdump.conf
|
||||
else
|
||||
echo "no /etc/sysconfig/kdump.conf"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
do_check()
|
||||
{
|
||||
#check makedumpfile
|
||||
if [ ! -e ${MAKEDUMPFILE} -o ! -x ${MAKEDUMPFILE} ] ;then
|
||||
echo "No makedumpfile found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#check kexec
|
||||
if [ ! -e ${KEXEC} -o ! -x ${KEXEC} ] ;then
|
||||
echo "No kexec found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#check whether kdump kernel image exists on the system
|
||||
if [ -z "${KDUMP_KIMAGE}" -o ! -f "${KDUMP_KIMAGE}" ]; then
|
||||
echo "No kdump kernel image found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${KDUMP_CMDLINE}"x = "x" ] ; then
|
||||
echo "KDUMP_CMDLINE is not configured"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
do_save_vmcore()
|
||||
{
|
||||
if [ ${KDUMP_VMCORE_PATH}x = x ]; then
|
||||
KDUMP_VMCORE_PATH="/var/crash/`date +"%Y-%m-%d"`"
|
||||
fi
|
||||
|
||||
mkdir -p ${KDUMP_VMCORE_PATH}
|
||||
echo "Saving a vmcore to ${KDUMP_VMCORE_PATH}."
|
||||
|
||||
${MAKEDUMPFILE} ${MAKEDUMPFILE_ARGS} /proc/vmcore ${KDUMP_VMCORE_PATH}/vmcore-"`date +"%H:%M:%S"`"
|
||||
# cp --sparse=always /proc/vmcore ${KDUMP_VMCORE_PATH}/vmcore-"`date +"%H:%M:%S"`"
|
||||
rc=$?
|
||||
if [ ${rc} == 0 ]; then
|
||||
${LOGGER} "Saved a vmcore to ${KDUMP_VMCORE_PATH}."
|
||||
else
|
||||
${LOGGER} "Failed to save vmcore!"
|
||||
fi
|
||||
return ${rc}
|
||||
}
|
||||
|
||||
do_start()
|
||||
{
|
||||
#check file
|
||||
do_check
|
||||
|
||||
#check whether the running kernel supports kdump.
|
||||
if [ ! -e /sys/kernel/kexec_crash_loaded ]; then
|
||||
echo "Kdump isn't supported on the running kernel!!!"
|
||||
${LOGGER} "Kdump isn't supported on the running kernel!!!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
#check whether kdump kernel image has been loaded
|
||||
rc=`cat /sys/kernel/kexec_crash_loaded`
|
||||
if [ ${rc} != 0 ]; then
|
||||
echo "Kdump is already running.";
|
||||
${LOGGER} "Kdump is already running."
|
||||
return 0
|
||||
fi
|
||||
|
||||
#check the running kernel cmdline option,insure "crashkernel=" always set.
|
||||
grep -q crashkernel= /proc/cmdline
|
||||
if [ $? != 0 ]; then
|
||||
echo "Kdump isn't supported on the running kernel,please check boot option!!!"
|
||||
${LOGGER} "Kdump isn't supported on the running kernel,please check boot option!!!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
#Load the kdump kernel image
|
||||
${KEXEC} ${KEXEC_ARGS} "${KDUMP_KIMAGE}" --append="${KDUMP_CMDLINE}"
|
||||
if [ $? != 0 ]; then
|
||||
echo "Failed to load kdump kernel!"
|
||||
${LOGGER} "Failed to load kdump kernel!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Kdump started up."
|
||||
${LOGGER} "Kdump started up."
|
||||
}
|
||||
|
||||
do_stop()
|
||||
{
|
||||
${KEXEC} -p -u 2>/dev/null
|
||||
if [ $? == 0 ]; then
|
||||
echo "Kdump has been stopped."
|
||||
${LOGGER} "Kdump has been stopped."
|
||||
else
|
||||
echo "Failed to stop kdump!"
|
||||
${LOGGER} "Failed to stop kdump!"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ -s /proc/vmcore ]; then
|
||||
do_save_vmcore
|
||||
reboot
|
||||
else
|
||||
do_start
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
do_stop
|
||||
do_start
|
||||
;;
|
||||
stop)
|
||||
do_stop
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
@@ -0,0 +1,14 @@
|
||||
#the kdump kernel version string.
|
||||
#KDUMP_KVER="`uname -r`"
|
||||
|
||||
#this will be passed to the kdump kernel as kdump kernel command line
|
||||
#KDUMP_CMDLINE="`cat /proc/cmdline`"
|
||||
|
||||
#the kernel image for kdump
|
||||
#KDUMP_KIMAGE="/boot/bzImage-${KDUMP_KVER}"
|
||||
|
||||
#Where to save the vmcore
|
||||
#KDUMP_VMCORE_PATH="/var/crash/`date +"%Y-%m-%d"`"
|
||||
|
||||
#the arguments to makedumpfile
|
||||
MAKEDUMPFILE_ARGS="--dump-dmesg -x /boot/vmlinux-`uname -r`"
|
||||
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Reboot and dump vmcore via kexec
|
||||
DefaultDependencies=no
|
||||
Requires=sysinit.target
|
||||
After=sysinit.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=@LIBEXECDIR@/kdump-helper start
|
||||
ExecStop=@LIBEXECDIR@/kdump-helper stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user