LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   AMD microcode/ucode update for Slackware 14.2? (https://www.linuxquestions.org/questions/slackware-14/amd-microcode-ucode-update-for-slackware-14-2-a-4175678648/)

obobskivich 07-13-2020 10:57 AM

AMD microcode/ucode update for Slackware 14.2?
 
Just a curiosity - I am wondering if there is a way to update AMD CPU ucode in 14.2 - I see on slackbuilds that the Intel ucode is available (iucode-tool), but I have not found amd64-ucode like other distros (e.g. Ubuntu, Arch). Is there something that exists like this for Slackware?

bassmadrigal 07-13-2020 11:51 AM

AMD microcode updates are included with the kernel-firmware package. However, I've heard that even though the kernel is supposed to load those automatically on boot, that it hasn't been.

Another way to update your microcode is by updating your BIOS/UEFI, if there's supported updates for your motherboard.

obobskivich 07-13-2020 12:11 PM

Quote:

Originally Posted by bassmadrigal (Post 6144947)
AMD microcode updates are included with the kernel-firmware package. However, I've heard that even though the kernel is supposed to load those automatically on boot, that it hasn't been.

Another way to update your microcode is by updating your BIOS/UEFI, if there's supported updates for your motherboard.


I had read about kernel-firmware providing that, and I've got the latest updates via slackpkg (as of a few days ago) for 14.2, but know its a bit 'behind' where -current or other distros are in terms of kernel revision, so figured maybe that was part of it. According to what I've polled off of the CPU, it has a recent but not latest firmware, which is also what led me to this reasoning.

Motherboard updates ended a long time ago (like most motherboards older than 3 months ha!) - it's had the latest BIOS installed for years, but that's not in-line with the latest updates from AMD.

Ah well, it's not like it is having any problems and it does have a recent-ish firmware (if I'm not mistaken, its not *that* far behind the latest, which leads me to believe 14.2 *is* updating it over the motherboard, just not 'enough' because it doesn't have the latest package (yet?)).

bassmadrigal 07-13-2020 01:24 PM

Have you checked your dmesg to see what microcode is being loaded (and compare that with what is the latest for your CPU)? According to Gentoo's wiki on Ryzens, my Ryzen 7 has the latest microcode already provided (via my UEFI).

Code:

dmesg | grep microcode
The kernel-firmware package on 14.2 isn't old at all. It was actually just updated last month.

Code:

+--------------------------+
Fri Jun 12 19:05:51 UTC 2020
patches/packages/kernel-firmware-20200610_887d2a1-noarch-1.txz:  Upgraded.

If there is a newer microcode available in that kernel-firmware package that you're not running, you could try and load it via running the following as root:

Code:

echo 1 > /sys/devices/system/cpu/microcode/reload
Once run, you could then check dmesg output to see if your microcode was updated. If it wasn't updated, then you'd likely need to look into loading it early via adding it to your initrd.

obobskivich 07-13-2020 01:54 PM

Yes I did check dmesg and cpuinfo - it was a revision or two behind (just based on the version #s) according to the latest I'm aware of (via spectre-meltdown-checker, which also nicely checks microcode updates for us). Is there a way to check what specific package is being distributed within the kernel-firmware package (as in, what is it 'supposed to be' doing)? (the release notes don't seem to have more information than what you copy/pasted that I could find)

Richard Cranium 07-13-2020 03:16 PM

If you use an initrd, you can use that to load the new firmware at boot.

EDIT: I only have AMD CPUs on my laptops/desktops. (My wife has an Intel laptop, but I don't hold that against her.)

I think I've posted this somewhere else, but another version isn't horrible.

Note that my swap lives on an lvm logical volume and this is from a laptop where I do encrypt my lvm physical volume(s).

Code:

bash-5.0$ cat mkinitrd.conf
# mkinitrd.conf.sample
# See "man mkinitrd.conf" for details on the syntax of this file
#
#SOURCE_TREE="/boot/initrd-tree"
#CLEAR_TREE="0"
#OUTPUT_IMAGE="/boot/initrd.gz"
#KERNEL_VERSION="$(uname -r)"
#KEYMAP="us"
#MODULE_LIST="ext4"
LUKSDEV="/dev/sda2"
#LUKSKEY="LABEL=TRAVELSTICK:/keys/alienbob.luks"
#ROOTDEV="/dev/sda1"
#ROOTFS="ext3"
RESUMEDEV="/dev/lvg/swaplv"
#RAID="0"
#LVM="0"
#UDEV="1"
#MODCONF="0"
#WAIT="1"
MICROCODE_ARCH="/boot/amd-ucode.cpio"

Note the MICROCODE_ARCH property.

Code:

root@sonicmaster:~# cat bin/make-amd-ucode-cpio.sh
#! /bin/sh
set -x
set -e

LIB=/lib/firmware/amd-ucode/
TDIR=kernel/x86/microcode
CPIO=/boot/amd-ucode.cpio

echo "Create the $CPIO file from the $LIB directory of files"
rm -rf  /tmp/amd-ucode-cpio
mkdir -p /tmp/amd-ucode-cpio
cd      /tmp/amd-ucode-cpio
mkdir -p  $TDIR
find $LIB -type f -name \*bin | sort | xargs cat > $TDIR/AuthenticAMD.bin
find . | cpio --no-absolute-filenames -H newc -o -F $CPIO

exit

Code:

root@sonicmaster:~# cat bin/mkinit.sh
#!/bin/bash
# expects that mkinitrd.conf is set to build firmware as well
kv=$(readlink /boot/vmlinuz-generic | cut -d- -f3-)
~/bin/make-amd-ucode-cpio.sh
# make sure any RAID arrays are defined prior to creating initrd
/sbin/mdadm -E -s > /etc/mdadm.conf
$( /usr/share/mkinitrd/mkinitrd_command_generator.sh -k ${kv} -a "-F -o /boot/initrd-${kv}.gz" -r )
~/bin/mkgrub.sh
root@sonicmaster:~#

I use grub. You may not want to.

Code:

root@sonicmaster:~# cat bin/mkgrub.sh
#!/bin/bash
/usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg
root@sonicmaster:~#

And there's my grub addition at https://github.com/Richard-Cranium/SlackwareGrub2 that you might want if you do use grub.

bassmadrigal 07-13-2020 04:47 PM

Quote:

Originally Posted by obobskivich (Post 6144993)
Is there a way to check what specific package is being distributed within the kernel-firmware package (as in, what is it 'supposed to be' doing)? (the release notes don't seem to have more information than what you copy/pasted that I could find)

Best thing I know is to check the git logs for the amd-ucode folder in the kernel-firmware git repo. This is the repo Pat uses to build newer versions of the kernel-firmware package.

https://git.kernel.org/pub/scm/linux.../log/amd-ucode

But it doesn't really show much. I'm not sure if there's a place to get more detailed information.

PROBLEMCHYLD 07-15-2020 04:21 PM

Quote:

Originally Posted by Richard Cranium (Post 6145011)
Code:

root@sonicmaster:~# cat bin/make-amd-ucode-cpio.sh
#! /bin/sh
set -x
set -e

LIB=/lib/firmware/amd-ucode/
TDIR=kernel/x86/microcode
CPIO=/boot/amd-ucode.cpio

echo "Create the $CPIO file from the $LIB directory of files"
rm -rf  /tmp/amd-ucode-cpio
mkdir -p /tmp/amd-ucode-cpio
cd      /tmp/amd-ucode-cpio
mkdir -p  $TDIR
find $LIB -type f -name \*bin | sort | xargs cat > $TDIR/AuthenticAMD.bin
find . | cpio --no-absolute-filenames -H newc -o -F $CPIO

exit


Thanks for the script

Jul 15 15:59:52 darkstar kernel: [ 4.356400] microcode: CPU0: patch_level=0x07030105
Jul 15 15:59:52 darkstar kernel: [ 4.357769] microcode: CPU1: patch_level=0x07030105
Jul 15 15:59:52 darkstar kernel: [ 4.359207] microcode: CPU2: patch_level=0x07030105
Jul 15 15:59:52 darkstar kernel: [ 4.360576] microcode: CPU3: patch_level=0x07030105
Jul 15 15:59:52 darkstar kernel: [ 4.361927] microcode: Microcode Update Driver: v2.2.

Richard Cranium 07-15-2020 07:09 PM

To be honest, I'm positive that someone else posted the original in this forum sometime in the past.


All times are GMT -5. The time now is 12:30 PM.