[3ae81e1] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
| 8 | <sect1 id="postlfs-firmware" xreflabel="About Firmware">
|
---|
| 9 | <?dbhtml filename="firmware.html"?>
|
---|
| 10 |
|
---|
| 11 | <sect1info>
|
---|
[d027410] | 12 | <date>$Date$</date>
|
---|
[3ae81e1] | 13 | </sect1info>
|
---|
| 14 |
|
---|
| 15 | <title>About Firmware</title>
|
---|
| 16 |
|
---|
| 17 | <indexterm zone="postlfs-firmware">
|
---|
| 18 | <primary sortas="e-lib-firmware">/lib/firmware</primary>
|
---|
| 19 | </indexterm>
|
---|
| 20 |
|
---|
[81a73ed8] | 21 | <para>
|
---|
| 22 | On some recent PCs it can be necessary, or desirable, to load firmware
|
---|
| 23 | to make them work at their best. There is a directory, <filename
|
---|
| 24 | class="directory">/lib/firmware</filename>, where the kernel or kernel
|
---|
| 25 | drivers look for firmware images.
|
---|
| 26 | </para>
|
---|
| 27 |
|
---|
| 28 | <para>
|
---|
| 29 | Currently, most firmware can be found at a <userinput>git</userinput>
|
---|
| 30 | repository: <ulink url=
|
---|
| 31 | "http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/"/>.
|
---|
| 32 | For convenience, the LFS Project has created a mirror, updated daily, where
|
---|
| 33 | these firmware files can be accessed via <userinput>wget</userinput> or a
|
---|
| 34 | web browser at <ulink url="&sources-anduin-http;/linux-firmware/"/>.
|
---|
| 35 | </para>
|
---|
| 36 |
|
---|
| 37 | <para>
|
---|
| 38 | To get the firmware, either point a browser to one of the above
|
---|
| 39 | repositories and then download the item(s) which you need, or install
|
---|
| 40 | <xref linkend="git"/> and clone that repository.
|
---|
| 41 | </para>
|
---|
| 42 |
|
---|
| 43 | <para>
|
---|
| 44 | For some other firmware, particularly for Intel microcode and certain
|
---|
| 45 | wifi devices, the needed firmware is not available in the above repository.
|
---|
| 46 | Some of this will be addressed below, but a search of the Internet for
|
---|
| 47 | needed firmware is sometimes necessary.
|
---|
| 48 | </para>
|
---|
| 49 |
|
---|
| 50 | <para>
|
---|
| 51 | Firmware files are conventionally referred to as blobs because you cannot
|
---|
| 52 | determine what they will do. Note that firmware is distributed under
|
---|
| 53 | various different licenses which do not permit disassembly or
|
---|
| 54 | reverse-engineering.
|
---|
| 55 | </para>
|
---|
| 56 |
|
---|
| 57 | <para>
|
---|
| 58 | Firmware for PCs falls into four categories:
|
---|
| 59 | </para>
|
---|
[3ae81e1] | 60 |
|
---|
| 61 | <itemizedlist spacing="compact">
|
---|
| 62 | <listitem>
|
---|
[81a73ed8] | 63 | <para>
|
---|
| 64 | Updates to the CPU to work around errata, usually referred to as
|
---|
| 65 | microcode.
|
---|
| 66 | </para>
|
---|
[3ae81e1] | 67 | </listitem>
|
---|
| 68 | <listitem>
|
---|
[81a73ed8] | 69 | <para>
|
---|
[3179c69] | 70 | Firmware for video controllers. On x86 machines this is required for
|
---|
| 71 | ATI devices (Radeon and AMDGPU chips) and may be useful for Intel (Skylake
|
---|
| 72 | and later) and Nvidia (Kepler and later) GPUs.
|
---|
| 73 | </para>
|
---|
| 74 |
|
---|
| 75 | <para>
|
---|
| 76 | ATI Radeon and AMGPU devices all require firmware to be able to use KMS
|
---|
[81a73ed8] | 77 | (kernel modesetting - the preferred option) as well as for Xorg. For
|
---|
[3179c69] | 78 | old radeon chips (before the R600), the firmware is still in the
|
---|
| 79 | kernel source.
|
---|
| 80 | </para>
|
---|
| 81 |
|
---|
| 82 | <para>
|
---|
| 83 | Intel integrated GPUs from Skylake onwards can use firmware for GuC
|
---|
| 84 | (the Graphics microcontroller), and also for the HuC (HEVC/H265
|
---|
| 85 | microcontroller which offloads to the GPU) and the DMC (Display
|
---|
| 86 | Microcontroller) to provide additional low-power states. The GuC and
|
---|
| 87 | HuC have had a chequered history in the kernel and updated firmware
|
---|
| 88 | may be disabled by default, depending on your kernel version. Further
|
---|
| 89 | details may be found at <ulink
|
---|
| 90 | url="https://01.org/linuxgraphics/downloads/firmware/">01.org</ulink>
|
---|
| 91 | and <ulink
|
---|
[14cec0f] | 92 | url="https://wiki.archlinux.org/index.php/intel_graphics">Arch
|
---|
[3179c69] | 93 | linux</ulink>.
|
---|
| 94 | </para>
|
---|
| 95 |
|
---|
| 96 | <para>
|
---|
| 97 | Nvidia GPUs from Kepler onwards require signed firmware, otherwise the
|
---|
| 98 | nouveau driver is unable to provide hardware acceleration. Nvidia has
|
---|
| 99 | now released firmware up to Turing (most, maybe all, GTX16xx and RTX20xx
|
---|
| 100 | GPUs) to linux-firmware, and kernels from linux-5.6 should support it,
|
---|
| 101 | although Mesa support may require a development version until Mesa-20.2
|
---|
| 102 | is released. Note that faster clocks than the default are not enabled
|
---|
| 103 | by the released firmware.
|
---|
[81a73ed8] | 104 | </para>
|
---|
[3ae81e1] | 105 | </listitem>
|
---|
| 106 | <listitem>
|
---|
[81a73ed8] | 107 | <para>
|
---|
| 108 | Firmware updates for wired network ports. Mostly they work even
|
---|
| 109 | without the updates, but probably they will work better with
|
---|
| 110 | the updated firmware. For some modern laptops, firmware for both
|
---|
| 111 | wired ethernet (e.g. rtl_nic) and also for bluetooth devices (e.g. qca)
|
---|
| 112 | is <emphasis>required</emphasis> before the wired network can be used.
|
---|
[89bdbf8] | 113 | </para>
|
---|
[3ae81e1] | 114 | </listitem>
|
---|
| 115 | <listitem>
|
---|
[81a73ed8] | 116 | <para>
|
---|
| 117 | Firmware for other devices, such as wifi. These devices are not
|
---|
| 118 | required for the PC to boot, but need the firmware before these devices
|
---|
| 119 | can be used.
|
---|
| 120 | </para>
|
---|
[3ae81e1] | 121 | </listitem>
|
---|
| 122 | </itemizedlist>
|
---|
| 123 |
|
---|
[81a73ed8] | 124 | <note>
|
---|
| 125 | <para>
|
---|
| 126 | Although not needed to load a firmware blob, the following
|
---|
| 127 | tools may be useful for determining, obtaining, or preparing the needed
|
---|
| 128 | firmware in order to load it into the system:
|
---|
| 129 | <xref linkend="cpio"/>,
|
---|
| 130 | <xref linkend="git"/>,
|
---|
| 131 | <xref linkend="pciutils"/>, and
|
---|
| 132 | <xref linkend="wget"/>
|
---|
| 133 | </para>
|
---|
| 134 | </note>
|
---|
[3ae81e1] | 135 |
|
---|
| 136 | <para condition="html" role="usernotes">User Notes:
|
---|
| 137 | <ulink url="&blfs-wiki;/aboutfirmware"/></para>
|
---|
| 138 |
|
---|
| 139 | <sect2 id="cpu-microcode">
|
---|
| 140 | <title>Microcode updates for CPUs</title>
|
---|
| 141 |
|
---|
[81a73ed8] | 142 | <para>
|
---|
| 143 | In general, microcode can be loaded by the BIOS or UEFI, and it might be
|
---|
| 144 | updated by upgrading to a newer version of those. On linux, you can also
|
---|
| 145 | load the microcode from the kernel if you are using an AMD family 10h or
|
---|
| 146 | later processor (first introduced late 2007), or an Intel processor from
|
---|
| 147 | 1998 and later (Pentium4, Core, etc), if updated microcode has been
|
---|
| 148 | released. These updates only last until the machine is powered off, so
|
---|
| 149 | they need to be applied on every boot.
|
---|
| 150 | </para>
|
---|
| 151 |
|
---|
| 152 | <para>
|
---|
[bd78d011] | 153 | Intel provide updates of their microcode for Skylake and later
|
---|
[83d1722c] | 154 | processors as new vulnerabilities come to light, and have in the past
|
---|
| 155 | provided updates for processors from SandyBridge onwards, although those
|
---|
| 156 | are no-longer supported for new fixes. New versions of AMD
|
---|
[81a73ed8] | 157 | firmware are rare and usually only apply to a few models, although
|
---|
| 158 | motherboard manufacturers get extra updates which maybe update microcode
|
---|
| 159 | along with the changes to support newer CPUs and faster memory.
|
---|
| 160 | </para>
|
---|
| 161 |
|
---|
| 162 | <para>
|
---|
| 163 | There are two ways of loading the microcode, described as 'early' and
|
---|
| 164 | 'late'. Early loading happens before userspace has been started, late
|
---|
| 165 | loading happens after userspace has started. Not surprisingly, early
|
---|
| 166 | loading is preferred, (see e.g. an explanatory comment in a kernel
|
---|
| 167 | commit noted at <ulink url="https://lwn.net/Articles/530346/">
|
---|
| 168 | x86/microcode: Early load microcode</ulink> on LWN.) Indeed, it
|
---|
| 169 | is needed to work around one particular erratum in early Intel Haswell
|
---|
| 170 | processors which had TSX enabled. (See <ulink url=
|
---|
| 171 | "http://www.anandtech.com/show/8376/intel-disables-tsx-instructions-erratum-found-in-haswell-haswelleep-broadwellyi/">
|
---|
| 172 | Intel Disables TSX Instructions: Erratum Found in Haswell,
|
---|
| 173 | Haswell-E/EP, Broadwell-Y
|
---|
| 174 | </ulink>.) Without this update glibc can do the wrong thing in uncommon
|
---|
| 175 | situations.
|
---|
| 176 | </para>
|
---|
| 177 |
|
---|
| 178 | <para>
|
---|
| 179 | It is still possible to manually force late loading of microcode, either
|
---|
| 180 | for testing or to prevent having to reboot. You will need to reconfigure
|
---|
| 181 | your kernel for either method. The instructions here will create a
|
---|
| 182 | kernel <filename>.config</filename> to suite early loading, before
|
---|
| 183 | forcing late loading to see if there is any microcode. If there is,
|
---|
| 184 | the instructions then show you how to create an initrd for early loading.
|
---|
| 185 | </para>
|
---|
| 186 |
|
---|
| 187 | <para>
|
---|
| 188 | To confirm what processor(s) you have (if more than one, they will be
|
---|
| 189 | identical) look in /proc/cpuinfo.
|
---|
| 190 | </para>
|
---|
[3ae81e1] | 191 |
|
---|
[83d1722c] | 192 | <para>
|
---|
| 193 | If you are creating an initrd to update firmware for different machines,
|
---|
| 194 | as a distro would do, go down to 'Early loading of microcode' and cat all
|
---|
| 195 | the Intel blobs to GenuineIntel.bin or cat all the AMD blobs to
|
---|
| 196 | AuthenticAMD.bin. This creates a larger initrd - for all Intel machines in
|
---|
| 197 | the 20200609 update the size is 3.0 MB compared to typically 24 KB for one
|
---|
| 198 | machine.
|
---|
| 199 | </para>
|
---|
| 200 |
|
---|
[3ae81e1] | 201 | <sect3 id="intel-microcode">
|
---|
| 202 | <title>Intel Microcode for the CPU</title>
|
---|
[ba78ebe2] | 203 |
|
---|
[81a73ed8] | 204 | <para>
|
---|
| 205 | The first step is to get the most recent version of the Intel
|
---|
| 206 | microcode. This must be done by navigating to <ulink url=
|
---|
[3179c69] | 207 | 'https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/releases/'/>
|
---|
[81a73ed8] | 208 | and downloading the latest file there. As of this writing the most
|
---|
[3179c69] | 209 | secure version of the microcode, for those machines which can boot it,
|
---|
[4a80a67] | 210 | is microcode-20210216.<!-- If you have a Skylake machine, please read the
|
---|
[bd78d011] | 211 | Caution in the 'Early loading of microcode' section below.--> Extract this
|
---|
[81a73ed8] | 212 | file in the normal way, the microcode is in the <filename>intel-ucode
|
---|
| 213 | </filename> directory, containing various blobs with names in the form
|
---|
| 214 | XX-YY-ZZ. There are also various other files, and a releasenote.
|
---|
| 215 | </para>
|
---|
| 216 |
|
---|
| 217 | <para>
|
---|
| 218 | In the past, intel did not provide any details of which blobs had
|
---|
| 219 | changed versions, but now the release note details this.
|
---|
| 220 | </para>
|
---|
| 221 |
|
---|
| 222 | <para>
|
---|
| 223 | The recent firmware for older processors is provided to deal with
|
---|
| 224 | vulnerabilities which have now been made public, and for some of these
|
---|
| 225 | such as Microarchitectural Data Sampling (MDS) you might wish to
|
---|
| 226 | increase the protection by disabling hyperthreading, or alternatively
|
---|
| 227 | to disable the kernel's default mitigation because of its impact on
|
---|
| 228 | compile times. Please read the online documentation at <ulink url=
|
---|
| 229 | 'https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/index.html'/>.
|
---|
| 230 | </para>
|
---|
| 231 |
|
---|
[bd78d011] | 232 | <!-- commented, I don't think there is a new listed item for 2011-11 vulns
|
---|
| 233 | (platypus etc : intel-sa-00381 and 0389)
|
---|
| 234 | and anyway the very latest stable releases have backports : ken
|
---|
[81a73ed8] | 235 | <para>
|
---|
[83d1722c] | 236 | The documentation on the latest SRBDS (Special Register Buffer Data
|
---|
| 237 | Sampling) vulnerabilities/fixes will be documented in kernels 5.4.46,
|
---|
| 238 | 5.6.18, 5.7.2, 5.8.0 and later.
|
---|
[bd78d011] | 239 | </para>-->
|
---|
[81a73ed8] | 240 |
|
---|
| 241 | <para>
|
---|
| 242 | Now you need to determine your processor's identity to see if there
|
---|
| 243 | is any microcode for it. Determine the decimal values of the cpu family,
|
---|
| 244 | model and stepping by running the following command (it will also report
|
---|
| 245 | the current microcode version):
|
---|
| 246 | </para>
|
---|
[3ae81e1] | 247 |
|
---|
| 248 | <screen><userinput>head -n7 /proc/cpuinfo</userinput></screen>
|
---|
| 249 |
|
---|
[81a73ed8] | 250 | <para>
|
---|
| 251 | Convert the cpu family, model and stepping to pairs of hexadecimal
|
---|
| 252 | digits. For a Skylake i3 6100 (described as Intel(R) Core(TM) i3-6100
|
---|
| 253 | CPU) the relevant values are cpu family 6, model 94, stepping 3 so in
|
---|
| 254 | this case the required identification is 06-5e-03. A look at the blobs
|
---|
| 255 | will show that there is one for this CPU (although for older issues it
|
---|
| 256 | might have already been applied by the BIOS). If there is a blob for
|
---|
| 257 | your system then test if it will be applied by copying it (replace
|
---|
| 258 | <XX-YY-ZZ> by the identifier for your CPU) to where the
|
---|
| 259 | kernel can find it:
|
---|
| 260 | </para>
|
---|
[3ae81e1] | 261 |
|
---|
| 262 | <screen><userinput>mkdir -pv /lib/firmware/intel-ucode
|
---|
[ba78ebe2] | 263 | cp -v intel-ucode/<XX-YY-ZZ> /lib/firmware/intel-ucode</userinput></screen>
|
---|
[3ae81e1] | 264 |
|
---|
[81a73ed8] | 265 | <para>
|
---|
| 266 | Now that the Intel microcode has been prepared, use the following
|
---|
| 267 | options when you configure the kernel to load Intel microcode:
|
---|
| 268 | </para>
|
---|
[3ae81e1] | 269 |
|
---|
[0576c595] | 270 | <screen><literal>General Setup --->
|
---|
[f39cf0d0] | 271 | [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support [CONFIG_BLK_DEV_INITRD]
|
---|
[0576c595] | 272 | Processor type and features --->
|
---|
[f39cf0d0] | 273 | [*] CPU microcode loading support [CONFIG_MICROCODE]
|
---|
| 274 | [*] Intel microcode loading support [CONFIG_MICROCODE_INTEL]</literal></screen>
|
---|
[0576c595] | 275 |
|
---|
[81a73ed8] | 276 | <para>
|
---|
| 277 | After you have successfully booted the new system, force late loading
|
---|
| 278 | by using the command:
|
---|
| 279 | </para>
|
---|
[0576c595] | 280 |
|
---|
| 281 | <screen><userinput>echo 1 > /sys/devices/system/cpu/microcode/reload</userinput></screen>
|
---|
| 282 |
|
---|
[81a73ed8] | 283 | <para>
|
---|
| 284 | Then use the following command to see if anything was loaded:
|
---|
[83d1722c] | 285 | (N.B. the dates when microcode was created may be months ahead of when
|
---|
| 286 | it was released.)
|
---|
[81a73ed8] | 287 | </para>
|
---|
[0576c595] | 288 |
|
---|
| 289 | <screen><userinput>dmesg | grep -e 'microcode' -e 'Linux version' -e 'Command line'</userinput></screen>
|
---|
| 290 |
|
---|
[81a73ed8] | 291 | <para>
|
---|
[bd78d011] | 292 | This reformatted example for a machine with old microcode in its BIOS
|
---|
[83d1722c] | 293 | was created by temporarily booting without
|
---|
[bd78d011] | 294 | microcode, to show the current Firmware Bug messages, then the late load
|
---|
| 295 | shows it being updated to revision 0xec.
|
---|
[81a73ed8] | 296 | </para>
|
---|
[c6ebc90b] | 297 |
|
---|
[bd78d011] | 298 | <screen><literal>[ 0.000000] Linux version 5.9.8 (ken@leshp) (gcc (GCC) 10.2.0,
|
---|
| 299 | GNU ld (GNU Binutils) 2.35)
|
---|
| 300 | #1 SMP PREEMPT Mon Nov 16 20:42:42 GMT 2020
|
---|
| 301 | [ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-5.9.8-sda11 root=/dev/sda11 ro
|
---|
| 302 | [ 0.028715] [Firmware Bug]: TSC_DEADLINE disabled due to Errata;
|
---|
| 303 | please update microcode to version: 0xb2 (or later)
|
---|
| 304 | [ 0.111874] SRBDS: Vulnerable: No microcode
|
---|
| 305 | [ 0.111984] MDS: Vulnerable: Clear CPU buffers attempted, no microcode</literal></screen>
|
---|
[3ae81e1] | 306 |
|
---|
[81a73ed8] | 307 | <para>
|
---|
| 308 | If the microcode was not updated, there is no new microcode for this
|
---|
| 309 | system's processor. If it did get updated, you can now proceed to
|
---|
| 310 | <xref linkend='early-microcode'/>.
|
---|
| 311 | </para>
|
---|
[3ae81e1] | 312 |
|
---|
| 313 | </sect3>
|
---|
| 314 |
|
---|
[bd78d011] | 315 | <sect3 id="amd-microcode">
|
---|
[3ae81e1] | 316 | <title>AMD Microcode for the CPU</title>
|
---|
| 317 |
|
---|
[81a73ed8] | 318 | <para>
|
---|
| 319 | Begin by downloading a container of firmware for your CPU family
|
---|
| 320 | from <ulink url=
|
---|
| 321 | '&sources-anduin-http;/linux-firmware/amd-ucode/'/>.
|
---|
| 322 | The family is always specified in hex. Families 10h to 14h (16 to 20)
|
---|
| 323 | are in microcode_amd.bin. Families 15h, 16h and 17h have their own
|
---|
| 324 | containers. Create the required directory and put the firmware you
|
---|
| 325 | downloaded into it as the <systemitem
|
---|
| 326 | class="username">root</systemitem> user:
|
---|
| 327 | </para>
|
---|
[3ae81e1] | 328 |
|
---|
| 329 | <screen><userinput>mkdir -pv /lib/firmware/amd-ucode
|
---|
| 330 | cp -v microcode_amd* /lib/firmware/amd-ucode</userinput></screen>
|
---|
| 331 |
|
---|
[81a73ed8] | 332 | <para>
|
---|
| 333 | When you configure the kernel, use the following options
|
---|
| 334 | to load AMD microcode:
|
---|
| 335 | </para>
|
---|
[0576c595] | 336 |
|
---|
| 337 | <screen><literal>General Setup --->
|
---|
[f39cf0d0] | 338 | [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support [CONFIG_BLK_DEV_INITRD]
|
---|
[0576c595] | 339 | Processor type and features --->
|
---|
[f39cf0d0] | 340 | [*] CPU microcode loading support [CONFIG_MICROCODE]
|
---|
| 341 | [*] AMD microcode loading support [CONFIG_MICROCODE_AMD]</literal></screen>
|
---|
[0576c595] | 342 |
|
---|
[81a73ed8] | 343 | <para>
|
---|
| 344 | After you have successfully booted the new system, force late loading
|
---|
| 345 | by using the command:
|
---|
| 346 | </para>
|
---|
[0576c595] | 347 |
|
---|
| 348 | <screen><userinput>echo 1 > /sys/devices/system/cpu/microcode/reload</userinput></screen>
|
---|
[3ae81e1] | 349 |
|
---|
[81a73ed8] | 350 | <para>
|
---|
| 351 | Then use the following command to see if anything was loaded:
|
---|
| 352 | </para>
|
---|
[3ae81e1] | 353 |
|
---|
[0576c595] | 354 | <screen><userinput>dmesg | grep -e 'microcode' -e 'Linux version' -e 'Command line'</userinput></screen>
|
---|
[81a73ed8] | 355 | <para>
|
---|
| 356 | This historic example from an old Athlon(tm) II X2 shows it has been
|
---|
| 357 | updated. At that time, all CPUs were still reported in the microcode
|
---|
| 358 | details on AMD machines (the current position for AMD machines where
|
---|
| 359 | newer microcode is available is unknown) :
|
---|
| 360 | </para>
|
---|
[3ae81e1] | 361 |
|
---|
[c6d338e] | 362 | <screen><literal>[ 0.000000] Linux version 4.15.3 (ken@testserver) (gcc version 7.3.0 (GCC))
|
---|
| 363 | #1 SMP Sun Feb 18 02:08:12 GMT 2018
|
---|
| 364 | [ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.15.3-sda5 root=/dev/sda5 ro
|
---|
| 365 | [ 0.307619] microcode: CPU0: patch_level=0x010000b6
|
---|
| 366 | [ 0.307671] microcode: CPU1: patch_level=0x010000b6
|
---|
| 367 | [ 0.307743] microcode: Microcode Update Driver: v2.2.
|
---|
| 368 | [ 187.928891] microcode: CPU0: new patch_level=0x010000c8
|
---|
| 369 | [ 187.928899] microcode: CPU1: new patch_level=0x010000c8</literal></screen>
|
---|
[3ae81e1] | 370 |
|
---|
[81a73ed8] | 371 | <para>
|
---|
| 372 | If the microcode was not updated, there is no new microcode for
|
---|
| 373 | this system's processor. If it did get updated, you can now proceed to
|
---|
| 374 | <xref linkend='early-microcode'/>.
|
---|
| 375 | </para>
|
---|
[3ae81e1] | 376 |
|
---|
| 377 | </sect3>
|
---|
| 378 |
|
---|
| 379 | <sect3 id="early-microcode">
|
---|
| 380 | <title>Early loading of microcode</title>
|
---|
| 381 |
|
---|
[81a73ed8] | 382 | <para>
|
---|
| 383 | If you have established that updated microcode is available for
|
---|
| 384 | your system, it is time to prepare it for early loading. This requires
|
---|
| 385 | an additional package, <xref linkend='cpio'/> and the creation of an
|
---|
| 386 | initrd which will need to be added to grub.cfg.
|
---|
| 387 | </para>
|
---|
[3ae81e1] | 388 |
|
---|
[81a73ed8] | 389 | <para>
|
---|
| 390 | It does not matter where you prepare the initrd, and once it is
|
---|
| 391 | working you can apply the same initrd to later LFS systems or newer
|
---|
| 392 | kernels on this same machine, at least until any newer microcode is
|
---|
| 393 | released. Use the following commands:
|
---|
| 394 | </para>
|
---|
[3ae81e1] | 395 |
|
---|
| 396 | <screen><userinput>mkdir -p initrd/kernel/x86/microcode
|
---|
| 397 | cd initrd</userinput></screen>
|
---|
| 398 |
|
---|
[81a73ed8] | 399 | <para>
|
---|
| 400 | For an AMD machine, use the following command (replace
|
---|
| 401 | <MYCONTAINER> with the name of the container for your CPU's
|
---|
| 402 | family):
|
---|
| 403 | </para>
|
---|
[3ae81e1] | 404 |
|
---|
[af8a78d] | 405 | <screen><userinput>cp -v /lib/firmware/amd-ucode/<MYCONTAINER> kernel/x86/microcode/AuthenticAMD.bin</userinput></screen>
|
---|
[3ae81e1] | 406 |
|
---|
[81a73ed8] | 407 | <para>
|
---|
| 408 | Or for an Intel machine copy the appropriate blob using this command:
|
---|
| 409 | </para>
|
---|
[3ae81e1] | 410 |
|
---|
| 411 | <screen><userinput>cp -v /lib/firmware/intel-ucode/<XX-YY-ZZ> kernel/x86/microcode/GenuineIntel.bin</userinput></screen>
|
---|
| 412 |
|
---|
[bd78d011] | 413 | <!-- new version from 20201110 release onwards, assumed to work on all skylakes
|
---|
| 414 | But complaints about previous version took some days to appear, so keep as a comment for now.
|
---|
[fe2553a] | 415 | <caution>
|
---|
| 416 | <para>
|
---|
[3179c69] | 417 | On some Skylake machines with hex Model Number '4e' (78 decimal) the
|
---|
| 418 | upgrade to microcode version '0xdc' is reported to cause the machine to
|
---|
| 419 | hang in early boot, and the fix is to revert to version 0xd6 which was
|
---|
| 420 | first shipped in the 20191115 microcode release.
|
---|
[fe2553a] | 421 | </para>
|
---|
| 422 |
|
---|
| 423 | <para>
|
---|
[3179c69] | 424 | At least one model '5e' Skylake does boot successfully with version
|
---|
| 425 | 0xdc, but Intel has now shipped a 20200616 release which is intended for
|
---|
| 426 | distros which need an initrd that will boot on everyone's machine: it
|
---|
| 427 | reverts both Skylake variants ('4e' and '5e') to the old 0xd6.
|
---|
[fe2553a] | 428 | </para>
|
---|
| 429 |
|
---|
| 430 | <para>
|
---|
[3179c69] | 431 | For a Skylake which does not boot with 0xdc, reverting to 0xd6 will make
|
---|
| 432 | the machine usable, but without the SRBDS mitigations.
|
---|
[fe2553a] | 433 | </para>
|
---|
[bd78d011] | 434 | </caution>-->
|
---|
[fe2553a] | 435 |
|
---|
[81a73ed8] | 436 | <para>
|
---|
| 437 | Now prepare the initrd:
|
---|
| 438 | </para>
|
---|
[3ae81e1] | 439 |
|
---|
| 440 | <screen><userinput>find . | cpio -o -H newc > /boot/microcode.img</userinput></screen>
|
---|
| 441 |
|
---|
[81a73ed8] | 442 | <para>
|
---|
| 443 | You now need to add a new entry to /boot/grub/grub.cfg and
|
---|
| 444 | here you should add a new line after the linux line within the stanza.
|
---|
| 445 | If /boot is a separate mountpoint:
|
---|
| 446 | </para>
|
---|
[3ae81e1] | 447 |
|
---|
| 448 | <screen><userinput>initrd /microcode.img</userinput></screen>
|
---|
| 449 |
|
---|
[81a73ed8] | 450 | <para>
|
---|
| 451 | or this if it is not:
|
---|
| 452 | </para>
|
---|
[3ae81e1] | 453 |
|
---|
| 454 | <screen><userinput>initrd /boot/microcode.img</userinput></screen>
|
---|
| 455 |
|
---|
[81a73ed8] | 456 | <para>
|
---|
| 457 | If you are already booting with an initrd (see <xref
|
---|
| 458 | linkend="initramfs"/>), you should run <command>mkinitramfs</command>
|
---|
| 459 | again after putting the appropriate blob or container into <filename
|
---|
| 460 | class="directory">/lib/firmware</filename> as explained above.
|
---|
| 461 | Alternatively, you can have both initrd on the same line, such as
|
---|
| 462 | <userinput>initrd /microcode.img /other-initrd.img</userinput> (adapt
|
---|
| 463 | that as above if /boot is not a separate mountpoint).
|
---|
| 464 | </para>
|
---|
[a7c5f47] | 465 |
|
---|
[81a73ed8] | 466 | <para>
|
---|
| 467 | You can now reboot with the added initrd, and then use the same
|
---|
| 468 | command to check that the early load worked:
|
---|
| 469 | </para>
|
---|
[3ae81e1] | 470 |
|
---|
[0576c595] | 471 | <screen><userinput>dmesg | grep -e 'microcode' -e 'Linux version' -e 'Command line'</userinput></screen>
|
---|
| 472 |
|
---|
[81a73ed8] | 473 | <para>
|
---|
| 474 | If you updated to address vulnerabilities, you can look at <filename
|
---|
| 475 | class="directory">/sys/devices/system/cpu/vulnerabilities/</filename>
|
---|
| 476 | to see what is now reported.
|
---|
| 477 | </para>
|
---|
[3c19265] | 478 |
|
---|
[81a73ed8] | 479 | <para>
|
---|
| 480 | The places and times where early loading happens are very different
|
---|
[bd78d011] | 481 | in AMD and Intel machines. First, an Intel (Skylake) example with early loading:
|
---|
[81a73ed8] | 482 | </para>
|
---|
[b174fb1] | 483 |
|
---|
[bd78d011] | 484 | <screen><literal>[ 0.000000] microcode: microcode updated early to revision 0xe2, date = 2020-07-14
|
---|
| 485 | [ 0.000000] Linux version 5.9.8 (ken@leshp) (gcc (GCC) 10.2.0,
|
---|
| 486 | GNU ld (GNU Binutils) 2.35)
|
---|
| 487 | #1 SMP PREEMPT Mon Nov 16 20:42:42 GMT 2020
|
---|
| 488 | [ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-5.9.8-sda11 root=/dev/sda11 ro
|
---|
| 489 | [ 0.378287] microcode: sig=0x506e3, pf=0x2, revision=0xe2
|
---|
| 490 | [ 0.378315] microcode: Microcode Update Driver: v2.2.
|
---|
| 491 | </literal></screen>
|
---|
[83d1722c] | 492 |
|
---|
[0576c595] | 493 |
|
---|
[81a73ed8] | 494 | <para>
|
---|
| 495 | A historic AMD example:
|
---|
| 496 | </para>
|
---|
[0576c595] | 497 |
|
---|
[c6d338e] | 498 | <screen><literal>[ 0.000000] Linux version 4.15.3 (ken@testserver) (gcc version 7.3.0 (GCC))
|
---|
| 499 | #2 SMP Sun Feb 18 02:32:03 GMT 2018
|
---|
| 500 | [ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.15.3-sda5 root=/dev/sda5 ro
|
---|
| 501 | [ 0.307619] microcode: microcode updated early to new patch_level=0x010000c8
|
---|
| 502 | [ 0.307678] microcode: CPU0: patch_level=0x010000c8
|
---|
| 503 | [ 0.307723] microcode: CPU1: patch_level=0x010000c8
|
---|
| 504 | [ 0.307795] microcode: Microcode Update Driver: v2.2.</literal></screen>
|
---|
[3ae81e1] | 505 |
|
---|
| 506 | </sect3>
|
---|
| 507 |
|
---|
| 508 | </sect2>
|
---|
| 509 |
|
---|
[1cc5345] | 510 | <sect2 id="video-firmware">
|
---|
| 511 | <title>Firmware for Video Cards</title>
|
---|
| 512 |
|
---|
[81a73ed8] | 513 | <sect3 id="ati-video-firmware">
|
---|
| 514 | <title>Firmware for ATI video chips (R600 and later)</title>
|
---|
| 515 |
|
---|
| 516 | <para>
|
---|
| 517 | These instructions do NOT apply to old radeons before the R600
|
---|
| 518 | family. For those, the firmware is in the kernel's <filename
|
---|
| 519 | class='directory'>/lib/firmware/</filename> directory. Nor do they
|
---|
| 520 | apply if you intend to avoid a graphical setup such as Xorg and are
|
---|
| 521 | content to use the default 80x25 display rather than a framebuffer.
|
---|
| 522 | </para>
|
---|
| 523 |
|
---|
| 524 | <para>
|
---|
| 525 | Early radeon devices only needed a single 2K blob of firmware. Recent
|
---|
| 526 | devices need several different blobs, and some of them are much bigger.
|
---|
| 527 | The total size of the radeon firmware directory is over 500K —
|
---|
| 528 | on a large modern system you can probably spare the space, but it is
|
---|
| 529 | still redundant to install all the unused files each time you build
|
---|
| 530 | a system.
|
---|
| 531 | </para>
|
---|
| 532 |
|
---|
| 533 | <para>
|
---|
| 534 | A better approach is to install <xref linkend='pciutils'/> and then
|
---|
| 535 | use <userinput>lspci</userinput> to identify which VGA controller is
|
---|
| 536 | installed.
|
---|
| 537 | </para>
|
---|
| 538 |
|
---|
| 539 | <para>
|
---|
| 540 | With that information, check the RadeonFeature page of the Xorg wiki
|
---|
| 541 | for <ulink url="http://wiki.x.org/wiki/RadeonFeature/#index5h2">Decoder
|
---|
| 542 | ring for engineering vs marketing names</ulink> to identify the family
|
---|
| 543 | (you may need to know this for the Xorg driver in BLFS —
|
---|
| 544 | Southern Islands and Sea Islands use the radeonsi driver) and the
|
---|
| 545 | specific model.
|
---|
| 546 | </para>
|
---|
| 547 |
|
---|
| 548 | <para>
|
---|
| 549 | Now that you know which controller you are using, consult the
|
---|
| 550 | <ulink url="https://wiki.gentoo.org/wiki/Radeon#Firmware">
|
---|
| 551 | Radeon</ulink> page of the Gentoo wiki which has a table listing
|
---|
| 552 | the required firmware blobs for the various chipsets. Note that
|
---|
| 553 | Southern Islands and Sea Islands chips use different firmware for
|
---|
| 554 | kernel 3.17 and later compared to earlier kernels. Identify and
|
---|
| 555 | download the required blobs then install them:
|
---|
| 556 | </para>
|
---|
[3ae81e1] | 557 |
|
---|
| 558 | <screen><userinput>mkdir -pv /lib/firmware/radeon
|
---|
| 559 | cp -v <YOUR_BLOBS> /lib/firmware/radeon</userinput></screen>
|
---|
| 560 |
|
---|
[81a73ed8] | 561 | <para>
|
---|
| 562 | There are actually two ways of installing this firmware. BLFS, in the
|
---|
| 563 | 'Kernel Configuration for additional firmware' section part of the
|
---|
| 564 | <xref linkend="xorg-ati-driver"/> section gives an example of
|
---|
| 565 | compiling the firmware into the kernel - that is slightly faster to
|
---|
| 566 | load, but uses more kernel memory. Here we will use the alternative
|
---|
| 567 | method of making the radeon driver a module. In your kernel config
|
---|
| 568 | set the following:
|
---|
| 569 | </para>
|
---|
[3ae81e1] | 570 |
|
---|
| 571 | <screen><literal>Device Drivers --->
|
---|
| 572 | Graphics support --->
|
---|
| 573 | Direct Rendering Manager --->
|
---|
[f39cf0d0] | 574 | [*] Direct Rendering Manager (XFree86 ... support) [CONFIG_DRM]
|
---|
| 575 | [M] ATI Radeon [CONFIG_DRM_RADEON]</literal></screen>
|
---|
[3ae81e1] | 576 |
|
---|
[81a73ed8] | 577 | <para>
|
---|
| 578 | Loading several large blobs from /lib/firmware takes a noticeable
|
---|
| 579 | time, during which the screen will be blank. If you do not enable the
|
---|
| 580 | penguin framebuffer logo, or change the console size by using a bigger
|
---|
| 581 | font, that probably does not matter. If desired, you can slightly
|
---|
| 582 | reduce the time if you follow the alternate method of specifying 'y'
|
---|
| 583 | for CONFIG_DRM_RADEON covered in BLFS at the link above — you
|
---|
| 584 | must specify each needed radeon blob if you do that.
|
---|
| 585 | </para>
|
---|
[3ae81e1] | 586 |
|
---|
[81a73ed8] | 587 | </sect3>
|
---|
[1cc5345] | 588 |
|
---|
[81a73ed8] | 589 | <sect3 id="nvidia-video-firmware">
|
---|
| 590 | <title>Firmware for Nvidia video chips</title>
|
---|
[1cc5345] | 591 |
|
---|
[81a73ed8] | 592 | <para>
|
---|
| 593 | Some Nvidia graphics chips need firmware updates to take advantage
|
---|
| 594 | of all the card's capability. These are generally the GeForce 8, 9,
|
---|
| 595 | 9300, and 200-900 series chips. For more exact information, see
|
---|
| 596 | <ulink url=
|
---|
| 597 | "https://nouveau.freedesktop.org/wiki/VideoAcceleration/#firmware"/>.
|
---|
| 598 | </para>
|
---|
[1cc5345] | 599 |
|
---|
[81a73ed8] | 600 | <para>
|
---|
| 601 | First, the kernel Nvidia driver must be activated:
|
---|
| 602 | </para>
|
---|
[1cc5345] | 603 |
|
---|
| 604 | <screen><literal>Device Drivers --->
|
---|
| 605 | Graphics support --->
|
---|
| 606 | Direct Rendering Manager --->
|
---|
| 607 | <*> Direct Rendering Manager (XFree86 ... support) [CONFIG_DRM]
|
---|
[f39cf0d0] | 608 | <*/M> Nouveau (NVIDIA) cards [CONFIG_DRM_NOUVEAU]</literal></screen>
|
---|
[1cc5345] | 609 |
|
---|
[81a73ed8] | 610 | <para>
|
---|
| 611 | The steps to install the Nvidia firmware are:
|
---|
| 612 | </para>
|
---|
[1cc5345] | 613 |
|
---|
| 614 | <screen><userinput>wget https://raw.github.com/imirkin/re-vp2/master/extract_firmware.py
|
---|
| 615 | wget http://us.download.nvidia.com/XFree86/Linux-x86/325.15/NVIDIA-Linux-x86-325.15.run
|
---|
| 616 | sh NVIDIA-Linux-x86-325.15.run --extract-only
|
---|
| 617 | python extract_firmware.py
|
---|
| 618 | mkdir -p /lib/firmware/nouveau
|
---|
| 619 | cp -d nv* vuc-* /lib/firmware/nouveau/</userinput></screen>
|
---|
| 620 |
|
---|
[81a73ed8] | 621 | </sect3>
|
---|
[3ae81e1] | 622 | </sect2>
|
---|
| 623 |
|
---|
| 624 | <sect2 id="nic-firmware">
|
---|
| 625 | <title>Firmware for Network Interfaces</title>
|
---|
| 626 |
|
---|
[81a73ed8] | 627 | <para>
|
---|
| 628 | The kernel likes to load firmware for some network drivers, particularly
|
---|
| 629 | those from Realtek (the /lib/linux-firmware/rtl_nic/) directory, but
|
---|
| 630 | they generally appear to work without it. Therefore, you can boot the
|
---|
| 631 | kernel, check dmesg for messages about this missing firmware, and if
|
---|
| 632 | necessary download the firmware and put it in the specified directory in
|
---|
| 633 | <filename class="directory">/lib/firmware</filename> so that it will
|
---|
| 634 | be found on subsequent boots. Note that with current kernels this
|
---|
| 635 | works whether or not the driver is compiled in or built as a module,
|
---|
| 636 | there is no need to build this firmware into the kernel.
|
---|
| 637 | Here is an example where the R8169 driver has been compiled in but the
|
---|
| 638 | firmware was not made available. Once the firmware had been provided,
|
---|
| 639 | there was no mention of it on later boots.
|
---|
| 640 | </para>
|
---|
[3ae81e1] | 641 |
|
---|
| 642 | <screen><literal>dmesg | grep firmware | grep r8169
|
---|
| 643 | [ 7.018028] r8169 0000:01:00.0: Direct firmware load for rtl_nic/rtl8168g-2.fw failed with error -2
|
---|
| 644 | [ 7.018036] r8169 0000:01:00.0 eth0: unable to load firmware patch rtl_nic/rtl8168g-2.fw (-2)</literal></screen>
|
---|
| 645 |
|
---|
| 646 | </sect2>
|
---|
| 647 |
|
---|
| 648 | <sect2 id="other-firmware">
|
---|
| 649 | <title>Firmware for Other Devices</title>
|
---|
| 650 |
|
---|
[81a73ed8] | 651 | <para>
|
---|
| 652 | Identifying the correct firmware will typically require you to install
|
---|
| 653 | <xref linkend='pciutils'/>, and then use <userinput>lspci</userinput>
|
---|
| 654 | to identify the device. You should then search online to check which
|
---|
| 655 | module it uses, which firmware, and where to obtain the firmware —
|
---|
| 656 | not all of it is in linux-firmware.
|
---|
| 657 | </para>
|
---|
| 658 |
|
---|
| 659 | <para>
|
---|
| 660 | If possible, you should begin by using a wired connection when you first
|
---|
| 661 | boot your LFS system. To use a wireless connection you will need to
|
---|
| 662 | use a network tools such as <xref linkend='wireless_tools'/> and <xref
|
---|
| 663 | linkend='wpa_supplicant'/>.
|
---|
| 664 | </para>
|
---|
| 665 |
|
---|
[c18f6acb] | 666 | <para>
|
---|
| 667 | Different countries have different regulations on the radio spectrum
|
---|
| 668 | usage of wireless devices. You can install a firmware to make the
|
---|
| 669 | wireless devices obey local spectrum regulations, so you won't be
|
---|
| 670 | inquired by local authority or find your wireless NIC jamming the
|
---|
| 671 | frequencies of other devices (for example, remote controllers).
|
---|
| 672 | The regulatory database firmware can be downloaded from
|
---|
| 673 | <ulink url = 'https://kernel.org/pub/software/network/wireless-regdb/'/>.
|
---|
| 674 | To install it, simply extract <filename>regulatory.db</filename> and
|
---|
| 675 | <filename>regulatory.db.p7s</filename> from the tarball into
|
---|
| 676 | <filename class="directory">/lib/firmware</filename>.
|
---|
| 677 | The access point would send a country code to your wireless NIC,
|
---|
| 678 | and <xref linkend='wpa_supplicant'/> would tell the kernel to load
|
---|
| 679 | the regulation of this country from
|
---|
| 680 | <filename>regulatory.db</filename>, and enforce it.
|
---|
| 681 | </para>
|
---|
| 682 |
|
---|
[81a73ed8] | 683 | <para>
|
---|
| 684 | Firmware may also be needed for other devices such as some SCSI
|
---|
| 685 | controllers, bluetooth adaptors, or TV recorders. The same principles
|
---|
| 686 | apply.
|
---|
| 687 | </para>
|
---|
[3ae81e1] | 688 |
|
---|
| 689 | </sect2>
|
---|
| 690 |
|
---|
| 691 | </sect1>
|
---|