Gentoo Linux: Building/rebuilding a kernel and Intel CPU microcode in an installation without initramfs

In a 2016 post I explained how to update the Intel CPU microcode in a Gentoo Linux Stable Branch installation without an initramfs (I do not use sys-kernel/genkernel to build the kernel in the installation on my Clevo W230SS laptop). The behaviour of the tool sys-apps/iucode_tool for updating the Intel CPU microcode has changed since that post, hence this update.

Although not essential I normally perform the microcode upgrade procedure when I either rebuild or upgrade the Linux kernel, therefore I explain both procedures contiguously here.

These days the grub-mkconfig command edits the file /boot/grub/grub.cfg to add a line to the GRUB menu entries, to load the CPU microcode at boot, but nevertheless I prefer to follow a slightly different method that works reliably for me.

Below is the procedure I follow to build/rebuild the kernel and the Intel CPU microcode. Others may have a different approach, but this has always worked well for me, even if some of the steps are sometimes nugatory.

1. Mount the boot directory if it is on a separate partition

root # mount /dev/sda1 /boot

2. Check which kernel sources are installed and which of those sources is currently selected

root # eselect kernel list

3. Make a back-up of the current kernel configuration file

root # cp /usr/src/linux-`uname -r`/.config /home/fitzcarraldo/kernel-config-`uname -r`

4. Select the kernel sources I want to build

root # eselect kernel set <n>

5. Change to the currently selected kernel sources directory

root # cd /usr/src/linux

6. If wanting to build a new version of the kernel, create a template configuration file

N.B. Do NOT do this if rebuilding the kernel version that is currently in use.

root # cp /usr/src/linux-`uname -r`/.config /usr/src/linux/.config

7. Remove any existing object files

Definitely needed if the ‘make‘ command (see further on) returns an error message mentioning an old version of the compiler. It does no harm to perform this step in any case, so I always do it.

root # make clean

8. If building a new version of the kernel, create a new configuration file

N.B. Do NOT do this if rebuilding the kernel version that is currently in use.

root # make olddefconfig

The command ‘make olddefconfig‘ will edit the existing /usr/src/linux/.config file, keeping all the existing options in the file and setting any new options to their recommended (i.e. default) values.

9. Display a TUI menu of the kernel options in the .config file and make any desired changes

root # make menuconfig

I have configured the following kernel options relating to the early loading of the Intel CPU microcode (see later):

root # grep CONFIG_BLK_DEV_INITRD /usr/src/linux/.config
CONFIG_BLK_DEV_INITRD=y
root # grep CONFIG_MICROCODE /usr/src/linux/.config
CONFIG_MICROCODE=y
CONFIG_MICROCODE_INTEL=y
# CONFIG_MICROCODE_AMD is not set
# CONFIG_MICROCODE_OLD_INTERFACE is not set
root # grep CONFIG_INITRAMFS_SOURCE /usr/src/linux/.config
CONFIG_INITRAMFS_SOURCE=""

10. Build the kernel and modules

root # make && make modules_install
root # make install

11. Rebuild any third-party packages containing kernel modules

These could include packages such as nvidia-drivers, for example.

root # emerge @module-rebuild

In my case, currently the @module-rebuild set only comprises the following two packages:

root # cat /var/lib/module-rebuild/moduledb
a:1:app-emulation/virtualbox-modules-6.1.24
a:1:x11-drivers/nvidia-drivers-470.63.01

12. Rebuild the X Windows Server and X Windows drivers

I always do this even though not always necessary. One less thing to think about (not rebuilding them has sometimes caused me problems).

root # emerge xorg-server xorg-drivers

13. Rebuild NetworkManager if it is installed

I always do this even though not always necessary. One less thing to think about (not rebuilding it has sometimes caused me problems).

root # emerge networkmanager

14. If there is a new version of the Intel CPU microcode, generate it and copy it to the boot directory

Updates to the package sys-firmware/intel-microcode in the last couple of years have not resulted in a change to the version of Intel CPU microcode for the fourth-generation Intel Core i7-4810MQ CPU in my Clevo W230SS laptop, so I assume Intel no longer supports that version of CPU. Nevertheless it does no harm to repeat the procedure.

root # rm /boot/microcode.cpio
root # iucode_tool -S --write-earlyfw=/boot/microcode.cpio /lib/firmware/intel-ucode/*
root # rm /boot/intel-uc.img

(The third command is to stop the grub-mkconfig command (see later) adding intel-uc.img to the initrd line in the grub.cfg file.)

15. If a different version of the kernel has just been built, or if this is the first time upgrading the CPU microcode, create a new grub.cfg file

15.1 First check the contents of /etc/default/grub to make sure it will be OK for the new version of the kernel

root # nano /etc/default/grub

Modify the contents of /etc/default/grub if necessary for the kernel that has just been built.

15.2 Generate a new grub.cfg file

root # grub-mkconfig -o /boot/grub/grub.cfg

15.3 Check the new grub.cfg file includes the loading of the CPU microcode

root # nano /boot/grub/grub.cfg

The last line for each menu entry (i.e. the line before the closing curly bracket of the menu entry) should contain only ‘initrd /microcode.cpio‘, as shown in the example file excerpt below:

[...]
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-525a90f1-8ad2-44a3-ade3-20f18a0a9595' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  f6ffc085-66fe-4bbe-b080-cec355749f85
else
search --no-floppy --fs-uuid --set=root f6ffc085-66fe-4bbe-b080-cec355749f85
fi
echo	'Loading Linux 5.10.61-gentoo ...'
linux	/vmlinuz-5.10.61-gentoo root=/dev/sda5 ro  locale=en_GB i965.modeset=1 rcutree.rcu_idle_gp_delay=1 acpi_enforce_resources=lax reboot=force raid=noautodetect resume=/dev/sda2
echo	'Loading initial ramdisk ...'
initrd	/microcode.cpio
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-525a90f1-8ad2-44a3-ade3-20f18a0a9595' {
menuentry 'Gentoo GNU/Linux, with Linux 5.10.61-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.61-gentoo-advanced-525a90f1-8ad2-44a3-ade3-20f18a0a9595' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  f6ffc085-66fe-4bbe-b080-cec355749f85
else
search --no-floppy --fs-uuid --set=root f6ffc085-66fe-4bbe-b080-cec355749f85
fi
echo	'Loading Linux 5.10.61-gentoo ...'
linux	/vmlinuz-5.10.61-gentoo root=/dev/sda5 ro  locale=en_GB i965.modeset=1 rcutree.rcu_idle_gp_delay=1 acpi_enforce_resources=lax reboot=force raid=noautodetect resume=/dev/sda2
echo	'Loading initial ramdisk ...'
initrd	/microcode.cpio
}
menuentry 'Gentoo GNU/Linux, with Linux 5.10.61-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.61-gentoo-recovery-525a90f1-8ad2-44a3-ade3-20f18a0a9595' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  f6ffc085-66fe-4bbe-b080-cec355749f85
else
search --no-floppy --fs-uuid --set=root f6ffc085-66fe-4bbe-b080-cec355749f85
fi
echo	'Loading Linux 5.10.61-gentoo ...'
linux	/vmlinuz-5.10.61-gentoo root=/dev/sda5 ro single
echo	'Loading initial ramdisk ...'
initrd	/microcode.cpio
}
}

### END /etc/grub.d/10_linux ###
[...]

16. Reboot

17. Rebuild VirtualBox if it is installed

root # emerge virtualbox

18. Check the current version of the Intel CPU microcode

Either:

root # dmesg | grep microcode

or:

root # grep microcode /proc/cpuinfo

For example:

root # dmesg | grep microcode
[    0.000000] microcode: microcode updated early to revision 0x28, date = 2019-11-12
[    0.335631] microcode: sig=0x306c3, pf=0x10, revision=0x28
[    0.335730] microcode: Microcode Update Driver: v2.2.
root # grep microcode /proc/cpuinfo
microcode       : 0x28
microcode       : 0x28
microcode       : 0x28
microcode       : 0x28
microcode       : 0x28
microcode       : 0x28
microcode       : 0x28
microcode       : 0x28

19. Edit /var/lib/portage/world and add (or change) the specific kernel sources package version

I do this in order to ensure the command ‘emerge --depclean‘ does not remove a specific kernel’s source code during a world update. I want Portage always to install the latest (stable) version of gentoo-sources but not to delete the version of gentoo-sources that corresponds to the kernel my installation is currently using.

For example, let’s say I have just replaced a kernel built from gentoo-sources:4.19.57 with a kernel built from gentoo-sources:4.19.66. My world file would initially contain the following:

[...]
sys-kernel/gentoo-sources
sys-kernel/gentoo-sources:4.19.57
[...]

If, following a successful reboot with kernel 4.19.66, I want to delete the files for kernel 4.19.17 in /boot/ (System.map-4.19.17-gentoo, config-4.19.17-gentoo and vmlinuz-4.19.17-gentoo) and to edit the file /boot/grub/grub.cfg to remove the menu entries for kernel 4.19.57, I would change the world file’s contents to:

[...]
sys-kernel/gentoo-sources
sys-kernel/gentoo-sources:4.19.66
[...]

On the other hand, if, following a successful reboot, I want to keep the files for both kernel 4.19.17 and kernel 4.19.66, I would change the world file’s contents to:

