Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
basic kernel config for efivarfs mount
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5365

PostPosted: Wed Oct 01, 2014 7:15 pm    Post subject: basic kernel config for efivarfs mount Reply with quote

Greetings,

in my workplace we have an usb image that allows us to boot our servers for some diagnostics.
I'm in charge of maintaining the kernel part of it (no one else has the guts to do that), one of the brainiac in the company has installed centos with efi support on.
now is computer is kinda broken and I need to be able to salvage some files from there. I need to add basic efivarfs support to the image, thing is I cannot get /sys/firmware/efi to exists, what is the minimal kernel config I need to be able to see /sys/firmware/efi and mount it?

Thanks.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
eborg
n00b
n00b


Joined: 20 Sep 2014
Posts: 9

PostPosted: Fri Oct 03, 2014 5:15 am    Post subject: Reply with quote

I'm not sure if you're still looking, but here's what you need in the kernel.

Processor type and features --->
[*] EFI runtime service support
[*] EFI stub support
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5365

PostPosted: Fri Oct 03, 2014 8:31 am    Post subject: Reply with quote

eborg wrote:
I'm not sure if you're still looking, but here's what you need in the kernel.

Processor type and features --->
[*] EFI runtime service support
[*] EFI stub support


not sure that is correct, for example, centos's kernel doesn't jave EFI stub enabled but it does have /sys/firmware/efi
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
RazielFMX
l33t
l33t


Joined: 23 Apr 2005
Posts: 835
Location: NY, USA

PostPosted: Fri Oct 03, 2014 8:10 pm    Post subject: Reply with quote

I have /sys/firmware/efi, here are my EFI related kernel settings:

Code:

$ grep -i efi /usr/src/linux/.config
CONFIG_EFI_PARTITION=y
CONFIG_EFI=y
CONFIG_EFI_STUB=y
CONFIG_FB_EFI=y
CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
# EFI (Extensible Firmware Interface) Support
CONFIG_EFI_VARS=y
CONFIG_EFIVAR_FS=y
# CONFIG_EARLY_PRINTK_EFI is not set


My kernel info:

Code:

$ uname -a
Linux gentoobox 3.14.14-gentoo #1 SMP Thu Jul 31 11:36:36 EDT 2014 x86_64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz GenuineIntel GNU/Linux
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6194

PostPosted: Sat Oct 04, 2014 12:28 am    Post subject: Reply with quote

CONFIG_EFI_STUB is for building a kernel, that can be run straight from EFI without a bootloader (though strong limitations here).
CONFIG_FB_EFI is for initial console before FRAMEBUFFER_CONSOLE/KMS kicks in.
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5365

PostPosted: Sat Oct 04, 2014 10:31 am    Post subject: Reply with quote

question is, what I need to be able to read /sys/firmware/efi.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6194

PostPosted: Sat Oct 04, 2014 1:50 pm    Post subject: Reply with quote

Well, menuconfig is your friend, but going by the names, most likely CONFIG_EFIVAR_FS.
Though IIRC, catch is the machine must be booted by UEFI, not BIOS - at least it was something like that when I was migrating grub to such setup.
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5365

PostPosted: Sat Oct 04, 2014 5:00 pm    Post subject: Reply with quote

VoidMage wrote:
Well, menuconfig is your friend, but going by the names, most likely CONFIG_EFIVAR_FS.
Though IIRC, catch is the machine must be booted by UEFI, not BIOS - at least it was something like that when I was migrating grub to such setup.

you mean that the booting image must be efi right?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6194

PostPosted: Sat Oct 04, 2014 7:56 pm    Post subject: Reply with quote

DaggyStyle wrote:
VoidMage wrote:
Well, menuconfig is your friend, but going by the names, most likely CONFIG_EFIVAR_FS.
Though IIRC, catch is the machine must be booted by UEFI, not BIOS - at least it was something like that when I was migrating grub to such setup.

you mean that the booting image must be efi right?


...well, probably...
Not sure how it is right now, but back then if motherboard offered a choice between booting by BIOS and booting by UEFI, if you chose the former, sysfs efi entries wouldn't get populated.
Back to top
View user's profile Send private message
eborg
n00b
n00b


