Commit Graph

6 Commits

Author SHA1 Message Date
c83ad9a83e initramfs/initcpio: Fix minimal initrd creation
Due to a brainfart, forgot the "-k" modifier on mkinitcpio call. It
happened to work by coincidence - without this flag, "uname -r" was
used and worked most of times, but that's clearly a bug.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2024-01-05 17:08:16 -03:00
acd5a64652 all: Add LICENSE (and fix SPDX deprecated header)
Thanks to the heads-up from Foxboron (on Arch Linux IRC channel)
add hereby a LICENSE file to the project that matches the SPDX
headers. While at it, fix the SPDX short identifier on headers,
that was deprecated (as per [0]).

The license file was a pure copy obtained today from [1].

[0] https://spdx.org/licenses/LGPL-2.1+.html
[1] https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2023-04-02 12:26:00 -03:00
4b5746a60e all: Rename the tool to kdumpst
Big but self-explanatory commit: rename the tool. The name choice was
kdumpst, since it's a tool to enable both kdump and pstore setting, also
it's a silly wordplay with the superlative of kdump, as in "kdumpest".

It's an invasive change (touches most of the files), but should
offer no functional change other than logging messages showing
kdumpst now, instead of kdump, and some filenames.

Notice it doesn't touch documentation, which will be done in
a subsequent commit.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2023-03-31 15:34:42 -03:00
dc4e6b964c initramfs/dracut: Enable zstd compression for kernels 5.9+
Way fast to compress/decompress and produce smaller archives (compared
to deflate/gzip in general), but only supported in kernels 5.9+.
Notice we fallback to the default "--compress=gzip" in case kernel
does not support zstd.

Special thanks to Clayton (craftyguy) for the kernel version test.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2023-03-31 15:34:42 -03:00
32692de010 initramfs: Guard against non-existing block device during kdump
Being extra cautious to prevent hangs.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
2023-03-31 15:34:42 -03:00
b834754cf9 initramfs: Switch to the alpm-hooks approach, supporting both initcpio/dracut
This is one of the major changes/refactors so far, touches a lot of
files, and more important, it completely changes some premises.
With this patch, we now support fully both dracut-based and initcpio
initramfs systems.

For that to happen, we needed to decouple the initramfs creation from
scripts, by using alpm-hooks. These hooks allow scripts to be run on
events like kernel package installation or in the installation of the very
package responsible to create the initramfs image. We still have the
"kdump-load create-initrd" command though.

One of the biggest modifications here was in the Makefile, that now
composes multiple files by changing keywords (like INITRD) to the
respective initramfs system (dracut or mkinitcpio). Notice that this
brought some extra complexity to the package.

The logic used for supporting both initramfs systems was basically
de-duplicate all possible code (having dup code in common files),
using Makefile tricks to merge such files and have the unique
bits in dracut/initcpio specific files. We currently support dracut
and both mkinitcpio and mkinitcpio-git packages.

Caveats: currently the initramfs specific package removal is not handled
here. So, if the user has dracut and installs kdump, we install the
dracut hooks. In case this user decides to remove dracut and installs
mkinitcpio, we install the mkinitcpio hooks and all should work, but
the previous dracut hooks installed are not unistalled by us; likely
the dracut package removal would drop the files itself.

This was a deliberate move to avoid even more alpm-hooks, should be
a rare case and as said, the package removal should clear the files
itself, without requiring our interaction. Also, by using the
alpm-hooks, we see "errors" (warnings really) about the other
initramfs package not being present - not sure if it's possible to
disable this behavior.

Finally, while at it:

* Added a new approach to dracut initramfs creation to pick the most
common block drivers - since it's hostonly, it doesn't add the ones
that aren't loaded, hence image is not bloated by that.

* Chenged the "command -v makedumpfile" validation to something
more elegant - thanks for the suggestion Clayton (@craftyguy).

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