已关闭
fix(dracut.sh): remove microcode check based on CONFIG_MICROCODE_[AMD|INTEL] #185
zhaoxiaohu创建于 5月18日关闭于 5月19日
fix(dracut.sh): remove microcode check based on CONFIG_MICROCODE_[AMD|INTEL] #185
已关闭
共 2 个文件变更+54-1
| @@ -9,7 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | Name: dracut | 10 | Name: dracut |
| 11 | Version: 055 | 11 | Version: 055 |
| 12 | -Release: 17 | 12 | +Release: 18 |
| 13 | 13 | ||
| 14 | Summary: Initramfs generator using udev | 14 | Summary: Initramfs generator using udev |
| 15 | 15 | ||
| @@ -105,6 +105,7 @@ Patch6053: backport-fix-dracut-util-do-not-call-strcmp-if-the-value-argu.patch | |||
| 105 | Patch9000: remove-iscsi-related-code-since-it-is-no-longer-main.patch | 105 | Patch9000: remove-iscsi-related-code-since-it-is-no-longer-main.patch |
| 106 | Patch9001: fix-dracut-install-copy-mode-when-use-clone-ioctl.patch | 106 | Patch9001: fix-dracut-install-copy-mode-when-use-clone-ioctl.patch |
| 107 | Patch9002: backport-fix-dracut-functions.sh-config-microcode-support-Hygon.patch | 107 | Patch9002: backport-fix-dracut-functions.sh-config-microcode-support-Hygon.patch |
| 108 | +Patch9003: fix-dracut.sh-remove-microcode-check-based-on-CONFIG.patch | ||
| 108 | 109 | ||
| 109 | Source1: https://www.gnu.org/licenses/lgpl-2.1.txt | 110 | Source1: https://www.gnu.org/licenses/lgpl-2.1.txt |
| 110 | Source2: openEuler.conf.example | 111 | Source2: openEuler.conf.example |
| @@ -579,6 +580,9 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne | |||
| 579 | %endif | 580 | %endif |
| 580 | 581 | ||
| 581 | %changelog | 582 | %changelog |
| 583 | +* Wed Apr 1 2026 zhaoxiaohu <zhaoxiaohu@kuaishou.com> - 055-18 | ||
| 584 | +- fix: dracut: Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y | ||
| 585 | + | ||
| 582 | * Wed Mar 11 2026 wjiang <app@cameyan.com> - 055-17 | 586 | * Wed Mar 11 2026 wjiang <app@cameyan.com> - 055-17 |
| 583 | - fix(dracut-util): do not call `strcmp` if the `value` argument is NULL | 587 | - fix(dracut-util): do not call `strcmp` if the `value` argument is NULL |
| 584 | 588 | ||
| @@ -0,0 +1,49 @@ | |||
| 1 | +From 84017bf61bb3a75577e0787e418a2f40434a4eaf Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: zhaoxiaohu <zhaoxiaohu@kuaishou.com> | ||
| 3 | +Date: Tue, 31 Mar 2026 21:57:53 +0800 | ||
| 4 | +Subject: [PATCH 1/1] fix(dracut.sh): remove microcode check based on | ||
| 5 | + CONFIG_MICROCODE_[AMD|INTEL] `CONFIG_MICROCODE_AMD` and | ||
| 6 | + `CONFIG_MICROCODE_INTEL` are hidden since | ||
| 7 | + https://lore.kernel.org/all/20230810160805.081212701@linutronix.de/, | ||
| 8 | + therefore this check is wrong and early microcode is always disabled. | ||
| 9 | + | ||
| 10 | +Signed-off-by: zhaoxiaohu <zhaoxiaohu@kuaishou.com> | ||
| 11 | +--- | ||
| 12 | + dracut.sh | 11 ++++------- | ||
| 13 | + 1 file changed, 4 insertions(+), 7 deletions(-) | ||
| 14 | + | ||
| 15 | +diff --git a/dracut.sh b/dracut.sh | ||
| 16 | +index 3293bc9..2457665 100755 | ||
| 17 | +--- a/dracut.sh | ||
| 18 | ++++ b/dracut.sh | ||
| 19 | +@@ -1389,23 +1389,20 @@ fi | ||
| 20 | + | ||
| 21 | + if [[ $early_microcode == yes ]]; then | ||
| 22 | + if [[ $hostonly ]]; then | ||
| 23 | +- if [[ $(get_cpu_vendor) == "AMD" ]]; then | ||
| 24 | +- check_kernel_config CONFIG_MICROCODE_AMD || unset early_microcode | ||
| 25 | +- elif [[ $(get_cpu_vendor) == "Intel" ]]; then | ||
| 26 | +- check_kernel_config CONFIG_MICROCODE_INTEL || unset early_microcode | ||
| 27 | ++ if [[ $(get_cpu_vendor) == "AMD" || $(get_cpu_vendor) == "Intel" ]]; then | ||
| 28 | ++ check_kernel_config CONFIG_MICROCODE || unset early_microcode | ||
| 29 | + else | ||
| 30 | + unset early_microcode | ||
| 31 | + fi | ||
| 32 | + else | ||
| 33 | +- ! check_kernel_config CONFIG_MICROCODE_AMD \ | ||
| 34 | +- && ! check_kernel_config CONFIG_MICROCODE_INTEL \ | ||
| 35 | ++ ! check_kernel_config CONFIG_MICROCODE \ | ||
| 36 | + && unset early_microcode | ||
| 37 | + fi | ||
| 38 | + # Do not complain on non-x86 architectures as it makes no sense | ||
| 39 | + case $(uname -m) in | ||
| 40 | + x86_64 | i?86) | ||
| 41 | + [[ $early_microcode != yes ]] \ | ||
| 42 | +- && dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y" | ||
| 43 | ++ && dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE!=y" | ||
| 44 | + ;; | ||
| 45 | + *) ;; | ||
| 46 | + esac | ||
| 47 | +-- | ||
| 48 | +2.33.0 | ||
| 49 | + | ||
这个改法是不是不太合适,假设某个异常场景内核config有CONFIG_MICROCODE_INTEL没有CONFIG_MICROCODE_AMD ,且$(get_cpu_vendor) == "AMD",那逻辑就是不对的了。
本质上说这个修改的逻辑破坏了原有语义。如果想兼容高版本内核,还是需要确保原有逻辑不要有变更吧