WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Howto] Download and use Intel microcode with grub2 bootloader  (Read 1334 times)

aus9

  • Guest
Warning try at own risk

Introduction

ARM processors users can ignore this post as
Quote
An Arm processor SNIP does not use digital microcode SNIP
https://www.zdnet.com/article/arm-processors-everything-you-need-to-know-now/

Bios updates are preferred over using early loading microcodes
Microcodes are useful if motherboard maker has no recent bios updates or
third party bios maker reluctant to provide updates or
you may be reluctant to flash bios as you may be concerned you might "brick" your motherboard.
Some motherboards can have dual bios setups YMMV

Kernel series 6.1 and higher no longer allow late loading of microcodes.
Quote
With kernel version 6.1 a late microcode loading is not possible anymore because it is now disabled by default
https://wiki.gentoo.org/wiki/Microcode

Why else is it important to use early loading microcodes?
Quote
Loading microcode early can fix CPU issues before they are observed during kernel boot time
https://www.kernel.org/doc/html/v5.18/x86/microcode.html

As I do not have a Intel CPU I can not test. I find Intel more complex than AMD
and most wikis use iucode-tool so I cheat.

credits to Christian Hesse, maintainer of Arch package.

step 1 run all below code boxes as a local user note we are not root this time
Code: [Select]
USER=`cat /etc/sysconfig/tcuser`
LIST1="file zstd"
for Z in $LIST1
    do
    su -c "tce-load -w $Z" $USER
    su -c "tce-load -i $Z" $USER
done

echo 'provides commands file and zstd'

step 2 bookmark this page in your favourite web browser
https://archlinux.org/packages/extra/any/intel-ucode/

step 3
In above web page, top right hand corner, click on Download from Mirror
package will download, if firefox it defaults to ~/Downloads YMMV
change next commands to suit your download dir.

step 4
Code: [Select]
cd ~/Downloads
unzstd -d intel-ucode-*.tar.zst && tar xvf intel-ucode-*.tar
file boot/intel-ucode.img

step 5
copy intel-ucode.img from sub-directory boot under your download dir
to your real boot directory or grub dir and similar to AMD
copy your boot loader menu but adjust second copy so it reads something like

At time of writing I was on 14x alpha
Quote
menuentry "microcodes" {
set root=blah blah
linux blah blah
initrd /boot/intel-ucode.img /boot/rootfs64.gz /boot/modules64.gz
}

Adjust initrd line if you are not using a boot directory

step 6 full reboot and check if microcodes load
Code: [Select]
dmesg | grep microcode
Now the variations you will have:

A) no hits as your CPU is not (no longer) supported by Intel microcodes
B) a result that matched your research on what microcodes your bios already has
 which means bios is up-to-date and microcodes not yet needed
C) a result of an update

Good Luck

If you like to build iucode-tool read next post.
« Last Edit: March 06, 2023, 09:09:36 PM by Rich »

aus9

  • Guest
Re: [Howto] Create and use Intel microcode with grub2 bootloader
« Reply #1 on: March 05, 2023, 05:43:03 AM »
Build Intel iucode-tool needed IMHO for Intel research

Run as a local user
Code: [Select]
sudo su
USER=`cat /etc/sysconfig/tcuser`
LIST1="compiletc libcpuid-dev submitqc xz"
for Z in $LIST1
    do
    su -c "tce-load -w $Z" $USER
    su -c "tce-load -i $Z" $USER
done

echo 'Version may need update in future '

PKG=iucode-tool
URL=https://gitlab.com/iucode-tool/releases/raw/master
V=2.3.1
SRC=$PKG-$V # unpack changes from understem to hyphen
su -c "wget -nc --no-check-certificate $URL/iucode-tool_2.3.1.tar.xz" $USER

echo 'unpack source and build it'
xz -d $PKG*xz && tar xvf $PKG*tar
cd $SRC
./configure --prefix=/usr/local --with-default-firmware-dir=/lib/firmware/intel-ucode --sbindir=/usr/local/bin
make -j5 # seconds on a modern PC
make install-strip DESTDIR=/tmp/$PKG
cd /tmp

# change name of executable from understem to hyphen
mv $PKG/usr/local/bin/iucode* $PKG/usr/local/bin/$PKG
# strings $PKG/usr/local/bin/$PKG | grep cpuid  gives hits so looks OK

# no need for man page, create short licence
rm -rf $PKG/usr/local/share/man
mkdir -p $PKG/usr/local/share/doc/$PKG
echo 'GPL v' > $PKG/usr/local/share/doc/$PKG/COPYING

# find running dependencies as I am unable to boot into libX but can do Xorg or wayland
readelf -d $PKG/usr/local/bin/$PKG | grep 'NEEDED'
# 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6] -> which is  TCB
# but add libcpuid

LIST2="$PKG "
for Z in $LIST2
do
mksquashfs $Z $Z.tcz
md5sum $Z.tcz > $Z.tcz.md5.txt
cd $Z
find usr -not -type d > /tmp/$Z.tcz.list
        sed 's|usr|/usr|g' -i /tmp/$Z.tcz.list
cd /tmp
done

ls -hal

echo 'Title:          iucode-tool.tcz
Description:    tool for Intel microcodes
Version:        2.3.1
Author:         Henrique de Moraes Holschuh
Original-site:  https://gitlab.com/iucode-tool
Copying-policy: GPL v2
Size:           32K         
Extension_by:   volunteer-name who has intel cpu
Tags:           intel Intel microcodes
Comments:       see TC forum post on how to use please
                online non-TC man page here
                http://man.he.net/man8/iucode-tool
           
Change-log:     2023/03/03  first version 2.3.1
Current:        2023/03/03  ' > $PKG.tcz.info

echo 'libcpuid.tcz' > $PKG.tcz.dep

submitqc --libs

Move iucode-tool.tcz and its dep to your tcedir.
Unless you want to be the submitter you can ignore the md5, info, list and zsync files

try
Code: [Select]
tce-load -i iucode-tool
iucode-tool -S

The rest I can not test.

aus9

  • Guest
Re: [Howto] Download and use Intel microcode with grub2 bootloader
« Reply #2 on: March 15, 2023, 12:27:45 AM »
TC64 14x users have the TCE if interested. I have no plans to build for TC32