Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Booting an UEFI system [SOLVED]
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Mormegil
n00b
n00b


Joined: 07 Mar 2006
Posts: 6

PostPosted: Mon Mar 26, 2012 3:38 pm    Post subject: Booting an UEFI system [SOLVED] Reply with quote

I've been trying to make my UEFI system boot, and things are not funny anymore. I've been trying to follow all the different GRUB2 howtos, which are confusing, and seem to offer contradicting information.

Anyway. I have 100 MiB fat32 partition /dev/sda1 (which is EFI bootable in gdisk), which I mount to /boot, and which contains the kernel image at root, and grub2 and efi directories as in http://dev.gentoo.org/~scarabeus/grub-2-guide.xml. Partition /dev/sda2 is mounted as root. The steps I have taken after chrooting to my system:

Code:

# mkdir -p /boot/grub2
# cp /usr/lib/grub2/x86_64-efi/* /boot/grub2/

# grub2-mkimage -p /grub2 -o /boot/grub2/grub.efi -O x86_64-efi part_msdos part_gpt fat

# mkdir -p /boot/EFI/BOOT
# cp /boot/grub2/grub.efi /boot/EFI/BOOT/BOOTX64.EFI

# grub2-editenv - create

# mount --rbind /sys /path/to/chroot/sys
# grub2-mkconfig -o /boot/grub2/grub.cfg


In the last step grub2-mkconfig couldn't find my kernel (located at /boot). How can this be fixed?

Well, then I tried to create a custom entry into /etc/grub.d/40_custom. After rebooting the system, I get plain black screen with a blinking cursor. Is grub2 supposed to give some signs of life even though my 40_custom file might be wrong? The delay of selecting the kernel was set to 4 seconds.

Did I do everything correctly? How to get my system to boot? Is this really enough to install GRUB2?

EDIT: The partitions are GPT.


Last edited by Mormegil on Tue Apr 03, 2012 5:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2151

PostPosted: Mon Mar 26, 2012 7:07 pm    Post subject: Reply with quote

For me, this worked:

0) `modprobe efivars` - if it's not built into the kernel of your live medium
a) partition the disk as needed
b) make sda1 FAT32
c) mount your / on /mnt/gentoo
d) mount all other partitions EXCEPT /boot under /mnt/gentoo/X
e) mount --rbind /dev
f) mount /proc and /sys
g) chroot
h) now mount /boot from inside the chroot

Don't know why, but the last step was the crucial one on my Macbook. Hope that helps.
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5724

PostPosted: Mon Mar 26, 2012 7:48 pm    Post subject: Reply with quote

If you get yourself a sufficiently new kernel you can boot it directly from the EFI bootloader. You don't need to put up with GRUB's config mess at all.
Back to top
View user's profile Send private message
Mormegil
n00b
n00b


Joined: 07 Mar 2006
Posts: 6

PostPosted: Tue Mar 27, 2012 5:34 am    Post subject: Reply with quote

avx wrote:
Don't know why, but the last step was the crucial one on my Macbook. Hope that helps.

For me it didn't matter when I mounted /boot. Grub still didn't find my kernel images.

Ant P. wrote:
If you get yourself a sufficiently new kernel you can boot it directly from the EFI bootloader. You don't need to put up with GRUB's config mess at all.

Thanks. I did this, and it worked (almost) perfectly. My system boots now as it should, but I need to launch the UEFI shell, and manually boot the kernel. This shall do for a while since I want to complete Gentoo installation.

Does anyone know how to supply the boot parameters, e.g. ’ro root=/dev/sda2’, to the kernel without launching the UEFI shell? Reading some configuration file while booting, or hard coding the parameters on compile time would do.

For others struggling with UEFI booting, here's shortly what I did:

- I booted Ubuntu LiveCD in UEFI mode. At least with my motherboard (AsRock X79 Extreme 3), I needed to press F11 when booting, and select UEFI mode from the menu.

