When someone is using a minimal kernel without squash module installed, including squash dracut module will either either fail to build or fail to boot the initramfs.
As kdump always build the image for one single kernel, we can safely just use modprobe to check if a modules is already built in, or it exists and loadable for the kernel we are using for kdump image, and don't include the squash module if they are missing. Everything will still work just fine without squash module.
We do the check in kdump dracut modules not in squash dracut module because kdump dracut module could leverage of the KDUMP_KERNELVER variable to know which kernel it should check against, squash dracut module may be used to build for a generic image.
And we only check for the kernel module dependency, other binary dependencies are either well checked or well declared in dracut.
Signed-off-by: Kairui Song kasong@redhat.com --- dracut-module-setup.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 7499678..64d475f 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -18,7 +18,23 @@ check() { }
depends() { - local _dep="base shutdown squash" + local _dep="base shutdown" + + is_squash_available() { + for kmodule in squashfs overlay loop; do + if [ -z "$KDUMP_KERNELVER" ]; then + modprobe --dry-run $kmodule &>/dev/null || return 1 + else + modprobe -S $KDUMP_KERNELVER --dry-run $kmodule &>/dev/null || return 1 + fi + done + } + + if is_squash_available; then + _dep="$_dep squash" + else + dwarning "Required modules to build a squashed kdump image is missing!" + fi
if [ -n "$( find /sys/devices -name drm )" ] || [ -d /sys/module/hyperv_fb ]; then _dep="$_dep drm"
On 12/26/18 at 12:56am, Kairui Song wrote:
When someone is using a minimal kernel without squash module installed, including squash dracut module will either either fail to build or fail to boot the initramfs.
As kdump always build the image for one single kernel, we can safely just use modprobe to check if a modules is already built in, or it exists and loadable for the kernel we are using for kdump image, and don't include the squash module if they are missing. Everything will still work just fine without squash module.
We do the check in kdump dracut modules not in squash dracut module because kdump dracut module could leverage of the KDUMP_KERNELVER variable to know which kernel it should check against, squash dracut module may be used to build for a generic image.
And we only check for the kernel module dependency, other binary dependencies are either well checked or well declared in dracut.
Signed-off-by: Kairui Song kasong@redhat.com
dracut-module-setup.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 7499678..64d475f 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -18,7 +18,23 @@ check() { }
depends() {
- local _dep="base shutdown squash"
local _dep="base shutdown"
is_squash_available() {
for kmodule in squashfs overlay loop; do
if [ -z "$KDUMP_KERNELVER" ]; then
modprobe --dry-run $kmodule &>/dev/null || return 1
else
modprobe -S $KDUMP_KERNELVER --dry-run $kmodule &>/dev/null || return 1
fi
done
}
if is_squash_available; then
_dep="$_dep squash"
else
dwarning "Required modules to build a squashed kdump image is missing!"
fi
if [ -n "$( find /sys/devices -name drm )" ] || [ -d /sys/module/hyperv_fb ]; then _dep="$_dep drm"
-- 2.20.0.rc2
ACK
Thanks Dave