testing/makedumpfile: new aport
makedumpfile is used to take crash dumps with kexec on panic
The actual "load a backup kernel and take the dump" logic isn't that complicated, but unfortunately each distro seems to roll their own: https://github.com/rhkdump/kdump-utils https://tracker.debian.org/pkg/kdump-tools
So I just whipped up a minimal example for people to customize instead of doing something proper and checked it dumps in a VM and on a real board after setting up /etc/conf.d/kdump + crashkernel boot param:
# vi /etc/conf.d/kdump
(set kernel etc)
# vi /etc/update-extlinux.conf
(add crashkernel= param, set custom kernel as default)
# update-extlinux
# reboot
...
* Loading crash kernel ... [ ok ]
...
# echo c > /proc/sysrq-trigger
[ 17.876403] sysrq: Trigger a crash
...
* Dumping kernel /var/crash/2024-07-17-17:24:15 ...
Copying data : [100.0 %] - eta: 0s
The dumpfile is saved to /var/crash/2024-07-17-17:24:15/dump.
makedumpfile Completed.
The dmesg log is saved to /var/crash/2024-07-17-17:24:15/dmesg.
makedumpfile Completed.
* Dump done, rebooting
...
# ls -lh /var/crash/2024-07-17-17:24:15/
total 35M
-rw------- 1 root root 32.1K Jul 17 17:24 dmesg
-rw------- 1 root root 34.6M Jul 17 17:24 dump