- Booting in UEFI mode gives access to files in /sys/firmware/efi/vars/. Then I followed Arch Linux Wiki, and modified the command

Code:
# efibootmgr --create --gpt --disk /dev/sdX --part Y --write-signature --label "Arch Linux (GRUB2)" --loader '\EFI\arch_grub\grubx64.efi'

to make a boot option for my disk.

- I compiled my kernel with CONFIG_EFI_STUB, and placed the image to /boot/EFI/BOOT/BOOTX64.EFI (modify above accordingly, and see Gentoo Wiki GRUB2 page).

- I copied the UEFI Shell image to /boot/SHELLX64.EFI (see http://en.gentoo-wiki.com/wiki/UEFI#EFI_Shell).

- Then I booted the UEFI Shell (this varies depending on your motherboard), and ran the following (edit to your needs):

Code:
fs0:
cd EFI\BOOT # Note the backslash.
BOOTX64.EFI ro root=/dev/sda2

and my kernel booted, init and everything else ran as expected.

Lastly, I need to rant just a bit. All this GRUB2 stuff is in my opinion way too complicated. All I want to do is to boot a kernel, and perhaps allow the user to select an alternative kernel image. I can't see why all the scripting stuff in GRUB2 was worth it. GRUB Legacy was dead simple. For now I'm staying away from GRUB2. Perhaps I don't get what's fancy in GRUB2, but to me it seems the developers have forgotten the purpose of a bootloader: simply boot an image, and be done with it. With seven years of worth of experience with Gentoo, I managed to get GRUB2 to load, but after selecting the image I got ’no suitable video mode found, booting in blind mode’, and apparently my system froze.
Back to top
View user's profile Send private message
quadbox
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2002
Posts: 94
Location: Brisbane, Australia

PostPosted: Sat Mar 31, 2012 3:02 am    Post subject: Reply with quote

Couldnt agree with you more about grub2.

Personally, I'm now using rEFInd as the efi boot manager, booting the stub loader kernel from there. That provides an easy way to pass kernel arguments and provides a pretty boot menu without a whole lot of fucking about. It pretty much self configures apart from the boot parameters.

Installation's just put the whole contents of the refind binary download in /EFI/BOOT, rename the actual efi application so your firmware autoloads it, and create a directory called "gentoo" containing all your kernels (in format either vmlinuz-<version>.efi or bzImage-<version>.efi), initramdisks (init*-<version>.*) and a file called refind_linux.conf that contains kernel params.

My setup is now like so: (icons dir contents and a few unused files ommitted for clarity)

Code:

/boot/efi/EFI
|-- BOOT
|   |-- BOOTX64.EFI
|   |-- icons
|   `-- refind.conf
|-- gentoo
|   |-- initramfs.cpio.gz
|   |-- refind_linux.conf
|   `-- vmlinuz.efi
`-- tools
    |-- diskpart.efi
    `-- shell.efi


Note that I've renamed the refind 64bit binary to BOOTX64.EFI, the default first EFI boot option on my motherboard's implementation. If you've already got your system booted in EFI mode, so have access to EFI vars, you could alternatively leave it as the default filename and use efibootmgr to point UEFI at it. refind_linux.conf consists of a single line defining the kernel params:

Code:

"Gentoo"   "video=inteldrmfb root=/dev/sdc4 ro pcie_aspm=force"


You could edit refind.conf to change boot options, but the default config works fine to autodetect the kernel directory and present an option called Gentoo. Including giving it a gentoo logo icon.

Note that with my motherboard (has gigabyte's touchbios implementation) at least, if it finds a bootloader in the MBR it'll treat it as a bios disk. Even if it's formatted in GPT and has an efi system partition. So remember to zero out anything from the MBR using dd if=/dev/zero of=/dev/sda bs=446 count=1 (BE CAREFUL)

Also note that there's really no reason why you cant use your efi system partition as your boot partition, and have it mounted as /boot. Gotchas are that it wont support unix permissions or symlinks, but if you're using this method of booting the only files you'll have in /boot are what I've shown above anyway. Just means you cant have a symlink to the current vmlinuz and initramfs

Once you've got the system booted in UEFI mode it's a good idea to delete the UEFI's default timeout, since at least on my system it delays boot by 3 seconds for absolutely no point at all (it's not providing you any actual options during those 3 seconds, it's just sitting there doing nothing). The command to get rid of it entirely is efibootmgr -T, or to change the timeout it's efibootmgr -t <seconds>
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2151

PostPosted: Sat Mar 31, 2012 7:00 am    Post subject: Reply with quote

quadbox, thanks for the hint, might try this sometime.

Quote:
Once you've got the system booted in UEFI mode it's a good idea to delete the UEFI's default timeout, since at least on my system it delays boot by 3 seconds for absolutely no point at all (it's not providing you any actual options during those 3 seconds, it's just sitting there doing nothing).
Isn't that the window of time you're supposed to press a key to get something like a boot menu or is this properly handled by refind(think booting from USB f.e.)?
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5724

PostPosted: Sat Mar 31, 2012 3:07 pm    Post subject: Reply with quote

Mormegil wrote:
Does anyone know how to supply the boot parameters, e.g. ’ro root=/dev/sda2’, to the kernel without launching the UEFI shell? Reading some configuration file while booting, or hard coding the parameters on compile time would do.

There's a config option for it in the kernel menuconfig, at the bottom of CPU Type/Features.

I just got a UEFI system myself, so if I find out anything useful I'll let you know!
Back to top
View user's profile Send private message
quadbox
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2002
Posts: 94
Location: Brisbane, Australia

PostPosted: Sun Apr 01, 2012 3:45 am    Post subject: Reply with quote

avx wrote:
Isn't that the window of time you're supposed to press a key to get something like a boot menu or is this properly handled by refind(think booting from USB f.e.)?


It isnt on this board, you can press F12 at any time during post to escape to the boot menu. Might well be that it serves a purpose like that on other machines. This particular board's inbuilt ufi tools are basically nonexistant, there is for example no inbuilt way to escape to the shell, or anything useful
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2151

PostPosted: Sun Apr 01, 2012 10:58 am    Post subject: Reply with quote

Ok, thanks for the info, I'll see how that works on my MacBook. Shouldn't be a problem, I once had refit installed and still could access another boot menu by holding alt/option.

For the record, I too don't like GRUB2, though the devs were very helpfull on IRC and quickly helped me debugging a problem with booting OSX. Still, I think the changes are mostly important for maintainers of other, more mainstream distros, since the new GRUB allows more flexibility in terms of scripting. For the average Gentoo user, that surely isn't need and is overly complicated, but well...
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 434
Location: Woonsocket, RI

PostPosted: Tue Apr 03, 2012 4:23 pm    Post subject: Reply with quote

Mormegil wrote:
Lastly, I need to rant just a bit. All this GRUB2 stuff is in my opinion way too complicated. All I want to do is to boot a kernel, and perhaps allow the user to select an alternative kernel image. I can't see why all the scripting stuff in GRUB2 was worth it. GRUB Legacy was dead simple. For now I'm staying away from GRUB2. Perhaps I don't get what's fancy in GRUB2, but to me it seems the developers have forgotten the purpose of a bootloader: simply boot an image, and be done with it. With seven years of worth of experience with Gentoo, I managed to get GRUB2 to load, but after selecting the image I got ’no suitable video mode found, booting in blind mode’, and apparently my system froze.


I agree; GRUB 2 is, in my experience, the least reliable of the available EFI boot loaders for Linux. The kernel's EFI stub loader is the most reliable. ELILO and Fedora's patched GRUB Legacy come in-between. In my mind, GRUB 2 is "the kitchen sink boot loader," as in the phrase, "everything but the kitchen sink," and the attempt to include everything hinders its ability to do any one thing very well. In this respect it violates an old Unix principle that a program should do one thing and do it well, leaving more complex tasks to combinations of simple tools. In any event, I've got a Web page that covers all of the available Linux EFI boot loaders (except for efilinux, which is more of a reference implementation than a real tool).

FWIW, I'm the person who forked rEFIt to create rEFInd. It was becoming increasingly obvious that rEFIt was abandonware, and although it did a lot of things well, it had some annoyances. As it happens, my timing was fortuitous, since the 3.3.0 kernel with its EFI stub loader appeared at about the same time I did the fork, and as quadbox has pointed out, the combination of the two makes for a system that's quite easy to configure and very reliable.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5724

PostPosted: Tue Apr 03, 2012 4:40 pm    Post subject: Reply with quote

I wish I'd seen that post before going ahead with installing... after fighting with this until 4am I eventually got something resembling a normal setup using GRUB2 and booting in EFI mode.
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2151

PostPosted: Tue Apr 03, 2012 4:43 pm    Post subject: Reply with quote

srs5694 wrote:
FWIW, I'm the person who forked rEFIt to create rEFInd.
Interesting and good to know, thanks for your efforts.

I'm currently backing up my Mac before trying rEFInd and while I'm at it, I might as well ask two questions.

a) does it work with (Lion) disk encryption? If not, absolutely not or are there just some steps to be done by hand?

b) from what I read on your page, there's the feature of having a set of icons in one line and if they overflow the screen, one is able to scroll through them. Can I limit that in the sense that I only show one icon, but that is scrollable? In terms of looks, I'd like to mimic the normal Apple bootscreen - so not to confuse others using the machine - while still being able to boot into my linux systems without holding the option key.
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
Mormegil
n00b
n00b


