[LEDE-DEV] [PATCH 1/2] x86: add amd microcode entries to grub config

Tomasz Maciej Nowak tomek_n at o2.pl
Tue Apr 24 05:56:19 PDT 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                  |  3 +++
 target/linux/x86/image/grub.cfg                      |  3 +++
 3 files changed, 6 insertions(+), 12 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 30b587bd1c..5a2d67b7b3 100644
--- a/target/linux/x86/image/grub-iso.cfg
+++ b/target/linux/x86/image/grub-iso.cfg
@@ -10,4 +10,7 @@ menuentry "OpenWrt" {
 	if [ -e /boot/intel-ucode.img ]; then
 		initrd /boot/intel-ucode.img
 	fi
+	if [ -e /boot/amd-ucode.img ]; then
+		initrd /boot/amd-ucode.img
+	fi
 }
diff --git a/target/linux/x86/image/grub.cfg b/target/linux/x86/image/grub.cfg
index dde24b95ce..caf38ec2c4 100644
--- a/target/linux/x86/image/grub.cfg
+++ b/target/linux/x86/image/grub.cfg
@@ -10,6 +10,9 @@ menuentry "OpenWrt" {
 	if [ -e /boot/intel-ucode.img ]; then
 		initrd /boot/intel-ucode.img
 	fi
+	if [ -e /boot/amd-ucode.img ]; then
+		initrd /boot/amd-ucode.img
+	fi
 }
 menuentry "OpenWrt (failsafe)" {
 	linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
-- 
2.17.0




More information about the Lede-dev mailing list