# Only include kdump if it is explicitly asked in the argument list check() { return 255 } installkernel() { load_kdump_config # First clear all unnecessary firmwares/drivers added by drm in order # to reduce the size of the minimal initramfs being created - kdump # is an non-graphical environment. This should have been already done # via dracut cmdline arguments, but play safe and delete here as well. # Our list include the most common FWs/drivers (amd, i915, nvidia) rm -rf "$initdir"/usr/lib/firmware/{amdgpu,i915,nvidia,radeon} rm -rf "$initdir"/usr/lib/modules/*/kernel/drivers/gpu/drm/{amd,i915,nouveau,radeon} FSMOD="$(findmnt -n -o FSTYPE --target "${MOUNT_FOLDER}")" if [ -z "${FSMOD}" ]; then logger "kdump: error on filesystem discovery" exit 1 fi hostonly='' instmods "${FSMOD}" } install() { # A valid makedumpfile is essential for the kdump initrd creation. if [ ! -x "$(command -v makedumpfile)" ]; then logger "kdump: failed to create dracut initrd, makedumpfile is missing" exit 1 fi load_kdump_config # Install necessary binaries inst date inst sync inst makedumpfile # Copying kdump config/lib files is essential for a functional kdump. cp -LR --preserve=all /usr/share/kdump.d/ "$initdir"/usr/share/ cp -LR --preserve=all /usr/lib/kdump/ "$initdir"/usr/lib/ # Finally, we need to derive the proper place to save the dump from the # config files, in a way that makes possible to mount it in early boot. DEVNODE="$(findmnt -n -o SOURCE --target "${MOUNT_FOLDER}")" if [ -z "${DEVNODE}" ]; then logger "kdump: error on devnode discovery" exit 1 fi echo "${DEVNODE}" > "$initdir"/usr/lib/kdump/kdump.mnt TGT="$(findmnt -n -o TARGET --target "${MOUNT_FOLDER}")" if [ -z "${TGT}" ]; then logger "kdump: error on base folder discovery" exit 1 fi BASE_FLD="${MOUNT_FOLDER#*$TGT}" echo "${BASE_FLD}" > "$initdir"/usr/lib/kdump/kdump.dir inst_hook pre-mount 01 "$moddir/kdump-collect.sh" }