diff --git a/00-default.conf b/00-default.conf index f7cca48..e810495 100644 --- a/00-default.conf +++ b/00-default.conf @@ -16,9 +16,15 @@ # relies in having an available RAM buffer on /proc/iomem with at least # PSTORE_MEM_AMOUNT (decimal, in MB) in size. Also, kernel must be able to # allocate a contiguous memory amount of PSTORE_RECORD_SZ (decimal, MB). +# If there is no such RAM buffer, there is a possibility to make use of +# the crash kernel area for that. There are risks: such memory area could +# have its address mapped differently across kernel updates; also if both +# pstore and the kdump kernel are loaded, that memory region will be for +# sure corrupted by the kexec panic load - so, kind of a last resource. USE_PSTORE_RAM=1 PSTORE_MEM_AMOUNT=4194304 PSTORE_RECORD_SZ=1048576 +PSTORE_RAM_USE_CRASH_MEM=0 # # # Mount-related options diff --git a/kdumpst-load.sh.in b/kdumpst-load.sh.in index cec33c6..c28b925 100644 --- a/kdumpst-load.sh.in +++ b/kdumpst-load.sh.in @@ -77,10 +77,14 @@ clear_all_initrds() { # Next routine parses /proc/iomem to obtain the biggest RAM buffer # available. Saves the results in 2 global variables: MEM_{SIZE,START}. parse_ram_buffers() { - BUFFERS="$(grep "RAM buffer" /proc/iomem)" + BUFFERS="$(grep "$1" /proc/iomem)" while read -r line do - RANGE=$(echo "$line" | cut -f1 -d\ ) + RANGE=$(echo "$line" | sed 's/^[[:space:]]*//g' | cut -f1 -d:) + + if [ "${RANGE}" == '' ]; then + continue + fi MEM_END=$(echo "$RANGE" | cut -f2 -d-) MSTART=$(echo "$RANGE" | cut -f1 -d-) @@ -155,7 +159,11 @@ if [ "${USE_PSTORE_RAM}" -eq 1 ]; then RECORD_SIZE="${PSTORE_RECORD_SZ}" MEM_SIZE=0 - parse_ram_buffers + parse_ram_buffers "RAM buffer" + + if [ "${MEM_SIZE}" -eq 0 ] && [ "${PSTORE_RAM_USE_CRASH_MEM}" -eq 1 ]; then + parse_ram_buffers "Crash kernel" + fi if [ "${MEM_SIZE}" -gt 0 ]; then if modprobe ramoops mem_address=0x"${MEM_START}" mem_size="${MEM_REQUIRED}" record_size="${RECORD_SIZE}"; then