← Documents Documentation/filesystems/efivarfs.rst GitHub 원문 ↗

Linux 6.18.37 · Filesystems

efivarfs - a (U)EFI variable filesystem

efivarfs의 sysfs 대체 배경, immutable firmware 보호와 attributes·payload binary layout을 다룬 전문 번역입니다.

Source pathDocumentation/filesystems/efivarfs.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

efivarfs.rst:1-43

efivarfs는 sysfs의 오래된 1024-byte 제한 없이 UEFI variable을 file로 관리합니다. firmware 손상을 막기 위해 비표준 variable은 immutable로 만들며 file의 첫 4 bytes는 little-endian attributes, 나머지는 data입니다.

efivar file 해석
variable file이 표준인지 확인비표준 file은 immutable 보호 유지필요한 경우에만 `chattr -i`binary read의 처음 4 bytes를 attributes로 해석offset 4 이후를 variable data로 처리

file 보호를 해제하거나 payload를 읽기 전에 확인할 순서입니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =======================================
4 efivarfs - a (U)EFI variable filesystem
5 =======================================
6
7 The efivarfs filesystem was created to address the shortcomings of
8 using entries in sysfs to maintain EFI variables. The old sysfs EFI
9 variables code only supported variables of up to 1024 bytes. This
10 limitation existed in version 0.99 of the EFI specification, but was
11 removed before any full releases. Since variables can now be larger
12 than a single page, sysfs isn't the best interface for this.
13
14 Variables can be created, deleted and modified with the efivarfs
15 filesystem.
16
17 efivarfs is typically mounted like this::
18
19 mount -t efivarfs none /sys/firmware/efi/efivars
20
21 Due to the presence of numerous firmware bugs where removing non-standard
22 UEFI variables causes the system firmware to fail to POST, efivarfs
23 files that are not well-known standardized variables are created
24 as immutable files. This doesn't prevent removal - "chattr -i" will work -
25 but it does prevent this kind of failure from being accomplished
26 accidentally.
27
28 .. warning ::
29 When a content of an UEFI variable in /sys/firmware/efi/efivars is
30 displayed, for example using "hexdump", pay attention that the first
31 4 bytes of the output represent the UEFI variable attributes,
32 in little-endian format.
33
34 Practically the output of each efivar is composed of:
35
36 +-----------------------------------+
37 |4_bytes_of_attributes + efivar_data|
38 +-----------------------------------+
39
40 *See also:*
41
42 - Documentation/admin-guide/acpi/ssdt-overlays.rst
43 - Documentation/ABI/removed/sysfs-firmware-efi-vars
44

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Sysfs 한계와 efivarfs mount

1-20

efivarfs는 sysfs entry로 EFI variable을 관리하던 방식의 한계를 해결하기 위해 만들어졌습니다. 과거 sysfs EFI variable 코드는 최대 1024 bytes만 지원했습니다.

이 제한은 EFI specification 0.99에 있었지만 정식 release 전 제거되었습니다. 현재 variable은 한 page보다 클 수 있으므로 sysfs는 적절한 interface가 아닙니다.

efivarfs에서는 variable을 생성·삭제·수정할 수 있습니다. 일반적인 mount 명령은 `mount -t efivarfs none /sys/firmware/efi/efivars`입니다.

EFI variable interface 전환
과거 sysfs interface는 variable당 1024-byte 제한EFI 0.99 이후 specification에서 제한 제거한 page보다 큰 variable 출현efivarfs가 file 단위 생성·삭제·수정 제공`/sys/firmware/efi/efivars`에 mount

크기 제한이 있는 sysfs에서 전용 filesystem으로 옮긴 이유입니다.

.. SPDX-License-Identifier: GPL-2.0

=======================================
efivarfs - a (U)EFI variable filesystem
=======================================

The efivarfs filesystem was created to address the shortcomings of
using entries in sysfs to maintain EFI variables. The old sysfs EFI
variables code only supported variables of up to 1024 bytes. This
limitation existed in version 0.99 of the EFI specification, but was
removed before any full releases. Since variables can now be larger
than a single page, sysfs isn't the best interface for this.

Variables can be created, deleted and modified with the efivarfs
filesystem.

efivarfs is typically mounted like this::

        mount -t efivarfs none /sys/firmware/efi/efivars

Immutable 보호와 binary layout

21-43

비표준 UEFI variable을 제거하면 firmware가 POST에 실패하는 bug가 많기 때문에, 잘 알려진 표준 variable이 아닌 efivarfs file은 immutable로 생성됩니다. `chattr -i`를 사용하면 제거할 수 있지만 실수로 firmware failure를 일으키는 상황을 막습니다.

`/sys/firmware/efi/efivars`의 UEFI variable 내용을 `hexdump` 등으로 표시할 때는 처음 4 bytes가 little-endian UEFI variable attributes라는 점에 유의해야 합니다.

각 efivar file의 실제 layout은 `4_bytes_of_attributes + efivar_data`입니다.

관련 문서는 `Documentation/admin-guide/acpi/ssdt-overlays.rst`와 `Documentation/ABI/removed/sysfs-firmware-efi-vars`입니다.

efivar file binary layout
Byte rangeFieldEncoding
0-3UEFI variable attributeslittle-endian 4 bytes
4-endefivar datavariable payload

원문의 ASCII box를 같은 의미의 field 표로 정리했습니다.

Due to the presence of numerous firmware bugs where removing non-standard
UEFI variables causes the system firmware to fail to POST, efivarfs
files that are not well-known standardized variables are created
as immutable files.  This doesn't prevent removal - "chattr -i" will work -
but it does prevent this kind of failure from being accomplished
accidentally.

.. warning ::
      When a content of an UEFI variable in /sys/firmware/efi/efivars is
      displayed, for example using "hexdump", pay attention that the first
      4 bytes of the output represent the UEFI variable attributes,
      in little-endian format.

      Practically the output of each efivar is composed of:

          +-----------------------------------+
          |4_bytes_of_attributes + efivar_data|
          +-----------------------------------+

*See also:*

- Documentation/admin-guide/acpi/ssdt-overlays.rst
- Documentation/ABI/removed/sysfs-firmware-efi-vars