[OpenWrt-Devel] [PATCH v2 1/2] x86: add amd microcode entries to grub config

Tomasz Maciej Nowak tomek_n at o2.pl
Wed Oct 31 13:48:37 EDT 2018


Create initrd enries for x86 images, that'll load amd microcode as early
as possible. Also remove the preinit script responsible for late load of
microcode.

Signed-off-by: Tomasz Maciej Nowak <tomek_n at o2.pl>
---
 .../x86/base-files/lib/preinit/02_load_x86_ucode     | 12 ------------
 target/linux/x86/image/grub-iso.cfg                  |  9 +++++++--
 target/linux/x86/image/grub.cfg                      |  9 +++++++--
 3 files changed, 14 insertions(+), 16 deletions(-)
 delete mode 100644 target/linux/x86/base-files/lib/preinit/02_load_x86_ucode

diff --git a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode b/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
deleted file mode 100644
index d3a23e24b2..0000000000
--- a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2018 OpenWrt.org
-
-do_load_x86_ucode() {
-	if grep -q AuthenticAMD /proc/cpuinfo; then
-		if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then
-			echo 1 > /sys/devices/system/cpu/microcode/reload
-		fi
-	fi
-}
-
-boot_hook_add preinit_main do_load_x86_ucode
diff --git a/target/linux/x86/image/grub-iso.cfg b/target/linux/x86/image/grub-iso.cfg
index 5d128aa3aa..c624cbe0ee 100644
--- a/target/linux/x86/image/grub-iso.cfg
+++ b/target/linux/x86/image/grub-iso.cfg
@@ -7,7 +7,12 @@ set root='(cd)'
 
 menuentry "@TITLE@" {
 	linux /boot/vmlinuz @CMDLINE@ noinitrd
-	if [ -s /boot/intel-ucode.img ]; then
-		initrd /boot/intel-ucode.img
+	set amd="/boot/amd-ucode.img"
+	set intel="/boot/intel-ucode.img"
+	if [ -s "$amd" ]; then
+		initrd $amd $intel
+	fi
+	if [ -s "$intel" ]; then
+		initrd $intel $amd
 	fi
 }
diff --git a/target/linux/x86/image/grub.cfg b/target/linux/x86/image/grub.cfg
index a665686863..21d719261b 100644
--- a/target/linux/x86/image/grub.cfg
+++ b/target/linux/x86/image/grub.cfg
@@ -7,8 +7,13 @@ set root='(@ROOT@)'
 
 menuentry "@TITLE@" {
 	linux /boot/vmlinuz @CMDLINE@ noinitrd
-	if [ -s /boot/intel-ucode.img ]; then
-		initrd /boot/intel-ucode.img
+	set amd="/boot/amd-ucode.img"
+	set intel="/boot/intel-ucode.img"
+	if [ -s "$amd" ]; then
+		initrd $amd $intel
+	fi
+	if [ -s "$intel" ]; then
+		initrd $intel $amd
 	fi
 }
 menuentry "@TITLE@ (failsafe)" {
-- 
2.19.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list