AMD microcode

This article Article description::describes updating the [[microcode for AMD processors.]]

Emerge
Microcode updates for AMD processors are provided by package. Install the package via:

Kernel
In order to load the CPU microcode the following kernel options should be enabled:

Configuration
There are multiple ways how to update the microcode.

Built-in firmware
This way the firmware files will be built directly into the kernel.

Firmware blob files selection
You can either include all the available AMD firmware files to the kernel or select just the one specific for your CPU.

All firmware files
This setup simply builds all the firmware blobs into the kernel. This can be achieved by the following kernel optionsː

Specific firmware only
This way you only include the firmware suitable to your current CPU family. The CPU family identification can be obtained from :

In this example the CPU belongs to the AMD CPU family 22.

The following table helps to identify the right firmware blob file for given CPU family identificator:

The previously identified CPU specific firmware blob file (in this example CPU family 22) needs to be built into the kernelː

Initrd
You can load the microcode with the initrd. This way the firmware blobs are not inside the kernel, which will instead look for them in the loaded initrd.

Kernel
In order to use the initrd, you have to enable it in the kernel:

Firmware files preparation
First create the specified directory and cd into it. It doesn't have to be in but the  part is necessary.

Then we concatenate all the AMD firmware files into a single file. As before the path and filename of the output file must not be altered.

Then we will create a cpio archive in using  from :

Alternatively, enable the USE flag for sys-kernel/linux-firmware to get /boot/amd-uc.img.

GRUB2 configuration
Since the image file is one of the recognized ones by GRUB2 we just need to regenerate grub config.

It should show that it found the file.

Building the kernel
Rebuild and install the kernel as usual.

Verification
After the next reboot with the new kernel, you should see a similar output:

The first line contains the  log message in case a microcode update was performed during the boot.