This helper function will be used to retrieve the value of kernel
cmdline parameters including crashkernel, fadump, swiotlb and etc.
Suggested-by: Philipp Rudo <prudo(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdumpctl | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index 1938968..7fc3a4d 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1306,6 +1306,17 @@ get_default_crashkernel()
echo -n "$(kdump_get_arch_recommend_crashkernel "$_dump_mode")"
}
+# Read kernel cmdline parameter for a specific kernel
+# $1: kernel path, DEFAULT or kernel path, ALL not accepted
+# $2: kernel cmldine parameter
+get_grub_kernel_boot_parameter()
+{
+ local _kernel_path=$1 _para=$2
+
+ [[ $_kernel_path == ALL ]] && derror "kernel_path=ALL invalid for
get_grub_kernel_boot_parameter" && return 1
+ grubby --info="$_kernel_path" | sed -En -e
"/^args=.*$/{s/^.*(\s|\")${_para}=(\S*).*\"$/\2/p;q}"
+}
+
reset_crashkernel()
{
local kernel=$1 entry crashkernel_default
--
2.31.1