From: Harald Hoyer Date: Wed, 20 Aug 2014 08:13:55 +0000 (+0200) Subject: Check kernel config for early microcode and ACPI override X-Git-Tag: 039~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e3f6537493d94d9818dc4456ce8cb629a17040f;p=thirdparty%2Fdracut.git Check kernel config for early microcode and ACPI override Disable early microcode and ACPI override, if the kernel does not support it. --- diff --git a/dracut-functions.sh b/dracut-functions.sh index 928682827..4ad77aa58 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -739,7 +739,6 @@ fs_get_option() { done } - if ! [[ $DRACUT_INSTALL ]]; then DRACUT_INSTALL=$(find_binary dracut-install) fi @@ -1740,6 +1739,24 @@ instmods() { _ret=$? return $_ret } + +check_kernel_config() +{ + local _config_opt="$1" + local _config_file + [[ -f /boot/config-$kernel ]] \ + && _config_file="/boot/config-$kernel" + [[ -f /lib/modules/$kernel/config ]] \ + && _config_file="/lib/modules/$kernel/config" + + # no kernel config file, so return true + [[ $_config_file ]] || return 0 + + grep -q -F "${_config_opt}=" "$_config_file" && return 0 + return 1 +} + + # get_cpu_vendor # Only two values are returned: AMD or Intel get_cpu_vendor () diff --git a/dracut.sh b/dracut.sh index 2cce85b47..0e9b2a54f 100755 --- a/dracut.sh +++ b/dracut.sh @@ -983,6 +983,28 @@ if [[ ! $print_cmdline ]]; then fi fi +if [[ $acpi_override = yes ]] && ! check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE; then + dwarn "Disabling ACPI override, because kernel does not support it. CONFIG_ACPI_INITRD_TABLE_OVERRIDE!=y" + unset acpi_override +fi + +if [[ $early_microcode = yes ]]; then + if [[ $hostonly ]]; then + [[ $(get_cpu_vendor) == "AMD" ]] \ + && ! check_kernel_config CONFIG_MICROCODE_AMD_EARLY \ + && unset early_microcode + [[ $(get_cpu_vendor) == "Intel" ]] \ + && ! check_kernel_config CONFIG_MICROCODE_INTEL_EARLY \ + && unset early_microcode + else + ! check_kernel_config CONFIG_MICROCODE_AMD_EARLY \ + && ! check_kernel_config CONFIG_MICROCODE_INTEL_EARLY \ + && unset early_microcode + fi + [[ $early_microcode != yes ]] \ + && dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]_EARLY!=y" +fi + # Need to be able to have non-root users read stuff (rpcbind etc) chmod 755 "$initdir"