Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Outdated Intel microcode documentation
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
YumeWizard
n00b
n00b


Joined: 05 Jul 2016
Posts: 29

PostPosted: Fri Jul 08, 2016 8:54 pm    Post subject: Outdated Intel microcode documentation Reply with quote

Sometime ago I noticed that while following my usual steps to install a Gentoo system some information I was reading on the wiki was seemingly now outdated.

*EDIT: I have since updated the Wiki page!*
Source: https://wiki.gentoo.org/wiki/Intel_microcode
Code:
Configuration
OpenRC

You can now start microcode-ctl:
root #/etc/init.d/microcode_ctl start

To start microcode-ctl at boot time, add it your boot runlevel:
root #rc-update add microcode_ctl boot


This "microcode_ctl" service seemingly no longer exists as it is not in my /etc/init.d folder, I know for a fact that this service used to exist and I had used it in the past. I'm not sure if this is only outdated on unstable systems or how I'm supposed to handle microcode updates now.


Last edited by YumeWizard on Sat Jul 09, 2016 12:38 pm; edited 3 times in total
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Fri Jul 08, 2016 9:10 pm    Post subject: Reply with quote

The microcode as a init script no longer works for Intel Haswell generation (changing microcode on a running system = crash) which is why switching to early microcode (even before initramfs) is recommended.

This is described in a subsection here https://wiki.gentoo.org/wiki/Intel_microcode#Early_Microcode

Not sure if that is related to the vanished init.d script at all.

With early microcode the kernel log looks like this:

Code:

