diff --git a/kdump.conf b/kdump.conf index de3ad4a..c5cfb4a 100644 --- a/kdump.conf +++ b/kdump.conf @@ -119,6 +119,10 @@ # Specifying 1 means though block target is unresettable, user # understand this situation and want to try dumping. By default, # it's set to 0, means not to try a destined failure. +# +# dracut_args +# - Pass extra dracut options when rebuilding kdump +# initrd. #raw /dev/vg/lv_kdump #ext4 /dev/vg/lv_kdump @@ -136,3 +140,4 @@ path /var/crash #extra_modules gfs2 #default shell #force_rebuild 1 +#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3" diff --git a/kdump.conf.5 b/kdump.conf.5 index 9e498c5..6f88370 100644 --- a/kdump.conf.5 +++ b/kdump.conf.5 @@ -171,6 +171,12 @@ to try dumping. By default, it's set to 0, means not to try a destined failure. .RE +.B dracut_args +.RS +Kdump uses dracut to generate initramfs for second kernel. This option +allows a user to pass arguments to dracut directly. +.RE + .SH DEPRECATED OPTIONS .B net | diff --git a/kdumpctl b/kdumpctl index 9b102e5..fad323c 100755 --- a/kdumpctl +++ b/kdumpctl @@ -86,7 +86,7 @@ function check_config() case "$config_opt" in \#* | "") ;; - raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild) + raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args) [ -z "$config_val" ] && { echo "Invalid kdump config value for option $config_opt." return 1; diff --git a/mkdumprd b/mkdumprd index 0be02f6..24e5d98 100644 --- a/mkdumprd +++ b/mkdumprd @@ -45,9 +45,29 @@ get_persistent_dev() { } add_dracut_arg() { + local arg qarg is_quoted=0 while [ $# -gt 0 ]; do - dracut_args+=("$1") + arg="${1//\'/\"}" + #Handle quoted substring properly for passing it to dracut_args array. + if [ $is_quoted -eq 0 ]; then + if [[ "$arg" == "\"" ]] || [[ $arg != ${arg#\"} ]]; then + is_quoted=1 + arg=${arg#\"} + fi + fi + if [ $is_quoted -eq 1 ]; then + qarg="$qarg $arg" + if [[ "$arg" == "\"" ]] || [[ $arg != ${arg%\"} ]]; then + is_quoted=0 + arg=${qarg%\"} + qarg="" + else + shift + continue + fi + fi + dracut_args+=("$arg") shift done } @@ -500,6 +520,9 @@ do core_collector) verify_core_collector "$config_val" ;; + dracut_args) + add_dracut_arg $config_val + ;; *) if [ -n $(echo $config_opt | grep "^#.*$") ] then