Joined: 07 Mar 2006
Posts: 6

PostPosted: Tue Apr 03, 2012 5:46 pm    Post subject: Reply with quote

Ant P. wrote:
There's a config option for it in the kernel menuconfig, at the bottom of CPU Type/Features.

I just got a UEFI system myself, so if I find out anything useful I'll let you know!

Thanks. I figured that out too a few days ago. Now my system boots up just fine. No need for any bootloaders. I'll save copies of old kernels in /boot just in case a new kernel doesn't work, I can load them from the UEFI shell. Marking this as solved.

EDIT: Thank you for writing all those instructions srs5694! I was going to write a bit about my adventures with the EFI stub loader on my web page, but you saved me the trouble. I think you should mention that the kernel parameters can be hard coded into the kernel (as Ant P. pointed out), so no need to launch from the UEFI shell.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 434
Location: Woonsocket, RI

PostPosted: Tue Apr 03, 2012 6:37 pm    Post subject: Reply with quote

avx wrote:
srs5694 wrote:
FWIW, I'm the person who forked rEFIt to create rEFInd.
Interesting and good to know, thanks for your efforts.

I'm currently backing up my Mac before trying rEFInd and while I'm at it, I might as well ask two questions.

a) does it work with (Lion) disk encryption? If not, absolutely not or are there just some steps to be done by hand?


