-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* In the event of a kernel crash, we need to gather as much information as possible to understand and identify the root cause of the crash. Currently, the kernel does not provide much information, which make kernel crash investigation difficult and time consuming. Fortunately, there is a way in the kernel to provide more information in the case of a kernel crash. kdump is a feature of the Linux kernel that creates crash dumps in the event of a kernel crash. This PR will add kermel kdump support. An extension to the CLI utilities config and show is provided to configure and manage kdump: - enable / disable kdump functionality - configure kdump (how many kernel crash logs can be saved, memory allocated for capture kernel) - view kernel crash logs
- Loading branch information
1 parent
be3421c
commit c70d8bc
Showing
9 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# kdump-tools package | ||
|
||
KDUMP_TOOLS_VERSION_BASE = 1.6.1 | ||
KDUMP_TOOLS_VERSION = $(KDUMP_TOOLS_VERSION_BASE)-1 | ||
export KDUMP_TOOLS_VERSION_BASE | ||
export KDUMP_TOOLS_VERSION | ||
|
||
KDUMP_TOOLS = kdump-tools_$(KDUMP_TOOLS_VERSION)_all.deb | ||
$(KDUMP_TOOLS)_SRC_PATH = $(SRC_PATH)/kdump-tools | ||
SONIC_MAKE_DEBS += $(KDUMP_TOOLS) | ||
SONIC_STRETCH_DEBS += $(KDUMP_TOOLS) | ||
|
||
export KDUMP_TOOLS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.ONESHELL: | ||
SHELL = /bin/bash | ||
.SHELLFLAGS += -e | ||
|
||
MAIN_TARGET = $(KDUMP_TOOLS) | ||
|
||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : | ||
# Remove any stale files | ||
rm -rf ./makedumpfile_$(KDUMP_TOOLS_VERSION_BASE).orig.tar.gz ./makedumpfile_$(KDUMP_TOOLS_VERSION).debian.tar.xz | ||
rm -rf ./makedumpfile-$(KDUMP_TOOLS_VERSION_BASE) | ||
|
||
# Get makedumpfile release | ||
wget http://deb.debian.org/debian/pool/main/m/makedumpfile/makedumpfile_$(KDUMP_TOOLS_VERSION_BASE).orig.tar.gz | ||
wget http://deb.debian.org/debian/pool/main/m/makedumpfile/makedumpfile_$(KDUMP_TOOLS_VERSION).debian.tar.xz | ||
tar -f makedumpfile_$(KDUMP_TOOLS_VERSION_BASE).orig.tar.gz -x | ||
pushd ./makedumpfile-$(KDUMP_TOOLS_VERSION_BASE) | ||
tar -f ../makedumpfile_$(KDUMP_TOOLS_VERSION).debian.tar.xz -x | ||
|
||
git init | ||
git add -f * | ||
git commit -m "unmodified kdump-tools source" | ||
|
||
# Apply patches | ||
stg init | ||
stg import -s ../patch/series | ||
|
||
# Build source and Debian packages | ||
fakeroot debian/rules binary-indep | ||
popd | ||
|
||
# Move the newly-built .deb packages to the destination directory | ||
mv $* $(DEST)/ |
41 changes: 41 additions & 0 deletions
41
src/kdump-tools/patch/0001-Generate-initramfs-for-installed-kernels-in-chroot.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From 7e6c0d5b0c7299154f75f281c02cf02cf85fb80e Mon Sep 17 00:00:00 2001 | ||
From: Benjamin Drung <benjamin.drung@profitbricks.com> | ||
Date: Thu, 2 Mar 2017 19:52:23 +0100 | ||
Subject: [PATCH] Generate initramfs for installed kernels in chroot | ||
|
||
The postinst script from kdump-tools creates an initramfs for the | ||
running kernel. When running inside a chroot, the running kernel (from | ||
the host) might differ from the kernels that are available in the | ||
chroot. | ||
|
||
Thus generate the initramfs only when the running kernel is installed in | ||
the system. Otherwise generate the initramfs for all installed kernels. | ||
|
||
Bug-Debian: #856594 | ||
--- | ||
debian/kdump-tools.postinst | 10 +++++++++- | ||
1 file changed, 9 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/debian/kdump-tools.postinst b/debian/kdump-tools.postinst | ||
index 4b6c6be..f604c8e 100755 | ||
--- a/debian/kdump-tools.postinst | ||
+++ b/debian/kdump-tools.postinst | ||
@@ -33,7 +33,15 @@ update_param() { | ||
case "$1" in | ||
configure) | ||
# create smaller initrd.img files for kdump use | ||
- /etc/kernel/postinst.d/kdump-tools $(uname -r) > /dev/null 2>&1 | ||
+ if test -d /lib/modules/$(uname -r); then | ||
+ /etc/kernel/postinst.d/kdump-tools $(uname -r) > /dev/null 2>&1 | ||
+ else | ||
+ # Running kernel not installed. Running in chroot? | ||
+ for kernel_release in $(ls /lib/modules/); do | ||
+ /etc/kernel/postinst.d/kdump-tools $kernel_release > /dev/null 2>&1 | ||
+ kdump-config symlinks $kernel_release | ||
+ done | ||
+ fi | ||
|
||
# Customize crashkernel= value according to architecture | ||
ARCH="$(arch)" | ||
-- | ||
2.9.3 |
24 changes: 24 additions & 0 deletions
24
src/kdump-tools/patch/0002-core-file-prefixed-by-kdump.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- a/debian/kdump-config.orig 2019-10-24 09:38:19.006679000 -0700 | ||
+++ b/debian/kdump-config 2019-10-24 12:16:23.791899000 -0700 | ||
@@ -639,8 +639,8 @@ | ||
{ | ||
KDUMP_STAMP=`date +"%Y%m%d%H%M"` | ||
KDUMP_STAMPDIR=$(define_stampdir $KDUMP_STAMP) | ||
- KDUMP_CORETEMP="$KDUMP_STAMPDIR/dump-incomplete" | ||
- KDUMP_COREFILE="$KDUMP_STAMPDIR/dump.$KDUMP_STAMP" | ||
+ KDUMP_CORETEMP="$KDUMP_STAMPDIR/kdump-incomplete" | ||
+ KDUMP_COREFILE="$KDUMP_STAMPDIR/kdump.$KDUMP_STAMP" | ||
KDUMP_DMESGFILE="$KDUMP_STAMPDIR/dmesg.$KDUMP_STAMP" | ||
|
||
# If we use NFS, verify that we can mount the FS | ||
@@ -755,8 +755,8 @@ | ||
KDUMP_STAMP=`date +"%Y%m%d%H%M"` | ||
KDUMP_STAMPDIR=$(define_stampdir $KDUMP_STAMP) | ||
|
||
- KDUMP_CORETEMP="$KDUMP_STAMPDIR/dump-incomplete" | ||
- KDUMP_COREFILE="$KDUMP_STAMPDIR/dump.$KDUMP_STAMP" | ||
+ KDUMP_CORETEMP="$KDUMP_STAMPDIR/kdump-incomplete" | ||
+ KDUMP_COREFILE="$KDUMP_STAMPDIR/kdump.$KDUMP_STAMP" | ||
KDUMP_TMPDMESG="/tmp/dmesg.$KDUMP_STAMP" | ||
KDUMP_DMESGFILE="$KDUMP_STAMPDIR/dmesg.$KDUMP_STAMP" | ||
ERROR=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
0001-Generate-initramfs-for-installed-kernels-in-chroot.patch | ||
0002-core-file-prefixed-by-kdump.patch |