aboutsummaryrefslogtreecommitdiffstats
path: root/package/boot/kexec-tools/files/kdump.defaults
diff options
context:
space:
mode:
Diffstat (limited to 'package/boot/kexec-tools/files/kdump.defaults')
-rw-r--r--package/boot/kexec-tools/files/kdump.defaults14
1 files changed, 13 insertions, 1 deletions
diff --git a/package/boot/kexec-tools/files/kdump.defaults b/package/boot/kexec-tools/files/kdump.defaults
index 2f15e757bf..62366a2950 100644
--- a/package/boot/kexec-tools/files/kdump.defaults
+++ b/package/boot/kexec-tools/files/kdump.defaults
@@ -1,10 +1,22 @@
#!/bin/sh
+# kB disable if mem low than 256MB
+memtotal=`grep MemTotal /proc/meminfo | awk '{print $2}'`
+if test $memtotal -le 262144; then
+ exit 0
+fi
+KZ=128
+if test $memtotal -ge 8388608; then
+ KZ=512
+elif test $memtotal -ge 4194304; then
+ KZ=256
+fi
+
case $(uname -m) in
i?86|x86_64)
if ! grep -q crashkernel /boot/grub/grub.cfg; then
mount /boot -o remount,rw
- sed -i 's/linux.*/& crashkernel=32M@32M/' /boot/grub/grub.cfg
+ sed -i "s/linux.*/& crashkernel=${KZ}M/" /boot/grub/grub.cfg
mount /boot -o remount,ro
fi
;;