selftests/kexec: update searching for the Kconfig
authorMimi Zohar <zohar@linux.ibm.com>
Fri, 3 Dec 2021 15:20:42 +0000 (10:20 -0500)
committerMimi Zohar <zohar@linux.ibm.com>
Fri, 31 Dec 2021 18:16:13 +0000 (13:16 -0500)
First check /lib/modules/`uname -r`/config, before using the IKCONFIG.
In addition, the configs.ko might be compressed.  Fix the configs.ko
name.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
tools/testing/selftests/kexec/kexec_common_lib.sh

index 43017cf..5a1b8ae 100755 (executable)
@@ -138,15 +138,20 @@ kconfig_enabled()
        return 0
 }
 
-# Attempt to get the kernel config first via proc, and then by
-# extracting it from the kernel image or the configs.ko using
-# scripts/extract-ikconfig.
+# Attempt to get the kernel config first by checking the modules directory
+# then via proc, and finally by extracting it from the kernel image or the
+# configs.ko using scripts/extract-ikconfig.
 # Return 1 for found.
 get_kconfig()
 {
        local proc_config="/proc/config.gz"
        local module_dir="/lib/modules/`uname -r`"
-       local configs_module="$module_dir/kernel/kernel/configs.ko"
+       local configs_module="$module_dir/kernel/kernel/configs.ko*"
+
+       if [ -f $module_dir/config ]; then
+               IKCONFIG=$module_dir/config
+               return 1
+       fi
 
        if [ ! -f $proc_config ]; then
                modprobe configs > /dev/null 2>&1