dracut.sh: fix early microcode detection logic

This fixes two issues:

1) on non-x86 systems in non-hostonly config this would cause
   an annoying warning on every initramfs generation
2) on non-x86 systems in hostonly config this would result in
   early microcode not getting disabled
master
q66 2020-07-25 17:28:16 +02:00 committed by Daniel Molkentin
parent 3b869230a0
commit d8d5cb839c
1 changed files with 15 additions and 8 deletions

View File

@ -1194,19 +1194,26 @@ fi


if [[ $early_microcode = yes ]]; then if [[ $early_microcode = yes ]]; then
if [[ $hostonly ]]; then if [[ $hostonly ]]; then
[[ $(get_cpu_vendor) == "AMD" ]] \ if [[ $(get_cpu_vendor) == "AMD" ]]; then
&& ! check_kernel_config CONFIG_MICROCODE_AMD \ check_kernel_config CONFIG_MICROCODE_AMD || unset early_microcode
&& unset early_microcode elif [[ $(get_cpu_vendor) == "Intel" ]]; then
[[ $(get_cpu_vendor) == "Intel" ]] \ check_kernel_config CONFIG_MICROCODE_INTEL || unset early_microcode
&& ! check_kernel_config CONFIG_MICROCODE_INTEL \ else
&& unset early_microcode unset early_microcode
fi
else else
! check_kernel_config CONFIG_MICROCODE_AMD \ ! check_kernel_config CONFIG_MICROCODE_AMD \
&& ! check_kernel_config CONFIG_MICROCODE_INTEL \ && ! check_kernel_config CONFIG_MICROCODE_INTEL \
&& unset early_microcode && unset early_microcode
fi fi
[[ $early_microcode != yes ]] \ # Do not complain on non-x86 architectures as it makes no sense
&& dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y" case $(uname -m) in
x86_64|i?86)
[[ $early_microcode != yes ]] \
&& dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y"
;;
*) ;;
esac
fi fi


# Need to be able to have non-root users read stuff (rpcbind etc) # Need to be able to have non-root users read stuff (rpcbind etc)