1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
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 | <!ENTITY linux-firmware-git "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git">
|
---|
7 | ]>
|
---|
8 |
|
---|
9 | <sect1 id="postlfs-firmware" xreflabel="About Firmware">
|
---|
10 | <?dbhtml filename="firmware.html"?>
|
---|
11 |
|
---|
12 |
|
---|
13 | <title>About Firmware</title>
|
---|
14 |
|
---|
15 | <indexterm zone="postlfs-firmware">
|
---|
16 | <primary sortas="e-lib-firmware">/lib/firmware</primary>
|
---|
17 | </indexterm>
|
---|
18 |
|
---|
19 | <para>
|
---|
20 | On some recent PCs it can be necessary, or desirable, to load firmware
|
---|
21 | to make them work at their best. There is a directory, <filename
|
---|
22 | class="directory">/lib/firmware</filename>, where the kernel or kernel
|
---|
23 | drivers look for firmware images.
|
---|
24 | </para>
|
---|
25 |
|
---|
26 | <para>
|
---|
27 | Currently, most firmware can be found at a <userinput>git</userinput>
|
---|
28 | repository which can be viewed in the browser with the URL
|
---|
29 | <ulink url="&linux-firmware-git;/plain"/>.
|
---|
30 | For convenience, the LFS Project has created a mirror, updated daily, where
|
---|
31 | these firmware files can be accessed via <userinput>wget</userinput> or a
|
---|
32 | web browser at <ulink url="&sources-anduin-http;/linux-firmware/"/>.
|
---|
33 | </para>
|
---|
34 |
|
---|
35 | <para>
|
---|
36 | To get the firmware, point a browser to one of the above
|
---|
37 | repositories and then download the item(s) which you need. If you want
|
---|
38 | all these firmware files (for example you are distributing the system
|
---|
39 | onto multiple hardware systems), either install <xref linkend="git"/>
|
---|
40 | and clone <ulink url='&linux-firmware-git;'/>, or open this URL in a
|
---|
41 | browser and download the latest snapshot listed in the
|
---|
42 | <literal>Tag</literal> table.
|
---|
43 | </para>
|
---|
44 |
|
---|
45 | <para>
|
---|
46 | For some other firmware, particularly for Intel microcode and certain
|
---|
47 | wifi devices, the needed firmware is not available in the above repository.
|
---|
48 | Some of this will be addressed below, but a search of the Internet for
|
---|
49 | needed firmware is sometimes necessary.
|
---|
50 | </para>
|
---|
51 |
|
---|
52 | <para>
|
---|
53 | Firmware files are conventionally referred to as blobs because you cannot
|
---|
54 | determine what they will do. Note that firmware is distributed under
|
---|
55 | various different licenses which do not permit disassembly or
|
---|
56 | reverse-engineering.
|
---|
57 | </para>
|
---|
58 |
|
---|
59 | <para>
|
---|
60 | Firmware for PCs falls into four categories:
|
---|
61 | </para>
|
---|
62 |
|
---|
63 | <itemizedlist spacing="compact">
|
---|
64 | <listitem>
|
---|
65 | <para>
|
---|
66 | Updates to the CPU to work around errata, usually referred to as
|
---|
67 | microcode.
|
---|
68 | </para>
|
---|
69 | </listitem>
|
---|
70 | <listitem>
|
---|
71 | <para>
|
---|
72 | Firmware for video controllers. On x86 machines this is required for
|
---|
73 | ATI devices (Radeon and AMDGPU chips) and may be useful for Intel (Skylake
|
---|
74 | and later) and Nvidia (Kepler and later) GPUs.
|
---|
75 | </para>
|
---|
76 |
|
---|
77 | <para>
|
---|
78 | ATI Radeon and AMDGPU devices all require firmware to be able to use KMS
|
---|
79 | (kernel modesetting - the preferred option) as well as for Xorg. For
|
---|
80 | old radeon chips (before the R600), the firmware is still in the
|
---|
81 | kernel source.
|
---|
82 | </para>
|
---|
83 |
|
---|
84 | <para>
|
---|
85 | Intel integrated GPUs from Skylake onwards can use firmware for GuC
|
---|
86 | (the Graphics microcontroller), and also for the HuC (HEVC/H265
|
---|
87 | microcontroller which offloads to the GPU) and the DMC (Display
|
---|
88 | Microcontroller) to provide additional low-power states. The GuC and
|
---|
89 | HuC have had a chequered history in the kernel and updated firmware
|
---|
90 | may be disabled by default, depending on your kernel version. Further
|
---|
91 | details may be found at <ulink
|
---|
92 | url="https://01.org/linuxgraphics/downloads/firmware/">01.org</ulink>
|
---|
93 | and <ulink
|
---|
94 | url="https://wiki.archlinux.org/index.php/intel_graphics">Arch
|
---|
95 | linux</ulink>.
|
---|
96 | </para>
|
---|
97 |
|
---|
98 | <para>
|
---|
99 | Nvidia GPUs from Kepler onwards require signed firmware, otherwise the
|
---|
100 | nouveau driver is unable to provide hardware acceleration. Nvidia has
|
---|
101 | now released firmware up to Ampere (GeForce30 series) to linux-firmware.
|
---|
102 | Note that faster clocks than the default are not enabled
|
---|
103 | by the released firmware.
|
---|
104 | </para>
|
---|
105 | </listitem>
|
---|
106 | <listitem>
|
---|
107 | <para>
|
---|
108 | Firmware updates for wired network ports. Most of them work even
|
---|
109 | without the updates, but they will probably 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.
|
---|
113 | </para>
|
---|
114 | </listitem>
|
---|
115 | <listitem>
|
---|
116 | <para>
|
---|
117 | Firmware for other devices, such as wireless NICs. These devices are not
|
---|
118 | required for the PC to boot, but need the firmware before these devices
|
---|
119 | can be used.
|
---|
120 | </para>
|
---|
121 | </listitem>
|
---|
122 | </itemizedlist>
|
---|
123 |
|
---|
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>
|
---|
135 |
|
---|
136 |
|
---|
137 | <sect2 id="cpu-microcode">
|
---|
138 | <title>Microcode updates for CPUs</title>
|
---|
139 |
|
---|
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 | <note>
|
---|
151 | <para>
|
---|
152 | In some rare cases a microcode update from the kernel can be
|
---|
153 | ineffective. For example, despite intel-microcode-20240910
|
---|
154 | <!-- deliberate hard coded version, not a bug --> contains the
|
---|
155 | Raptor Lake microcode revision 0x129 which is intended to fix a
|
---|
156 | notorious excessive voltage issue causing stability issues and even
|
---|
157 | permanent CPU damages, when the kernel boots it's already
|
---|
158 | <ulink url='https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/issues/78#issuecomment-2286857023'>too late</ulink>
|
---|
159 | for the microcode to fix the issue. The only way to fix this issue
|
---|
160 | is updating the BIOS.
|
---|
161 | </para>
|
---|
162 | </note>
|
---|
163 |
|
---|
164 | <para>
|
---|
165 | Intel provide updates of their microcode for Skylake and later
|
---|
166 | processors as new vulnerabilities come to light, and have in the past
|
---|
167 | provided updates for processors from SandyBridge onwards, although those
|
---|
168 | are no-longer supported for new fixes. New versions of AMD
|
---|
169 | firmware are rare and usually only apply to a few models, although
|
---|
170 | motherboard manufacturers get AGESA (AMD Generic Encapsulated Software
|
---|
171 | Architecture) updates to change BIOS values, e.g. to support more memory
|
---|
172 | variants, new vulnerability fixes or newer CPUs.
|
---|
173 | </para>
|
---|
174 |
|
---|
175 | <para>
|
---|
176 | There were two ways of loading the microcode, described as 'early' and
|
---|
177 | 'late'. Early loading happens before userspace has been started, late
|
---|
178 | loading happens after userspace has started. However, late loading is
|
---|
179 | known to be problematic and not supported anymore (see the kernel commit
|
---|
180 | <ulink url="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d23d33e">
|
---|
181 | x86/microcode: Taint and warn on late loading</ulink>). Indeed, early
|
---|
182 | loading is needed to work around one particular erratum in early Intel
|
---|
183 | Haswell processors which had TSX enabled. (See <ulink url=
|
---|
184 | "https://www.anandtech.com/show/8376/intel-disables-tsx-instructions-erratum-found-in-haswell-haswelleep-broadwelly/">
|
---|
185 | Intel Disables TSX Instructions: Erratum Found in Haswell,
|
---|
186 | Haswell-E/EP, Broadwell-Y</ulink>.)
|
---|
187 | Without this update glibc can do the wrong thing in uncommon
|
---|
188 | situations.
|
---|
189 | </para>
|
---|
190 |
|
---|
191 | <para>
|
---|
192 | In previous versions of this book, late loading of microcode to see if
|
---|
193 | it gets applied was recommended, followed by using an initrd to force
|
---|
194 | early loading. But now that the contents of the Intel microcode tarball
|
---|
195 | is documented, and AMD microcode can be read by a Python script to
|
---|
196 | determine which machines it covers, there is no real reason to use late
|
---|
197 | loading.
|
---|
198 | </para>
|
---|
199 |
|
---|
200 | <para>
|
---|
201 | It might be still possible to manually force late loading of microcode.
|
---|
202 | But it may cause kernel malfunction and you should take the risk yourself.
|
---|
203 | You will need to reconfigure your kernel for late loading, but
|
---|
204 | early loading is always supported by Linux kernel version 6.6
|
---|
205 | or later on a x86 (no matter 32-bit or 64-bit) system. The
|
---|
206 | instructions here will show you how to create an initrd for early
|
---|
207 | loading. It is also possible to build the same microcode bin file into
|
---|
208 | the kernel, which allows early loading but requires the kernel to be
|
---|
209 | recompiled to update the microcode.
|
---|
210 | </para>
|
---|
211 |
|
---|
212 | <para>
|
---|
213 | To confirm what processor(s) you have (if more than one, they will be
|
---|
214 | identical) look in /proc/cpuinfo. Determine the decimal values of the cpu
|
---|
215 | family, model and stepping by running the following command (it will also
|
---|
216 | report the current microcode version):
|
---|
217 | </para>
|
---|
218 |
|
---|
219 | <screen><userinput>head -n7 /proc/cpuinfo</userinput></screen>
|
---|
220 |
|
---|
221 | <para>
|
---|
222 | Convert the cpu family, model and stepping to pairs of hexadecimal
|
---|
223 | digits, and remember the value of the <quote>microcode</quote> field.
|
---|
224 | You can now check if there is any microcode available.
|
---|
225 | </para>
|
---|
226 |
|
---|
227 | <para>
|
---|
228 | If you are creating an initrd to update firmware for different machines,
|
---|
229 | as a distro would do, go down to 'Early loading of microcode' and cat all
|
---|
230 | the Intel blobs to GenuineIntel.bin or cat all the AMD blobs to
|
---|
231 | AuthenticAMD.bin. This creates a larger initrd - for all Intel machines in
|
---|
232 | the 20200609 update the size was 3.0 MB compared to typically 24 KB for one
|
---|
233 | machine.
|
---|
234 | </para>
|
---|
235 |
|
---|
236 | <sect3 id="intel-microcode">
|
---|
237 | <title>Intel Microcode for the CPU</title>
|
---|
238 |
|
---|
239 | <para>
|
---|
240 | The first step is to get the most recent version of the Intel
|
---|
241 | microcode. This must be done by navigating to <ulink url=
|
---|
242 | 'https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/releases/'/>
|
---|
243 | and downloading the latest file there. As of this writing the most
|
---|
244 | secure version of the microcode is microcode-&intel-microcode-version;.
|
---|
245 | Extract this file in the normal way, the microcode is in the
|
---|
246 | <filename>intel-ucode </filename> directory, containing various blobs
|
---|
247 | with names in the form XX-YY-ZZ. There are also various other files,
|
---|
248 | and a release note.
|
---|
249 | </para>
|
---|
250 |
|
---|
251 | <para>
|
---|
252 | In the past, intel did not provide any details of which blobs had
|
---|
253 | changed versions, but now the release note details this. You can
|
---|
254 | compare the microcode version in <filename>/proc/cpuinfo</filename>
|
---|
255 | with the version for your CPU model in the releasenote to know if
|
---|
256 | there is an update.
|
---|
257 | </para>
|
---|
258 |
|
---|
259 | <para>
|
---|
260 | The recent firmware for older processors is provided to deal with
|
---|
261 | vulnerabilities which have now been made public, and for some of these
|
---|
262 | such as Microarchitectural Data Sampling (MDS) you might wish to
|
---|
263 | increase the protection by disabling hyperthreading, or alternatively
|
---|
264 | to disable the kernel's default mitigation because of its impact on
|
---|
265 | compile times. Please read the online documentation at <ulink url=
|
---|
266 | 'https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/index.html'/>.
|
---|
267 | </para>
|
---|
268 |
|
---|
269 | <para>
|
---|
270 | For an Tigerlake mobile (described as Intel(R) Core(TM) i5-11300H
|
---|
271 | CPU) the relevant values are cpu family 6, model 140, stepping 1 so
|
---|
272 | in this case the required identification is 06-8c-01. The
|
---|
273 | releasenote says the latest microcode for it is versioned 0xb8. If
|
---|
274 | the value of the <quote>microcode</quote> field in
|
---|
275 | <filename>/proc/cpuinfo</filename> is 0xb8 or greater, it indicates
|
---|
276 | the microcode update is already applied by the BIOS. Otherwise,
|
---|
277 | proceed to <xref linkend='early-microcode'/>.
|
---|
278 | </para>
|
---|
279 | </sect3>
|
---|
280 |
|
---|
281 | <sect3 id="amd-microcode">
|
---|
282 | <title>AMD Microcode for the CPU</title>
|
---|
283 |
|
---|
284 | <para>
|
---|
285 | Begin by downloading a container of firmware for your CPU family
|
---|
286 | from <ulink url=
|
---|
287 | '&sources-anduin-http;/linux-firmware/amd-ucode/'/>.
|
---|
288 | The family is always specified in hex. Families 10h to 14h (16 to 20)
|
---|
289 | are in microcode_amd.bin. Families 15h, 16h, 17h (Zen, Zen+, Zen2) and
|
---|
290 | 19h (Zen3) have their own containers, but very few machines are likely to
|
---|
291 | get updated microcode. Instead, AMD provide an updated AGESA to the
|
---|
292 | motherboard makers, who may provide an updated BIOS using this.
|
---|
293 | There is a Python3 script at <ulink url=
|
---|
294 | 'https://github.com/AMDESE/amd_ucode_info/blob/master/amd_ucode_info.py'/>.
|
---|
295 | Download that script and run it against the bin file to check which
|
---|
296 | processors have updates.
|
---|
297 | </para>
|
---|
298 |
|
---|
299 | <para>
|
---|
300 | For the very old Athlon(tm) II X2 in these examples the values were
|
---|
301 | cpu family 16, model 5, stepping 3 giving an identification of
|
---|
302 | Family=0x10 Model=0x05 Stepping=0x03. One line of the
|
---|
303 | <command>amd_ucode_info.py</command> script output describes the
|
---|
304 | microcode version for it:
|
---|
305 | </para>
|
---|
306 |
|
---|
307 | <screen><computeroutput>Family=0x10 Model=0x05 Stepping=0x03: Patch=0x010000c8 Length=960 bytes</computeroutput></screen>
|
---|
308 |
|
---|
309 | <para>
|
---|
310 | If the value of the <quote>microcode</quote> field in
|
---|
311 | <filename>/proc/cpuinfo</filename> is 0x10000c8 or greater, it
|
---|
312 | indicates the BIOS has already applied the microcode update.
|
---|
313 | Otherwise, proceed to <xref linkend='early-microcode'/>.
|
---|
314 | </para>
|
---|
315 | </sect3>
|
---|
316 |
|
---|
317 | <sect3 id="early-microcode">
|
---|
318 | <title>Early loading of microcode</title>
|
---|
319 |
|
---|
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>
|
---|
326 |
|
---|
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>
|
---|
333 |
|
---|
334 | <screen><userinput>mkdir -p initrd/kernel/x86/microcode
|
---|
335 | cd initrd</userinput></screen>
|
---|
336 |
|
---|
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>
|
---|
342 |
|
---|
343 | <screen><userinput>cp -v ../<MYCONTAINER> kernel/x86/microcode/AuthenticAMD.bin</userinput></screen>
|
---|
344 |
|
---|
345 | <para>
|
---|
346 | Or for an Intel machine copy the appropriate blob using this command:
|
---|
347 | </para>
|
---|
348 |
|
---|
349 | <screen><userinput>cp -v ../intel-ucode/<XX-YY-ZZ> kernel/x86/microcode/GenuineIntel.bin</userinput></screen>
|
---|
350 |
|
---|
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.
|
---|
353 | <caution>
|
---|
354 | <para>
|
---|
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.
|
---|
359 | </para>
|
---|
360 |
|
---|
361 | <para>
|
---|
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.
|
---|
366 | </para>
|
---|
367 |
|
---|
368 | <para>
|
---|
369 | For a Skylake which does not boot with 0xdc, reverting to 0xd6 will make
|
---|
370 | the machine usable, but without the SRBDS mitigations.
|
---|
371 | </para>
|
---|
372 | </caution>-->
|
---|
373 |
|
---|
374 | <para>
|
---|
375 | Now prepare the initrd:
|
---|
376 | </para>
|
---|
377 |
|
---|
378 | <screen><userinput>find . | cpio -o -H newc > /boot/microcode.img</userinput></screen>
|
---|
379 |
|
---|
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>
|
---|
385 |
|
---|
386 | <screen><userinput>initrd /microcode.img</userinput></screen>
|
---|
387 |
|
---|
388 | <para>
|
---|
389 | or this if it is not:
|
---|
390 | </para>
|
---|
391 |
|
---|
392 | <screen><userinput>initrd /boot/microcode.img</userinput></screen>
|
---|
393 |
|
---|
394 | <para>
|
---|
395 | If you are already booting with an initrd (see <xref
|
---|
396 | linkend="initramfs"/>), you should run <command>mkinitramfs</command>
|
---|
397 | again after putting the appropriate blob or container into <filename
|
---|
398 | class="directory">/lib/firmware</filename>. More precisely, put an
|
---|
399 | intel blob in a <filename
|
---|
400 | class="directory">/lib/firmware/intel-ucode</filename> directory
|
---|
401 | or an AMD container in a <filename
|
---|
402 | class="directory">/lib/firmware/amd-ucode</filename> directory before
|
---|
403 | running <command>mkinitramfs</command>.
|
---|
404 | Alternatively, you can have both initrd on the same line, such as
|
---|
405 | <userinput>initrd /microcode.img /other-initrd.img</userinput> (adapt
|
---|
406 | that as above if /boot is not a separate mountpoint).
|
---|
407 | </para>
|
---|
408 |
|
---|
409 | <para>
|
---|
410 | You can now reboot with the added initrd, and then use the following
|
---|
411 | command to check that the early load worked:
|
---|
412 | </para>
|
---|
413 |
|
---|
414 | <screen><userinput>dmesg | grep -e 'microcode' -e 'Linux version' -e 'Command line'</userinput></screen>
|
---|
415 |
|
---|
416 | <para>
|
---|
417 | If you updated to address vulnerabilities, you can look at the
|
---|
418 | output of the <command>lscpu</command> command to see what is now
|
---|
419 | reported.
|
---|
420 | </para>
|
---|
421 |
|
---|
422 | <para>
|
---|
423 | The places and times where early loading happens are very different
|
---|
424 | in AMD and Intel machines. First, an example of an Intel (Tigerlake
|
---|
425 | mobile) with early loading:
|
---|
426 | </para>
|
---|
427 |
|
---|
428 | <screen><literal>[ 0.000000] Linux version 6.10.4 (xry111@stargazer) (gcc (GCC) 14.2.0, GNU ld (GNU Binutils) 2.43) #4 SMP PREEMPT_DYNAMIC Tue Aug 15 18:04:11 CST 2024
|
---|
429 | [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-6.10.0 root=PARTUUID=<replaceable><CLASSIFIED></replaceable> ro
|
---|
430 | [ 0.585605] microcode: Current revision: 0x000000b8
|
---|
431 | [ 0.585611] microcode: Updated early from: 0x00000086</literal></screen>
|
---|
432 |
|
---|
433 | <para>
|
---|
434 | A historic AMD example:
|
---|
435 | </para>
|
---|
436 |
|
---|
437 | <screen><literal>[ 0.000000] Linux version 4.15.3 (ken@testserver) (gcc version 7.3.0 (GCC))
|
---|
438 | #2 SMP Sun Feb 18 02:32:03 GMT 2018
|
---|
439 | [ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.15.3-sda5 root=/dev/sda5 ro
|
---|
440 | [ 0.307619] microcode: microcode updated early to new patch_level=0x010000c8
|
---|
441 | [ 0.307678] microcode: CPU0: patch_level=0x010000c8
|
---|
442 | [ 0.307723] microcode: CPU1: patch_level=0x010000c8
|
---|
443 | [ 0.307795] microcode: Microcode Update Driver: v2.2.</literal></screen>
|
---|
444 |
|
---|
445 | </sect3>
|
---|
446 |
|
---|
447 | </sect2>
|
---|
448 |
|
---|
449 | <sect2 id="video-firmware">
|
---|
450 | <title>Firmware for Video Cards</title>
|
---|
451 |
|
---|
452 | <sect3 id="ati-video-firmware">
|
---|
453 | <title>Firmware for ATI video chips (R600 and later)</title>
|
---|
454 |
|
---|
455 | <para>
|
---|
456 | These instructions do NOT apply to old radeons before the R600
|
---|
457 | family. For those, the firmware is in the kernel's <filename
|
---|
458 | class='directory'>/lib/firmware/</filename> directory. Nor do they
|
---|
459 | apply if you intend to avoid a graphical setup such as Xorg and are
|
---|
460 | content to use the default 80x25 display rather than a framebuffer.
|
---|
461 | </para>
|
---|
462 |
|
---|
463 | <para>
|
---|
464 | Early radeon devices only needed a single 2K blob of firmware. Recent
|
---|
465 | devices need several different blobs, and some of them are much bigger.
|
---|
466 | The total size of the radeon firmware directory is over 500K —
|
---|
467 | on a large modern system you can probably spare the space, but it is
|
---|
468 | still redundant to install all the unused files each time you build
|
---|
469 | a system.
|
---|
470 | </para>
|
---|
471 |
|
---|
472 | <para>
|
---|
473 | A better approach is to install <xref linkend='pciutils'/> and then
|
---|
474 | use <userinput>lspci</userinput> to identify which VGA controller is
|
---|
475 | installed.
|
---|
476 | </para>
|
---|
477 |
|
---|
478 | <para>
|
---|
479 | With that information, check the RadeonFeature page of the Xorg wiki
|
---|
480 | for <ulink url="https://wiki.x.org/wiki/RadeonFeature/#index5h2">Decoder
|
---|
481 | ring for engineering vs marketing names</ulink> to identify the family
|
---|
482 | (you may need to know this for the Xorg driver in BLFS —
|
---|
483 | Southern Islands and Sea Islands use the radeonsi driver) and the
|
---|
484 | specific model.
|
---|
485 | </para>
|
---|
486 |
|
---|
487 | <para>
|
---|
488 | Now that you know which controller you are using, consult the
|
---|
489 | <ulink url="https://wiki.gentoo.org/wiki/Radeon#Firmware">
|
---|
490 | Radeon</ulink> page of the Gentoo wiki which has a table listing
|
---|
491 | the required firmware blobs for the various chipsets. Note that
|
---|
492 | Southern Islands and Sea Islands chips use different firmware for
|
---|
493 | kernel 3.17 and later compared to earlier kernels. Identify and
|
---|
494 | download the required blobs then install them:
|
---|
495 | </para>
|
---|
496 |
|
---|
497 | <screen><userinput>mkdir -pv /lib/firmware/radeon
|
---|
498 | cp -v <YOUR_BLOBS> /lib/firmware/radeon</userinput></screen>
|
---|
499 |
|
---|
500 | <para>
|
---|
501 | Building the kernel amdgpu driver as a module is recommended because
|
---|
502 | the firmware files need to be accessible at the time it is loaded.
|
---|
503 | If you are building it as a part of the kernel image for any reason,
|
---|
504 | you need to either include the firmware files in the initramfs (read
|
---|
505 | <xref linkend='initramfs'/> for details), or include them in the
|
---|
506 | kernel image itself (read <xref linkend='firmware-in-kernel-image'/>
|
---|
507 | for details).
|
---|
508 | </para>
|
---|
509 |
|
---|
510 | </sect3>
|
---|
511 |
|
---|
512 | <sect3 id="amdgpu-video-firmware">
|
---|
513 | <title>Firmware for AMD/ATI amdgpu video chips</title>
|
---|
514 |
|
---|
515 | <para>
|
---|
516 | All video controllers using the amdgpu kernel driver require firmware,
|
---|
517 | whether you will be using the xorg amdgpu driver, the xserver's modesetting
|
---|
518 | driver, or just kernel modesetting to get a console framebuffer larger than
|
---|
519 | 80x25.
|
---|
520 | </para>
|
---|
521 |
|
---|
522 | <para>
|
---|
523 | Install <xref linkend="pciutils"/> and use that to check the model name
|
---|
524 | (look for 'VGA compatible controller:'). If you have an APU (Accelerated
|
---|
525 | Processing Unit, i.e. CPU and video on the same chip) that will probably
|
---|
526 | tell you the name. If you have a separate amdgpu video card you will need
|
---|
527 | to search to determine which name it uses (e.g. a card described as
|
---|
528 | Advanced Micro Devices, Inc. [AMD/ATI] Baffin [Radeon RX 550 640SP / RX
|
---|
529 | 560/560X] needs Polaris11 firmware. There is a table of "Family, Chipset
|
---|
530 | name, Product name and Firmware" at the end of the Kernel sections in
|
---|
531 | <ulink url="https://wiki.gentoo.org/wiki/AMDGPU#Known_firmware_blobs">
|
---|
532 | AMDGPU</ulink> page of the Gentoo wiki.
|
---|
533 | </para>
|
---|
534 |
|
---|
535 | <para>
|
---|
536 | Once you have identified the firmware name, install all the relevant
|
---|
537 | files for it. For example, the Baffin card mentioned above has 21 different
|
---|
538 | polaris11* files, APUs such as renoir and picasso have at least 12 files and
|
---|
539 | might gain more in future updates (e.g. the raven APU now has a 13th file,
|
---|
540 | raven_ta.bin).
|
---|
541 | </para>
|
---|
542 |
|
---|
543 | <screen><userinput>mkdir -pv /lib/firmware/amdgpu
|
---|
544 | cp -v <YOUR_BLOBS> /lib/firmware/amdgpu</userinput></screen>
|
---|
545 |
|
---|
546 | <para>
|
---|
547 | If disk space is not a problem, you could install all the current amdgpu
|
---|
548 | firmware files and not worry about exactly which chipset is installed.
|
---|
549 | </para>
|
---|
550 |
|
---|
551 | <para>
|
---|
552 | Building the kernel amdgpu driver as a module is recommended because
|
---|
553 | the firmware files need to be accessible at the time it is loaded.
|
---|
554 | If you are building it as a part of the kernel image for any reason,
|
---|
555 | you need to either include the firmware files in the initramfs (read
|
---|
556 | <xref linkend='initramfs'/> for details), or include them in the
|
---|
557 | kernel image itself (read <xref linkend='firmware-in-kernel-image'/>
|
---|
558 | for details).
|
---|
559 | </para>
|
---|
560 |
|
---|
561 | </sect3>
|
---|
562 |
|
---|
563 | <sect3 id="nvidia-video-firmware">
|
---|
564 | <title>Firmware for Nvidia video chips</title>
|
---|
565 |
|
---|
566 | <para>
|
---|
567 | Nvidia has released basic signed firmware for recent graphics chips,
|
---|
568 | but significantly after the chips and its own binary drivers were first
|
---|
569 | available. For other chips it has been necessary to extract the firmware
|
---|
570 | from the binary driver.
|
---|
571 | </para>
|
---|
572 | <para>
|
---|
573 | For more exact information about which chips need extracted firmware, see
|
---|
574 | <ulink url=
|
---|
575 | "https://nouveau.freedesktop.org/VideoAcceleration.html"/>.
|
---|
576 | </para>
|
---|
577 |
|
---|
578 | <para>
|
---|
579 | If the necessary firmware is available in the
|
---|
580 | <filename class="directory">nvidia/</filename> directory of
|
---|
581 | linux-firmware, copy it to
|
---|
582 | <filename class="directory">/lib/firmware/nouveau</filename>.
|
---|
583 | </para>
|
---|
584 | <para>
|
---|
585 | If the firmware has not been made available in linux-firmware,
|
---|
586 | for the old chips mentioned in the nouveau wiki link above
|
---|
587 | run the following commands:
|
---|
588 | </para>
|
---|
589 |
|
---|
590 | <screen><userinput>wget https://anduin.linuxfromscratch.org/BLFS/nvidia-firmware/extract_firmware.py
|
---|
591 | wget https://us.download.nvidia.com/XFree86/Linux-x86/340.32/NVIDIA-Linux-x86-340.32.run
|
---|
592 | sh NVIDIA-Linux-x86-340.32.run --extract-only
|
---|
593 | python3 extract_firmware.py
|
---|
594 | mkdir -p /lib/firmware/nouveau
|
---|
595 | cp -d nv* vuc-* /lib/firmware/nouveau/</userinput></screen>
|
---|
596 |
|
---|
597 | </sect3>
|
---|
598 | </sect2>
|
---|
599 |
|
---|
600 | <sect2 id="nic-firmware">
|
---|
601 | <title>Firmware for Network Interfaces</title>
|
---|
602 |
|
---|
603 | <para>
|
---|
604 | The kernel likes to load firmware for some network drivers, particularly
|
---|
605 | those from Realtek (the /lib/linux-firmware/rtl_nic/) directory, but
|
---|
606 | they generally appear to work without it. Therefore, you can boot the
|
---|
607 | kernel, check dmesg for messages about this missing firmware, and if
|
---|
608 | necessary download the firmware and put it in the specified directory in
|
---|
609 | <filename class="directory">/lib/firmware</filename> so that it will
|
---|
610 | be found on subsequent boots. Note that with current kernels this
|
---|
611 | works whether or not the driver is compiled in or built as a module,
|
---|
612 | there is no need to build this firmware into the kernel.
|
---|
613 | Here is an example where the R8169 driver has been compiled in but the
|
---|
614 | firmware was not made available. Once the firmware had been provided,
|
---|
615 | there was no mention of it on later boots.
|
---|
616 | </para>
|
---|
617 |
|
---|
618 | <screen><literal>dmesg | grep firmware | grep r8169
|
---|
619 | [ 7.018028] r8169 0000:01:00.0: Direct firmware load for rtl_nic/rtl8168g-2.fw failed with error -2
|
---|
620 | [ 7.018036] r8169 0000:01:00.0 eth0: unable to load firmware patch rtl_nic/rtl8168g-2.fw (-2)</literal></screen>
|
---|
621 |
|
---|
622 | </sect2>
|
---|
623 |
|
---|
624 | <sect2 id="regulatory-db">
|
---|
625 | <title>Firmware for Regulatory Database of Wireless Devices</title>
|
---|
626 |
|
---|
627 | <para>
|
---|
628 | Different countries have different regulations on the radio spectrum
|
---|
629 | usage of wireless devices. You can install a firmware to make the
|
---|
630 | wireless devices obey local spectrum regulations, so you won't be
|
---|
631 | inquired by local authority or find your wireless NIC jamming the
|
---|
632 | frequencies of other devices (for example, remote controllers).
|
---|
633 | The regulatory database firmware can be downloaded from
|
---|
634 | <ulink url = 'https://kernel.org/pub/software/network/wireless-regdb/'/>.
|
---|
635 | To install it, simply extract <filename>regulatory.db</filename> and
|
---|
636 | <filename>regulatory.db.p7s</filename> from the tarball into
|
---|
637 | <filename class="directory">/lib/firmware</filename>. Note that either
|
---|
638 | the <option>cfg80211</option> driver needs to be selected as a module
|
---|
639 | for the <filename>regulatory.*</filename>
|
---|
640 | files to be loaded, or those files need to be included as firmware into
|
---|
641 | the kernel, as explained above in <xref linkend="video-firmware"/>.
|
---|
642 | </para>
|
---|
643 |
|
---|
644 | <para>
|
---|
645 | The access point (AP) would send a country code to your wireless NIC,
|
---|
646 | and <xref linkend='wpa_supplicant'/> would tell the kernel to load
|
---|
647 | the regulation of this country from
|
---|
648 | <filename>regulatory.db</filename>, and enforce it. Note that several AP
|
---|
649 | don't send this country code, so you may be locked to a rather
|
---|
650 | restricted usage (specially if you want to use your interface as an AP).
|
---|
651 | </para>
|
---|
652 | </sect2>
|
---|
653 |
|
---|
654 | <sect2 id="sound-open-firmware">
|
---|
655 | <title>Sound Open Firmware</title>
|
---|
656 |
|
---|
657 | <para>
|
---|
658 | Some systems (especially budget laptops) utilize a DSP shipped with
|
---|
659 | the CPU for connection with the audio codec. The Sound Open Firmware
|
---|
660 | must be loaded onto the DSP to make it functional. These firmware
|
---|
661 | files can be downloaded from
|
---|
662 | <ulink url='https://github.com/thesofproject/sof-bin/releases'/>.
|
---|
663 | Extract the tarball and changing into the extracted directory,
|
---|
664 | then as the &root; user install the firmware:
|
---|
665 | </para>
|
---|
666 |
|
---|
667 | <screen role="nodump"><userinput>install -vdm755 /usr/lib/firmware/intel &&
|
---|
668 | cp -av -T --no-preserve=ownership sof \
|
---|
669 | /usr/lib/firmware/intel/sof &&
|
---|
670 | cp -av -T --no-preserve=ownership sof-tplg \
|
---|
671 | /usr/lib/firmware/intel/sof-tplg</userinput></screen>
|
---|
672 |
|
---|
673 | <para>
|
---|
674 | <xref linkend="alsa-lib"/> needs Use Case Manager configuration files
|
---|
675 | for the systems using Sound Open Firmware as well. Read the
|
---|
676 | <xref linkend="alsa-lib"/> page for the instructions to install them.
|
---|
677 | Once the firmware is loaded (you may need a reboot so the kernel will
|
---|
678 | load them) and the UCM configuration files are installed, following
|
---|
679 | <xref linkend="alsa-utils-config-sect"/> to set up your sound card for
|
---|
680 | ALSA properly.
|
---|
681 | </para>
|
---|
682 | </sect2>
|
---|
683 |
|
---|
684 | <sect2 id="other-firmware">
|
---|
685 | <title>Firmware for Other Devices</title>
|
---|
686 |
|
---|
687 | <para>
|
---|
688 | Identifying the correct firmware will typically require you to install
|
---|
689 | <xref linkend='pciutils'/>, and then use <userinput>lspci</userinput>
|
---|
690 | to identify the device. You should then search online to check which
|
---|
691 | module it uses, which firmware, and where to obtain the firmware —
|
---|
692 | not all of it is in linux-firmware.
|
---|
693 | </para>
|
---|
694 |
|
---|
695 | <para>
|
---|
696 | If possible, you should begin by using a wired connection when you first
|
---|
697 | boot your LFS system. To use a wireless connection you will need to
|
---|
698 | use a network tools such as <xref linkend="iw"/>,
|
---|
699 | <xref linkend='wireless_tools'/>, or <xref linkend='wpa_supplicant'/>.
|
---|
700 | </para>
|
---|
701 |
|
---|
702 | <para>
|
---|
703 | Firmware may also be needed for other devices such as some SCSI
|
---|
704 | controllers, bluetooth adaptors, or TV recorders. The same principles
|
---|
705 | apply.
|
---|
706 | </para>
|
---|
707 |
|
---|
708 | </sect2>
|
---|
709 |
|
---|
710 | <sect2 id='firmware-in-kernel-image'>
|
---|
711 | <title>Include Firmware Blobs in the Kernel Image</title>
|
---|
712 |
|
---|
713 | <para>
|
---|
714 | Some drivers, notably the drivers for ATI or AMD GPU, requires the
|
---|
715 | firmware files accessible at the time it is loaded. The easiest
|
---|
716 | method to handle these drivers is building them as a kernel module.
|
---|
717 | An alternative method is creating an initramfs (read
|
---|
718 | <xref linkend='initramfs'/> for details) including the firmware files.
|
---|
719 | If you don't want to use either methods, you may include the firmware
|
---|
720 | files in the kernel image itself. Install the needed firmware files
|
---|
721 | into <filename class='directory'>/lib/firmware</filename> first, then
|
---|
722 | set the following kernel configuration and rebuild the kernel:
|
---|
723 | </para>
|
---|
724 |
|
---|
725 | <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
---|
726 | href="builtin-fw-kernel.xml"/>
|
---|
727 |
|
---|
728 | <para>
|
---|
729 | Replace <replaceable>xx/aa.bin xx/bb.bin</replaceable>
|
---|
730 | with a whitespace-separated list of paths to the needed firmware
|
---|
731 | files, relative to
|
---|
732 | <filename class='directory'>/lib/firmware</filename>. A method
|
---|
733 | easier than manually typing the list (it may be long) is running the
|
---|
734 | following command:
|
---|
735 | </para>
|
---|
736 |
|
---|
737 | <screen><userinput>echo CONFIG_EXTRA_FIRMWARE='"'$({ cd /lib/firmware; echo <replaceable>amdgpu/*</replaceable> })'"' >> .config
|
---|
738 | make oldconfig</userinput></screen>
|
---|
739 |
|
---|
740 | <para>
|
---|
741 | Replace <replaceable>amdgpu/*</replaceable> with a shell pattern
|
---|
742 | matching the needed firmware files.
|
---|
743 | </para>
|
---|
744 |
|
---|
745 | <warning>
|
---|
746 | <para>
|
---|
747 | Do not distribute a kernel image containing the firmware to others
|
---|
748 | or you may violate the GPL.
|
---|
749 | </para>
|
---|
750 | </warning>
|
---|
751 |
|
---|
752 | </sect2>
|
---|
753 |
|
---|
754 | </sect1>
|
---|