x86: add amd microcode entries to grub config
authorTomasz Maciej Nowak <tomek_n@o2.pl>
Wed, 31 Oct 2018 17:48:37 +0000 (18:48 +0100)
committerJohn Crispin <john@phrozen.org>
Mon, 26 Nov 2018 11:05:45 +0000 (12:05 +0100)
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@o2.pl>
target/linux/x86/base-files/lib/preinit/02_load_x86_ucode [deleted file]
target/linux/x86/image/grub-iso.cfg
target/linux/x86/image/grub.cfg

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 (file)
index d3a23e2..0000000
+++ /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
index 5d128aa3aab17ec4df050479dea16e51a5d9783b..c624cbe0ee1d137e88f378b5a3832bbe9f637e45 100644 (file)
@@ -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
 }
index a665686863e230822b9ad26d43e9ffc54dcf0229..21d719261b1a7b03f081b2a8b5b08701cc0666d6 100644 (file)
@@ -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)" {