I've never used disk encryption in OS X, so I can't say for sure. I can think of reasons why it should work, but also reasons why it might not. My knowledge of how OS X implements encryption is simply limited enough that I can't really say. If you try it, I'd be interested to know how it works. FWIW, if rEFIt works with encryption, I'd expect rEFInd to work, too.

Quote:
b) from what I read on your page, there's the feature of having a set of icons in one line and if they overflow the screen, one is able to scroll through them. Can I limit that in the sense that I only show one icon, but that is scrollable? In terms of looks, I'd like to mimic the normal Apple bootscreen - so not to confuse others using the machine - while still being able to boot into my linux systems without holding the option key.


That's not currently possible; however, given the way the code is structured, it might be possible to add such a feature relatively easily. I'll look into it....

[quote=Moremegil]Thank you for writing all those instructions srs5694! I was going to write a bit about my adventures with the EFI stub loader on my web page, but you saved me the trouble. I think you should mention that the kernel parameters can be hard coded into the kernel (as Ant P. pointed out), so no need to launch from the UEFI shell.[/quote]

I was vaguely aware that such an option existed, but I couldn't locate it until I stumbled across this thread. I've made a mental note to check it out and add something about it to my Web page, but I may not get around to it for a few days....
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2151

PostPosted: Tue Apr 03, 2012 7:09 pm    Post subject: Reply with quote

