x86: add intel microcode entries to grub config

Create initrd enries for x86 images, that'll load intel microcode as
early as possible. To achieve that the test module for grub is enabled
which provides shell-like conditionals. Also restrict the late load of
microcode to AMD processors.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
master
Tomasz Maciej Nowak 2018-11-20 17:20:43 +01:00 committed by John Crispin
parent ad83fde30d
commit 546fced2a2
4 changed files with 12 additions and 4 deletions

View File

@ -2,9 +2,11 @@
# 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

View File

@ -9,8 +9,8 @@ include $(INCLUDE_DIR)/image.mk
export PATH=$(TARGET_PATH):/sbin
GRUB2_MODULES = biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial vga
GRUB2_MODULES_ISO = biosdisk boot chain configfile iso9660 linux ls part_msdos reboot serial vga
GRUB2_MODULES = biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial test vga
GRUB2_MODULES_ISO = biosdisk boot chain configfile iso9660 linux ls part_msdos reboot serial test vga
GRUB_TERMINALS =
GRUB_SERIAL_CONFIG =
GRUB_TERMINAL_CONFIG =

View File

@ -7,4 +7,7 @@ set root='(cd)'
menuentry "@TITLE@" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
if [ -s /boot/intel-ucode.img ]; then
initrd /boot/intel-ucode.img
fi
}

View File

@ -7,6 +7,9 @@ set root='(@ROOT@)'
menuentry "@TITLE@" {
linux /boot/vmlinuz @CMDLINE@ noinitrd
if [ -s /boot/intel-ucode.img ]; then
initrd /boot/intel-ucode.img
fi
}
menuentry "@TITLE@ (failsafe)" {
linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd