all: Add/improve config options

As part of the upstreaming effort, we need to add some extra tunings
in the package. Especially related to GRUB autosetting and Pstore
memory settings:

(a) Currently the ramoops record size and memory amount are hardcoded
in the kdump-load script - we change it here, by having these settings
on the kdump config file;

(b) GRUB autosetting is pretty simple and everything is hardcoded.
We hereby add a bunch of configurable settings in the kdump conf file,
in order we can customize the GRUB handling, to make it work in both
Arch and SteamOS.

While at it, fixed some related comments and renamed some variables,
usually dropping KDUMP_ name when it applies to pstore as well.
Also, bumped the crashkernel memory from 192M to 256M - recent kernels
demand more memory, let's play safe.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
This commit is contained in:
Guilherme G. Piccoli
2022-11-25 14:10:04 -03:00
parent 7f212ffb73
commit ecbf6f298f
4 changed files with 100 additions and 72 deletions

View File

@ -25,16 +25,16 @@ if [ ${HAVE_CFG_FILES} -eq 0 ]; then
exit 1
fi
KDUMP_MAIN_FOLDER="$(cat "${KDUMP_MNT}")"
rm -f "${KDUMP_MNT}"
MAIN_FOLDER="$(cat "${MNT_TMP}")"
rm -f "${MNT_TMP}"
if [ ! -d "${KDUMP_MAIN_FOLDER}" ]; then
logger "kdump: invalid folder (${KDUMP_MAIN_FOLDER}) - aborting..."
if [ ! -d "${MAIN_FOLDER}" ]; then
logger "kdump: invalid folder (${MAIN_FOLDER}) - aborting..."
exit 1
fi
LOGS_FOUND=0
KDUMP_TMP_FOLDER="${KDUMP_MAIN_FOLDER}/.tmp"
KDUMP_TMP_FOLDER="${MAIN_FOLDER}/.tmp"
# Use UTC timezone to match kdump collection
CURRENT_TSTAMP=$(date -u +"%Y%m%d%H%M")
@ -67,7 +67,7 @@ if [ "${PSTORE_CNT}" -ne 0 ]; then
fi
# Now, we proceed the same way if there are kdump data.
KDUMP_CRASH_FOLDER="${KDUMP_MAIN_FOLDER}/crash"
KDUMP_CRASH_FOLDER="${MAIN_FOLDER}/crash"
KDUMP_CNT=$(find "${KDUMP_CRASH_FOLDER}"/* -type d 2>/dev/null | wc -l)
if [ "${KDUMP_CNT}" -ne 0 ]; then
@ -112,10 +112,10 @@ fi
# If we have pstore and/or kdump logs, let's process them...
KDUMP_LOGS_FOLDER="${KDUMP_MAIN_FOLDER}/logs"
LOGS_FOLDER="${MAIN_FOLDER}/logs"
if [ ${LOGS_FOUND} -ne 0 ]; then
mkdir -p "${KDUMP_LOGS_FOLDER}"
mkdir -p "${LOGS_FOLDER}"
# First we collect some more info, like DMI data, os-release, etc;
DMI_FNAME="${KDUMP_TMP_FOLDER}/dmidecode.${CURRENT_TSTAMP}"
@ -131,7 +131,7 @@ if [ ${LOGS_FOUND} -ne 0 ]; then
# Create the dump compressed pack.
LOG_FNAME="kdump-${CURRENT_TSTAMP}.zip"
LOG_FNAME="${KDUMP_LOGS_FOLDER}/${LOG_FNAME}"
LOG_FNAME="${LOGS_FOLDER}/${LOG_FNAME}"
zip -9 -jq "${LOG_FNAME}" "${KDUMP_TMP_FOLDER}"/* 1>/dev/null
sync "${LOG_FNAME}" 2>/dev/null
@ -139,7 +139,7 @@ if [ ${LOGS_FOUND} -ne 0 ]; then
logger "kdump: couldn't create the compressed log archive"
logger "kdump: check folder \"${KDUMP_TMP_FOLDER}\" for logs"
else
logger "kdump: logs saved in \"${KDUMP_LOGS_FOLDER}\""
logger "kdump: logs saved in \"${LOGS_FOLDER}\""
fi
fi