Add pstore-RAM support and fix comments indentation
Check README.MD and /etc/default/kdump for instructions on pstore usage - should be simple, it's automatically configured. Notice that we expect all units to have the same e820 memory map, hence to have the RAM buffer available. This point should be better clarified by the team working with firmware. Also, the package now enables the kdump systemd service automatically, in a post-installer hook. Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
This commit is contained in:
@ -4,10 +4,50 @@
|
||||
#
|
||||
# Copyright (c) 2021 Valve.
|
||||
#
|
||||
# This is a dummy script (for now) that aims to submit error/crash
|
||||
# This is currently a dummy script for kdump, but collects and clears
|
||||
# pstore saved logs for now. It aims, in the future, to submit error/crash
|
||||
# reports to Valve servers in order to do a post-mortem analysis.
|
||||
# This is part of SteamOS kdump - it is invoked by systemd on boot time
|
||||
# and for now it just graciously exits.
|
||||
# and should always exit graciously to avoid breaking the boot services.
|
||||
#
|
||||
|
||||
if [ ! -f "/etc/default/kdump" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
. /etc/default/kdump
|
||||
|
||||
# Yeah, we assume pstore is mounted by default, in this location;
|
||||
# if not, we get a 0 and don't loop.
|
||||
PSTORE_CNT=$(find /sys/fs/pstore/* 2>/dev/null | grep -c ramoops)
|
||||
if [ ${PSTORE_CNT} -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# We do some validation to be sure KDUMP_MNT pointed path is valid...
|
||||
KDUMP_CRASH_FOLDER="$(cat ${KDUMP_MNT})"
|
||||
rm -f ${KDUMP_MNT}
|
||||
|
||||
if [ ! -d "${KDUMP_CRASH_FOLDER}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# If valid, then dump the pstore logs in the crash subfolder.
|
||||
KDUMP_CRASH_FOLDER="${KDUMP_CRASH_FOLDER}/crash"
|
||||
mkdir -p ${KDUMP_CRASH_FOLDER}
|
||||
|
||||
PSTORE_TSTAMP=$(date +"%Y%m%d%H%M")
|
||||
LOOP_CNT=0
|
||||
while [ ${PSTORE_CNT} -gt 0 ];
|
||||
do
|
||||
PSTORE_FILE="$(find /sys/fs/pstore/* | grep ramoops | sort | head -n1)"
|
||||
SAVED_FILE="${KDUMP_CRASH_FOLDER}/dmesg-pstore.${PSTORE_TSTAMP}-${LOOP_CNT}"
|
||||
|
||||
cat ${PSTORE_FILE} > ${SAVED_FILE}
|
||||
sync ${SAVED_FILE}
|
||||
rm -f ${PSTORE_FILE}
|
||||
|
||||
PSTORE_CNT=$((${PSTORE_CNT} - 1))
|
||||
LOOP_CNT=$((${LOOP_CNT} + 1))
|
||||
done
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user