Linux 固件

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Linux firmware and the translation is 59% complete.
Outdated translations are marked like this.
Other languages:

Linux 固件是与 Linux 内核一起发行的软件包,它包含了某些硬件设备部分或全部功能所需固件的二进制 blob 。 因为一些硬件制造商不开放构建固件的源代码,所以这些二进制 blob 一般来说是专有 blob。

现在的超威半导体英伟达显卡一般都需要二进制 blob 才能正确的加载硬件。

Starting at Broxton (a Skylake-based micro-architecture) Intel CPUs require binary blobs for additional low-power idle states (DMC), graphics workload scheduling on the various graphics parallel engines (GuC), and offloading some media functions from the CPU to GPU (HuC).[1]

此外,现在的英特尔 Wi-Fi 芯片组大多都需要 blob。[2]

安装

出于安全原因,要避免在运行中的内核热加载固件。现代的 init 系统,比如说

systemd 强烈反对从用户空间加载固件。

内核

警告
Including firmware files into binary kernel images that are not available under the terms of the GPL, may result in a violation of the GPL if the image is distributed. It is wise to consult a lawyer before distributing images that contain firmware files from sys-kernel/linux-firmware.

A few kernel options are important to consider when building in firmware support for certain devices in the Linux kernel (for kernels beginning with 4.18):

Firmware loading facility (CONFIG_FW_LOADER)
This option is provided for the case where none of the in-tree modules require userspace firmware loading support, but a module built out-of-tree does.
Build named firmware blobs into the kernel binary (CONFIG_EXTRA_FIRMWARE)
This option is a string and takes the (space-separated) names of firmware files to be built into the kernel. These files will then be accessible to the kernel at runtime.
内核 Enable support for Linux firmware
Device Drivers  --->
  Generic Driver Options  --->
    Firmware loader --->
       -*- Firmware loading facility
       ()    Build named firmware blobs into the kernel binary
       # Optional: Enable compressed firmware support
       [*]   Enable compressed firmware support
       [*]     Enable XZ-compressed firmware support
       [*]     Enable ZSTD-compressed firmware support

USE 标记

USE flags for sys-kernel/linux-firmware Linux firmware files

bindist Flag to enable or disable options for prebuilt (GRP) packages (eg. due to licensing issues)
compress-xz Compress firmware using xz (app-arch/xz-utils) before installation
compress-zstd Compress firmware using zstd (app-arch/zstd) before installation
deduplicate Create symlinks for all firmware that is duplicate using rdfind
initramfs Create and install initramfs for early microcode loading in /boot (only AMD for now)
redistributable Install also non-free (but redistributable) firmware files
savedconfig Allows individual selection of firmware files
unknown-license Install firmware files whose license is unknown

Emerge

root #emerge --ask sys-kernel/linux-firmware

可选:Savedconfig

After emerging sys-kernel/linux-firmware, the configuration file is made into /etc/portage/savedconfig/sys-kernel/linux-firmware-ddmmyyyy. This file can be edited and the unwanted lines be commented out or deleted. Edit and save the file and re-emerge sys-kernel/linux-firmware with the savedconfig USE flag:

root #echo sys-kernel/linux-firmware savedconfig >> /etc/portage/package.use/kernel
root #emerge --ask sys-kernel/linux-firmware

可选:压缩

Firmware to be loaded into the kernel can be compressed in order to achieve greater space efficiency and faster read speeds (at the expense of processing time). See the CONFIG_FW_LOADER_COMPRESS kernel symbol for additional information.

sys-kernel/linux-firmware supports either xz or zstd (starting from Linux kernel 5.19[3]) compression via appropriate USE-flags. The kernel configuration should include CONFIG_FW_LOADER_COMPRESS_XZ and/or CONFIG_FW_LOADER_COMPRESS_ZSTD options to support these compression formats.

故障排除

Searching for loaded firmware

dmesg can be grepped to determine what firmware has been loaded:

user $dmesg | grep -i firmware

移除

Unmerge

root #emerge --ask --depclean --verbose sys-kernel/linux-firmware

另请参阅

  • Fwupd — a daemon that provides a safe, reliable way of applying firmware updates on Linux.
  • Kernel — 操作系统的核心。
  • IwlwifiIntel's current wireless chips的无线驱动
  • Microcode — describes various ways to update a CPU's microcode in Gentoo.
  • AMDGPU — 新一代开源图形驱动程序系列,采用新的显示核心(Display Core, DC)框架,专为 Vega、Raven Ridge 及后续 GPU 设计。然而,它还能够支持基于 GCN1.0+ 架构的较新 AMD/ATI Radeon 系列显卡,包括但不限于南方群岛(Southern Islands)、海洋群岛(Sea Islands)、火山群岛(Volcanic Islands)以及北极群岛(Arctic Islands)系列芯片组。
  • Intel — the open source graphics driver for Intel GMA on-board graphics cards and Intel Arc dedicated graphics cards, starting with the Intel 810.

外部资源

参考