[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
|
---|
[083a8d7] | 99 | now released firmware up to Ampere (GeForce30 series) to linux-firmware.
|
---|
| 100 | Note that faster clocks than the default are not enabled
|
---|
[3179c69] | 101 | by the released firmware.
|
---|
[81a73ed8] | 102 | </para>
|
---|
[3ae81e1] | 103 | </listitem>
|
---|
| 104 | <listitem>
|
---|
[81a73ed8] | 105 | <para>
|
---|
| 106 | Firmware updates for wired network ports. Mostly they work even
|
---|
| 107 | without the updates, but probably they will work better with
|
---|
| 108 | the updated firmware. For some modern laptops, firmware for both
|
---|
| 109 | wired ethernet (e.g. rtl_nic) and also for bluetooth devices (e.g. qca)
|
---|
| 110 | is <emphasis>required</emphasis> before the wired network can be used.
|
---|
[89bdbf8] | 111 | </para>
|
---|
[3ae81e1] | 112 | </listitem>
|
---|
| 113 | <listitem>
|
---|
[81a73ed8] | 114 | <para>
|
---|
| 115 | Firmware for other devices, such as wifi. These devices are not
|
---|
| 116 | required for the PC to boot, but need the firmware before these devices
|
---|
| 117 | can be used.
|
---|
| 118 | </para>
|
---|
[3ae81e1] | 119 | </listitem>
|
---|
| 120 | </itemizedlist>
|
---|
| 121 |
|
---|
[81a73ed8] | 122 | <note>
|
---|
| 123 | <para>
|
---|
| 124 | Although not needed to load a firmware blob, the following
|
---|
| 125 | tools may be useful for determining, obtaining, or preparing the needed
|
---|
| 126 | firmware in order to load it into the system:
|
---|
| 127 | <xref linkend="cpio"/>,
|
---|
| 128 | <xref linkend="git"/>,
|
---|
| 129 | <xref linkend="pciutils"/>, and
|
---|
| 130 | <xref linkend="wget"/>
|
---|
| 131 | </para>
|
---|
| 132 | </note>
|
---|
[3ae81e1] | 133 |
|
---|
| 134 | <para condition="html" role="usernotes">User Notes:
|
---|
| 135 | <ulink url="&blfs-wiki;/aboutfirmware"/></para>
|
---|
| 136 |
|
---|
| 137 | <sect2 id="cpu-microcode">
|
---|
| 138 | <title>Microcode updates for CPUs</title>
|
---|
| 139 |
|
---|
[81a73ed8] | 140 | <para>
|
---|
| 141 | In general, microcode can be loaded by the BIOS or UEFI, and it might be
|
---|
| 142 | updated by upgrading to a newer version of those. On linux, you can also
|
---|
| 143 | load the microcode from the kernel if you are using an AMD family 10h or
|
---|
| 144 | later processor (first introduced late 2007), or an Intel processor from
|
---|
| 145 | 1998 and later (Pentium4, Core, etc), if updated microcode has been
|
---|
| 146 | released. These updates only last until the machine is powered off, so
|
---|
| 147 | they need to be applied on every boot.
|
---|
| 148 | </para>
|
---|
| 149 |
|
---|
| 150 | <para>
|
---|
[bd78d011] | 151 | Intel provide updates of their microcode for Skylake and later
|
---|
[83d1722c] | 152 | processors as new vulnerabilities come to light, and have in the past
|
---|
| 153 | provided updates for processors from SandyBridge onwards, although those
|
---|
| 154 | are no-longer supported for new fixes. New versions of AMD
|
---|
[81a73ed8] | 155 | firmware are rare and usually only apply to a few models, although
|
---|
[083a8d7] | 156 | motherboard manufacturers get AGESA (AMD Generic Encapsulated Software
|
---|
| 157 | Architecture) updates to change BIOS values, e.g. to support more memory
|
---|
| 158 | variants or newer CPUs.
|
---|
[81a73ed8] | 159 | </para>
|
---|
| 160 |
|
---|
| 161 | <para>
|
---|
[3b50f0de] | 162 | There were two ways of loading the microcode, described as 'early' and
|
---|
[81a73ed8] | 163 | 'late'. Early loading happens before userspace has been started, late
|
---|
[3b50f0de] | 164 | loading happens after userspace has started. However, late loading is
|
---|
| 165 | known to be problematic and not supported anymore (see the kernel commit
|
---|
| 166 | <ulink url="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d23d33e">
|
---|
| 167 | x86/microcode: Taint and warn on late loading</ulink>.) Indeed, early
|
---|
| 168 | loading is needed to work around one particular erratum in early Intel
|
---|
| 169 | Haswell processors which had TSX enabled. (See <ulink url=
|
---|
[81a73ed8] | 170 | "http://www.anandtech.com/show/8376/intel-disables-tsx-instructions-erratum-found-in-haswell-haswelleep-broadwellyi/">
|
---|
| 171 | Intel Disables TSX Instructions: Erratum Found in Haswell,
|
---|
[3b50f0de] | 172 | Haswell-E/EP, Broadwell-Y</ulink>.)
|
---|
| 173 | Without this update glibc can do the wrong thing in uncommon
|
---|
[8558044] | 174 | situations.
|
---|
[81a73ed8] | 175 | </para>
|
---|
| 176 |
|
---|
[083a8d7] | 177 | <para>
|
---|
| 178 | In previous versions of this book, late loading of microcode to see if
|
---|
| 179 | it gets applied was recommended, followed by using an initrd to force
|
---|
| 180 | early loading. But now that the contents of the Intel microcode tarball
|
---|
| 181 | is documented, and AMD microcode can be read by a Python script to
|
---|
| 182 | determine which machines it covers, there is no real reason to use late
|
---|
| 183 | loading.
|
---|
| 184 | </para>
|
---|
| 185 |
|
---|
[81a73ed8] | 186 | <para>
|
---|
[3b50f0de] | 187 | It might be still possible to manually force late loading of microcode.
|
---|
| 188 | But it may cause kernel malfunction and you should take the risk yourself.
|
---|
| 189 | You will need to reconfigure your kernel for either method. The
|
---|
| 190 | instructions here will show you how to create an initrd for early
|
---|
| 191 | loading. It is also possible to build the same microcode bin file into
|
---|
| 192 | the kernel, which allows early loading but requires the kernel to be
|
---|
| 193 | recompiled to update the microcode.
|
---|
[81a73ed8] | 194 | </para>
|
---|
| 195 |
|
---|
| 196 | <para>
|
---|
| 197 | To confirm what processor(s) you have (if more than one, they will be
|
---|
[083a8d7] | 198 | identical) look in /proc/cpuinfo. Determine the decimal values of the cpu
|
---|
| 199 | family, model and stepping by running the following command (it will also
|
---|
| 200 | report the current microcode version):
|
---|
| 201 | </para>
|
---|
| 202 |
|
---|
| 203 | <screen><userinput>head -n7 /proc/cpuinfo</userinput></screen>
|
---|
| 204 |
|
---|
| 205 | <para>
|
---|
[3b50f0de] | 206 | Convert the cpu family, model and stepping to pairs of hexadecimal
|
---|
| 207 | digits, and remember the value of the <quote>microcode</quote> field.
|
---|
[083a8d7] | 208 | You can now check if there is any microcode available.
|
---|
[81a73ed8] | 209 | </para>
|
---|
[3ae81e1] | 210 |
|
---|
[83d1722c] | 211 | <para>
|
---|
| 212 | If you are creating an initrd to update firmware for different machines,
|
---|
| 213 | as a distro would do, go down to 'Early loading of microcode' and cat all
|
---|
| 214 | the Intel blobs to GenuineIntel.bin or cat all the AMD blobs to
|
---|
| 215 | AuthenticAMD.bin. This creates a larger initrd - for all Intel machines in
|
---|
[083a8d7] | 216 | the 20200609 update the size was 3.0 MB compared to typically 24 KB for one
|
---|
[83d1722c] | 217 | machine.
|
---|
| 218 | </para>
|
---|
| 219 |
|
---|
[3ae81e1] | 220 | <sect3 id="intel-microcode">
|
---|
| 221 | <title>Intel Microcode for the CPU</title>
|
---|
[ba78ebe2] | 222 |
|
---|
[81a73ed8] | 223 | <para>
|
---|
| 224 | The first step is to get the most recent version of the Intel
|
---|
| 225 | microcode. This must be done by navigating to <ulink url=
|
---|
[3179c69] | 226 | 'https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/releases/'/>
|
---|
[81a73ed8] | 227 | and downloading the latest file there. As of this writing the most
|
---|
[bfd2ba3c] | 228 | <!-- at one time, some skylakes had problems with a certain revision
|
---|
| 229 | secure version of the microcode, for those machines which can boot it, -->
|
---|
| 230 | secure version of the microcode
|
---|
[9f4b2b89] | 231 | is microcode-20220510.<!-- If you have a Skylake machine, please read the
|
---|
[bd78d011] | 232 | Caution in the 'Early loading of microcode' section below.--> Extract this
|
---|
[81a73ed8] | 233 | file in the normal way, the microcode is in the <filename>intel-ucode
|
---|
| 234 | </filename> directory, containing various blobs with names in the form
|
---|
| 235 | XX-YY-ZZ. There are also various other files, and a releasenote.
|
---|
| 236 | </para>
|
---|
| 237 |
|
---|
| 238 | <para>
|
---|
| 239 | In the past, intel did not provide any details of which blobs had
|
---|
[3b50f0de] | 240 | changed versions, but now the releasenote details this. You can
|
---|
| 241 | compare the microcode version in <filename>/proc/cpuinfo</filename>
|
---|
| 242 | with the version for your CPU model in the releasenote to know if
|
---|
| 243 | there is an update.
|
---|
[81a73ed8] | 244 | </para>
|
---|
| 245 |
|
---|
| 246 | <para>
|
---|
| 247 | The recent firmware for older processors is provided to deal with
|
---|
| 248 | vulnerabilities which have now been made public, and for some of these
|
---|
| 249 | such as Microarchitectural Data Sampling (MDS) you might wish to
|
---|
| 250 | increase the protection by disabling hyperthreading, or alternatively
|
---|
| 251 | to disable the kernel's default mitigation because of its impact on
|
---|
| 252 | compile times. Please read the online documentation at <ulink url=
|
---|
| 253 | 'https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/index.html'/>.
|
---|
| 254 | </para>
|
---|
| 255 |
|
---|
| 256 | <para>
|
---|
[3b50f0de] | 257 | For an Icelake mobile (described as Intel(R) Core(TM) i7-1065G7
|
---|
| 258 | CPU) the relevant values are cpu family 6, model 126, stepping 5 so
|
---|
| 259 | in this case the required identification is 06-7e-05. The
|
---|
| 260 | releasenote says the latest microcode for it is versioned 0xb0. If
|
---|
| 261 | the value of the <quote>microcode</quote> field in
|
---|
| 262 | <filename>/proc/cpuinfo</filename> is 0xb0 or greater, it indicates
|
---|
| 263 | the microcode update is already applied by the BIOS. Otherwise,
|
---|
| 264 | configure the kernel to support loading Intel microcode, and then
|
---|
| 265 | proceed to <xref linkend='early-microcode'/>:
|
---|
[81a73ed8] | 266 | </para>
|
---|
[3ae81e1] | 267 |
|
---|
[0576c595] | 268 | <screen><literal>General Setup --->
|
---|
[f39cf0d0] | 269 | [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support [CONFIG_BLK_DEV_INITRD]
|
---|
[0576c595] | 270 | Processor type and features --->
|
---|
[f39cf0d0] | 271 | [*] CPU microcode loading support [CONFIG_MICROCODE]
|
---|
| 272 | [*] Intel microcode loading support [CONFIG_MICROCODE_INTEL]</literal></screen>
|
---|
[0576c595] | 273 |
|
---|
[3ae81e1] | 274 | </sect3>
|
---|
| 275 |
|
---|
[bd78d011] | 276 | <sect3 id="amd-microcode">
|
---|
[3ae81e1] | 277 | <title>AMD Microcode for the CPU</title>
|
---|
| 278 |
|
---|
[81a73ed8] | 279 | <para>
|
---|
| 280 | Begin by downloading a container of firmware for your CPU family
|
---|
| 281 | from <ulink url=
|
---|
| 282 | '&sources-anduin-http;/linux-firmware/amd-ucode/'/>.
|
---|
| 283 | The family is always specified in hex. Families 10h to 14h (16 to 20)
|
---|
[083a8d7] | 284 | are in microcode_amd.bin. Families 15h, 16h, 17h (Zen, Zen+, Zen2) and
|
---|
| 285 | 19h (Zen3) have their own containers. Very few machines are likely to
|
---|
| 286 | get updated microcode. There is a Python3 script at <ulink url=
|
---|
| 287 | 'https://github.com/AMDESE/amd_ucode_info/blob/master/amd_ucode_info.py'/>.
|
---|
| 288 | Download that script and run it against the bin file to check which
|
---|
| 289 | processors have updates.
|
---|
| 290 | </para>
|
---|
| 291 |
|
---|
| 292 | <para>
|
---|
| 293 | For the very old Athlon(tm) II X2 in these examples the values were
|
---|
| 294 | cpu family 16, model 5, stepping 3 giving an identification of
|
---|
[3b50f0de] | 295 | Family=0x10 Model=0x05 Stepping=0x03. One line of the
|
---|
| 296 | <command>amd_ucode_info.py</command> script output describes the
|
---|
| 297 | microcode version for it:
|
---|
[083a8d7] | 298 | </para>
|
---|
| 299 |
|
---|
[3b50f0de] | 300 | <screen><computeroutput>Family=0x10 Model=0x05 Stepping=0x03: Patch=0x010000c8 Length=960 bytes</computeroutput></screen>
|
---|
[3ae81e1] | 301 |
|
---|
[81a73ed8] | 302 | <para>
|
---|
[3b50f0de] | 303 | If the value of the <quote>microcode</quote> field in
|
---|
| 304 | <filename>/proc/cpuinfo</filename> is 0x10000c8 or greater, it
|
---|
| 305 | indicates the BIOS has already applied the microcode update.
|
---|
[7dd1546] | 306 | Otherwise, configure the kernel to support loading AMD microcode,
|
---|
[3b50f0de] | 307 | and then proceed to <xref linkend='early-microcode'/>:
|
---|
[81a73ed8] | 308 | </para>
|
---|
[0576c595] | 309 |
|
---|
| 310 | <screen><literal>General Setup --->
|
---|
[f39cf0d0] | 311 | [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support [CONFIG_BLK_DEV_INITRD]
|
---|
[0576c595] | 312 | Processor type and features --->
|
---|
[f39cf0d0] | 313 | [*] CPU microcode loading support [CONFIG_MICROCODE]
|
---|
| 314 | [*] AMD microcode loading support [CONFIG_MICROCODE_AMD]</literal></screen>
|
---|
[3ae81e1] | 315 | </sect3>
|
---|
| 316 |
|
---|
| 317 | <sect3 id="early-microcode">
|
---|
| 318 | <title>Early loading of microcode</title>
|
---|
| 319 |
|
---|
[81a73ed8] | 320 | <para>
|
---|
| 321 | If you have established that updated microcode is available for
|
---|
| 322 | your system, it is time to prepare it for early loading. This requires
|
---|
| 323 | an additional package, <xref linkend='cpio'/> and the creation of an
|
---|
| 324 | initrd which will need to be added to grub.cfg.
|
---|
| 325 | </para>
|
---|
[3ae81e1] | 326 |
|
---|
[81a73ed8] | 327 | <para>
|
---|
| 328 | It does not matter where you prepare the initrd, and once it is
|
---|
| 329 | working you can apply the same initrd to later LFS systems or newer
|
---|
| 330 | kernels on this same machine, at least until any newer microcode is
|
---|
| 331 | released. Use the following commands:
|
---|
| 332 | </para>
|
---|
[3ae81e1] | 333 |
|
---|
| 334 | <screen><userinput>mkdir -p initrd/kernel/x86/microcode
|
---|
| 335 | cd initrd</userinput></screen>
|
---|
| 336 |
|
---|
[81a73ed8] | 337 | <para>
|
---|
| 338 | For an AMD machine, use the following command (replace
|
---|
| 339 | <MYCONTAINER> with the name of the container for your CPU's
|
---|
| 340 | family):
|
---|
| 341 | </para>
|
---|
[3ae81e1] | 342 |
|
---|
[af8a78d] | 343 | <screen><userinput>cp -v /lib/firmware/amd-ucode/<MYCONTAINER> kernel/x86/microcode/AuthenticAMD.bin</userinput></screen>
|
---|
[3ae81e1] | 344 |
|
---|
[81a73ed8] | 345 | <para>
|
---|
| 346 | Or for an Intel machine copy the appropriate blob using this command:
|
---|
| 347 | </para>
|
---|
[3ae81e1] | 348 |
|
---|
| 349 | <screen><userinput>cp -v /lib/firmware/intel-ucode/<XX-YY-ZZ> kernel/x86/microcode/GenuineIntel.bin</userinput></screen>
|
---|
| 350 |
|
---|
[bd78d011] | 351 | <!-- new version from 20201110 release onwards, assumed to work on all skylakes
|
---|
| 352 | But complaints about previous version took some days to appear, so keep as a comment for now.
|
---|
[fe2553a] | 353 | <caution>
|
---|
| 354 | <para>
|
---|
[3179c69] | 355 | On some Skylake machines with hex Model Number '4e' (78 decimal) the
|
---|
| 356 | upgrade to microcode version '0xdc' is reported to cause the machine to
|
---|
| 357 | hang in early boot, and the fix is to revert to version 0xd6 which was
|
---|
| 358 | first shipped in the 20191115 microcode release.
|
---|
[fe2553a] | 359 | </para>
|
---|
| 360 |
|
---|
| 361 | <para>
|
---|
[3179c69] | 362 | At least one model '5e' Skylake does boot successfully with version
|
---|
| 363 | 0xdc, but Intel has now shipped a 20200616 release which is intended for
|
---|
| 364 | distros which need an initrd that will boot on everyone's machine: it
|
---|
| 365 | reverts both Skylake variants ('4e' and '5e') to the old 0xd6.
|
---|
[fe2553a] | 366 | </para>
|
---|
| 367 |
|
---|
| 368 | <para>
|
---|
[3179c69] | 369 | For a Skylake which does not boot with 0xdc, reverting to 0xd6 will make
|
---|
| 370 | the machine usable, but without the SRBDS mitigations.
|
---|
[fe2553a] | 371 | </para>
|
---|
[bd78d011] | 372 | </caution>-->
|
---|
[fe2553a] | 373 |
|
---|
[81a73ed8] | 374 | <para>
|
---|
| 375 | Now prepare the initrd:
|
---|
| 376 | </para>
|
---|
[3ae81e1] | 377 |
|
---|
| 378 | <screen><userinput>find . | cpio -o -H newc > /boot/microcode.img</userinput></screen>
|
---|
| 379 |
|
---|
[81a73ed8] | 380 | <para>
|
---|
| 381 | You now need to add a new entry to /boot/grub/grub.cfg and
|
---|
| 382 | here you should add a new line after the linux line within the stanza.
|
---|
| 383 | If /boot is a separate mountpoint:
|
---|
| 384 | </para>
|
---|
[3ae81e1] | 385 |
|
---|
| 386 | <screen><userinput>initrd /microcode.img</userinput></screen>
|
---|
| 387 |
|
---|
[81a73ed8] | 388 | <para>
|
---|
| 389 | or this if it is not:
|
---|
| 390 | </para>
|
---|
[3ae81e1] | 391 |
|
---|
| 392 | <screen><userinput>initrd /boot/microcode.img</userinput></screen>
|
---|
| 393 |
|
---|
[81a73ed8] | 394 | <para>
|
---|
| 395 | If you are already booting with an initrd (see <xref
|
---|
[8558044] | 396 | linkend="initramfs"/>), you should run <command>mkinitramfs</command>
|
---|
[81a73ed8] | 397 | again after putting the appropriate blob or container into <filename
|
---|
| 398 | class="directory">/lib/firmware</filename> as explained above.
|
---|
| 399 | Alternatively, you can have both initrd on the same line, such as
|
---|
| 400 | <userinput>initrd /microcode.img /other-initrd.img</userinput> (adapt
|
---|
| 401 | that as above if /boot is not a separate mountpoint).
|
---|
| 402 | </para>
|
---|
[a7c5f47] | 403 |
|
---|
[81a73ed8] | 404 | <para>
|
---|
| 405 | You can now reboot with the added initrd, and then use the same
|
---|
| 406 | command to check that the early load worked:
|
---|
| 407 | </para>
|
---|
[3ae81e1] | 408 |
|
---|
[0576c595] | 409 | <screen><userinput>dmesg | grep -e 'microcode' -e 'Linux version' -e 'Command line'</userinput></screen>
|
---|
| 410 |
|
---|
[81a73ed8] | 411 | <para>
|
---|
[3b50f0de] | 412 | If you updated to address vulnerabilities, you can look at the
|
---|
| 413 | output of the <command>lscpu</command> command to see what is now
|
---|
| 414 | reported.
|
---|
[81a73ed8] | 415 | </para>
|
---|
[3c19265] | 416 |
|
---|
[81a73ed8] | 417 | <para>
|
---|
| 418 | The places and times where early loading happens are very different
|
---|
[3b50f0de] | 419 | in AMD and Intel machines. First, an example of an Intel (Icelake
|
---|
| 420 | mobile) with early loading:
|
---|
[81a73ed8] | 421 | </para>
|
---|
[b174fb1] | 422 |
|
---|
[3b50f0de] | 423 | <screen><literal>[ 0.000000] microcode: microcode updated early to revision 0xb0, date = 2022-03-09
|
---|
| 424 | [ 0.000000] Linux version 5.18.1 (xry111@xry111-X57S1) (gcc (GCC) 12.1.0, GNU ld (GNU Binutils) 2.38) #95 SMP PREEMPT_DYNAMIC Sun Jun 5 21:14:29 CST 2022
|
---|
| 425 | [ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-5.18.1-lfs-r11.1-109-systemd root=/dev/nvme0n1p7 ro
|
---|
| 426 | [ 0.435085] microcode: sig=0x706e5, pf=0x80, revision=0xb0
|
---|
| 427 | [ 0.435197] microcode: Microcode Update Driver: v2.2.</literal></screen>
|
---|
[83d1722c] | 428 |
|
---|
[0576c595] | 429 |
|
---|
[81a73ed8] | 430 | <para>
|
---|
| 431 | A historic AMD example:
|
---|
| 432 | </para>
|
---|
[0576c595] | 433 |
|
---|
[c6d338e] | 434 | <screen><literal>[ 0.000000] Linux version 4.15.3 (ken@testserver) (gcc version 7.3.0 (GCC))
|
---|
| 435 | #2 SMP Sun Feb 18 02:32:03 GMT 2018
|
---|
| 436 | [ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.15.3-sda5 root=/dev/sda5 ro
|
---|
| 437 | [ 0.307619] microcode: microcode updated early to new patch_level=0x010000c8
|
---|
| 438 | [ 0.307678] microcode: CPU0: patch_level=0x010000c8
|
---|
| 439 | [ 0.307723] microcode: CPU1: patch_level=0x010000c8
|
---|
| 440 | [ 0.307795] microcode: Microcode Update Driver: v2.2.</literal></screen>
|
---|
[3ae81e1] | 441 |
|
---|
| 442 | </sect3>
|
---|
| 443 |
|
---|
| 444 | </sect2>
|
---|
| 445 |
|
---|
[1cc5345] | 446 | <sect2 id="video-firmware">
|
---|
| 447 | <title>Firmware for Video Cards</title>
|
---|
| 448 |
|
---|
[81a73ed8] | 449 | <sect3 id="ati-video-firmware">
|
---|
| 450 | <title>Firmware for ATI video chips (R600 and later)</title>
|
---|
| 451 |
|
---|
| 452 | <para>
|
---|
| 453 | These instructions do NOT apply to old radeons before the R600
|
---|
| 454 | family. For those, the firmware is in the kernel's <filename
|
---|
| 455 | class='directory'>/lib/firmware/</filename> directory. Nor do they
|
---|
| 456 | apply if you intend to avoid a graphical setup such as Xorg and are
|
---|
| 457 | content to use the default 80x25 display rather than a framebuffer.
|
---|
| 458 | </para>
|
---|
| 459 |
|
---|
| 460 | <para>
|
---|
| 461 | Early radeon devices only needed a single 2K blob of firmware. Recent
|
---|
| 462 | devices need several different blobs, and some of them are much bigger.
|
---|
| 463 | The total size of the radeon firmware directory is over 500K —
|
---|
| 464 | on a large modern system you can probably spare the space, but it is
|
---|
| 465 | still redundant to install all the unused files each time you build
|
---|
| 466 | a system.
|
---|
| 467 | </para>
|
---|
| 468 |
|
---|
| 469 | <para>
|
---|
| 470 | A better approach is to install <xref linkend='pciutils'/> and then
|
---|
| 471 | use <userinput>lspci</userinput> to identify which VGA controller is
|
---|
| 472 | installed.
|
---|
| 473 | </para>
|
---|
| 474 |
|
---|
| 475 | <para>
|
---|
| 476 | With that information, check the RadeonFeature page of the Xorg wiki
|
---|
| 477 | for <ulink url="http://wiki.x.org/wiki/RadeonFeature/#index5h2">Decoder
|
---|
| 478 | ring for engineering vs marketing names</ulink> to identify the family
|
---|
| 479 | (you may need to know this for the Xorg driver in BLFS —
|
---|
| 480 | Southern Islands and Sea Islands use the radeonsi driver) and the
|
---|
| 481 | specific model.
|
---|
| 482 | </para>
|
---|
| 483 |
|
---|
| 484 | <para>
|
---|
| 485 | Now that you know which controller you are using, consult the
|
---|
| 486 | <ulink url="https://wiki.gentoo.org/wiki/Radeon#Firmware">
|
---|
| 487 | Radeon</ulink> page of the Gentoo wiki which has a table listing
|
---|
| 488 | the required firmware blobs for the various chipsets. Note that
|
---|
| 489 | Southern Islands and Sea Islands chips use different firmware for
|
---|
| 490 | kernel 3.17 and later compared to earlier kernels. Identify and
|
---|
| 491 | download the required blobs then install them:
|
---|
| 492 | </para>
|
---|
[3ae81e1] | 493 |
|
---|
| 494 | <screen><userinput>mkdir -pv /lib/firmware/radeon
|
---|
| 495 | cp -v <YOUR_BLOBS> /lib/firmware/radeon</userinput></screen>
|
---|
| 496 |
|
---|
[81a73ed8] | 497 | <para>
|
---|
| 498 | There are actually two ways of installing this firmware. BLFS, in the
|
---|
| 499 | 'Kernel Configuration for additional firmware' section part of the
|
---|
| 500 | <xref linkend="xorg-ati-driver"/> section gives an example of
|
---|
| 501 | compiling the firmware into the kernel - that is slightly faster to
|
---|
| 502 | load, but uses more kernel memory. Here we will use the alternative
|
---|
| 503 | method of making the radeon driver a module. In your kernel config
|
---|
| 504 | set the following:
|
---|
| 505 | </para>
|
---|
[3ae81e1] | 506 |
|
---|
| 507 | <screen><literal>Device Drivers --->
|
---|
| 508 | Graphics support --->
|
---|
| 509 | Direct Rendering Manager --->
|
---|
[f39cf0d0] | 510 | [*] Direct Rendering Manager (XFree86 ... support) [CONFIG_DRM]
|
---|
| 511 | [M] ATI Radeon [CONFIG_DRM_RADEON]</literal></screen>
|
---|
[3ae81e1] | 512 |
|
---|
[81a73ed8] | 513 | <para>
|
---|
| 514 | Loading several large blobs from /lib/firmware takes a noticeable
|
---|
| 515 | time, during which the screen will be blank. If you do not enable the
|
---|
| 516 | penguin framebuffer logo, or change the console size by using a bigger
|
---|
| 517 | font, that probably does not matter. If desired, you can slightly
|
---|
| 518 | reduce the time if you follow the alternate method of specifying 'y'
|
---|
| 519 | for CONFIG_DRM_RADEON covered in BLFS at the link above — you
|
---|
| 520 | must specify each needed radeon blob if you do that.
|
---|
| 521 | </para>
|
---|
[3ae81e1] | 522 |
|
---|
[81a73ed8] | 523 | </sect3>
|
---|
[1cc5345] | 524 |
|
---|
[83cc2cc3] | 525 | <sect3 id="amdgpu-video-firmware">
|
---|
| 526 | <title>Firmware for AMD/ATI amdgpu video chips</title>
|
---|
| 527 |
|
---|
| 528 | <para>
|
---|
| 529 | All video controllers using the amdgpu kernel driver require firmware,
|
---|
| 530 | whether you will be using the xorg amdgpu driver, the xserver's modesetting
|
---|
| 531 | driver, or just kernel modesetting to get a console framebuffer larger than
|
---|
| 532 | 80x25.
|
---|
| 533 | </para>
|
---|
| 534 |
|
---|
| 535 | <para>
|
---|
| 536 | Install <xref linkend="pciutils"/> and use that to check the model name
|
---|
| 537 | (look for 'VGA compatible controller:'). If you have an APU (Accelerated
|
---|
| 538 | Processing Unit, i.e. CPU and video on the same chip) that will probably
|
---|
| 539 | tell you the name. If you have a separate amdgpu video card you will need
|
---|
| 540 | to search to determine which name it uses (e.g. a card described as
|
---|
| 541 | Advanced Micro Devices, Inc. [AMD/ATI] Baffin [Radeon RX 550 640SP / RX
|
---|
| 542 | 560/560X] needs Polaris11 firmware. There is a table of "Family, Chipset
|
---|
| 543 | name, Product name and Firmware" at the end of the Kernel sections in
|
---|
| 544 | <ulink url="https://wiki.gentoo.org/wiki/AMDGPU#Known_firmware_blobs">
|
---|
| 545 | AMDGPU</ulink> page of the Gentoo wiki.
|
---|
| 546 | </para>
|
---|
| 547 |
|
---|
| 548 | <para>
|
---|
| 549 | Once you have identified the firmware name, install all the relevant
|
---|
| 550 | files for it. For example, the Baffin card mentioned above has 21 different
|
---|
| 551 | polaris11* files, APUs such as renoir and picasso have at least 12 files and
|
---|
| 552 | might gain more in future updates (e.g. the raven APU now has a 13th file,
|
---|
| 553 | raven_ta.bin).
|
---|
| 554 | </para>
|
---|
| 555 |
|
---|
| 556 | <screen><userinput>mkdir -pv /lib/firmware/amdgpu
|
---|
| 557 | cp -v <YOUR_BLOBS> /lib/firmware/amdgpu</userinput></screen>
|
---|
| 558 |
|
---|
| 559 | <para>
|
---|
| 560 | If disk space is not a problem, you could install all the current amdgpu
|
---|
| 561 | firmware files and not worry about exactly which chipset is installed.
|
---|
| 562 | </para>
|
---|
| 563 |
|
---|
| 564 | <para>
|
---|
| 565 | You are recommended to build the kernel amdgpu driver as a module.
|
---|
| 566 | In your kernel .config set at least the following options and review
|
---|
| 567 | the other AMDGPU options according to what hardware you are building
|
---|
| 568 | for, e.g ACP (Audio Co-Processor) support for some APUs,
|
---|
| 569 | </para>
|
---|
| 570 |
|
---|
| 571 | <screen><literal>Device Drivers --->
|
---|
| 572 | Graphics support --->
|
---|
| 573 | Direct Rendering Manager --->
|
---|
| 574 | [*] Direct Rendering Manager (XFree86 ... support) [CONFIG_DRM]
|
---|
| 575 | [M] AMD GPU [CONFIG_DRM_AMDGPU]
|
---|
| 576 | Display Engine Configuration --->
|
---|
| 577 | [*] AMD DC - Enable new display engine (NEW) [CONFIG_DRM_AMD_DC]</literal></screen>
|
---|
| 578 |
|
---|
| 579 | <para>
|
---|
| 580 | As written above at the end of the section on 'Firmware for ATI video
|
---|
| 581 | chips', loading large blobs from /lib/firmware can take a noticeable
|
---|
| 582 | time during which the screen will be blank. On a slow machine you might
|
---|
| 583 | wish to refer to the 'Kernel Configuration for additional firmware'
|
---|
| 584 | part of <xref linkend="xorg-amdgpu-driver"/> and compile all the
|
---|
| 585 | required modules into the kernel to reduce this time, at the cost of
|
---|
| 586 | using more kernel memory.
|
---|
| 587 | </para>
|
---|
| 588 |
|
---|
| 589 | </sect3>
|
---|
| 590 |
|
---|
[81a73ed8] | 591 | <sect3 id="nvidia-video-firmware">
|
---|
| 592 | <title>Firmware for Nvidia video chips</title>
|
---|
[1cc5345] | 593 |
|
---|
[81a73ed8] | 594 | <para>
|
---|
[083a8d7] | 595 | Nvidia has released basic signed firmware for recent graphics chips,
|
---|
| 596 | but significantly after the chips and its own binary drivers were first
|
---|
| 597 | available. For other chips it has been necessary to extract the firmware
|
---|
| 598 | from the binary driver.
|
---|
| 599 | </para>
|
---|
| 600 | <para>
|
---|
| 601 | For more exact information about which chips need extracted firmware, see
|
---|
[81a73ed8] | 602 | <ulink url=
|
---|
| 603 | "https://nouveau.freedesktop.org/wiki/VideoAcceleration/#firmware"/>.
|
---|
| 604 | </para>
|
---|
[8558044] | 605 |
|
---|
[81a73ed8] | 606 | <para>
|
---|
| 607 | First, the kernel Nvidia driver must be activated:
|
---|
| 608 | </para>
|
---|
[1cc5345] | 609 |
|
---|
| 610 | <screen><literal>Device Drivers --->
|
---|
| 611 | Graphics support --->
|
---|
| 612 | Direct Rendering Manager --->
|
---|
| 613 | <*> Direct Rendering Manager (XFree86 ... support) [CONFIG_DRM]
|
---|
[f39cf0d0] | 614 | <*/M> Nouveau (NVIDIA) cards [CONFIG_DRM_NOUVEAU]</literal></screen>
|
---|
[1cc5345] | 615 |
|
---|
[81a73ed8] | 616 | <para>
|
---|
[083a8d7] | 617 | If the necessary firmware is available in the
|
---|
| 618 | <filename class="directory">nvidia/</filename> directory of
|
---|
| 619 | linux-firmware, copy it to
|
---|
| 620 | <filename class="directory">/lib/firmware/nouveau</filename>.
|
---|
| 621 | </para>
|
---|
| 622 | <para>
|
---|
| 623 | If the firmware has not been made available in linux-firmware,
|
---|
| 624 | for the old chips mentioned in the nouveau wiki link above ensure you have
|
---|
| 625 | installed <xref linkend="python2"/> and run the following commands:
|
---|
[81a73ed8] | 626 | </para>
|
---|
[1cc5345] | 627 |
|
---|
| 628 | <screen><userinput>wget https://raw.github.com/imirkin/re-vp2/master/extract_firmware.py
|
---|
| 629 | wget http://us.download.nvidia.com/XFree86/Linux-x86/325.15/NVIDIA-Linux-x86-325.15.run
|
---|
| 630 | sh NVIDIA-Linux-x86-325.15.run --extract-only
|
---|
[083a8d7] | 631 | python2 extract_firmware.py
|
---|
[1cc5345] | 632 | mkdir -p /lib/firmware/nouveau
|
---|
| 633 | cp -d nv* vuc-* /lib/firmware/nouveau/</userinput></screen>
|
---|
| 634 |
|
---|
[81a73ed8] | 635 | </sect3>
|
---|
[3ae81e1] | 636 | </sect2>
|
---|
| 637 |
|
---|
| 638 | <sect2 id="nic-firmware">
|
---|
| 639 | <title>Firmware for Network Interfaces</title>
|
---|
| 640 |
|
---|
[81a73ed8] | 641 | <para>
|
---|
| 642 | The kernel likes to load firmware for some network drivers, particularly
|
---|
| 643 | those from Realtek (the /lib/linux-firmware/rtl_nic/) directory, but
|
---|
| 644 | they generally appear to work without it. Therefore, you can boot the
|
---|
| 645 | kernel, check dmesg for messages about this missing firmware, and if
|
---|
| 646 | necessary download the firmware and put it in the specified directory in
|
---|
| 647 | <filename class="directory">/lib/firmware</filename> so that it will
|
---|
| 648 | be found on subsequent boots. Note that with current kernels this
|
---|
| 649 | works whether or not the driver is compiled in or built as a module,
|
---|
| 650 | there is no need to build this firmware into the kernel.
|
---|
| 651 | Here is an example where the R8169 driver has been compiled in but the
|
---|
| 652 | firmware was not made available. Once the firmware had been provided,
|
---|
| 653 | there was no mention of it on later boots.
|
---|
| 654 | </para>
|
---|
[3ae81e1] | 655 |
|
---|
| 656 | <screen><literal>dmesg | grep firmware | grep r8169
|
---|
| 657 | [ 7.018028] r8169 0000:01:00.0: Direct firmware load for rtl_nic/rtl8168g-2.fw failed with error -2
|
---|
| 658 | [ 7.018036] r8169 0000:01:00.0 eth0: unable to load firmware patch rtl_nic/rtl8168g-2.fw (-2)</literal></screen>
|
---|
| 659 |
|
---|
| 660 | </sect2>
|
---|
| 661 |
|
---|
| 662 | <sect2 id="other-firmware">
|
---|
| 663 | <title>Firmware for Other Devices</title>
|
---|
| 664 |
|
---|
[81a73ed8] | 665 | <para>
|
---|
| 666 | Identifying the correct firmware will typically require you to install
|
---|
| 667 | <xref linkend='pciutils'/>, and then use <userinput>lspci</userinput>
|
---|
| 668 | to identify the device. You should then search online to check which
|
---|
| 669 | module it uses, which firmware, and where to obtain the firmware —
|
---|
| 670 | not all of it is in linux-firmware.
|
---|
| 671 | </para>
|
---|
| 672 |
|
---|
| 673 | <para>
|
---|
| 674 | If possible, you should begin by using a wired connection when you first
|
---|
| 675 | boot your LFS system. To use a wireless connection you will need to
|
---|
| 676 | use a network tools such as <xref linkend='wireless_tools'/> and <xref
|
---|
| 677 | linkend='wpa_supplicant'/>.
|
---|
| 678 | </para>
|
---|
| 679 |
|
---|
[c18f6acb] | 680 | <para>
|
---|
| 681 | Different countries have different regulations on the radio spectrum
|
---|
| 682 | usage of wireless devices. You can install a firmware to make the
|
---|
| 683 | wireless devices obey local spectrum regulations, so you won't be
|
---|
| 684 | inquired by local authority or find your wireless NIC jamming the
|
---|
| 685 | frequencies of other devices (for example, remote controllers).
|
---|
| 686 | The regulatory database firmware can be downloaded from
|
---|
| 687 | <ulink url = 'https://kernel.org/pub/software/network/wireless-regdb/'/>.
|
---|
| 688 | To install it, simply extract <filename>regulatory.db</filename> and
|
---|
| 689 | <filename>regulatory.db.p7s</filename> from the tarball into
|
---|
| 690 | <filename class="directory">/lib/firmware</filename>.
|
---|
| 691 | The access point would send a country code to your wireless NIC,
|
---|
| 692 | and <xref linkend='wpa_supplicant'/> would tell the kernel to load
|
---|
| 693 | the regulation of this country from
|
---|
| 694 | <filename>regulatory.db</filename>, and enforce it.
|
---|
| 695 | </para>
|
---|
| 696 |
|
---|
[81a73ed8] | 697 | <para>
|
---|
| 698 | Firmware may also be needed for other devices such as some SCSI
|
---|
| 699 | controllers, bluetooth adaptors, or TV recorders. The same principles
|
---|
| 700 | apply.
|
---|
| 701 | </para>
|
---|
[3ae81e1] | 702 |
|
---|
| 703 | </sect2>
|
---|
| 704 |
|
---|
| 705 | </sect1>
|
---|