srs5694 wrote:
I've never used disk encryption in OS X, so I can't say for sure. I can think of reasons why it should work, but also reasons why it might not. My knowledge of how OS X implements encryption is simply limited enough that I can't really say. If you try it, I'd be interested to know how it works. FWIW, if rEFIt works with encryption, I'd expect rEFInd to work, too.
I never got it to work with rEFIt, that is, I installed it, then turned on encryption and from there, rEFIt didn't show up again - might just be that OS X overwrote the default EFI to boot. Will investigate that, once I've got it basicly running.

Quote:
b) from what I read on your page, there's the feature of having a set of icons in one line and if they overflow the screen, one is able to scroll through them. Can I limit that in the sense that I only show one icon, but that is scrollable? In terms of looks, I'd like to mimic the normal Apple bootscreen - so not to confuse others using the machine - while still being able to boot into my linux systems without holding the option key.
That would be nice, thanks.
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 434
Location: Woonsocket, RI

PostPosted: Wed Apr 04, 2012 3:35 am    Post subject: Reply with quote

Mormegil wrote:
EDIT: Thank you for writing all those instructions srs5694! I was going to write a bit about my adventures with the EFI stub loader on my web page, but you saved me the trouble. I think you should mention that the kernel parameters can be hard coded into the kernel (as Ant P. pointed out), so no need to launch from the UEFI shell.


I've updated my EFI stub loader page to provide this information. Thanks to Ant P. for pointing it out!

FWIW, I've discovered that rEFIt can boot a kernel directly when these options are set appropriately. rEFInd still provides better flexibility, though, since it's easy to set the options in a text editor and you can maintain multiple options for a single kernel.
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2151

PostPosted: Wed Apr 04, 2012 5:43 pm    Post subject: Reply with quote

A big thank you, system is now up and running fine, using the built-in commandline of the kernel.

For those interested in my b) from above, here's a quote rEFInd's dev sent me per PM.

Quote:
Do you know how to use git and compile software manually? If so, I've placed a version of rEFInd on its Sourceforge git repository that implements this feature. You should be able to get it by typing:
Code:
git clone git://git.code.sf.net/p/refind/code refind-code


You'll need to emerge the gnu-efi package, and you should then be able to compile it.

The new feature is called max_tags, and to get the functionality you want, you'd set it to 1 in refind.conf:

max_tags 1

The default value is 0 and stands for a limit of whatever the screen can handle. If you care to test it and report back, that'd be great. If you can't or you're busy, that's fine; I'll probably just release it as-is, since it wasn't a tricky feature to implement.


First `emerge gnu-efi`, then check out as stated above, set the config variable and it just works(tm).

What I noticed, starting an entry brings up shortly a "refind boots $foo, using $bla"-screen, I'd like to get rid of that, is this possible?

Also, I'd like to mount my EFI-partition (sda1) on /mnt/boot and then `mount --bind /mnt/boot/EFI/gentoo /boot` - can I bind-mount the latter from fstab? Edit:, found this one, just
Code:
/from /to none bind,defaults 0 0

_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
quadbox
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2002
Posts: 94
Location: Brisbane, Australia

PostPosted: Thu Apr 05, 2012 5:18 am    Post subject: Reply with quote

srs5694 wrote:
Mormegil wrote:
EDIT: Thank you for writing all those instructions srs5694! I was going to write a bit about my adventures with the EFI stub loader on my web page, but you saved me the trouble. I think you should mention that the kernel parameters can be hard coded into the kernel (as Ant P. pointed out), so no need to launch from the UEFI shell.


