How To: Early-loading of Intel Microcode on Slackware Linux


1. Obtain the microcode for your particular Intel processor.

1.1 Determine your Intel processor's family, model, and stepping, expressed in hex as family-model-stepping:

printf "%02x-%02x-%02x\n" `lscpu | grep -e "CPU family:" -e "Model:" -e "Stepping:" | cut -d: -f2`

Example ouput from the printf command above showing my processor's family(06)-model(2a)-stepping(07):

06-2a-07

Ref: Intel: Microcode Loading

1.2 Download the microcode file for your particular processor from Intel's microcode repository (on GitHub) to your /lib/firmware/intel-ucode directory.

Example using 06-2a-07 as the particular processor:

cd /lib/firmware/intel-ucode
wget https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/raw/main/intel-ucode/06-2a-07

Ref: Intel: Microcode Repository


2. Create an initial RAM-disc (initrd) image prepended with a microcode archive containing Intel processor-specific microcode.

2.1 Make a cpio archive containing the microcode directory tree.

Example using 06-2a-07 as the particular processor:

cd /root
(ensure no /root/kernel directory exists)
mkdir -p kernel/x86/microcode
cp /lib/firmware/intel-ucode/06-2a-07 kernel/x86/microcode/GenuineIntel.bin
find kernel | cpio -o -H newc > /boot/intel-ucode.cpio
rm -r kernel

2.2 Make an initrd image which includes the microcode archive.

2.2.1 Generate a mkinitrd command-line referencing your Linux kernel by running:

/usr/share/mkinitrd/mkinitrd_command_generator.sh -k `uname -r`

Example ouput from the mkinitrd_command_generator.sh command above referencing my Linux kernel's revision (5.15.38):

mkinitrd -c -k 5.15.38 -f ext4 -r /dev/sda2 -m xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-asus:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd2:mbcache:crc32c_intel:crc32c_generic:ext4 -u -o /boot/initrd.gz

2.2.2 Insert the string "-P /boot/intel-ucode.cpio" in the argument-list output from the mkinitrd_command_generator.sh command above, and issue that edited command.

Example on my Linux box running kernel revision 5.15.38:

mkinitrd -c -k 5.15.38 -P /boot/intel-ucode.cpio -f ext4 -r /dev/sda2 -m xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-asus:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd2:mbcache:crc32c_intel:crc32c_generic:ext4 -u -o /boot/initrd.gz

3. Update the boot-loader (lilo).

3.1 Add an initrd record referencing /boot/initrd.gz to /etc/lilo.conf.

Example extracted from /etc/lilo.conf on my Linux box:

      # Slackware 15.0, Linux 5.15.38 [x86-64] bootable partition config begins
        image  = /boot/vmlinuz
        initrd = /boot/initrd.gz
        root   = /dev/sda2
        label  = Slackware_15.0
        read-only
      # Slackware bootable partition config ends

3.2 Run lilo:

/sbin/lilo

Repeat instructions 2.2.1, 2.2.2, and 3.2 above when a new kernel is installed.