[...]
sys-kernel/gentoo-sources
sys-kernel/gentoo-sources:4.19.57
sys-kernel/gentoo-sources:4.19.66
[...]

Gentoo Linux installations without initramfs: Updating Intel CPU microcode revisited

In a previous post I described how I updated the CPU microcode on my Clevo W230SS laptop running Gentoo Linux (Stable Branch). Today I decided to check if a newer version of microcode had been released since then and apply it.

First I checked the current state of my installation…

The CPU microcode version in use was the version I had installed last year:

root # grep microcode /proc/cpuinfo
microcode       : 0x1c
microcode       : 0x1c
microcode       : 0x1c
microcode       : 0x1c
microcode       : 0x1c
microcode       : 0x1c
microcode       : 0x1c
microcode       : 0x1c

The existing kernel image was still configured as necessary:

root # grep CONFIG_BLK_DEV_INITRD /usr/src/linux/.config
CONFIG_BLK_DEV_INITRD=y
root # grep CONFIG_MICROCODE /usr/src/linux/.config
CONFIG_MICROCODE=y
CONFIG_MICROCODE_INTEL=y
CONFIG_MICROCODE_AMD is not set
CONFIG_MICROCODE_OLD_INTERFACE=y
CONFIG_MICROCODE_INTEL_EARLY=y
CONFIG_MICROCODE_AMD_EARLY is not set
CONFIG_MICROCODE_EARLY=y
root # grep CONFIG_INITRAMFS_SOURCE /usr/src/linux/.config
CONFIG_INITRAMFS_SOURCE=""

The relevant packages I installed last year were sys-apps/microcode-ctl-1.28-r1, sys-apps/microcode-data-20150121-r1 and sys-apps/iucode_tool-1.3. Since then I have updated the installation regularly, and I now found microcode-ctl-1.28-r1 and iucode_tool-1.5 installed but the package microcode-data had been replaced by the new package sys-firmware/intel-microcode-20160607:

root # eix microcode
[I] sys-apps/microcode-ctl
     Available versions:  1.23 (~)1.27 (~)1.28 (~)1.28-r1 {selinux}
     Installed versions:  1.28-r1(15:06:33 26/08/15)(-selinux)
     Homepage:            https://fedorahosted.org/microcode_ctl/
     Description:         Intel processor microcode update utility

[I] sys-firmware/intel-microcode
     Available versions:  20140430 (~)20140624 (~)20140913 20150121 (~)20150121-r1 (~)20151106 (~)20160607 {initramfs monolithic +split-ucode}
     Installed versions:  20160607(23:02:24 25/06/16)(initramfs split-ucode -monolithic)
     Homepage:            http://inertiawar.com/microcode/ https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=26083
     Description:         Intel IA32/IA64 microcode update data

Found 2 matches
root # eix iucode_tool
[I] sys-apps/iucode_tool
     Available versions:  (~)1.3 (~)1.5
     Installed versions:  1.5(15:57:21 13/12/15)
     Homepage:            https://gitlab.com/iucode-tool/
     Description:         tool to manipulate Intel X86 and X86-64 processor microcode update collections

I checked the relevant contents of package.use and package.accept_keywords and found that Portage had updated automatically the files to reflect the replacement of package sys-apps/microcode-data by the package sys-firmware/intel-microcode (Portage is an excellent package manager!):

root # cat /etc/portage/package.use/microcode-data
# move sys-apps/microcode-data sys-firmware/intel-microcode
sys-firmware/intel-microcode initramfs
root # cat /etc/portage/package.accept_keywords/microcode-data
# move sys-apps/microcode-data sys-firmware/intel-microcode
sys-firmware/intel-microcode ~amd64
sys-apps/iucode_tool ~amd64

The file /lib/firmware/microcode.cpio and the contents of /lib/firmware/intel-ucode/ had indeed changed since I applied the last CPU microcode update:

root # ls -la /lib/firmware/microcode.cpio
-rw-r--r-- 1 root root 946176 Jun 25 23:02 /lib/firmware/microcode.cpio
root # ls -la /lib/firmware/intel-ucode/
total 1052
drwxr-xr-x  2 root root  4096 Jun 25 23:02 .
drwxr-xr-x 75 root root 16384 Jun 25 23:02 ..
-rw-r--r--  1 root root  2048 Jun 25 23:02 06-03-02
-rw-r--r--  1 root root  6144 Jun 25 23:02 06-05-00
-rw-r--r--  1 root root  2048 Jun 25 23:02 06-05-01
-rw-r--r--  1 root root  6144 Jun 25 23:02 06-05-02
-rw-r--r--  1 root root  8192 Jun 25 23:02 06-05-03
-rw-r--r--  1 root root  2048 Jun 25 23:02 06-06-00
-rw-r--r--  1 root root  2048 Jun 25 23:02 06-06-05
-rw-r--r--  1 root root  6144 Jun 25 23:02 06-06-0a
-rw-r--r--  1 root root  6144 Jun 25 23:02 06-06-0d
-rw-r--r--  1 root root  2048 Jun 25 23:02 06-07-01
-rw-r--r--  1 root root  2048 Jun 25 23:02 06-07-02
-rw-r--r--  1 root root  2048 Jun 25 23:02 06-07-03
-rw-r--r--  1 root root 10240 Jun 25 23:02 06-08-01
-rw-r--r--  1 root root  4096 Jun 25 23:02 06-08-03
-rw-r--r--  1 root root 10240 Jun 25 23:02 06-08-06
-rw-r--r--  1 root root  6144 Jun 25 23:02 06-08-0a
-rw-r--r--  1 root root  6144 Jun 25 23:02 06-09-05
-rw-r--r--  1 root root  2048 Jun 25 23:02 06-0a-00
-rw-r--r--  1 root root  2048 Jun 25 23:02 06-0a-01
-rw-r--r--  1 root root  4096 Jun 25 23:02 06-0b-01
-rw-r--r--  1 root root  4096 Jun 25 23:02 06-0b-04
-rw-r--r--  1 root root  2048 Jun 25 23:02 06-0d-06
-rw-r--r--  1 root root  4096 Jun 25 23:02 06-0e-08
-rw-r--r--  1 root root  8192 Jun 25 23:02 06-0e-0c
-rw-r--r--  1 root root  8192 Jun 25 23:02 06-0f-02
-rw-r--r--  1 root root 12288 Jun 25 23:02 06-0f-06
-rw-r--r--  1 root root  8192 Jun 25 23:02 06-0f-07
-rw-r--r--  1 root root  4096 Jun 25 23:02 06-0f-0a
-rw-r--r--  1 root root 28672 Jun 25 23:02 06-0f-0b
-rw-r--r--  1 root root 12288 Jun 25 23:02 06-0f-0d
-rw-r--r--  1 root root 12288 Jun 25 23:02 06-16-01
-rw-r--r--  1 root root 20480 Jun 25 23:02 06-17-06
-rw-r--r--  1 root root  4096 Jun 25 23:02 06-17-07
-rw-r--r--  1 root root 24576 Jun 25 23:02 06-17-0a
-rw-r--r--  1 root root 14336 Jun 25 23:02 06-1a-04
-rw-r--r--  1 root root 10240 Jun 25 23:02 06-1a-05
-rw-r--r--  1 root root 15360 Jun 25 23:02 06-1c-02
-rw-r--r--  1 root root 20480 Jun 25 23:02 06-1c-0a
-rw-r--r--  1 root root  4096 Jun 25 23:02 06-1d-01
-rw-r--r--  1 root root  6144 Jun 25 23:02 06-1e-04
-rw-r--r--  1 root root  7168 Jun 25 23:02 06-1e-05
-rw-r--r--  1 root root  8192 Jun 25 23:02 06-25-02
-rw-r--r--  1 root root  3072 Jun 25 23:02 06-25-05
-rw-r--r--  1 root root 10240 Jun 25 23:02 06-26-01
-rw-r--r--  1 root root 10240 Jun 25 23:02 06-2a-07
-rw-r--r--  1 root root 16384 Jun 25 23:02 06-2d-06
-rw-r--r--  1 root root 17408 Jun 25 23:02 06-2d-07
-rw-r--r--  1 root root 13312 Jun 25 23:02 06-2f-02
-rw-r--r--  1 root root 12288 Jun 25 23:02 06-3a-09
-rw-r--r--  1 root root 22528 Jun 25 23:02 06-3c-03
-rw-r--r--  1 root root 17408 Jun 25 23:02 06-3d-04
-rw-r--r--  1 root root 13312 Jun 25 23:02 06-3e-04
-rw-r--r--  1 root root 11264 Jun 25 23:02 06-3e-06
-rw-r--r--  1 root root 15360 Jun 25 23:02 06-3e-07
-rw-r--r--  1 root root 32768 Jun 25 23:02 06-3f-02
-rw-r--r--  1 root root 15360 Jun 25 23:02 06-3f-04
-rw-r--r--  1 root root 20480 Jun 25 23:02 06-45-01
-rw-r--r--  1 root root 24576 Jun 25 23:02 06-46-01
-rw-r--r--  1 root root 11264 Jun 25 23:02 06-47-01
-rw-r--r--  1 root root 96256 Jun 25 23:02 06-4e-03
-rw-r--r--  1 root root 25600 Jun 25 23:02 06-4f-01
-rw-r--r--  1 root root 28672 Jun 25 23:02 06-56-02
-rw-r--r--  1 root root 96256 Jun 25 23:02 06-5e-03
-rw-r--r--  1 root root  4096 Jun 25 23:02 0f-00-07
-rw-r--r--  1 root root  6144 Jun 25 23:02 0f-00-0a
-rw-r--r--  1 root root  2048 Jun 25 23:02 0f-01-02
-rw-r--r--  1 root root  6144 Jun 25 23:02 0f-02-04
-rw-r--r--  1 root root  8192 Jun 25 23:02 0f-02-05
-rw-r--r--  1 root root  2048 Jun 25 23:02 0f-02-06
-rw-r--r--  1 root root  6144 Jun 25 23:02 0f-02-07
-rw-r--r--  1 root root  6144 Jun 25 23:02 0f-02-09
-rw-r--r--  1 root root  2048 Jun 25 23:02 0f-03-02
-rw-r--r--  1 root root  2048 Jun 25 23:02 0f-03-03
-rw-r--r--  1 root root  7168 Jun 25 23:02 0f-03-04
-rw-r--r--  1 root root 10240 Jun 25 23:02 0f-04-01
-rw-r--r--  1 root root  2048 Jun 25 23:02 0f-04-03
-rw-r--r--  1 root root  3072 Jun 25 23:02 0f-04-04
-rw-r--r--  1 root root  3072 Jun 25 23:02 0f-04-07
-rw-r--r--  1 root root  9216 Jun 25 23:02 0f-04-08
-rw-r--r--  1 root root  2048 Jun 25 23:02 0f-04-09
-rw-r--r--  1 root root  4096 Jun 25 23:02 0f-04-0a
-rw-r--r--  1 root root  3072 Jun 25 23:02 0f-06-02
-rw-r--r--  1 root root  6144 Jun 25 23:02 0f-06-04
-rw-r--r--  1 root root  2048 Jun 25 23:02 0f-06-05
-rw-r--r--  1 root root  2048 Jun 25 23:02 0f-06-08