I've updated my EFI stub loader page to provide this information. Thanks to Ant P. for pointing it out!

FWIW, I've discovered that rEFIt can boot a kernel directly when these options are set appropriately. rEFInd still provides better flexibility, though, since it's easy to set the options in a text editor and you can maintain multiple options for a single kernel.


I presume come to that, not that I cbf testing right now, that if you both hardcode the kernel parameters in and also build the initramfs directly into the kernel you could just name your kernel BOOTX64.EFI and lose the boot manager entirely. Wouldnt give you any recovery options though.

Thanks for your efforts anyway srs5694, I like the approach you've taken. Especially now my brain's caught up and I've realised you can edit your kernel boot params at boot time when things go pear shaped, by dropping to the shell, editing refind_linux.conf, then running refind again
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 434
Location: Woonsocket, RI

PostPosted: Thu Apr 05, 2012 3:01 pm    Post subject: Reply with quote

quadbox wrote:
I presume come to that, not that I cbf testing right now, that if you both hardcode the kernel parameters in and also build the initramfs directly into the kernel you could just name your kernel BOOTX64.EFI and lose the boot manager entirely. Wouldnt give you any recovery options though.


Actually, it's possible even without building the initramfs into the kernel -- you just need to pass the initramfs filename as one of the kernel options (in EFI format, e.g., "initrd=EFI\gentoo\initrd.img"). I've tested this, and it works fine. It might be suitable for some situations, like embedded devices -- but as you say, the lack of recovery options could be a problem on a desktop or even a server computer.

Quote:
Thanks for your efforts anyway srs5694, I like the approach you've taken. Especially now my brain's caught up and I've realised you can edit your kernel boot params at boot time when things go pear shaped, by dropping to the shell, editing refind_linux.conf, then running refind again


You're welcome. FWIW, I've just released version 0.2.4, which incorporates those features avx mentioned and a few other changes. Note that I've reworked the "hideui" and "disable" options; "disable" is now gone, with some of the functionality of both now in "hideui" and a new option, "showtools", providing the remaining functionality in a more flexible form. (You can now specify the order in which you want the tool tags to appear.) I mention this because if you'd been using "disable" and/or "hideui", the new version might require some reconfiguration.
Back to top
View user's profile Send private message
quadbox
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2002
Posts: 94
Location: Brisbane, Australia

PostPosted: Mon Apr 09, 2012 5:49 am    Post subject: Reply with quote

Now if only there was a way to install EFI filesystem drivers so you can have an ESP using something less featureless than vfat :p. Hell, I'd settle for being able to patch HFS+ support from the mac firmwares onto a pc's firmware
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 434
Location: Woonsocket, RI

PostPosted: Mon Apr 09, 2012 2:32 pm    Post subject: Reply with quote

quadbox wrote:
Now if only there was a way to install EFI filesystem drivers so you can have an ESP using something less featureless than vfat :p. Hell, I'd settle for being able to patch HFS+ support from the mac firmwares onto a pc's firmware


In theory, it's already possible. rEFIt includes an ext2fs driver, but I've never attempted to use it, and I dropped it from rEFInd because I wanted to focus on the boot manager. Also, the GNU-EFI toolchain that I used for rEFInd doesn't support the system call to load EFI drivers, so you'd need to load it outside of rEFInd -- say, in an EFI startup script. (I've been looking into using the Tianocore package to compile rEFInd, which should provide the means to re-enable that driver-loading code, but the Tianocore build process is quite alien to my understanding, so I'm still struggling with building a "hello, world" program, much less rEFInd!)

IMHO, a project to port a bunch of filesystems to EFI would be worthwhile. Perhaps the drivers in the Linux kernel or in GRUB 2 could be ported, but I've not looked into this.
Back to top
View user's profile Send private message
quadbox
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2002
Posts: 94
Location: Brisbane, Australia

