Files
kdumpst/module-setup.sh
Guilherme G. Piccoli 5c1cc98502 kdump-steamos: Move configuration file out of /etc
This patch main goal is to "un-Debianize" the configuration file
for kdump-steamos - thanks Emil (@xexaxo) for the discussions; it
is with a bit of a heavy heart I do that, but let's comply with the
modern distros ;-)

We hereby put the config file in a more standard path: /usr/share.
Usually users could override that with /etc/ file, but not in this
case, or at least, not for now. Kdump/pstore is expected to work
quietly, with no users' interference. Advanced users might want to
play with the configs though; and those can just go ahead and edit
the /usr/share/kdump/kdump.conf - it's all documented in the README.

In the future we can improve that by having the override mechanism
with the /etc file, let's see if we have a demand for that.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2023-03-31 15:34:42 -03:00

52 lines
1.5 KiB
Bash

#!/bin/sh
#
# SPDX-License-Identifier: LGPL-2.1+
#
# Copyright (c) 2021 Valve.
#
# SteamOS kdump module construction/inclusion script for
# Dracut-based initramfs.
#
# Only include kdump if it is explicitly asked in the argument list
check() {
return 255
}
installkernel() {
hostonly='' instmods ext4
}
install() {
# Having a valid /usr/share/kdump/kdump.conf is essential for kdump.
if [ ! -s "/usr/share/kdump/kdump.conf" ]; then
return 1
fi
. /usr/share/kdump/kdump.conf
# First clear all unnecessary firmwares/drivers added by drm in order to
# reduce the size of this minimal initramfs being created. This should
# be already done via command-line arguments, but let's play safe and delete
# from here as well just in case.
rm -rf "$initdir"/usr/lib/firmware/amdgpu/
rm -rf "$initdir"/usr/lib/modules/*/kernel/drivers/gpu/drm/amd/*
# Install necessary binaries
inst date
inst sync
inst makedumpfile
mkdir -p "$initdir"/usr/lib/kdump
# Determine the numerical devnode for kdump, and save it on initrd;
# notice that partset link is not available that early in boot time.
DEVN="$(readlink -f "${MOUNT_DEVNODE}")"
echo "${DEVN}" > "$initdir"/usr/lib/kdump/kdump.devnode
cp -LR --preserve=all /usr/lib/kdump/* "$initdir"/usr/lib/kdump/
cp -LR --preserve=all /usr/share/kdump/kdump.conf "$initdir"/usr/lib/kdump/kdump.conf
inst_hook pre-mount 01 "$moddir/kdump-collect.sh"
}