[    0.000000] microcode: microcode updated early to revision 0x1c, date = 2014-07-03
[    0.000000] Linux version 4.6.1 (root@EIS) (gcc version 5.3.0 (Gentoo 5.3.0 p1.1, pie-0.6.5) ) #1 SMP Fri Jun 3 18:39:25 CEST 2016
[    0.000000] Command line: BOOT_IMAGE=/EIS/bzImage-default
[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point regi
...


So the microcode is loaded even before the Linux kernel reports its version number...
Back to top
View user's profile Send private message
YumeWizard
n00b
n00b


Joined: 05 Jul 2016
Posts: 29

PostPosted: Fri Jul 08, 2016 10:19 pm    Post subject: Reply with quote

frostschutz wrote:
The microcode as a init script no longer works for Intel Haswell generation (changing microcode on a running system = crash) which is why switching to early microcode (even before initramfs) is recommended.

This is described in a subsection here https://wiki.gentoo.org/wiki/Intel_microcode#Early_Microcode

Not sure if that is related to the vanished init.d script at all.

With early microcode the kernel log looks like this:

Code:

[    0.000000] microcode: microcode updated early to revision 0x1c, date = 2014-07-03
[    0.000000] Linux version 4.6.1 (root@EIS) (gcc version 5.3.0 (Gentoo 5.3.0 p1.1, pie-0.6.5) ) #1 SMP Fri Jun 3 18:39:25 CEST 2016
[    0.000000] Command line: BOOT_IMAGE=/EIS/bzImage-default
[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point regi
...


So the microcode is loaded even before the Linux kernel reports its version number...


Thanks, I'll try my hand at cleaning/updating the Wiki page.
Back to top
View user's profile Send private message
YumeWizard
n00b
n00b


Joined: 05 Jul 2016
Posts: 29

PostPosted: Fri Jul 08, 2016 10:27 pm    Post subject: Reply with quote

frostschutz wrote:
The microcode as a init script no longer works for Intel Haswell generation (changing microcode on a running system = crash) which is why switching to early microcode (even before initramfs) is recommended.

This is described in a subsection here https://wiki.gentoo.org/wiki/Intel_microcode#Early_Microcode

Not sure if that is related to the vanished init.d script at all.

With early microcode the kernel log looks like this:

Code:

[    0.000000] microcode: microcode updated early to revision 0x1c, date = 2014-07-03
[    0.000000] Linux version 4.6.1 (root@EIS) (gcc version 5.3.0 (Gentoo 5.3.0 p1.1, pie-0.6.5) ) #1 SMP Fri Jun 3 18:39:25 CEST 2016
[    0.000000] Command line: BOOT_IMAGE=/EIS/bzImage-default
[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point regi
...


So the microcode is loaded even before the Linux kernel reports its version number...


What was your process for getting your microcode updates to work, I'm trying to follow the wiki but one package(sys-apps/microcode-data) no longer exists. From the name it sounds like sys-firmware/intel-microcode might be what I need?
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Fri Jul 08, 2016 10:31 pm    Post subject: Reply with quote

Oh, apparently it got renamed. :?

Maybe you should look into the ebuild files or search bugs.gentoo.org for these (including closed tickets) maybe those changes are documented somewhere.

I set this up some time ago and haven't had to touch it since then so I'm not up to date, sorry...
Back to top
View user's profile Send private message
YumeWizard
n00b
n00b


Joined: 05 Jul 2016
Posts: 29

PostPosted: Fri Jul 08, 2016 10:47 pm    Post subject: Reply with quote

frostschutz wrote:
Oh, apparently it got renamed. :?

Maybe you should look into the ebuild files or search bugs.gentoo.org for these (including closed tickets) maybe those changes are documented somewhere.

I set this up some time ago and haven't had to touch it since then so I'm not up to date, sorry...


Here it is: https://bugs.gentoo.org/show_bug.cgi?id=557402

Also the current stable microcode-ctl ebuild(released quite sometime ago) still contains the init script.
Back to top
View user's profile Send private message
YumeWizard
n00b
n00b


Joined: 05 Jul 2016
Posts: 29

PostPosted: Sat Jul 09, 2016 1:15 am    Post subject: Reply with quote

It would be really great if an automated solution existed for this new method when using an initramfs.

The only thing I've gotten to work so far is:
Code:
cat mcode.cpio initramfs > initramfs.new
mv initramfs.new initramfs


Which of course would have to be re-run everytime you need to build a new initramfs.

EDIT-00:
There are probably some other options that also work but I was testing this on a machine that doesn't have newer microcode. :oops:
EDIT-01: I've found a much nicer and simpler option that works after testing with a Laptop that does have available updates.
Back to top
View user's profile Send private message
YumeWizard
n00b
n00b


Joined: 05 Jul 2016
Posts: 29

PostPosted: Sat Jul 09, 2016 3:46 am    Post subject: Reply with quote

After some exploring and documenting I've updated the Wiki page!(My first time ever editing a Wiki)

Please take a look at it:
https://wiki.gentoo.org/wiki/Intel_microcode
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sun Jul 10, 2016 3:24 am    Post subject: Reply with quote

Few questions:

Where did the files from the microcode-data package go? All my remaining Intel boxes are old Atom CPUs, one of which *needs* that microcode to work around a bug ("Atom PSE errata", not having it breaks THP among other things). The intel-microcode package doesn't seem to support anything but new CPUs.

What am I supposed to do when I don't use an initramfs to boot, am I forced to install all that cruft? Will just putting the microcode files in CONFIG_EXTRA_FIRMWARE work, like on my AMD systems?
Back to top
View user's profile Send private message
dweezil-n0xad
Apprentice
Apprentice


Joined: 30 Oct 2006
Posts: 156
Location: Ostend, Belgium

PostPosted: Sun Jul 10, 2016 7:29 am    Post subject: Reply with quote

YumeWizard wrote:
It would be really great if an automated solution existed for this new method when using an initramfs.

The only thing I've gotten to work so far is:
Code:
cat mcode.cpio initramfs > initramfs.new
mv initramfs.new initramfs


Which of course would have to be re-run everytime you need to build a new initramfs.

EDIT-00:
There are probably some other options that also work but I was testing this on a machine that doesn't have newer microcode. :oops:
EDIT-01: I've found a much nicer and simpler option that works after testing with a Laptop that does have available updates.

my automated solution:
1. changed the intel-microcode-20160607.ebuild to mount /boot, generate microcode.cpio and copy microcode.cpio to /boot (with USE="initramfs -monolithic -split-ucode")
Code:
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI="5"

inherit toolchain-funcs mount-boot

# Find updates by searching and clicking the first link (hopefully it's the one):
# http://www.intel.com/content/www/us/en/search.html?keyword=Processor+Microcode+Data+File

NUM="26083"
DESCRIPTION="Intel IA32/IA64 microcode update data"
HOMEPAGE="http://inertiawar.com/microcode/ https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=${NUM}"
SRC_URI="http://downloadmirror.intel.com/${NUM}/eng/microcode-${PV}.tgz"

LICENSE="intel-ucode"
SLOT="0"
KEYWORDS="-* ~amd64 ~x86"
IUSE="initramfs monolithic +split-ucode"
REQUIRED_USE="|| ( initramfs monolithic split-ucode )"

DEPEND="initramfs? ( sys-apps/iucode_tool )"
RDEPEND="!<sys-apps/microcode-ctl-1.17-r2" #268586

S=${WORKDIR}

src_unpack() {
   default
   cp "${FILESDIR}"/intel-microcode2ucode.c ./ || die
}

src_compile() {
   if use initramfs ; then
      iucode_tool --write-earlyfw=microcode.cpio microcode.dat || die
   fi

   if use split-ucode ; then
      tc-env_build emake intel-microcode2ucode
      ./intel-microcode2ucode microcode.dat || die
   fi
}

src_install() {
   insinto /boot
   use initramfs && doins microcode.cpio
   use monolithic && doins microcode.dat
   use split-ucode && doins -r intel-ucode
}

2. patched grub: https://bugs.gentoo.org/show_bug.cgi?id=587422
_________________
i7-4790K | 16GB DDR3 | GTX 970 | 500GB SSD
ASUS N56VV | i7-3630QM | 12GB DDR3 | GT 750M | 256GB SSD
Back to top
View user's profile Send private message
YumeWizard
n00b
n00b


Joined: 05 Jul 2016
Posts: 29

PostPosted: Sun Jul 10, 2016 11:59 am    Post subject: Reply with quote

Ant P. wrote:
Few questions:

Where did the files from the microcode-data package go? All my remaining Intel boxes are old Atom CPUs, one of which *needs* that microcode to work around a bug ("Atom PSE errata", not having it breaks THP among other things). The intel-microcode package doesn't seem to support anything but new CPUs.

What am I supposed to do when I don't use an initramfs to boot, am I forced to install all that cruft? Will just putting the microcode files in CONFIG_EXTRA_FIRMWARE work, like on my AMD systems?


The files from microcode-data are now in intel-microcode, if you do not have an initramfs you can simply follow the instructions I've typed here: https://wiki.gentoo.org/wiki/Intel_microcode
Which if you do not have an initramfs basically just adds "initrd /early_ucode.cpio" to your /boot/grub/grub.cfg(and continues to do so when regenerating the grub.cfg).

As for putting them in CONFIG_EXTRA_FIRMWARE I have not tested it but I believe I read something along those lines, so it might work.


Last edited by YumeWizard on Sun Jul 10, 2016 12:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
YumeWizard
n00b
n00b


Joined: 05 Jul 2016
Posts: 29

PostPosted: Sun Jul 10, 2016 12:33 pm    Post subject: Reply with quote

dweezil-n0xad wrote:
YumeWizard wrote:
It would be really great if an automated solution existed for this new method when using an initramfs.

The only thing I've gotten to work so far is:
Code:
cat mcode.cpio initramfs > initramfs.new
mv initramfs.new initramfs


Which of course would have to be re-run everytime you need to build a new initramfs.

EDIT-00:
There are probably some other options that also work but I was testing this on a machine that doesn't have newer microcode. :oops:
EDIT-01: I've found a much nicer and simpler option that works after testing with a Laptop that does have available updates.

my automated solution:
1. changed the intel-microcode-20160607.ebuild to mount /boot, generate microcode.cpio and copy microcode.cpio to /boot (with USE="initramfs -monolithic -split-ucode")
Code:
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI="5"

inherit toolchain-funcs mount-boot

# Find updates by searching and clicking the first link (hopefully it's the one):
# http://www.intel.com/content/www/us/en/search.html?keyword=Processor+Microcode+Data+File

NUM="26083"
DESCRIPTION="Intel IA32/IA64 microcode update data"
HOMEPAGE="http://inertiawar.com/microcode/ https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=${NUM}"
SRC_URI="http://downloadmirror.intel.com/${NUM}/eng/microcode-${PV}.tgz"

LICENSE="intel-ucode"
SLOT="0"
KEYWORDS="-* ~amd64 ~x86"
IUSE="initramfs monolithic +split-ucode"
REQUIRED_USE="|| ( initramfs monolithic split-ucode )"

DEPEND="initramfs? ( sys-apps/iucode_tool )"
RDEPEND="!<sys-apps/microcode-ctl-1.17-r2" #268586

S=${WORKDIR}

src_unpack() {
   default
   cp "${FILESDIR}"/intel-microcode2ucode.c ./ || die
}

src_compile() {
   if use initramfs ; then
      iucode_tool --write-earlyfw=microcode.cpio microcode.dat || die
   fi

   if use split-ucode ; then
      tc-env_build emake intel-microcode2ucode
      ./intel-microcode2ucode microcode.dat || die
   fi
}

src_install() {
   insinto /boot
   use initramfs && doins microcode.cpio
   use monolithic && doins microcode.dat
   use split-ucode && doins -r intel-ucode
}

2. patched grub: https://bugs.gentoo.org/show_bug.cgi?id=587422


As for anything currently going on with part 2 of your solution, I was only able to find this: https://lists.gnu.org/archive/html/grub-devel/2016-02/msg00017.html
I couldn't find anything in their bugtracker though.
Back to top
View user's profile Send private message
dweezil-n0xad
Apprentice
Apprentice


Joined: 30 Oct 2006
Posts: 156
Location: Ostend, Belgium

PostPosted: Sun Jul 10, 2016 2:11 pm    Post subject: Reply with quote

I copied the b.g.o link from that previous thread about Intel microcode: https://forums.gentoo.org/viewtopic-p-7937512.html#7937512
I still use the patch from that pull request in /etc/portage/patches/sys-boot/grub/
_________________
i7-4790K | 16GB DDR3 | GTX 970 | 500GB SSD
ASUS N56VV | i7-3630QM | 12GB DDR3 | GT 750M | 256GB SSD
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sun Jul 10, 2016 5:57 pm    Post subject: Reply with quote

YumeWizard wrote:
The files from microcode-data are now in intel-microcode

iucode_tool -S fails to find any microcode files matching my CPU, so that's where I gave up.
Back to top
View user's profile Send private message
YumeWizard
n00b
n00b


Joined: 05 Jul 2016
Posts: 29

PostPosted: Sun Jul 10, 2016 10:08 pm    Post subject: Reply with quote

Ant P. wrote:
YumeWizard wrote:
The files from microcode-data are now in intel-microcode

iucode_tool -S fails to find any microcode files matching my CPU, so that's where I gave up.


Does everything work fine after installing "sys-firmware/intel-microcode"?
Back to top
View user's profile Send private message
Fitap
Guru
Guru


Joined: 13 Mar 2011
Posts: 437
Location: Rosario, Argentina

PostPosted: Sun Jul 17, 2016 2:39 pm    Post subject: Reply with quote

YumeWizard wrote:
Ant P. wrote:
YumeWizard wrote:
The files from microcode-data are now in intel-microcode

iucode_tool -S fails to find any microcode files matching my CPU, so that's where I gave up.


Does everything work fine after installing "sys-firmware/intel-microcode"?


If I don't into mistake my answer is: yes, I am working fine intel-microcode early builtin, I follow some papers like wiki getoo microcode, wiki kernel microcode and a blog from an user here Fitzgerald or like that.

I run on EFI sytsem without grub, initrd and microcode-ctl, here are my outputs and config kernel.

Code:

fitap@gentoo-nb ~ $ ls -l /boot/

-rw-r--r-- 1 root root  146685 jul 16 19:33 config-4.6.4
drwx------ 2 root root   12288 jul  2 16:33 lost+found/
-rw-r--r-- 1 root root 4474603 jul 16 19:33 System.map-4.6.4
-rw-r--r-- 1 root root 6092912 jul 16 19:33 vmlinuz-4.6.4
-rwxr-xr-x 1 root root    7549 jul  4 03:38 vmlinuz-4.6.4.png



How you see, I have 2 firmware loaded, microcode regard to my core and wifi card.

Code:

fitap@gentoo-nb ~ $ zcat /proc/config.gz | grep FIRMWARE

CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_FIRMWARE_IN_KERNEL=y
CONFIG_EXTRA_FIRMWARE="intel-ucode/06-25-05 iwlwifi-6050-5.ucode"
CONFIG_EXTRA_FIRMWARE_DIR="/lib64/firmware"
CONFIG_RT2X00_LIB_FIRMWARE=y
# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
# CONFIG_FIRMWARE_EDID is not set
CONFIG_FIRMWARE_MEMMAP=y
# CONFIG_GOOGLE_FIRMWARE is not set
# CONFIG_TEST_FIRMWARE is not set



Code:

fitap@gentoo-nb ~ $ dmesg | more

[    0.000000] microcode: microcode updated early to revision 0x4, date = 2013-06-28
[    0.000000] Linux version 4.6.4 (fitap@gentoo-nb) (gcc version 4.9.3 (Gentoo 4.9.3 p1.5, pie-0.6.4) ) #16 SMP Sat Jul 16 19:
31:50 ART 2016
[    0.000000] Command line: \vmlinuz-4.6.4
[    0.000000] x86/fpu: Legacy x87 FPU detected.
[    0.000000] x86/fpu: Using 'eager' FPU context switches.



Regards
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum