What happens here is that the way GRUB's cmdline _removal_ was implemented
so far, it tries to remove "crashkernel=" from GRUB in pstore case, based
on kdumpst configuration. BUT it generates the GRUB config no matter what,
so if users added a crashkernel entry themselves, that doesn't match
kdumpst config file, what happens now is:
1) The code will try to sed-out our crashkernel setting from GRUB's
config, with no success (since our particular setting's not there);
2) GRUB config *will be* recreated by kdumpst (needlessly).
Fix that by checking if our crashkernel tuning is there before
the sed command is attempted (and the GRUB config, recreated).
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Currently kdumpst only allows a proper RAM buffer to be used as ramoops
memory area - this is the proper way of doing that, but there are cases
in which it's not trivial to have these buffers available:
(a) In case it's not there by default (due to kernel alignment / device-tree)
for example, there is no easy parameter to reserve such area right now
(using mem= is the way to go, but a bit complex to gather the exact size).
(b) The kernel parameter crashkernel= does something like this: reserve
a piece of memory not to be used by the kernel. It's meant for kdump, but
can be (ab)used for other purposes.
So, we hereby add a way for kdumpst to make use of crash reserved area
if the users wish so; the risks are exposed in the config file text.
Also, since we're changing this code, take the opportunity to improve the
sanitization of addresses from /proc/iomem and fix a corner case of empty
RANGE in the iomem parsing routine.
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
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>