Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Trouble with EFI booting on 64-bit Mac using rEFInd
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
propjow
n00b
n00b


Joined: 16 Jun 2013
Posts: 6

PostPosted: Sun Jun 16, 2013 7:58 pm    Post subject: [SOLVED] Trouble with EFI booting on 64-bit Mac using rEFInd Reply with quote

Hi All,
I'm looking to install AMD64 Gentoo alongside OS X on a 64-bit Mac, setting it up to boot directly from rEFInd (without grub) and I'm running into some trouble. Specifically, when I boot the Linux kernel from the rEFInd menu I'm given the error message:

Code:
Starting bootx64.efi
Using load options ' '
Error: Unsupported while loading bootx64.efi

* Hit any key to continue *


I'd followed the EFI stub kernel wiki page to configure and install the kernel, and consulted this other thread looking for anything I might have missed. In my case the changes I've made to the kernel config haven't yet produced a kernel that gets past the above error message. Here are my kernel config variables that are relevant to EFI:

Code:
CONFIG_EFI_PARTITION=y
CONFIG_EFI=y
CONFIG_EFI_STUB=y
CONFIG_FB_EFI=y
CONFIG_RELOCATABLE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="root=/dev/sda6"
CONFIG_EFI_VARS=m


I'd mounted the ESP to /boot, compiled and installed the kernel and modules, then copied the kernel image to {ESP}/EFI/Boot/bootx64.efi. rEFInd has no trouble finding this file automatically.

Any pointers would be most welcome.


Last edited by propjow on Tue Nov 19, 2013 5:33 pm; edited 1 time in total
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1159

PostPosted: Sun Jun 16, 2013 10:35 pm    Post subject: Reply with quote

Some ideas:
1. Perhaps it is a special case using the name bootx64.efi:
name it for example: (EFIPART)/EFI/Gentoo/kernel.efi
2. Also you can from refind chain load a normal grub (installed in a partition by using --force) .
3. rootfstype in cmdline:
Code:
CONFIG_EFI_PARTITION=y
CONFIG_EFI=y
CONFIG_EFI_STUB=y
CONFIG_FB_EFI=y
CONFIG_EFI_VARS=y
CONFIG_EFI_VARS_PSTORE=y
CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE=y
# CONFIG_CACHEFILES is not set

CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="root=/dev/sda4 init=/sbin/systemd quiet numa=off rootfstype=ext4 blacklist=nouveau"
# CONFIG_CMDLINE_OVERRIDE is not set
# CONFIG_MTD_CMDLINE_PARTS is not set

_________________
fun2gen2
Back to top
View user's profile Send private message
propjow
n00b
n00b


Joined: 16 Jun 2013
Posts: 6

PostPosted: Mon Jun 17, 2013 12:21 am    Post subject: Reply with quote

Thanks for the suggestions ulenrich,
Re 1 and 3: I recompiled the kernel with "rootfstype=ext4" added to the built-in command line and copied it to a new EFI file on the EFI partition. rEFInd detects the new kernel but alas I get the same "Error: Unsupported" when I try to boot it.

I was hoping to avoid grub entirely to streamline the boot process, but I'm nearing the point where I might install it just to get Linux up and running. I should in theory be able to boot without grub however, no?

Thanks again.
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1159

PostPosted: Mon Jun 17, 2013 7:15 am    Post subject: Reply with quote

I get a disadvantage booting in efi mode:
I cannot see any text mode console any more. This is because I use proprietary nvidia drivers. There should be a way to unload efi-framebuffer and loading an ordinary vga instead, but I don't know how to do it yet.

If you get it booted (with grub):
- turn on everything you want (external usb,dvb etc)
- make localyesconfig
This can get you a working kernel to boot without any initramfs. Be aware there are modules not available using this technique: microcode loader for example you have to activate manually by make menuconfig.
_________________
fun2gen2
Back to top
View user's profile Send private message
srs5694
Guru
Guru


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

PostPosted: Mon Jun 17, 2013 3:50 pm    Post subject: Reply with quote

What architecture type are you using? A 64-bit EFI can boot only a 64-bit (x86-64/AMD64/x64) Linux kernel, and a 32-bit EFI can boot only a 32-bit (x86/ia32) kernel. If you try to boot a 32-bit kernel from a 64-bit EFI or vice-versa, you'll get the "unsupported" message you report. Given that you've got CONFIG_EFI_STUB=y set in your kernel configuration, a mismatched architecture type is the most likely explanation. If this is the cause, then you have two choices:


  • Re-install Gentoo using the correct architecture type.
  • Use GRUB or some other boot loader that can handle the cross-architecture kernel loading.


One other thought occurs to me, and that is that the kernel file you've created is damaged or is the wrong file type. In a stock kernel compilation, you should be using the file /usr/src/linux/arch/x86/boot/bzImage. If you use some other file (say /usr/src/linux/arch/x86/boot/compressed/vmlinux), it probably won't work.

One more comment, although it's not the source of your problem: With the ESP mounted at /boot as you've done, copying your kernel to /boot/bzImage* or /boot/vmlinuz* should work with rEFInd; you shouldn't need to copy the kernel elsewhere or give it a filename extension of .efi. Using this name will also cause rEFInd to search for a refind_linux.conf file in which you can place kernel options, and to search for a matching initrd file. If you're installing manually, aren't using an initrd file, and have compiled your options into the kernel, you may not care about all this, but I thought I'd point it out because these features (particularly refind_linux.conf) can help you to experiment with your kernel options when you're setting things up.
Back to top
View user's profile Send private message
propjow
n00b
n00b


Joined: 16 Jun 2013
Posts: 6

PostPosted: Sun Jun 23, 2013 10:35 pm    Post subject: Reply with quote

Thanks, ulenrich and srs594.

Indeed you are likely correct that kernel was being compiled for the wrong architecture. I'd since come upon a post suggesting that Core 2 Duo Mac Minis before 2008 (such as my own, which is a 2007) have a 32 bit EFI.

I installed a 32-bit Gentoo and compiled, then installed a 32-bit kernel with the same EFI-related options as before. It's /usr/src/linux/arch/x86/boot/bzImage that is being copied over, by the way. On booting this new kernel I get:
Code:
Starting vmlinuz-3.8.13-gentoo
Using load options ' '

and then it hangs. So the "Error: Unsupported" went away at least; that seems like progress.

For what it's worth, I also tried my hand at installing grub2 but ran into trouble, with grub2-install yielding the error "source_dir doesn't exist. Please specify --target or --directory" despite specifying a target. From [url=http://forums.gentoo.org/viewtopic-p-7011836.html]this[url] post I gather that one must be in an environment that was booted in EFI mode to get it to install properly? I would think a Linux live CD that includes a 32-bit EFI stub kernel would solve this, but haven't been able to find one. Perhaps there's another way.

Thanks for the detail about filenames and rEFInd, srs5694. I'll definitely keep that in mind going forward.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


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

PostPosted: Sun Jun 23, 2013 11:31 pm    Post subject: Reply with quote

It looks like you're on the right track, propjow. Given the output you report, it seems that rEFInd is either not detecting the file as a Linux kernel (which it should be, given the name), or you don't have a refind_linux.conf file to pass it the kernel options. This file's format is pretty simple: It contains a series of lines, each with a name followed by kernel options. Both the name and the kernel options are enclosed in quotes, thus:

Code:
"Verbose boot"                "root=/dev/mapper/seeker-u1204 ro"
"Boot using standard options" "root=/dev/mapper/seeker-u1204 ro   quiet splash vt.handoff=7"
"Single-user boot"            "root=/dev/mapper/seeker-u1204 ro single"


That's taken from my current Gentoo system. Obviously you'll need different options for the root= device, and perhaps for others. The first line identifies the standard boot, and the others are available as options if you hit F2 or Insert instead of Enter to launch the kernel.

