Skip to contentSkip to conversation

systemd: mount the EFI variable filesystem

PATCH In review Lee, Chun-Yi 6 participants 6 messages Oct 27, 2012 – Nov 5, 2012 3 messages not in the archive EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 systemd: mount the EFI variable filesystem

Add efivarfs to the mount_table in mount-setup.c, so the EFI variable filesystem will be mounted when systemd executed.

The EFI variable filesystem will merge in v3.7 or v3.8 linux kernel.

Cc Kay Sievers <[email protected]>
Cc Lennart Poettering <[email protected]>
Cc Mantas MikulÄ—nas <[email protected]>
Cc Zbigniew JÄ™drzejewski-Szmek <zbyszek-wrcVdnn0TatmR6Xm/[email protected]>
Cc Matt Fleming <[email protected]>
Cc Jeremy Kerr <[email protected]>
Cc Matthew Garrett <[email protected]>
---
 src/core/kmod-setup.c  |    1 +
 src/core/mount-setup.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
src/core/kmod-setup.c +1 -0
index cc2a2d9..14a4778 100644
@@ -33,6 +33,7 @@
 static const char * const kmod_table[] = {
         "autofs4", "/sys/class/misc/autofs",
         "ipv6",    "/sys/module/ipv6",
+	"efivarfs", "/sys/firmware/efi/efivars",
         "unix",    "/proc/net/unix"
 };
 
src/core/mount-setup.c +1 -0
index 0fd112f..8ce4ddc 100644
@@ -66,6 +66,7 @@ static const MountPoint mount_table[] = {
         { "sysfs",    "/sys",                   "sysfs",    NULL,                MS_NOSUID|MS_NOEXEC|MS_NODEV,                true,  true  },
         { "devtmpfs", "/dev",                   "devtmpfs", "mode=755",          MS_NOSUID|MS_STRICTATIME,                    true,  true  },
         { "securityfs", "/sys/kernel/security", "securityfs", NULL,              MS_NOSUID|MS_NOEXEC|MS_NODEV,                false, false },
+	{ "efivarfs", "/sys/firmware/efi/efivars", "efivarfs", NULL,		 MS_NOSUID|MS_NOEXEC|MS_NODEV,                false, false },
         { "tmpfs",    "/dev/shm",               "tmpfs",    "mode=1777",         MS_NOSUID|MS_NODEV|MS_STRICTATIME,           true,  true  },
         { "devpts",   "/dev/pts",               "devpts",   "mode=620,gid=" STRINGIFY(TTY_GID), MS_NOSUID|MS_NOEXEC,          false, true  },
         { "tmpfs",    "/run",                   "tmpfs",    "mode=755",          MS_NOSUID|MS_NODEV|MS_STRICTATIME,           true,  true  },
Signature · 1 line
1.6.0.2
#2 lore raw
In reply to a message not in the archive
Quoted 4 lines · Chun-Yi

Add efivarfs to the mount_table in mount-setup.c, so the EFI variable filesystem will be mounted when systemd executed.

The EFI variable filesystem will merge in v3.7 or v3.8 linux kernel.

I can't really test this, but looks reasonably simple, and I assume this has been tested, so I merged this.

Thanks!

Lennart

Signature · 1 line
Lennart Poettering - Red Hat, Inc.
#4 lore raw
In reply to a message not in the archive

於 日,2012-10-28 於 14:00 +0100,Lennart Poettering 提到:

Quoted 5 lines · Chun-Yi
Quoted 4 lines

Add efivarfs to the mount_table in mount-setup.c, so the EFI variable filesystem will be mounted when systemd executed.

Quoted 9 lines
Quoted 1 line

The EFI variable filesystem will merge in v3.7 or v3.8 linux kernel.

I can't really test this, but looks reasonably simple, and I assume this has been tested, so I merged this.

Thanks!

Lennart

I tested this patch on my UEFI notebook with latest EFI kernel git tree, the efivarfs mounted normally after system boot and I can delete/add EFI variable through /sys/firmware/efi/efivars.

Thanks for your review and merged.

Thanks a lot!
Joey Lee

#5 lore raw
Quoted 3 lines · joeyli

I tested this patch on my UEFI notebook with latest EFI kernel git tree, the efivarfs mounted normally after system boot and I can delete/add EFI variable through /sys/firmware/efi/efivars.

This causes systemd to output a warning if the kernel doesn't have an efivars module. I suppose to do this kind of thing "right" we'd have to conditionalize the module loads on available kernel version they first appeared in?

(Yes, I frequently I boot bleeding edge systemd from git on older kernels)

#6 lore raw
Quoted 10 lines · Colin Walters
Quoted 3 lines · joeyli

I tested this patch on my UEFI notebook with latest EFI kernel git tree, the efivarfs mounted normally after system boot and I can delete/add EFI variable through /sys/firmware/efi/efivars.

This causes systemd to output a warning if the kernel doesn't have an efivars module. I suppose to do this kind of thing "right" we'd have to conditionalize the module loads on available kernel version they first appeared in?

We should probably suppress the warning that the module cannot be loaded. And then maybe make the mount conditional, depending on the existence of the target directory.

This should make all that only trigger when the kernel module is available or it is compiled-in (libkmod tells the same), and do nothing on older kernel, kernels without the filesysystem, or platforms without EFI.

We generally never want to depend on specific kernel versions, because people are free to backport stuff to older kernel versions or free to disable things in the kernel which are not absolutely required.

Kay

#8 lore raw
In reply to a message not in the archive
Quoted 12 lines · Kay Sievers
Quoted 10 lines · Colin Walters
Quoted 3 lines · joeyli

I tested this patch on my UEFI notebook with latest EFI kernel git tree, the efivarfs mounted normally after system boot and I can delete/add EFI variable through /sys/firmware/efi/efivars.

This causes systemd to output a warning if the kernel doesn't have an efivars module. I suppose to do this kind of thing "right" we'd have to conditionalize the module loads on available kernel version they first appeared in?

Quoted 8 lines

We should probably suppress the warning that the module cannot be loaded. And then maybe make the mount conditional, depending on the existence of the target directory.

This should make all that only trigger when the kernel module is available or it is compiled-in (libkmod tells the same), and do nothing on older kernel, kernels without the filesysystem, or platforms without EFI.

Yes to all of that.

For those wanting a distro kernel to play with that has this support, we've included efivarfs in Fedora rawhide and soon in F18.

josh