So I was in a position to apply the latest CPU microcode…

I mounted the /boot partition:

root # mount /dev/sda1 /boot
root # ls -1 /boot
System.map-3.18.11-gentoo
config-3.18.11-gentoo
grub
lost+found
microcode.cpio
vmlinuz-3.18.11-gentoo

Then I copied the new version of the file microcode.cpio to the /boot partition:

root # cp /lib/firmware/microcode.cpio /boot/

I made sure /boot/grub/grub.cfg still contained the extra line ‘initrd /microcode.cpio‘ I had added in the past:

root # grep -B 15 -A 1 initrd /boot/grub/grub.cfg

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-525a90f1-8ad2-44a3-ade3-20f18a0a9595' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  f6ffc085-66fe-4bbe-b080-cec355749f85
        else
          search --no-floppy --fs-uuid --set=root f6ffc085-66fe-4bbe-b080-cec355749f85
        fi
        echo    'Loading Linux 3.18.11-gentoo ...'
        linux   /vmlinuz-3.18.11-gentoo root=/dev/sda5 ro  drm_kms_helper.edid_firmware=edid/1920x1080_Clevo_W230SS.bin i915.modeset=1 rcutree.rcu_idle_gp_delay=1 acpi_enforce_resources=lax
        initrd /microcode.cpio
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-525a90f1-8ad2-44a3-ade3-20f18a0a9595' {
        menuentry 'Gentoo GNU/Linux, with Linux 3.18.11-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.18.11-gentoo-advanced-525a90f1-8ad2-44a3-ade3-20f18a0a9595' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  f6ffc085-66fe-4bbe-b080-cec355749f85
                else
                  search --no-floppy --fs-uuid --set=root f6ffc085-66fe-4bbe-b080-cec355749f85
                fi
                echo    'Loading Linux 3.18.11-gentoo ...'
                linux   /vmlinuz-3.18.11-gentoo root=/dev/sda5 ro  drm_kms_helper.edid_firmware=edid/1920x1080_Clevo_W230SS.bin i915.modeset=1 rcutree.rcu_idle_gp_delay=1 acpi_enforce_resources=lax
                initrd /microcode.cpio
        }

Then I rebooted and checked to make sure the new version of CPU microcode is being applied:

root # grep microcode /proc/cpuinfo
microcode       : 0x20
microcode       : 0x20
microcode       : 0x20
microcode       : 0x20
microcode       : 0x20
microcode       : 0x20
microcode       : 0x20
microcode       : 0x20
root # dmesg | grep microcode
[    0.000000] CPU0 microcode updated early to revision 0x20, date = 2016-03-16
[    0.049437] CPU1 microcode updated early to revision 0x20, date = 2016-03-16
[    0.064540] CPU2 microcode updated early to revision 0x20, date = 2016-03-16
[    0.079569] CPU3 microcode updated early to revision 0x20, date = 2016-03-16
[    0.265322] microcode: CPU0 sig=0x306c3, pf=0x10, revision=0x20
[    0.265425] microcode: CPU1 sig=0x306c3, pf=0x10, revision=0x20
[    0.265524] microcode: CPU2 sig=0x306c3, pf=0x10, revision=0x20
[    0.265620] microcode: CPU3 sig=0x306c3, pf=0x10, revision=0x20
[    0.265717] microcode: CPU4 sig=0x306c3, pf=0x10, revision=0x20
[    0.265815] microcode: CPU5 sig=0x306c3, pf=0x10, revision=0x20
[    0.265913] microcode: CPU6 sig=0x306c3, pf=0x10, revision=0x20
[    0.266011] microcode: CPU7 sig=0x306c3, pf=0x10, revision=0x20
[    0.266127] microcode: Microcode Update Driver: v2.00 <tigran@aivazian.fsnet.co.uk>, Peter Oruba

Notice the microcode version has changed from 0x1c to 0x20. Mission accomplished. 🙂

Gentoo Linux installations without initramfs: Updating Intel CPU microcode

This post explains how I configured the Gentoo Linux (amd64) installation on my Clevo W230SS laptop to make it update the Intel CPU microcode using the kernel Microcode Early Update driver.

Back in April I installed Gentoo Linux Stable and built the kernel using the default manual configuration steps given in the Gentoo Handbook, and my installation therefore did not use an initramfs. The contents of the /boot directory were as listed below:

# ls -1 /boot
System.map-3.18.11-gentoo
config-3.18.11-gentoo
grub
lost+found
vmlinuz-3.18.11-gentoo

Contrast the above with the boot directory of the Gentoo Linux Testing (~amd64) installation on my Compal NBLB2 laptop, which does use an initramfs because I built the kernel using the optional genkernel utility:

# ls -1 /boot
System.map-genkernel-x86_64-3.18.11-gentoo
boot
grub
initramfs-genkernel-x86_64-3.18.11-gentoo
kernel-genkernel-x86_64-3.18.11-gentoo
lost+found

Since I wrote my earlier post on updating CPU microcode, the use of a kernel module and initscript to update CPU microcode has been dropped (in Gentoo Linux, at least). This is because updating CPU microcode relatively late in the boot process may cause problems if some processes have started before the update has taken place. The only safe way to update CPU microcode is to use the kernel’s built-in Microcode Early Update driver (METHOD 2 in my earlier post).

Now, new versions of the relevant Gentoo Linux ebuilds (microcode-ctl-1.28-r1, microcode-data-20150121-r1 and iucode_tool-1.3) have recently been released (see Gentoo Bug Report No. 528712). If a Gentoo Linux installation does not use an initramfs, the microcode-data ebuild now includes an ‘initramfs‘ USE flag which you can set in order to create a minimal initramfs to load the CPU microcode at boot. Below I explain in detail how I configured my installation to update the CPU microcode early during boot.

Before doing anything at all, I checked the microcode version for my CPU (Intel Core i7-4810MQ @ 2.80GHz):

# grep microcode /proc/cpuinfo
microcode   : 0x12
microcode   : 0x12
microcode   : 0x12
microcode   : 0x12
microcode   : 0x12
microcode   : 0x12
microcode   : 0x12
microcode   : 0x12
# dmesg | grep microcode
[    0.262544] microcode: CPU0 sig=0x306c3, pf=0x10, revision=0x12
[    0.262641] microcode: CPU1 sig=0x306c3, pf=0x10, revision=0x12
[    0.262740] microcode: CPU2 sig=0x306c3, pf=0x10, revision=0x12
[    0.262841] microcode: CPU3 sig=0x306c3, pf=0x10, revision=0x12
[    0.262939] microcode: CPU4 sig=0x306c3, pf=0x10, revision=0x12
[    0.263038] microcode: CPU5 sig=0x306c3, pf=0x10, revision=0x12
[    0.263138] microcode: CPU6 sig=0x306c3, pf=0x10, revision=0x12
[    0.263236] microcode: CPU7 sig=0x306c3, pf=0x10, revision=0x12
[    0.263367] microcode: Microcode Update Driver: v2.00 , Peter Oruba

Fortunately I did not need to rebuild the kernel as I had already configured it back in April when I installed Gentoo, with a view to implementing early microcode updating at some point:

# grep CONFIG_BLK_DEV_INITRD /usr/src/linux/.config
CONFIG_BLK_DEV_INITRD=y
# grep CONFIG_MICROCODE /usr/src/linux/.config
CONFIG_MICROCODE=y
CONFIG_MICROCODE_INTEL=y
# CONFIG_MICROCODE_AMD is not set
CONFIG_MICROCODE_OLD_INTERFACE=y
CONFIG_MICROCODE_INTEL_EARLY=y
# CONFIG_MICROCODE_AMD_EARLY is not set
CONFIG_MICROCODE_EARLY=y
# grep CONFIG_INITRAMFS_SOURCE /usr/src/linux/.config
CONFIG_INITRAMFS_SOURCE=""

Then I set the initramfs USE flag and unmasked the ~amd64 ebuilds created by Gentoo developer SpanKY (microcode-ctl-1.28-r1.ebuild, microcode-data-20150121-r1.ebuild and iucode_tool-1.3.ebuild) as discussed in the above-mentioned Gentoo bug report:

# cat /etc/portage/package.use/microcode-data
sys-apps/microcode-data initramfs
# cat /etc/portage/package.accept_keywords/microcode-data
sys-apps/microcode-data ~amd64
sys-apps/iucode_tool ~amd64
# cat /etc/portage/package.accept_keywords/microcode-ctl
sys-apps/microcode-ctl ~amd64

Then I merged the packages:

# emerge --ask microcode-ctl microcode-data

This resulted in the following files:

# ls -la /lib/firmware/microcode.cpio
-rw-r--r-- 1 root root 663552 Aug 26 15:06 /lib/firmware/microcode.cpio
# ls -la /lib/firmware/intel-ucode
total 768
drwxr-xr-x  2 root root  4096 Aug 26 15:06 .
drwxr-xr-x 62 root root 16384 Aug 26 15:06 ..
-rw-r--r--  1 root root  2048 Aug 26 15:06 06-03-02
-rw-r--r--  1 root root  6144 Aug 26 15:06 06-05-00
-rw-r--r--  1 root root  2048 Aug 26 15:06 06-05-01
-rw-r--r--  1 root root  6144 Aug 26 15:06 06-05-02
-rw-r--r--  1 root root  8192 Aug 26 15:06 06-05-03
-rw-r--r--  1 root root  2048 Aug 26 15:06 06-06-00
-rw-r--r--  1 root root  2048 Aug 26 15:06 06-06-05
-rw-r--r--  1 root root  6144 Aug 26 15:06 06-06-0a
-rw-r--r--  1 root root  6144 Aug 26 15:06 06-06-0d
-rw-r--r--  1 root root  2048 Aug 26 15:06 06-07-01
-rw-r--r--  1 root root  2048 Aug 26 15:06 06-07-02
-rw-r--r--  1 root root  2048 Aug 26 15:06 06-07-03
-rw-r--r--  1 root root 10240 Aug 26 15:06 06-08-01
-rw-r--r--  1 root root  4096 Aug 26 15:06 06-08-03
-rw-r--r--  1 root root 10240 Aug 26 15:06 06-08-06
-rw-r--r--  1 root root  6144 Aug 26 15:06 06-08-0a
-rw-r--r--  1 root root  6144 Aug 26 15:06 06-09-05
-rw-r--r--  1 root root  2048 Aug 26 15:06 06-0a-00
-rw-r--r--  1 root root  2048 Aug 26 15:06 06-0a-01
-rw-r--r--  1 root root  4096 Aug 26 15:06 06-0b-01
-rw-r--r--  1 root root  4096 Aug 26 15:06 06-0b-04
-rw-r--r--  1 root root  2048 Aug 26 15:06 06-0d-06
-rw-r--r--  1 root root  4096 Aug 26 15:06 06-0e-08
-rw-r--r--  1 root root  8192 Aug 26 15:06 06-0e-0c
-rw-r--r--  1 root root  8192 Aug 26 15:06 06-0f-02
-rw-r--r--  1 root root 12288 Aug 26 15:06 06-0f-06
-rw-r--r--  1 root root  8192 Aug 26 15:06 06-0f-07
-rw-r--r--  1 root root  4096 Aug 26 15:06 06-0f-0a
-rw-r--r--  1 root root 28672 Aug 26 15:06 06-0f-0b
-rw-r--r--  1 root root 12288 Aug 26 15:06 06-0f-0d
-rw-r--r--  1 root root 12288 Aug 26 15:06 06-16-01
-rw-r--r--  1 root root 20480 Aug 26 15:06 06-17-06
-rw-r--r--  1 root root  4096 Aug 26 15:06 06-17-07
-rw-r--r--  1 root root 24576 Aug 26 15:06 06-17-0a
-rw-r--r--  1 root root 14336 Aug 26 15:06 06-1a-04
-rw-r--r--  1 root root 10240 Aug 26 15:06 06-1a-05
-rw-r--r--  1 root root 15360 Aug 26 15:06 06-1c-02
-rw-r--r--  1 root root 20480 Aug 26 15:06 06-1c-0a
-rw-r--r--  1 root root  4096 Aug 26 15:06 06-1d-01
-rw-r--r--  1 root root  6144 Aug 26 15:06 06-1e-04
-rw-r--r--  1 root root  7168 Aug 26 15:06 06-1e-05
-rw-r--r--  1 root root  8192 Aug 26 15:06 06-25-02
-rw-r--r--  1 root root  3072 Aug 26 15:06 06-25-05
-rw-r--r--  1 root root 10240 Aug 26 15:06 06-26-01
-rw-r--r--  1 root root 10240 Aug 26 15:06 06-2a-07
-rw-r--r--  1 root root 16384 Aug 26 15:06 06-2d-06
-rw-r--r--  1 root root 17408 Aug 26 15:06 06-2d-07
-rw-r--r--  1 root root 13312 Aug 26 15:06 06-2f-02
-rw-r--r--  1 root root 12288 Aug 26 15:06 06-3a-09
-rw-r--r--  1 root root 21504 Aug 26 15:06 06-3c-03
-rw-r--r--  1 root root 14336 Aug 26 15:06 06-3d-04
-rw-r--r--  1 root root 13312 Aug 26 15:06 06-3e-04
-rw-r--r--  1 root root 11264 Aug 26 15:06 06-3e-06
-rw-r--r--  1 root root 15360 Aug 26 15:06 06-3e-07
-rw-r--r--  1 root root 28672 Aug 26 15:06 06-3f-02
-rw-r--r--  1 root root 20480 Aug 26 15:06 06-45-01
-rw-r--r--  1 root root 23552 Aug 26 15:06 06-46-01
-rw-r--r--  1 root root  4096 Aug 26 15:06 0f-00-07
-rw-r--r--  1 root root  6144 Aug 26 15:06 0f-00-0a
-rw-r--r--  1 root root  2048 Aug 26 15:06 0f-01-02
-rw-r--r--  1 root root  6144 Aug 26 15:06 0f-02-04
-rw-r--r--  1 root root  8192 Aug 26 15:06 0f-02-05
-rw-r--r--  1 root root  2048 Aug 26 15:06 0f-02-06
-rw-r--r--  1 root root  6144 Aug 26 15:06 0f-02-07
-rw-r--r--  1 root root  6144 Aug 26 15:06 0f-02-09
-rw-r--r--  1 root root  2048 Aug 26 15:06 0f-03-02
-rw-r--r--  1 root root  2048 Aug 26 15:06 0f-03-03
-rw-r--r--  1 root root  7168 Aug 26 15:06 0f-03-04
-rw-r--r--  1 root root 10240 Aug 26 15:06 0f-04-01
-rw-r--r--  1 root root  2048 Aug 26 15:06 0f-04-03
-rw-r--r--  1 root root  3072 Aug 26 15:06 0f-04-04
-rw-r--r--  1 root root  3072 Aug 26 15:06 0f-04-07
-rw-r--r--  1 root root  9216 Aug 26 15:06 0f-04-08
-rw-r--r--  1 root root  2048 Aug 26 15:06 0f-04-09
-rw-r--r--  1 root root  4096 Aug 26 15:06 0f-04-0a
-rw-r--r--  1 root root  3072 Aug 26 15:06 0f-06-02
-rw-r--r--  1 root root  6144 Aug 26 15:06 0f-06-04
-rw-r--r--  1 root root  2048 Aug 26 15:06 0f-06-05
-rw-r--r--  1 root root  2048 Aug 26 15:06 0f-06-08

(By the way, the file 06-3c-03 is the microcode file for my particular CPU: Family 06h, Model 03Ch, Stepping 03h, as determined from the CPU World Web site.)

Then I copied to the boot directory the cpio file created when I merged the packages:

# cp /lib/firmware/microcode.cpio /boot/

Then I added an initrd line to /boot/grub/grub.cfg as shown below:

# grep -B 15 -A 1 initrd /boot/grub/grub.cfg

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-525a90f1-8ad2-44a3-ade3-20f18a0a9595' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  f6ffc085-66fe-4bbe-b080-cec355749f85
        else
          search --no-floppy --fs-uuid --set=root f6ffc085-66fe-4bbe-b080-cec355749f85
        fi
        echo    'Loading Linux 3.18.11-gentoo ...'
        linux   /vmlinuz-3.18.11-gentoo root=/dev/sda5 ro  drm_kms_helper.edid_firmware=edid/1920x1080_Clevo_W230SS.bin i915.modeset=1 rcutree.rcu_idle_gp_delay=1
        initrd /microcode.cpio
}

After rebooting:

# grep microcode /proc/cpuinfo
microcode       : 0x1c
microcode       : 0x1c
microcode       : 0x1c
microcode       : 0x1c
microcode       : 0x1c
microcode       : 0x1c
microcode       : 0x1c
microcode       : 0x1c
# dmesg | grep microcode
[    0.000000] CPU0 microcode updated early to revision 0x1c, date = 2014-07-03
[    0.049968] CPU1 microcode updated early to revision 0x1c, date = 2014-07-03
[    0.065070] CPU2 microcode updated early to revision 0x1c, date = 2014-07-03
[    0.080101] CPU3 microcode updated early to revision 0x1c, date = 2014-07-03
[    0.268736] microcode: CPU0 sig=0x306c3, pf=0x10, revision=0x1c
[    0.268838] microcode: CPU1 sig=0x306c3, pf=0x10, revision=0x1c
[    0.268935] microcode: CPU2 sig=0x306c3, pf=0x10, revision=0x1c
[    0.269034] microcode: CPU3 sig=0x306c3, pf=0x10, revision=0x1c
[    0.269131] microcode: CPU4 sig=0x306c3, pf=0x10, revision=0x1c
[    0.269230] microcode: CPU5 sig=0x306c3, pf=0x10, revision=0x1c
[    0.269329] microcode: CPU6 sig=0x306c3, pf=0x10, revision=0x1c
[    0.269448] microcode: CPU7 sig=0x306c3, pf=0x10, revision=0x1c
[    0.269570] microcode: Microcode Update Driver: v2.00 , Peter Oruba

As you can see above, the microcode early update kernel driver updates the microcode version to 0x1c at boot (cf. 0x12 originally). If you have a different model of CPU to mine, of course the version in your case could be different.

Note that the line ‘initrd /lib/firmware/microcode.cpio‘ in the file grub.cfg does not work for me. It has to be ‘initrd /microcode.cpio‘ and the file microcode.cpio has to be in the /boot directory:

# ls /boot
System.map-3.18.11-gentoo  config-3.18.11-gentoo  grub  lost+found  microcode.cpio  vmlinuz-3.18.11-gentoo

Note also that the precise steps specified in Comment #41 of Gentoo Bug Report No. 528712 do not work for me and others (see Gentoo Forums thread microcode-data-20150121-r1 with USE=initramfs: kernel panic). If I build the kernel with CONFIG_INITRAMFS_SOURCE="/lib/firmware/microcode.cpio", delete the line ‘initrd /microcode‘ from grub.cfg, delete the file /boot/microcode.cpio and reboot, the kernel panics and the last two console lines are as follows:

[    3.142079] drm_kms_helper: panic occurred, switching back to text console
[    3.142879] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,5)

Unless Gentoo developer SpanKY explains how he managed to get the procedure he gave in Comment #41 of Gentoo Bug Report No. 528712 to work, it seems the normal behaviour when applying the steps he gave would be for the kernel to panic. Even Gentoo developer Daniel Pielmeier experienced a kernel panic when he applied SpanKY‘s steps (Comment #54 of Gentoo Bug Report No. 528712).

As the procedure I gave above works fine, I therefore reverted to using CONFIG_INITRAMFS_SOURCE="", copying /lib/firmware/microcode.cpio to /boot/microcode.cpio again and re-adding the line ‘initrd /microcode.cpio‘ in the file grub.cfg. However, if you did not have an initramfs and were able to get the precise procedure given in Comment #41 of Gentoo Bug Report #528712 to work, please post a comment here.

How to install the linux-firmware package in Gentoo

The microcode image (a.k.a. firmware) file for a driver can be installed from the distribution’s package manager. For example, in Gentoo the microcode package for the Intel Wireless WiFi 5100AGN, 5300AGN and 5350AGN controllers is named sys-firmware/iwl5000-ucode. However, microcode files are also available in a single package named sys-kernel/linux-firmware and can be installed using that package instead. However, to me at least, it was not obvious how to do this and the elog output when you merge the linux-firmware package is not particularly helpful:

* If you are only interested in particular firmware files, edit the saved
* configfile and remove those that you do not want.
>>> sys-kernel/linux-firmware-20120816 merged.

In other words, I used to enter the following command to install the microcode for the Intel 5300AGN WiFi controller:

emerge sys-firmware/iwl5000-ucode

and that command installed only the microcode files needed for that WiFi controller, but the following command also installed many other microcode files for hardware that my laptop does not have:

emerge sys-kernel/linux-firmware

You can see below what the above command installs in /lib/firmware/ (/lib64/firmware/ if you have a 64-bit installation) in the case of the package linux-firmware-20120816.

# ls /lib/firmware/
3com bnx2 emi26 iwlwifi-4965-2.ucode LICENCE.broadcom_bcm43xx matrox qlogic s2250_loader.fw usbdux
acenic bnx2x emi62 iwlwifi-5000-1.ucode LICENCE.chelsio_firmware mrvl r128 sb16 usbduxfast_firmware.bin
ACX100_USB.bin bnx2x-e1-4.8.53.0.fw ene-ub6250 iwlwifi-5000-2.ucode LICENCE.ene_firmware mts_cdma.fw radeon slicoss usbdux_firmware.bin
adaptec bnx2x-e1-5.2.13.0.fw ess iwlwifi-5000-5.ucode LICENCE.i2400m mts_edge.fw RADIO0d.BIN STLC2500_R4_00_03.ptc usbduxsigma_firmware.bin
advansys bnx2x-e1-5.2.7.0.fw f2255usb.bin iwlwifi-5150-2.ucode LICENCE.iwlwifi_firmware mts_gsm.fw RADIO11.BIN STLC2500_R4_00_06.ssf v4l-cx231xx-avcore-01.fw
af9005.fw bnx2x-e1h-4.8.53.0.fw GPL-3 iwlwifi-6000-4.ucode LICENCE.Marvell mts_mt9234mu.fw RADIO15.BIN STLC2500_R4_02_02_WLAN.ssf v4l-cx23418-apu.fw
agere_ap_fw.bin bnx2x-e1h-5.2.13.0.fw htc_7010.fw iwlwifi-6000g2a-5.ucode LICENCE.mwl8335 mts_mt9234zba.fw README STLC2500_R4_02_04.ptc v4l-cx23418-cpu.fw
agere_sta_fw.bin bnx2x-e1h-5.2.7.0.fw htc_9271.fw iwlwifi-6000g2a-6.ucode LICENCE.myri10ge_firmware mwl8k rt2561.bin sun v4l-cx23418-dig.fw
ar3k brcm i2400m-fw-usb-1.4.sbcf iwlwifi-6000g2b-5.ucode LICENCE.OLPC myri10ge_ethp_z8e.dat rt2561s.bin sxg v4l-cx23885-avcore-01.fw
ar7010_1_1.fw cis i2400m-fw-usb-1.5.sbcf iwlwifi-6000g2b-6.ucode LICENCE.phanfw myri10ge_eth_z8e.dat rt2661.bin TDA7706_OM_v2.5.1_boot.txt v4l-cx23885-enc.fw
ar7010.fw configure i6050-fw-usb-1.5.sbcf iwlwifi-6050-4.ucode LICENCE.qla2xxx myri10ge_rss_ethp_z8e.dat rt2860.bin TDA7706_OM_v3.0.2_boot.txt v4l-cx25840.fw
ar9170-1.fw cpia2 intelliport2.bin iwlwifi-6050-5.ucode LICENCE.ralink-firmware.txt myri10ge_rss_eth_z8e.dat rt2870.bin tehuti vicam
ar9170-2.fw cxgb3 isci kaweth LICENCE.rtlwifi_firmware.txt myricom rt3070.bin ti_3410.fw vntwusb.fw
ar9271.fw cxgb4 iwlwifi-1000-3.ucode keyspan LICENCE.tda7706-firmware.txt ositech rt3071.bin ti_5052.fw vxge
ath3k-1.fw dabusb iwlwifi-1000-5.ucode keyspan_pda LICENCE.ti-connectivity phanfw.bin rt3090.bin TIACX111.BIN WHENCE
ath6k dsp56k iwlwifi-100-5.ucode korg LICENCE.ueagle-atm4-firmware ql2100_fw.bin rt3290.bin ti-connectivity whiteheat.fw
atmsar11.fw dvb-fe-xc5000-1.6.114.fw iwlwifi-105-6.ucode lbtf_usb.bin LICENCE.via_vt6656 ql2200_fw.bin rt73.bin tigon whiteheat_loader.fw
av7110 dvb-usb-dib0700-1.20.fw iwlwifi-135-6.ucode lgs8g75.fw LICENCE.xc5000 ql2300_fw.bin RTL8192E tlg2300_firmware.bin WLANGEN.BIN
BCM2033-FW.bin dvb-usb-terratec-h5-drxk.fw iwlwifi-2000-6.ucode libertas LICENSE.dib0700 ql2322_fw.bin rtl_nic tr_smctr.bin yam
BCM2033-MD.hex e100 iwlwifi-2030-6.ucode LICENCE.agere LICENSE.radeon ql2400_fw.bin rtlwifi ttusb-budget yamaha
BCM-LEGAL.txt edgeport iwlwifi-3945-2.ucode LICENCE.atheros_firmware Makefile ql2500_fw.bin s2250.fw ueagle-atm zd1211

But I only need the files iwlwifi-5000-*.ucode, not all those other microcode files, so here is what I do:

# emerge linux-firmware
# cp /etc/portage/savedconfig/sys-kernel/linux-firmware-20120816 /home/fitzcarraldo/linux-firmware-20120816.bak
# awk '{ printf "#"; print }' /home/fitzcarraldo/linux-firmware-20120816.bak > /etc/portage/savedconfig/sys-kernel/linux-firmware-20120816
# nano /etc/portage/savedconfig/sys-kernel/linux-firmware-20120816 # Remove the comment symbol from the files I want to install.
# cp /etc/portage/savedconfig/sys-kernel/linux-firmware-20120816 /home/fitzcarraldo/linux-firmware-20120816 # I like to keep a backup of the edited file too.
# USE="savedconfig" emerge linux-firmware

Of course you can add the savedconfig USE flag in /etc/portage/package.use instead, so that you do not have to type USE=”savedconfig” every time:

# echo "sys-kernel/linux-firmware savedconfig" >> /etc/portage/package.use

For example, I edited /etc/portage/savedconfig/sys-kernel/linux-firmware-20120816 so that the lines are commented out for firmware my laptop does not need. I could have deleted the unwanted lines instead, but I preferred to comment out unwanted lines in case I made a mistake. The file now looks like this:

# Remove files that shall not be installed from this list.
#3com/typhoon.bin
#3com/3C359.bin
#acenic/tg1.bin
#acenic/tg2.bin
#adaptec/starfire_rx.bin
#adaptec/starfire_tx.bin
#advansys/3550.bin
#advansys/38C1600.bin
#advansys/38C0800.bin
#advansys/mcode.bin
#agere_ap_fw.bin
#agere_sta_fw.bin
#ar3k/ramps_0x01020201_26.dfu
#ar3k/ramps_0x01020200_40.dfu
#ar3k/AthrBT_0x11020000.dfu
#ar3k/1020201/RamPatch.txt
#ar3k/1020201/PS_ASIC.pst
#ar3k/1020200/RamPatch.txt
#ar3k/1020200/ar3kbdaddr.pst
#ar3k/1020200/PS_ASIC.pst
#ar3k/ramps_0x11020000_40.dfu
#ar3k/AthrBT_0x01020201.dfu
#ar3k/30101/RamPatch.txt
#ar3k/30101/ar3kbdaddr.pst
#ar3k/30101/PS_ASIC.pst
#ar3k/30000/RamPatch.txt
#ar3k/30000/ar3kbdaddr.pst
#ar3k/30000/PS_ASIC.pst
#ar3k/30101coex/PS_ASIC_aclHighPri.pst
#ar3k/30101coex/PS_ASIC_aclLowPri.pst
#ar3k/30101coex/RamPatch.txt
#ar3k/30101coex/ar3kbdaddr.pst
#ar3k/30101coex/PS_ASIC.pst
#ar3k/ramps_0x01020001_26.dfu
#ar3k/AthrBT_0x31010000.dfu
#ar3k/AthrBT_0x01020001.dfu
#ar3k/ramps_0x01020201_40.dfu
#ar3k/ramps_0x01020200_26.dfu
#ar3k/AthrBT_0x01020200.dfu
#ar3k/ramps_0x31010000_40.dfu
#ar7010_1_1.fw
#ar7010.fw
#ar9170-1.fw
#ar9170-2.fw
#ar9271.fw
#ath3k-1.fw
#ath6k/AR6002/athwlan.bin.z77
#ath6k/AR6002/eeprom.bin
#ath6k/AR6002/data.patch.hw2_0.bin
#ath6k/AR6002/eeprom.data
#ath6k/AR6004/hw1.2/bdata.bin
#ath6k/AR6004/hw1.2/fw-2.bin
#ath6k/AR6003.1/hw2.1.1/athwlan.bin
#ath6k/AR6003.1/hw2.1.1/bdata.SD31.bin
#ath6k/AR6003.1/hw2.1.1/data.patch.bin
#ath6k/AR6003.1/hw2.1.1/bdata.WB31.bin
#ath6k/AR6003.1/hw2.1.1/endpointping.bin
#ath6k/AR6003.1/hw2.1.1/otp.bin
#ath6k/AR6003.1/hw2.1.1/bdata.SD32.bin
#ath6k/AR6003/hw1.0/athwlan.bin.z77
#ath6k/AR6003/hw1.0/otp.bin.z77
#ath6k/AR6003/hw1.0/bdata.SD31.bin
#ath6k/AR6003/hw1.0/data.patch.bin
#ath6k/AR6003/hw1.0/bdata.WB31.bin
#ath6k/AR6003/hw1.0/bdata.SD32.bin
#ath6k/AR6003/hw2.0/athwlan.bin.z77
#ath6k/AR6003/hw2.0/otp.bin.z77
#ath6k/AR6003/hw2.0/bdata.SD31.bin
#ath6k/AR6003/hw2.0/data.patch.bin
#ath6k/AR6003/hw2.0/bdata.WB31.bin
#ath6k/AR6003/hw2.0/bdata.SD32.bin
#ath6k/AR6003/hw2.1.1/athwlan.bin
#ath6k/AR6003/hw2.1.1/bdata.SD31.bin
#ath6k/AR6003/hw2.1.1/fw-3.bin
#ath6k/AR6003/hw2.1.1/data.patch.bin
#ath6k/AR6003/hw2.1.1/bdata.WB31.bin
#ath6k/AR6003/hw2.1.1/endpointping.bin
#ath6k/AR6003/hw2.1.1/otp.bin
#ath6k/AR6003/hw2.1.1/fw-2.bin
#ath6k/AR6003/hw2.1.1/bdata.SD32.bin
#atmsar11.fw
#av7110/Boot.S
#av7110/bootcode.bin
#av7110/Makefile
#bnx2/bnx2-rv2p-06-6.0.15.fw
#bnx2/bnx2-rv2p-09-6.0.17.fw
#bnx2/bnx2-rv2p-06-4.6.16.fw
#bnx2/bnx2-rv2p-09-5.0.0.j3.fw
#bnx2/bnx2-rv2p-06-5.0.0.j3.fw
#bnx2/bnx2-mips-09-5.0.0.j15.fw
#bnx2/bnx2-rv2p-09-4.6.15.fw
#bnx2/bnx2-rv2p-09ax-6.0.17.fw
#bnx2/bnx2-mips-06-5.0.0.j3.fw
#bnx2/bnx2-mips-06-6.2.3.fw
#bnx2/bnx2-mips-09-5.0.0.j9.fw
#bnx2/bnx2-rv2p-09-5.0.0.j10.fw
#bnx2/bnx2-mips-09-6.2.1b.fw
#bnx2/bnx2-rv2p-09ax-5.0.0.j3.fw
#bnx2/bnx2-mips-06-6.0.15.fw
#bnx2/bnx2-mips-09-6.2.1.fw
#bnx2/bnx2-mips-09-5.0.0.j3.fw
#bnx2/bnx2-rv2p-09ax-5.0.0.j10.fw
#bnx2/bnx2-mips-06-5.0.0.j6.fw
#bnx2/bnx2-mips-06-4.6.16.fw
#bnx2/bnx2-mips-06-6.2.1.fw
#bnx2/bnx2-mips-09-6.2.1a.fw
#bnx2/bnx2-mips-09-4.6.17.fw
#bnx2/bnx2-mips-09-6.0.17.fw
#bnx2x/bnx2x-e1h-6.2.5.0.fw
#bnx2x/bnx2x-e1-7.2.16.0.fw
#bnx2x/bnx2x-e1h-6.2.9.0.fw
#bnx2x/bnx2x-e2-6.2.5.0.fw
#bnx2x/bnx2x-e2-6.0.34.0.fw
#bnx2x/bnx2x-e2-6.2.9.0.fw
#bnx2x/bnx2x-e1-7.0.23.0.fw
#bnx2x/bnx2x-e1-6.2.9.0.fw
#bnx2x/bnx2x-e1-7.2.51.0.fw
#bnx2x/bnx2x-e1h-7.0.23.0.fw
#bnx2x/bnx2x-e1h-6.0.34.0.fw
#bnx2x/bnx2x-e2-7.0.29.0.fw
#bnx2x/bnx2x-e1h-7.2.51.0.fw
#bnx2x/bnx2x-e1h-7.0.29.0.fw
#bnx2x/bnx2x-e1h-7.2.16.0.fw
#bnx2x/bnx2x-e1-6.2.5.0.fw
#bnx2x/bnx2x-e2-7.0.20.0.fw
#bnx2x/bnx2x-e1-6.0.34.0.fw
#bnx2x/bnx2x-e1-7.0.29.0.fw
#bnx2x/bnx2x-e2-7.2.51.0.fw
#bnx2x/bnx2x-e2-7.0.23.0.fw
#bnx2x/bnx2x-e2-7.2.16.0.fw
#bnx2x/bnx2x-e1h-7.0.20.0.fw
#bnx2x/bnx2x-e1-7.0.20.0.fw
#bnx2x-e1-4.8.53.0.fw
#bnx2x-e1-5.2.13.0.fw
#bnx2x-e1-5.2.7.0.fw
#bnx2x-e1h-4.8.53.0.fw
#bnx2x-e1h-5.2.13.0.fw
#bnx2x-e1h-5.2.7.0.fw
#brcm/bcm43xx-0.fw
#brcm/brcmfmac4329.bin
#brcm/brcmfmac43236b.bin
#brcm/brcmfmac4330.bin
#brcm/brcmfmac4334.bin
#brcm/bcm4329-fullmac-4.bin
#brcm/bcm43xx_hdr-0.fw
#cis/MT5634ZLX.cis
#cis/SW_555_SER.cis
#cis/COMpad2.cis
#cis/SW_7xx_SER.cis
#cis/NE2K.cis
#cis/src/MT5634ZLX.cis
#cis/src/COMpad2.cis
#cis/src/NE2K.cis
#cis/src/DP83903.cis
#cis/src/RS-COM-2P.cis
#cis/src/LA-PCM.cis
#cis/src/COMpad4.cis
#cis/src/PE-200.cis
#cis/src/tamarack.cis
#cis/src/3CCFEM556.cis
#cis/src/PCMLM28.cis
#cis/src/3CXEM556.cis
#cis/src/PE520.cis
#cis/DP83903.cis
#cis/RS-COM-2P.cis
#cis/LA-PCM.cis
#cis/SW_8xx_SER.cis
#cis/COMpad4.cis
#cis/PE-200.cis
#cis/tamarack.cis
#cis/3CCFEM556.cis
#cis/Makefile
#cis/PCMLM28.cis
#cis/3CXEM556.cis
#cis/PE520.cis
configure
#cpia2/stv0672_vp4.bin
#cxgb3/t3b_psram-1.1.0.bin
#cxgb3/ael2005_twx_edc.bin
#cxgb3/t3fw-7.4.0.bin
#cxgb3/t3fw-7.1.0.bin
#cxgb3/t3c_psram-1.1.0.bin
#cxgb3/t3fw-7.12.0.bin
#cxgb3/t3fw-7.10.0.bin
#cxgb3/ael2020_twx_edc.bin
#cxgb3/t3fw-7.0.0.bin
#cxgb3/ael2005_opt_edc.bin
#cxgb4/t4fw.bin
#cxgb4/t4fw-1.4.23.0.bin
#dabusb/bitstream.bin
#dabusb/firmware.fw
#dsp56k/bootstrap.bin
#dsp56k/concat-bootstrap.pl
#dsp56k/bootstrap.asm
#dsp56k/Makefile
#dvb-fe-xc5000-1.6.114.fw
#dvb-usb-dib0700-1.20.fw
#dvb-usb-terratec-h5-drxk.fw
#e100/d101m_ucode.bin
#e100/d102e_ucode.bin
#e100/d101s_ucode.bin
#edgeport/boot.fw
#edgeport/down.fw
#edgeport/down2.fw
#edgeport/down3.bin
#edgeport/boot2.fw
#emi26/bitstream.fw
#emi26/loader.fw
#emi26/firmware.fw
#emi62/bitstream.fw
#emi62/loader.fw
#emi62/spdif.fw
#emi62/midi.fw
#ene-ub6250/msp_rdwr.bin
#ene-ub6250/sd_init1.bin
#ene-ub6250/sd_init2.bin
#ene-ub6250/ms_init.bin
#ene-ub6250/ms_rdwr.bin
#ene-ub6250/sd_rdwr.bin
#ess/maestro3_assp_minisrc.fw
#ess/maestro3_assp_kernel.fw
#f2255usb.bin
GPL-3
#htc_7010.fw
#htc_9271.fw
#i2400m-fw-usb-1.4.sbcf
#i2400m-fw-usb-1.5.sbcf
#i6050-fw-usb-1.5.sbcf
#intelliport2.bin
#isci/create_fw.c
#isci/README
#isci/probe_roms.h
#isci/isci_firmware.bin
#isci/create_fw.h
#isci/Makefile
#iwlwifi-1000-3.ucode
#iwlwifi-1000-5.ucode
#iwlwifi-100-5.ucode
#iwlwifi-105-6.ucode
#iwlwifi-135-6.ucode
#iwlwifi-2000-6.ucode
#iwlwifi-2030-6.ucode
#iwlwifi-3945-2.ucode
#iwlwifi-4965-2.ucode
iwlwifi-5000-1.ucode
iwlwifi-5000-2.ucode
iwlwifi-5000-5.ucode
#iwlwifi-5150-2.ucode
#iwlwifi-6000-4.ucode
#iwlwifi-6000g2a-5.ucode
#iwlwifi-6000g2a-6.ucode
#iwlwifi-6000g2b-5.ucode
#iwlwifi-6000g2b-6.ucode
#iwlwifi-6050-4.ucode
#iwlwifi-6050-5.ucode
#kaweth/trigger_code_fix.bin
#kaweth/new_code.bin
#kaweth/new_code_fix.bin
#kaweth/trigger_code.bin
#keyspan/usa19qi.fw
#keyspan/usa28xb.fw
#keyspan/usa28x.fw
#keyspan/usa49wlc.fw
#keyspan/usa49w.fw
#keyspan/usa19w.fw
#keyspan/usa28xa.fw
#keyspan/usa28.fw
#keyspan/usa19qw.fw
#keyspan/mpr.fw
#keyspan/usa18x.fw
#keyspan/usa19.fw
#keyspan_pda/keyspan_pda.S
#keyspan_pda/xircom_pgs.S
#keyspan_pda/keyspan_pda.fw
#keyspan_pda/xircom_pgs.fw
#keyspan_pda/Makefile
#korg/k1212.dsp
#lbtf_usb.bin
#lgs8g75.fw
#libertas/gspi8682.bin
#libertas/sd8682_helper.bin
#libertas/gspi8688_helper.bin
#libertas/gspi8686_v9.bin
#libertas/cf8385_helper.bin
#libertas/usb8682.bin
#libertas/cf8381_helper.bin
#libertas/usb8388_v9.bin
#libertas/sd8686_v8.bin
#libertas/sd8385_helper.bin
#libertas/sd8686_v9.bin
#libertas/sd8686_v9_helper.bin
#libertas/cf8381.bin
#libertas/gspi8686_v9_helper.bin
#libertas/usb8388_v5.bin
#libertas/gspi8682_helper.bin
#libertas/lbtf_sdio.bin
#libertas/gspi8688.bin
#libertas/sd8385.bin
#libertas/sd8682.bin
#libertas/usb8388_olpc.bin
#libertas/sd8688.bin
#libertas/sd8688_helper.bin
#libertas/sd8686_v8_helper.bin
#libertas/cf8385.bin
#LICENCE.agere
#LICENCE.atheros_firmware
#LICENCE.broadcom_bcm43xx
#LICENCE.chelsio_firmware
#LICENCE.ene_firmware
#LICENCE.i2400m
LICENCE.iwlwifi_firmware
#LICENCE.Marvell
#LICENCE.mwl8335
#LICENCE.myri10ge_firmware
#LICENCE.OLPC
#LICENCE.phanfw
#LICENCE.qla2xxx
#LICENCE.ralink-firmware.txt
#LICENCE.rtlwifi_firmware.txt
#LICENCE.tda7706-firmware.txt
#LICENCE.ti-connectivity
#LICENCE.ueagle-atm4-firmware
#LICENCE.via_vt6656
#LICENCE.xc5000
#LICENSE.dib0700
LICENSE.radeon
Makefile
#matrox/g400_warp.fw
#matrox/g200_warp.fw
#mrvl/sd8787_uapsta.bin
#mts_cdma.fw
#mts_edge.fw
#mts_gsm.fw
#mts_mt9234mu.fw
#mts_mt9234zba.fw
#mwl8k/fmimage_8366.fw
#mwl8k/helper_8366.fw
#mwl8k/fmimage_8366_ap-2.fw
#mwl8k/fmimage_8366_ap-1.fw
#mwl8k/fmimage_8687.fw
#mwl8k/helper_8687.fw
#myri10ge_ethp_z8e.dat
#myri10ge_eth_z8e.dat
#myri10ge_rss_ethp_z8e.dat
#myri10ge_rss_eth_z8e.dat
#myricom/lanai.bin
#ositech/Xilinx7OD.bin
#phanfw.bin
#ql2100_fw.bin
#ql2200_fw.bin
#ql2300_fw.bin
#ql2322_fw.bin
#ql2400_fw.bin
#ql2500_fw.bin
#qlogic/12160.bin
#qlogic/isp1000.bin
#qlogic/sd7220.fw
#qlogic/1280.bin
#qlogic/1040.bin
#r128/r128_cce.bin
#radeon/R600_pfp.bin
#radeon/RV770_pfp.bin
#radeon/RS780_me.bin
#radeon/CEDAR_me.bin
#radeon/TURKS_me.bin
#radeon/R600_me.bin
#radeon/RS600_cp.bin
#radeon/SUMO_me.bin
#radeon/CAYMAN_pfp.bin
#radeon/CYPRESS_me.bin
#radeon/CAICOS_pfp.bin
#radeon/R520_cp.bin
#radeon/VERDE_ce.bin
#radeon/RV630_me.bin
#radeon/R700_rlc.bin
#radeon/RV610_pfp.bin
#radeon/JUNIPER_me.bin
#radeon/RV710_pfp.bin
#radeon/RS690_cp.bin
#radeon/CYPRESS_pfp.bin
#radeon/SUMO2_me.bin
#radeon/VERDE_mc.bin
#radeon/BARTS_mc.bin
#radeon/CAICOS_mc.bin
#radeon/ARUBA_pfp.bin
#radeon/RV635_pfp.bin
#radeon/R420_cp.bin
#radeon/R600_rlc.bin
#radeon/RV630_pfp.bin
#radeon/RV635_me.bin
#radeon/PITCAIRN_ce.bin
#radeon/RV730_pfp.bin
radeon/REDWOOD_me.bin
#radeon/PALM_me.bin
#radeon/BTC_rlc.bin
#radeon/BARTS_pfp.bin
#radeon/SUMO_rlc.bin
radeon/REDWOOD_rlc.bin
#radeon/JUNIPER_rlc.bin
#radeon/R100_cp.bin
#radeon/VERDE_pfp.bin
#radeon/RV610_me.bin
#radeon/TAHITI_mc.bin
#radeon/CAYMAN_mc.bin
#radeon/RS780_pfp.bin
#radeon/VERDE_rlc.bin
radeon/REDWOOD_pfp.bin
#radeon/TAHITI_pfp.bin
#radeon/RV670_me.bin
#radeon/RV770_me.bin
#radeon/RV730_me.bin
#radeon/PITCAIRN_mc.bin
#radeon/CEDAR_pfp.bin
#radeon/CAICOS_me.bin
#radeon/BARTS_me.bin
#radeon/CYPRESS_rlc.bin
#radeon/TAHITI_ce.bin
#radeon/CAYMAN_rlc.bin
#radeon/CAYMAN_me.bin
#radeon/ARUBA_rlc.bin
#radeon/PALM_pfp.bin
#radeon/ARUBA_me.bin
#radeon/RV710_me.bin
#radeon/RV620_pfp.bin
#radeon/VERDE_me.bin
#radeon/TAHITI_rlc.bin
#radeon/RV670_pfp.bin
#radeon/TURKS_mc.bin
#radeon/TURKS_pfp.bin
#radeon/TAHITI_me.bin
#radeon/PITCAIRN_me.bin
#radeon/RV620_me.bin
#radeon/PITCAIRN_pfp.bin
#radeon/JUNIPER_pfp.bin
#radeon/SUMO_pfp.bin
#radeon/R300_cp.bin
#radeon/PITCAIRN_rlc.bin
#radeon/R200_cp.bin
#radeon/CEDAR_rlc.bin
#radeon/SUMO2_pfp.bin
README
#rt2561.bin
#rt2561s.bin
#rt2661.bin
#rt2860.bin
#rt2870.bin
#rt3070.bin
#rt3071.bin
#rt3090.bin
#rt3290.bin
#rt73.bin
#RTL8192E/data.img
#RTL8192E/main.img
#RTL8192E/boot.img
#rtl_nic/rtl8105e-1.fw
#rtl_nic/rtl8168e-2.fw
#rtl_nic/rtl8168f-2.fw
#rtl_nic/rtl8168e-1.fw
#rtl_nic/rtl8411-1.fw
#rtl_nic/rtl8168d-2.fw
#rtl_nic/rtl8168g-1.fw
#rtl_nic/rtl8168f-1.fw
#rtl_nic/rtl8168e-3.fw
#rtl_nic/rtl8168d-1.fw
#rtl_nic/rtl8106e-1.fw
#rtl_nic/rtl8402-1.fw
#rtlwifi/rtl8192cufw.bin
#rtlwifi/rtl8192sefw.bin
#rtlwifi/rtl8192cfw.bin
#rtlwifi/rtl8192defw.bin
#rtlwifi/rtl8712u.bin
#rtlwifi/rtl8192cfwU_B.bin
#rtlwifi/rtl8192cfwU.bin
#s2250.fw
#s2250_loader.fw
#sb16/ima_adpcm_capture.csp
#sb16/alaw_main.csp
#sb16/ima_adpcm_init.csp
#sb16/ima_adpcm_playback.csp
#sb16/mulaw_main.csp
#slicoss/oasisdbgdownload.sys
#slicoss/gbrcvucode.sys
#slicoss/oasisdownload.sys
#slicoss/oasisrcvucode.sys
#slicoss/gbdownload.sys
#sun/cassini.bin
#sxg/saharadbgdownloadB.sys
#sxg/saharadownloadB.sys
#TDA7706_OM_v2.5.1_boot.txt
#TDA7706_OM_v3.0.2_boot.txt
#tehuti/bdx.bin
#ti_3410.fw
#ti_5052.fw
#ti-connectivity/wl128x-fw-ap.bin
#ti-connectivity/wl1271-fw-ap.bin
#ti-connectivity/wl128x-fw-4-mr.bin
#ti-connectivity/wl128x-fw-4-sr.bin
#ti-connectivity/wl127x-fw-5-sr.bin
#ti-connectivity/wl128x-nvs.bin
#ti-connectivity/wl127x-fw-3.bin
#ti-connectivity/wl1271-nvs.bin
#ti-connectivity/wl127x-fw-5-plt.bin
#ti-connectivity/wl1271-fw-2.bin
#ti-connectivity/wl1271-fw.bin
#ti-connectivity/wl128x-fw-5-sr.bin
#ti-connectivity/wl128x-fw.bin
#ti-connectivity/wl127x-fw-plt-3.bin
#ti-connectivity/wl127x-nvs.bin
#ti-connectivity/wl12xx-nvs.bin
#ti-connectivity/wl128x-fw-4-plt.bin
#ti-connectivity/wl128x-fw-5-plt.bin
#ti-connectivity/wl127x-fw-4-plt.bin
#ti-connectivity/wl127x-fw-5-mr.bin
#ti-connectivity/wl128x-fw-3.bin
#ti-connectivity/TIInit_7.2.31.bts
#ti-connectivity/wl128x-fw-5-mr.bin
#ti-connectivity/wl127x-fw-4-mr.bin
#ti-connectivity/wl128x-fw-plt-3.bin
#ti-connectivity/wl18xx-fw.bin
#ti-connectivity/wl127x-fw-4-sr.bin
#tigon/tg3_tso5.bin
#tigon/tg3.bin
#tigon/tg3_tso.bin
#tlg2300_firmware.bin
#tr_smctr.bin
#ttusb-budget/dspbootcode.bin
#ueagle-atm/eagleIII.fw
#ueagle-atm/CMVep.bin
#ueagle-atm/DSPei.bin
#ueagle-atm/CMVepFR04.bin
#ueagle-atm/eagleI.fw
#ueagle-atm/930-fpga.bin
#ueagle-atm/CMV4p.bin.v2
#ueagle-atm/CMV9p.bin
#ueagle-atm/CMVepES03.bin
#ueagle-atm/CMVepIT.bin
#ueagle-atm/eagleII.fw
#ueagle-atm/CMVepFR.bin
#ueagle-atm/eagleIV.fw
#ueagle-atm/CMVepWO.bin
#ueagle-atm/CMVepFR10.bin
#ueagle-atm/CMVepES.bin
#ueagle-atm/CMVeiWO.bin
#ueagle-atm/CMVei.bin
#ueagle-atm/adi930.fw
#ueagle-atm/CMV9i.bin
#ueagle-atm/DSPep.bin
#ueagle-atm/DSP4p.bin
#ueagle-atm/DSP9i.bin
#ueagle-atm/DSP9p.bin
#usbdux/fx2-include.asm
#usbdux/Makefile_dux
#usbdux/usbduxsigma_firmware.asm
#usbdux/README.dux
#usbdux/usbduxfast_firmware.asm
#usbdux/usbdux_firmware.asm
#usbduxfast_firmware.bin
#usbdux_firmware.bin
#usbduxsigma_firmware.bin
#v4l-cx231xx-avcore-01.fw
#v4l-cx23418-apu.fw
#v4l-cx23418-cpu.fw
#v4l-cx23418-dig.fw
#v4l-cx23885-avcore-01.fw
#v4l-cx23885-enc.fw
#v4l-cx25840.fw
#vicam/firmware.fw
#vntwusb.fw
#vxge/X3fw.ncf
#vxge/X3fw-pxe.ncf
WHENCE
#whiteheat.fw
#whiteheat_loader.fw
#yam/9600.bin
#yam/1200.bin
#yamaha/yss225_registers.bin
#yamaha/ds1_ctrl.fw
#yamaha/ds1_dsp.fw
#yamaha/ds1e_ctrl.fw