PostPosted: Wed Apr 11, 2012 9:28 am    Post subject: Reply with quote

I suppose you'd still have the problem it's got to be able to read the filesystem you're getting the driver program off though? Ie it's not really freeing you of the need to have a vfat partition unless you can install the driver into the firmware itself
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 434
Location: Woonsocket, RI

PostPosted: Wed Apr 11, 2012 2:38 pm    Post subject: Reply with quote

quadbox wrote:
I suppose you'd still have the problem it's got to be able to read the filesystem you're getting the driver program off though? Ie it's not really freeing you of the need to have a vfat partition unless you can install the driver into the firmware itself


Correct. As the EFI spec says you're supposed to have a FAT32-formatted ESP, though, this isn't a big deal, at least not IMHO. Such a driver would, at least in theory, allow you to store your kernel anywhere you like. You might still need to put at least one boot manager on the ESP along with the driver, but there might be ways to have the boot manager elsewhere. (I'm thinking it might be possible to use an EFI shell script to load the driver and then load a boot manager from a driver-managed filesystem. I've not tried this, though.)
Back to top
View user's profile Send private message
gw
Apprentice
Apprentice


Joined: 03 Dec 2006
Posts: 215

PostPosted: Mon Apr 16, 2012 12:18 pm    Post subject: Reply with quote

Thanks to everybody contributing to this thread, and especially to srs5694 for his much appreciated work on refind!

I'm also trying to put gentoo on my macbook pro8,2, but I need full root encryption with dm-crypt/cryptsetup on the linux side, and this makes it hard for me to see through the process.

Is it even possible? And in case it is:

1) what would be the basic procedure (I mean the steps during the boot process, what is loading what, after having powered on the macbook)?

2) which boot loader should I use?

3) can I put all the linux stuff in one partition, that itself would consist of lvm volumes carrying root, boot and swap? Or otherwise boot on usb drive?

I'd be grateful if somone could outline the general procedure for that.

Thanks

gw
Back to top
View user's profile Send private message
quadbox
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2002
Posts: 94
Location: Brisbane, Australia

PostPosted: Sat Apr 21, 2012 2:12 pm    Post subject: Reply with quote

Makes no difference on the boot side to if you werent using an encrypted root gw, up to the point where the kernel loads your initramfs. The UEFI System Partition still has to be unencrypted and has to be vfat (Hfs+ on a mac I gather?). Must contain both your kernel and initramfs, and some way to make EFI load it. Make EFI aware of your kernel and initramfs one way or the other, using refind should work. Where all your crypt stuff comes in is in the initramfs. Obviously as per normal your initramfs has to be capable of decrypting and mounting your encrypted root. both the official and unofficial wikis have guides to doing that, and dracut certainly, and I think also genkernel? are capable of autogenerating an initramfs that can do it (when configured correctly) too if you dont want to roll your own.

Personally I roll my own mostly because it gives me a better idea what's going wrong when things go pearshaped, without delving into some convoluted autogenerated thing.

So the steps are: EFI starts up, finds your primary boot drive. It searches for the ESP, then loads the default .efi application there. We make that refind. Refind loads, searches its configs and the ESP for whatever available bootable OSes it can find on the ESP, gives you a menu. You pick gentoo. EFI then loads the linux kernel and initramfs. The init script in your initramfs initialises every program necessary to get dm-crypt support up, then brings your root device up, then mounts it, and switches root and starts your primary init

The answer to 2) is whatever you damned choose.

The answer to 3) is Yes, though obviously having an LVM within a dm_crypt device just adds even more to the overhead. and you've got to ask why the hell you feel you need an encrypted /, /boot and swap. I mean encrypted /home sure, but seriously?. Also, if you're using the above setup there's no particular need to have a seperate /boot unless you really want to. your ESP can be mounted on /boot. only downside is that it's hfs+ (or vfat on a non-mac machine)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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