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