Microcode
5.1
The microcode is a small program inside the processor. Intel and AMD publish updates that fix bugs and security flaws, such as Spectre. The BIOS or UEFI firmware loads one at power on, but it is often old: Linux can load a newer one at each boot, before anything else runs.
On SliTaz 5.1 the kernel (Linux 6.12) only takes the microcode very early, from an image the boot loader loads with the kernel. It cannot change it later on a running system. The Handbook explains the kernel and firmware and the boot menu.
Check the microcode in use
$ cat /sys/devices/system/cpu/cpu0/microcode/version
$ dmesg | grep microcode
The first command gives the revision, for example 0x410e. dmesg
shows the same revision on a Current revision line, and an Updated
early from line, with the old revision, when Linux loaded a new one at
boot.
Intel processors
Install the package as root:
# spk-add intel-microcode
It puts the files of every Intel processor in /lib/firmware/intel-ucode
and builds /boot/intel-ucode.img, the early image. An upgrade of the
package builds it again.
Then add the image to the boot menu, /boot/grub/grub.cfg. In the
SliTaz entry, put an initrd line under the linux line:
menuentry "SliTaz GNU/Linux" {
linux /boot/vmlinuz-6.12.115-slitaz root=PARTUUID=... rootwait quiet
initrd /boot/intel-ucode.img
}
Keep your own linux line as it is: only add the initrd line. Do the
same in the "SliTaz rescue (reprise)" entry. Reboot, then check:
dmesg | grep microcode should show the Updated early from line.
To know which file fits your processor, read its family, model and stepping:
$ grep -m5 -E 'vendor_id|cpu family|model|stepping' /proc/cpuinfo
Write the three numbers in hexadecimal, two digits each: family 6,
model 186, stepping 2 gives 06-ba-02.
$ printf '%02x-%02x-%02x\n' 6 186 2
$ ls /lib/firmware/intel-ucode/06-ba-02
If there is no such file, Intel has no update for this processor and the image changes nothing.
AMD processors
# spk-add amd-microcode
The package puts the AMD files in /lib/firmware/amd-ucode, but it does
not build an early image. Make one by hand, as root:
# mkdir -p /tmp/ucode/kernel/x86/microcode
# cat /lib/firmware/amd-ucode/microcode_amd*.bin > /tmp/ucode/kernel/x86/microcode/AuthenticAMD.bin
# cd /tmp/ucode
# find kernel | cpio -o -H newc > /boot/amd-ucode.img
# cd / && rm -rf /tmp/ucode
Then add initrd /boot/amd-ucode.img to the boot menu as for Intel.
Build the image again after an upgrade of the package.
The amd-microcode package dates from 2021: recent AMD processors may find nothing new in it.
Tips
- An
initrdline can hold several files: the microcode always comes first. A frugal install by tazinst boots withinitrd /boot/slitaz/rootfs.gz: copy the image next to it and writeinitrd /boot/slitaz/intel-ucode.img /boot/slitaz/rootfs.gz. - With Syslinux, the
INITRDline takes a list separated by commas, microcode first:INITRD /boot/intel-ucode.img, orINITRD /boot/intel-ucode.img,/boot/rootfs.gzfor a live entry. - The Intel image holds every processor and weighs about 17 MB. That costs a little time at boot on a slow disk, nothing more.
Troubleshooting
No Updated early from line after the reboot: the boot loader did not
load the image, or the image has nothing newer for this processor.
Check that you edited the entry you boot, and that
/boot/intel-ucode.img exists. When the GRUB of another system boots
the SliTaz kernel from its own menu, the line goes in that menu.
/sys/devices/system/cpu/microcode/reload does not exist: that is
normal on SliTaz 5.1. The kernel has no late loading: the old method,
echo 1 > .../reload on a running system, no longer works.