Browse Source

Check kernel config for early microcode and ACPI override

Disable early microcode and ACPI override, if the kernel does not
support it.
master
Harald Hoyer 11 years ago
parent
commit
8e3f653749
  1. 19
      dracut-functions.sh
  2. 22
      dracut.sh

19
dracut-functions.sh

@ -739,7 +739,6 @@ fs_get_option() { @@ -739,7 +739,6 @@ fs_get_option() {
done
}


if ! [[ $DRACUT_INSTALL ]]; then
DRACUT_INSTALL=$(find_binary dracut-install)
fi
@ -1740,6 +1739,24 @@ instmods() { @@ -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 ()

22
dracut.sh

@ -983,6 +983,28 @@ if [[ ! $print_cmdline ]]; then @@ -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"


Loading…
Cancel
Save