Joined: 20 Sep 2014
Posts: 9

PostPosted: Sat Oct 04, 2014 10:57 pm    Post subject: Reply with quote

DaggyStyle wrote:

you mean that the booting image must be efi right?


For me that was the case. I went through SystemRescueCD, Fedora, then Ubuntu's EFI images (which all sort of worked ok), and then when I found Iron Penguin (Gentoo image), that was the final blow to getting me past my issues.
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5365

PostPosted: Sun Oct 05, 2014 6:39 am    Post subject: Reply with quote

not sure I understood, bios is setup in efi, os was installed under efi, this means that the boot img is efi.
I have a usb image that I boot from, it isn't efi image, my question is, can I have /sys/firmware/efi in my usb image?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
SlashBeast
Moderator
Moderator


Joined: 23 May 2006
Posts: 2843

PostPosted: Sun Oct 05, 2014 8:15 am    Post subject: Reply with quote

the /sys is kernel interface, thus /sys/firmware/efi too. After a quick grep for '/sys/firmware/efi' on kernel sources I found:

drivers/firmware/efi/efi.c wrote:
/*
* efi.c - EFI subsystem
*
* Copyright (C) 2001,2003,2004 Dell <Matt_Domsch@dell.com>
* Copyright (C) 2004 Intel Corporation <matthew.e.tolentino@intel.com>
* Copyright (C) 2013 Tom Gundersen <teg@jklm.no>
*
* This code registers /sys/firmware/efi{,/efivars} when EFI is supported,
* allowing the efivarfs to be mounted or the efivars module to be loaded.
* The existance of /sys/firmware/efi may also be used by userspace to
* determine that the system supports EFI.
*
* This file is released under the GPLv2.
*/


And after quick glance on drivers/firmware/efi/Makefile
Code:
obj-$(CONFIG_EFI)           += efi.o vars.o


Which means you need to boot your kernel with CONFIG_EFI=y to have /sys/firmware/efi.

Srsly, don't be afraid to grep on kernel sources, they have tons of docs and comments in there.
_________________
BitBucket -- better-initramfs
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6194

PostPosted: Sun Oct 05, 2014 10:28 am    Post subject: Reply with quote

I might not be good enough at explaining this, so just read these answers. Pay attention to the screenshot - one of the disks is listed both as BIOS and UEFI boot.
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5365

PostPosted: Sun Oct 05, 2014 6:02 pm    Post subject: Reply with quote

SlashBeast wrote:
the /sys is kernel interface, thus /sys/firmware/efi too. After a quick grep for '/sys/firmware/efi' on kernel sources I found:

drivers/firmware/efi/efi.c wrote:
/*
* efi.c - EFI subsystem
*
* Copyright (C) 2001,2003,2004 Dell <Matt_Domsch@dell.com>
* Copyright (C) 2004 Intel Corporation <matthew.e.tolentino@intel.com>
* Copyright (C) 2013 Tom Gundersen <teg@jklm.no>
*
* This code registers /sys/firmware/efi{,/efivars} when EFI is supported,
* allowing the efivarfs to be mounted or the efivars module to be loaded.
* The existance of /sys/firmware/efi may also be used by userspace to
* determine that the system supports EFI.
*
* This file is released under the GPLv2.
*/


And after quick glance on drivers/firmware/efi/Makefile
Code:
obj-$(CONFIG_EFI)           += efi.o vars.o


Which means you need to boot your kernel with CONFIG_EFI=y to have /sys/firmware/efi.

Srsly, don't be afraid to grep on kernel sources, they have tons of docs and comments in there.

I've booted my kernel with CONFIG_EFI, CONFIG_EFI_VARS and CONFIG_EFIVAR_FS. none of the combinations showed /sys/firmware/efi.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5365

PostPosted: Sun Oct 05, 2014 6:02 pm    Post subject: Reply with quote

VoidMage wrote:
I might not be good enough at explaining this, so just read these answers. Pay attention to the screenshot - one of the disks is listed both as BIOS and UEFI boot.


thanks, will take a look
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum