You are not logged in.

#1 2013-11-30 10:48:38

gen2arch
Member
Registered: 2013-05-16
Posts: 182

Macbook Pro setup: refind+kernel on usb; encrypted partition on disk

Hi

I would like to install arch on a MacBook Pro8.2 (early 2011).
This is what I'm trying to do:
1) I want to use Rod Smiths's refind fork as an efi boot manager and
2) to install refind on a usb thumbdrive
3) the kernel should be started as an efi application (efi stub in the kernel)
4) the kernel and the initramd reside also on the thumb drive
5) the main partition is a dmcrypt/luks partition on the harddrive

Ideally, the boot would then go like this:
0) stick thumb drive to macbook
1) power on the machine
2) start efi boot manager (refind)
3) let refind start the kernel
4) the kernel/initramd decrypts the local partition
5) OS is started

Is this setup possible?
1) Can I install refind on a thumb drive
2) can the ESP (with efi stub kernel and ramdisk) reside on a thumbdrive; what file system to use on the thumb drive
3) Is the Macbook bootloader capable of starting refind on a usb thumb drive and finally
4) can I pass some kernel options to the kernel via refind?

Thanks for your help!

Offline

#2 2013-11-30 11:01:33

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: Macbook Pro setup: refind+kernel on usb; encrypted partition on disk

Offline

#3 2013-11-30 19:25:46

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: Macbook Pro setup: refind+kernel on usb; encrypted partition on disk

I agree with teateawhy on #1, #2, and #4. For #3, the answer is "yes, but the details depend on the Mac model." I recommend you start out with the USB flash drive rEFInd image. You can test it risk-free; if it comes up at all, then you can use that image as a starting point for your desired solution, or you can start from scratch and put rEFInd on a USB flash drive that you prepare yourself. If you can't get rEFInd to start from the image file that I provide on the rEFInd downloads page, then you can try installing it in some other way, such as to an HFS+ volume on the USB flash drive.

Offline

#4 2013-12-01 22:54:12

gen2arch
Member
Registered: 2013-05-16
Posts: 182

Re: Macbook Pro setup: refind+kernel on usb; encrypted partition on disk

Thanks teateawhy for the links, and thanks srs5694 for your answer, the usb image and of course for the entire refind system with its really great documentation!
I actually dd'd the image unto my thumb drive and the macbook booted it promptly. That's great! Can you help me with some remaining questions:

1) have you described somewhere on your refind pages how you compiled this usb image? what is needed in order to reproduce it? or, to put it differently: when would I have to update an image like this (besides of course updating the kernels)?

2) I also tried the efi shell provided by the image: unfortunately, on the Macbook it seems to freeze immediately. Do you know if it is at all possible to start an efi shell on a Mac?

3) the documentation http://www.rodsbooks.com/refind/linux.html#efistub reads: "rEFInd looks for boot loaders whose names include the strings bzImage or vmlinuz and that end in .efi"; but on the other hand the example stanzas provided in the refind.conf file have the keywords "loader" and "initrd" with exact determination of kernel and initramdisk file names as their values. Would it be sufficient to drop the kernel and initrd files into the /EFI/boot directory where the conf file is and leave the "loader", "initrd" and "volumes" keywords empty?

4) there are commands to select graphic cards before booting if more than one is present in the machine:
https://help.ubuntu.com/community/UEFIB … aphic_card
Where would commands like these ("outb") go whithin a refind/efistub boot configuration (no dedicated boot loader, just efistub); is it even possible?

Thanks again for your help!

Offline

#5 2013-12-01 23:24:05

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: Macbook Pro setup: refind+kernel on usb; encrypted partition on disk

gen2arch wrote:

1) have you described somewhere on your refind pages how you compiled this usb image? what is needed in order to reproduce it? or, to put it differently: when would I have to update an image like this (besides of course updating the kernels)?

See the "--usedefault" option to install.sh, as described in this section of the documentation. You'll need to create a USB flash drive with an ESP to set it up in this way. I myself use the mkdistrib script followed by the mkcdimage script to prepare my packages; but these probably won't work unchanged on other computers, because they rely on embedded assumptions about where things are located, what packages are available, etc. They might be worth consulting if you want to set up something unusual or automate the process yourself.

2) I also tried the efi shell provided by the image: unfortunately, on the Macbook it seems to freeze immediately. Do you know if it is at all possible to start an efi shell on a Mac?

Yes, it's possible, but you may need to track down another EFI shell binary. The Arch wiki includes links to several binaries you might try; or you could use the EFI shell that comes with rEFIt.

3) the documentation http://www.rodsbooks.com/refind/linux.html#efistub reads: "rEFInd looks for boot loaders whose names include the strings bzImage or vmlinuz and that end in .efi"; but on the other hand the example stanzas provided in the refind.conf file have the keywords "loader" and "initrd" with exact determination of kernel and initramdisk file names as their values. Would it be sufficient to drop the kernel and initrd files into the /EFI/boot directory where the conf file is and leave the "loader", "initrd" and "volumes" keywords empty?

There are two ways to load a Linux kernel via rEFInd:

  • Via automatic boot loader detection. This works if the kernel file is in a directory that rEFInd scans and has a name that begins with "vmlinuz" or "bzImage" or that ends in ".efi". To pass options, a refind_linux.conf file must be present in the same location as the kernel (or as a fallback, rEFInd will try to determine the root filesystem's identification from an /etc/fstab file on the same partition as the kernel).

  • Via a manual boot stanza. In this case, you set everything up by hand, including naming the kernel, naming the initrd file, and passing the kernel options. Such stanzas normally go in refind.conf.

Normally, you'd use one of those methods (in most cases the first is easier).

4) there are commands to select graphic cards before booting if more than one is present in the machine:
https://help.ubuntu.com/community/UEFIB … aphic_card
Where would commands like these ("outb") go whithin a refind/efistub boot configuration (no dedicated boot loader, just efistub); is it even possible?

That's not currently possible with rEFInd. It's conceivable that setting the video mode (via the "resolution" option) would switch between video cards, particularly on UEFI-based computers when using video mode numbers (such as "resolution 3") rather than mode descriptions (such as "resolution 1280 1024").

Offline

#6 2013-12-03 09:00:30

gen2arch
Member
Registered: 2013-05-16
Posts: 182

Re: Macbook Pro setup: refind+kernel on usb; encrypted partition on disk

As to point 3. -- Would it then be a correct refind setup to leave the "loader" and "initd" keywords empty and to use the config file just to give the kernel options? I'm asking this as it would be a very convenient setup to just copy over new kernels to the ESP, without having to explicitly declare their complete name in a boot stanza (which in turn only holds kernel options that tend to stay the same). Is the config file applied automatically to every kernel found in the same directory, even if the complete kernel version is not specified within the config?

point 4. -- It seems that the whole business of manipulating registers on AMD Macbooks is no longer necessarey! At least, this is how I understand
https://bugs.freedesktop.org/show_bug.cgi?id=26891.

Many thanks again! I guess I have everything together to try it out.

Offline

#7 2013-12-07 01:46:35

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: Macbook Pro setup: refind+kernel on usb; encrypted partition on disk

gen2arch wrote:

As to point 3. -- Would it then be a correct refind setup to leave the "loader" and "initd" keywords empty and to use the config file just to give the kernel options? I'm asking this as it would be a very convenient setup to just copy over new kernels to the ESP, without having to explicitly declare their complete name in a boot stanza (which in turn only holds kernel options that tend to stay the same). Is the config file applied automatically to every kernel found in the same directory, even if the complete kernel version is not specified within the config?

You must either

  • Create a complete manual boot stanza that includes both the "loader" and "initrd" options (assuming you're using an initrd).

  • Leave it to auto-detection, and if you need to pass kernel options, set them in the /boot/refind_linux.conf file. Note that given Arch's kernel management model, you'll probably want to set at least an "initrd={whatever}" option in refind_linux.conf, with a separate line to boot each of the two initrd files.

You can't use a manual boot stanza with an empty "loader" line.

Note also that if you're "copy[ing] over new kernels to the ESP," you've set things up the hard way. With rEFInd, there are two good ways to do it:

  • Mount the ESP at /boot. This will cause the kernels to appear in the ESP's root directory, where they'll be readily accessible to rEFInd (or to gummiboot, ELILO, SYSLINUX, or other boot loaders/managers, for that matter).

  • Ensure that your Linux /boot directory is on an ext2/3/4fs, ReiserFS, Btrfs, or HFS+ partition; don't use JFS or XFS, or put /boot in an LVM or RAID setup. You can then add an appropriate filesystem driver so that rEFInd can read the kernel directly from its regular location.

Most Arch users seem to like option #1, which works fine with Arch because Arch doesn't use any Linux/Unix-type features (like symbolic links) in /boot. Users of most other distributions tend to favor option #2, since these distributions tend to mount the ESP at /boot/efi by default, and they often make it hard to do otherwise. Such distributions usually match the other requirements laid out in option #2, though, so it becomes the path of least resistance.

Offline

Board footer

Powered by FluxBB