[LEDE-DEV] [PATCH 2/3] x86: add intel microcode entries to grub config
Philip Prindeville
philipp_subx at redfish-solutions.com
Mon Apr 9 12:00:38 PDT 2018
Inline. Has this been tested with UEFI?
> On Apr 3, 2018, at 7:13 AM, Tomasz Maciej Nowak <tomek_n at o2.pl> wrote:
>
> Create initrd enries for x86 images, that'll load intel microcode as
> early as possible. Also restrict the late load of microcode to AMD
> processors.
>
> Signed-off-by: Tomasz Maciej Nowak <tomek_n at o2.pl>
> ---
> target/linux/x86/base-files/lib/preinit/02_load_x86_ucode | 6 ++++--
> target/linux/x86/image/Makefile | 4 ++--
> target/linux/x86/image/grub-iso.cfg | 3 +++
> target/linux/x86/image/grub.cfg | 3 +++
> 4 files changed, 12 insertions(+), 4 deletions(-)
>
> 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
> index fb309c75c1..68ebdf8651 100644
> --- a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
> +++ b/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
> @@ -2,8 +2,10 @@
> # Copyright (C) 2018 OpenWrt.org
>
> do_load_x86_ucode() {
> - if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then
> - echo 1 > /sys/devices/system/cpu/microcode/reload
> + if [ "$(grep -c AuthenticAMD /proc/cpuinfo)" -gt "0" ]; then
Way too complicated. Try:
if grep -q AuthenticAMD /proc/cpuinfo; then
instead. -q inhibits output, and instead you get true for having matches, and false for no matches.
> + if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then
> + echo 1 > /sys/devices/system/cpu/microcode/reload
> + fi
> fi
> }
>
> diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
> index 8a3cb327e3..a05f4babd9 100644
> --- a/target/linux/x86/image/Makefile
> +++ b/target/linux/x86/image/Makefile
> @@ -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
What is “test” in this case?
> GRUB_TERMINALS =
> GRUB_SERIAL_CONFIG =
> GRUB_TERMINAL_CONFIG =
> diff --git a/target/linux/x86/image/grub-iso.cfg b/target/linux/x86/image/grub-iso.cfg
> index 3d47a95a4b..30b587bd1c 100644
> --- a/target/linux/x86/image/grub-iso.cfg
> +++ b/target/linux/x86/image/grub-iso.cfg
> @@ -7,4 +7,7 @@ set root='(cd)'
>
> menuentry "OpenWrt" {
> linux /boot/vmlinuz @CMDLINE@ noinitrd
> + if [ -e /boot/intel-ucode.img ]; then
> + initrd /boot/intel-ucode.img
> + fi
> }
> diff --git a/target/linux/x86/image/grub.cfg b/target/linux/x86/image/grub.cfg
> index 9ec6b2d39c..dde24b95ce 100644
> --- a/target/linux/x86/image/grub.cfg
> +++ b/target/linux/x86/image/grub.cfg
> @@ -7,6 +7,9 @@ set root='(@ROOT@)'
>
> menuentry "OpenWrt" {
> linux /boot/vmlinuz @CMDLINE@ noinitrd
> + if [ -e /boot/intel-ucode.img ]; then
> + initrd /boot/intel-ucode.img
> + fi
> }
> menuentry "OpenWrt (failsafe)" {
> linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
> --
> 2.16.3
More information about the Lede-dev
mailing list