Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 557278 - genkernel should include the latest microcode updates for x86 (intel & amd)
Summary: genkernel should include the latest microcode updates for x86 (intel & amd)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal enhancement
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 528712
  Show dependency tree
 
Reported: 2015-08-11 06:15 UTC by SpanKY
Modified: 2017-09-04 23:30 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SpanKY gentoo-dev 2015-08-11 06:15:15 UTC
genkernel should enable these options in the kernel by default on x86:
CONFIG_BLK_DEV_INITRD
CONFIG_MICROCODE
CONFIG_MICROCODE_AMD
CONFIG_MICROCODE_INTEL
CONFIG_MICROCODE_EARLY

if it sees CONFIG_MICROCODE_EARLY enabled, it should further bundle the boot time microcode that is needed for these processors.  these are the paths that have to be in the initramfs:
 intel   /kernel/x86/microcode/GenuineIntel.bin
 amd     /kernel/x86/microcode/AuthenticAMD.bin

i'm not sure how to build the amd file, but the intel one can be created by running the command:
 iucode_tool -w GenuineIntel.bin /lib/firmware/microcode.dat
Comment 1 Alexander Tsoy 2015-08-11 11:53:17 UTC
(In reply to SpanKY from comment #0)
> these are the paths that have to be in the initramfs:
>  intel   /kernel/x86/microcode/GenuineIntel.bin
>  amd     /kernel/x86/microcode/AuthenticAMD.bin

These file have to be in "early cpio image", not in initramfs. 
https://www.kernel.org/doc/Documentation/x86/early-microcode.txt
"The format of the combined initrd image is microcode in cpio format followed by
the initrd image (maybe compressed)."

(In reply to SpanKY from comment #0)
> i'm not sure how to build the amd file, but the intel one can be created by
> running the command:
>  iucode_tool -w GenuineIntel.bin /lib/firmware/microcode.dat

AFAIK you can just concatenate individual microcode files:
cat /lib/firmware/intel-ucode/* > GenuineIntel.bin
cat /lib/firmware/amd-ucode/* > AuthenticAMD.bin
At least this is what dracut do. :)
Comment 2 Richard Yao (RETIRED) gentoo-dev 2015-08-11 23:56:21 UTC
(In reply to SpanKY from comment #0)
> genkernel should enable these options in the kernel by default on x86:
> CONFIG_BLK_DEV_INITRD
> CONFIG_MICROCODE
> CONFIG_MICROCODE_AMD
> CONFIG_MICROCODE_INTEL
> CONFIG_MICROCODE_EARLY

These options are default in genkernel HEAD as of today.

> if it sees CONFIG_MICROCODE_EARLY enabled, it should further bundle the boot
> time microcode that is needed for these processors.  these are the paths
> that have to be in the initramfs:
>  intel   /kernel/x86/microcode/GenuineIntel.bin
>  amd     /kernel/x86/microcode/AuthenticAMD.bin
> 
> i'm not sure how to build the amd file, but the intel one can be created by
> running the command:
>  iucode_tool -w GenuineIntel.bin /lib/firmware/microcode.dat

This might not make it into the 3.4.52 release, but I will try to tackle it as soon as I can as this is important for my workstation.

(In reply to Alexander Tsoy from comment #1)
> (In reply to SpanKY from comment #0)
> > these are the paths that have to be in the initramfs:
> >  intel   /kernel/x86/microcode/GenuineIntel.bin
> >  amd     /kernel/x86/microcode/AuthenticAMD.bin
> 
> These file have to be in "early cpio image", not in initramfs. 
> https://www.kernel.org/doc/Documentation/x86/early-microcode.txt
> "The format of the combined initrd image is microcode in cpio format
> followed by
> the initrd image (maybe compressed)."
> 
> (In reply to SpanKY from comment #0)
> > i'm not sure how to build the amd file, but the intel one can be created by
> > running the command:
> >  iucode_tool -w GenuineIntel.bin /lib/firmware/microcode.dat
> 
> AFAIK you can just concatenate individual microcode files:
> cat /lib/firmware/intel-ucode/* > GenuineIntel.bin
> cat /lib/firmware/amd-ucode/* > AuthenticAMD.bin
> At least this is what dracut do. :)

The initramfs is a cpio image, although I have not scrutinized/tested the load early code to verify that it can handle everything being in one cpio. If we cannot, we will need to have it be separate and concatenate.
Comment 3 SpanKY gentoo-dev 2015-08-12 03:35:59 UTC
(In reply to Alexander Tsoy from comment #1)

initramfs is the same early cpio image.  there is only one mechanism in the kernel.  people just use multiple names for it.
Comment 4 Alexander Tsoy 2015-08-12 07:32:03 UTC
(In reply to SpanKY from comment #3)
The early initramfs for microcode updates must be uncompressed. That's why it is usually a separate cpio archive prepended to the initramfs.
Comment 5 Rick Farina (Zero_Chaos) gentoo-dev 2015-08-20 16:59:03 UTC
after testing for safety, I've committed the kernel config changes.  they don't do anything without the needed initramfs changes so this isn't a fix, just the first part.
Comment 6 Cody Schafer 2015-10-13 23:59:40 UTC
Might be worthwhile considering the setup I'm using at the moment:

 - enable the initramfs use flag on microcode-data
 - cp /lib/firmware/microcode.cpio /boot
 - edit /etc/grub.d/10_linux so that it detects the microcode.cpio and emits an `initrd` directive before the normal `initrd` (or by itself if no other initrd/initramfs is present).
Comment 7 Doug Goldstein (RETIRED) gentoo-dev 2015-12-20 22:03:37 UTC
Has anyone verified that the AMD ones can be concatted? On my machine it didn't seem to like that when mixing family 15 and family 16. I had to only include the correct one.
Comment 8 Austin S. Hemmelgarn 2015-12-21 12:29:17 UTC
Ironically, I just shut down my AMD box for good this weekend, so I can't verify this, but things did appear to be working with concatenated microcode blobs on the Family 15 processor in that system.
Comment 9 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2017-09-04 23:30:40 UTC
This shipped with v3.5.0.7