diff options
Diffstat (limited to 'meta/recipes-kernel')
-rwxr-xr-x | meta/recipes-kernel/kexec/kexec-tools/kdump | 52 | ||||
-rw-r--r-- | meta/recipes-kernel/kexec/kexec-tools/kdump.conf | 6 |
2 files changed, 18 insertions, 40 deletions
diff --git a/meta/recipes-kernel/kexec/kexec-tools/kdump b/meta/recipes-kernel/kexec/kexec-tools/kdump index 3fb133fb35..2347205eda 100755 --- a/meta/recipes-kernel/kexec/kexec-tools/kdump +++ b/meta/recipes-kernel/kexec/kexec-tools/kdump | |||
@@ -8,23 +8,7 @@ | |||
8 | # | 8 | # |
9 | 9 | ||
10 | #default | 10 | #default |
11 | KDUMP_KVER="`uname -r`" | 11 | KEXEC=/usr/sbin/kexec |
12 | KDUMP_KIMAGE="/boot/bzImage-${KDUMP_KVER}" | ||
13 | KDUMP_CMDLINE="`cat /proc/cmdline`" | ||
14 | KDUMP_CMDLINE_APPEND="kdump_needed maxcpus=1 irqpoll reset_devices" | ||
15 | KDUMP_VMCORE_PATH="/var/crash/`date +"%Y-%m-%d"`" | ||
16 | |||
17 | #get right kernel image | ||
18 | march="`uname -m`" | ||
19 | case ${march} in | ||
20 | x86*|i?86) | ||
21 | ;; | ||
22 | *) | ||
23 | KDUMP_KIMAGE="/boot/uImage-${KDUMP_KVER}" | ||
24 | ;; | ||
25 | esac | ||
26 | |||
27 | KEXEC=usr/sbin/kexec | ||
28 | KEXEC_ARGS="-p" | 12 | KEXEC_ARGS="-p" |
29 | 13 | ||
30 | MAKEDUMPFILE=/usr/bin/makedumpfile | 14 | MAKEDUMPFILE=/usr/bin/makedumpfile |
@@ -34,6 +18,9 @@ LOGGER="logger -p info -t kdump" | |||
34 | 18 | ||
35 | if [ -f /etc/sysconfig/kdump.conf ]; then | 19 | if [ -f /etc/sysconfig/kdump.conf ]; then |
36 | . /etc/sysconfig/kdump.conf | 20 | . /etc/sysconfig/kdump.conf |
21 | else | ||
22 | echo "no /etc/sysconfig/kdump.conf" | ||
23 | exit 1; | ||
37 | fi | 24 | fi |
38 | 25 | ||
39 | do_check() | 26 | do_check() |
@@ -41,24 +28,33 @@ do_check() | |||
41 | #check makedumpfile | 28 | #check makedumpfile |
42 | if [ ! -e ${MAKEDUMPFILE} -o ! -x ${MAKEDUMPFILE} ] ;then | 29 | if [ ! -e ${MAKEDUMPFILE} -o ! -x ${MAKEDUMPFILE} ] ;then |
43 | echo "No makedumpfile found." | 30 | echo "No makedumpfile found." |
44 | return 1; | 31 | exit 0 |
45 | fi | 32 | fi |
46 | 33 | ||
47 | #check kexec | 34 | #check kexec |
48 | if [ ! -e ${KEXEC} -o ! -x ${KEXEC} ] ;then | 35 | if [ ! -e ${KEXEC} -o ! -x ${KEXEC} ] ;then |
49 | echo "No kexec found." | 36 | echo "No kexec found." |
50 | return 1; | 37 | exit 0 |
51 | fi | 38 | fi |
52 | 39 | ||
53 | #check whether kdump kernel image exists on the system | 40 | #check whether kdump kernel image exists on the system |
54 | if [ ! -f ${KDUMP_KIMAGE} ]; then | 41 | if [ -z "${KDUMP_KIMAGE}" -o ! -f "${KDUMP_KIMAGE}" ]; then |
55 | echo "No kdump kernel image found." | 42 | echo "No kdump kernel image found." |
56 | return 1 | 43 | exit 0 |
44 | fi | ||
45 | |||
46 | if [ "${KDUMP_CMDLINE}"x = "x" ] ; then | ||
47 | echo "KDUMP_CMDLINE is not configured" | ||
48 | exit 0 | ||
57 | fi | 49 | fi |
58 | } | 50 | } |
59 | 51 | ||
60 | do_save_vmcore() | 52 | do_save_vmcore() |
61 | { | 53 | { |
54 | if [ ${KDUMP_VMCORE_PATH}x = x ]; then | ||
55 | KDUMP_VMCORE_PATH="/var/crash/`date +"%Y-%m-%d"`" | ||
56 | fi | ||
57 | |||
62 | mkdir -p ${KDUMP_VMCORE_PATH} | 58 | mkdir -p ${KDUMP_VMCORE_PATH} |
63 | echo "Saving a vmcore to ${KDUMP_VMCORE_PATH}." | 59 | echo "Saving a vmcore to ${KDUMP_VMCORE_PATH}." |
64 | 60 | ||
@@ -101,20 +97,6 @@ do_start() | |||
101 | return 1 | 97 | return 1 |
102 | fi | 98 | fi |
103 | 99 | ||
104 | #handle kdump cmdline parameters, remove some useless options | ||
105 | kcmdline="" | ||
106 | for x in `cat /proc/cmdline`; do | ||
107 | case $x in | ||
108 | crashkernel*) | ||
109 | ;; | ||
110 | *) | ||
111 | kcmdline="${kcmdline} $x" | ||
112 | ;; | ||
113 | esac | ||
114 | done | ||
115 | |||
116 | KDUMP_CMDLINE="${kcmdline} ${KDUMP_CMDLINE_APPEND}" | ||
117 | |||
118 | #Load the kdump kernel image | 100 | #Load the kdump kernel image |
119 | ${KEXEC} ${KEXEC_ARGS} "${KDUMP_KIMAGE}" --append="${KDUMP_CMDLINE}" | 101 | ${KEXEC} ${KEXEC_ARGS} "${KDUMP_KIMAGE}" --append="${KDUMP_CMDLINE}" |
120 | if [ $? != 0 ]; then | 102 | if [ $? != 0 ]; then |
diff --git a/meta/recipes-kernel/kexec/kexec-tools/kdump.conf b/meta/recipes-kernel/kexec/kexec-tools/kdump.conf index 42a2435b96..38190d207a 100644 --- a/meta/recipes-kernel/kexec/kexec-tools/kdump.conf +++ b/meta/recipes-kernel/kexec/kexec-tools/kdump.conf | |||
@@ -1,13 +1,9 @@ | |||
1 | #the kdump kernel version string. | 1 | #the kdump kernel version string. |
2 | #KDUMP_KVER="`uname -r`" | 2 | #KDUMP_KVER="`uname -r`" |
3 | 3 | ||
4 | #this will be passed to the kdump kernel as kdump kernel command line, it | 4 | #this will be passed to the kdump kernel as kdump kernel command line |
5 | #usually comes from /proc/cmdline | ||
6 | #KDUMP_CMDLINE="`cat /proc/cmdline`" | 5 | #KDUMP_CMDLINE="`cat /proc/cmdline`" |
7 | 6 | ||
8 | # append arguments to the kdump commandline | ||
9 | #KDUMP_CMDLINE_APPEND="kdump_needed maxcpus=1 irqpoll reset_devices" | ||
10 | |||
11 | #the kernel image for kdump | 7 | #the kernel image for kdump |
12 | #KDUMP_KIMAGE="/boot/bzImage-${KDUMP_KVER}" | 8 | #KDUMP_KIMAGE="/boot/bzImage-${KDUMP_KVER}" |
13 | 9 | ||