add dracut_args option to kdump.conf
mkdumprd call dracut to rebuilding kdump initrd, sometimes passing extra dracut args is helpful. For example user can enable debug output with --debug, --printsize to print roughly increased initramfs size by each module, --omit-drivers to omit kernel modules, etc. This patch enables dracut_args option for passing extra args to dracut. Also it modifies add_dracut_arg() to treat a string with-in quote as single string because for dracut options which has its own args, the args need to be quoted and space seperated. If add_dracut_arg() gets an string read from kdump.conf and if that string contains double quotes, then while converting to positional parameters those double quotes are not interpreted. Hence if /etc/kdump.conf contains following. dracut_args --add-drivers "driver1 driver2" then add_dracut_args() sees following positional parameters $1= --add-drivers $2= "driver1 $3= driver2" Notice, double quotes have been ignored and parameters have been broken based on white space. Modify add_dracut_arg() to look for parameters starting with " and if one is found, it tries to merge all the next parameters till one is found with ending double quote. Hence effectively simulating following behavior. $1= --add-drivers $2= "driver1 driver2" [v1->v2]: address quoted substring in dracut_args, also handle the leading and ending spaces in substring. [v2->v3]: fix dracut arguments seperator in kdump.conf. [v3->v4]: improve changelog, thanks vivek. [v4->v5]: make the manpage more verbose [vivek]. Tested with below dracut_args test cases: 1. dracut_args --add-drivers "pcspkr virtio_net" --omit-drivers "sdhci-pci hid-logitech-dj e1000" 2. dracut_args --add-drivers " pcspkr virtio_net " --omit-drivers "sdhci-pci hid-logitech-dj e1000" Signed-off-by: Dave Young <dyoung@redhat.com> Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
parent
9275e07621
commit
fe96b47828
@ -119,6 +119,10 @@
|
|||||||
# Specifying 1 means though block target is unresettable, user
|
# Specifying 1 means though block target is unresettable, user
|
||||||
# understand this situation and want to try dumping. By default,
|
# understand this situation and want to try dumping. By default,
|
||||||
# it's set to 0, means not to try a destined failure.
|
# it's set to 0, means not to try a destined failure.
|
||||||
|
#
|
||||||
|
# dracut_args <arg(s)>
|
||||||
|
# - Pass extra dracut options when rebuilding kdump
|
||||||
|
# initrd.
|
||||||
|
|
||||||
#raw /dev/vg/lv_kdump
|
#raw /dev/vg/lv_kdump
|
||||||
#ext4 /dev/vg/lv_kdump
|
#ext4 /dev/vg/lv_kdump
|
||||||
@ -136,3 +140,4 @@ path /var/crash
|
|||||||
#extra_modules gfs2
|
#extra_modules gfs2
|
||||||
#default shell
|
#default shell
|
||||||
#force_rebuild 1
|
#force_rebuild 1
|
||||||
|
#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
|
||||||
|
@ -171,6 +171,12 @@ to try dumping. By default, it's set to 0, means not to try a destined failure.
|
|||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
|
||||||
|
.B dracut_args <arg(s)>
|
||||||
|
.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
|
.SH DEPRECATED OPTIONS
|
||||||
|
|
||||||
.B net <nfs mount>|<user@server>
|
.B net <nfs mount>|<user@server>
|
||||||
|
2
kdumpctl
2
kdumpctl
@ -86,7 +86,7 @@ function check_config()
|
|||||||
case "$config_opt" in
|
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" ] && {
|
[ -z "$config_val" ] && {
|
||||||
echo "Invalid kdump config value for option $config_opt."
|
echo "Invalid kdump config value for option $config_opt."
|
||||||
return 1;
|
return 1;
|
||||||
|
25
mkdumprd
25
mkdumprd
@ -45,9 +45,29 @@ get_persistent_dev() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_dracut_arg() {
|
add_dracut_arg() {
|
||||||
|
local arg qarg is_quoted=0
|
||||||
while [ $# -gt 0 ];
|
while [ $# -gt 0 ];
|
||||||
do
|
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
|
shift
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -500,6 +520,9 @@ do
|
|||||||
core_collector)
|
core_collector)
|
||||||
verify_core_collector "$config_val"
|
verify_core_collector "$config_val"
|
||||||
;;
|
;;
|
||||||
|
dracut_args)
|
||||||
|
add_dracut_arg $config_val
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -n $(echo $config_opt | grep "^#.*$") ]
|
if [ -n $(echo $config_opt | grep "^#.*$") ]
|
||||||
then
|
then
|
||||||
|
Loading…
Reference in New Issue
Block a user