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