If you're using an initial RAM disk file, rEFInd should autodetect that if the name contains the same version string as the kernel's version string -- "3.8.13" in your example. If you're naming your initrd file differently, you must include its specification along with the options in refind_linux.conf. If you don't use an initrd file, don't worry about it.

Oh, and one more important detail: refind_linux.conf goes in the same directory as your kernel(s) -- normally /boot, once the system is up and running.
Back to top
View user's profile Send private message
propjow
n00b
n00b


Joined: 16 Jun 2013
Posts: 6

PostPosted: Thu Jun 27, 2013 6:22 am    Post subject: Reply with quote

Thank you, srs5694.

So, I placed a refind_linux.conf file with what I believe are appropriate kernel options ('root=/dev/sda6 rootfstype=ext4') on the ESP and rEFInd did pick those options up on reboot, but still no luck -- it hangs after "Using load options 'root=/dev/sda6 rootfstype=ext4'". Hmm.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


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

PostPosted: Thu Jun 27, 2013 7:24 pm    Post subject: Reply with quote

Do you have an initrd file? If so, it should be auto-detected, but if it's not being auto-detected, you can add it as an option.

Also, there have been some bugs introduced in the EFI stub loader starting with the 3.7 kernel series. These bugs are causing boot failures on some computers, including some Apples. If you're using a newer kernel, therefore, you could try dropping back to a pre-3.7 kernel. Alternatively, you can swap out the EFI stub loader for an older version. (IIRC, it's just one file, but I don't remember which one offhand. I can find out if you want to try this, though.)
Back to top
View user's profile Send private message
propjow
n00b
n00b


Joined: 16 Jun 2013
Posts: 6

PostPosted: Thu Jul 04, 2013 11:33 pm    Post subject: Reply with quote

No initrd file here, but that was a good thought.

I dropped to a kernel in the 3.4 series but the issue seems to persist - the kernel halts on initial load, this time after scrambling the screen a bit.

Incidentally, I stumbled on yet another thread that suggests this particular Mini prefers a 32-bit EFI with a 64-bit kernel. So per your recommendation there I think I'll try getting a 32-bit Grub (EFI) installed to load a 64-bit kernel.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


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

PostPosted: Fri Jul 05, 2013 2:25 am    Post subject: Reply with quote

Unfortunately, no EFI boot loader seems to be 100% effective. It could just be that the EFI stub loader won't work on your computer, in which case switching to another boot loader may work. For my thoughts on the various options, see my Web page on the subject. OTOH, it's also possible that you need a particular kernel option to get your system to work. Tracking that down can be difficult. The observation that you got some screen weirdness suggests you might need to set some sort of video option, though....
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1159

PostPosted: Fri Jul 05, 2013 9:45 am    Post subject: Reply with quote

srs5694 wrote:
see my Web page on the subject.
I found that much info I got drowned. I ended up installing rEFInd by just extracting the deb package. Which worked astonishingly after utilizing efibootmgr ...

But I didn't get a linux kernel started in pc-mode from rEFInd directly?

This is nessecary because of my proprietary nvidia graphics driver: I can get into a X session in EFI-mode, but relogin scrambles video output ... only one time session possible. This is why I go through EFI-rEFInd, followed by hypbrid grub2-sda2 booting PC-mode Gentoo Linux-3.9 ....
_________________
fun2gen2
Back to top
View user's profile Send private message
propjow
n00b
n00b


Joined: 16 Jun 2013
Posts: 6

PostPosted: Sun Jul 07, 2013 5:39 pm    Post subject: Reply with quote

Quote:
The observation that you got some screen weirdness suggests you might need to set some sort of video option, though....


Yep, that should have been a big clue for me... That was exactly the problem. I discovered that once I enabled mode setting (DRM_I915_KMS=y) I got a working kernel.

Thanks a ton for all your help! It's a great relief to have this working now.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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