and the resulting files in /lib64/firmware/ after re-merging linux-firmware are now:

# ls /lib/firmware/
ACX100_USB.bin BCM2033-FW.bin BCM-LEGAL.txt GPL-3 iwlwifi-5000-2.ucode LICENCE.iwlwifi_firmware Makefile RADIO0d.BIN RADIO15.BIN STLC2500_R4_00_03.ptc STLC2500_R4_02_02_WLAN.ssf TIACX111.BIN WLANGEN.BIN
af9005.fw BCM2033-MD.hex configure iwlwifi-5000-1.ucode iwlwifi-5000-5.ucode LICENSE.radeon radeon RADIO11.BIN README STLC2500_R4_00_06.ssf STLC2500_R4_02_04.ptc WHENCE zd1211
# ls /lib/firmware/radeon
REDWOOD_me.bin REDWOOD_pfp.bin REDWOOD_rlc.bin

Compare that with the contents of /lib/firmware/ I listed earlier. Much tidier, isn’t it? I’ve saved quite a bit of wasted disk space.

I hope this post is helpful to others, as I searched unsucessfully for instructions on how to install the linux-firmware package so that only the necessary firmware files are installed. Don’t worry though: you could simply go ahead and install linux-firmware without editing the file in /etc/portage/savedconfig/sys-kernel/ if you don’t mind having unecessary files in /lib/firmware/ in addition to the firmware files you need.