You are not logged in.

#1 2010-11-22 22:12:08

rwd
Member
Registered: 2009-02-08
Posts: 646

trouble setting up EFI boot on Macbook Pro

I've been running Arch as a single OS on my Macbook Pro 7.1 for a few months using the bios compatibility mode. I would like to try a pure EFI boot. The reason is that I have an OCZ Vertex II SSD that the MBP  fails to boot from, while booting works fine on an 4 y/o Dell Inspiron 6400. I suspect the   SATA running in IDE mode  on the MBP is the cause, and this wiki entry  suggests that under grub2 AHCI can be forced. Also the same page states that the TRIM feature in the kernel is not available in IDE mode.

I read the wiki pages on EFI, grub2 and this how-to http://grub.enbug.org/TestingOnMacbook, but some things are not clear to me:

- Do i need a separate 'EFI System' partition? If so what folder structure should it have and on which mount point should it be mounted? Does it need to be fat32?

- Do I need a  BIOS Boot Partition?

- The how to explains using  the 'Apple bootloader'. But isn't that what grub2 is?

- Do I need GPT for using EFI on a MBP?

- Do I need grub2-efi or does grub2 from core/community work well enough?

Last edited by rwd (2010-11-25 08:10:23)

Offline

#2 2010-11-23 06:33:25

skodabenz
Banned
From: Tamilnadu, India
Registered: 2010-04-11
Posts: 382

Re: trouble setting up EFI boot on Macbook Pro

Read http://wiki.archlinux.org/index.php/Uni … _Interface and http://wiki.archlinux.org/index.php/GUI … tion_Table .

Short answers -

All MB have a hidden EFI SYSTEM PARTITION. Use some rescue disk like PartedMagic or some system having GParted for accessing EFISYS partition.

BIOS Boot Partition not needed for UEFI boot.

You need GPT only if you want to retain Mac OS X, not if you plan to install Linux as the only OS. Having said that, I recommend GPT over MBR for many reasons as explained in the wiki page and although UEFI spec states MBR is supported, I have not heard of any UEFI+MBR system, although grub2 and the linux kernel support such a configuration.

grub2-efi-bzr http://aur.archlinux.org/packages.php?ID=40290 (I maintain this package) or http://dev.archlinux.org/~tpowa/grub2-efi/
I recommend the bzr version.


My new forum user/nick name is "the.ridikulus.rat" .

Offline

#3 2010-11-24 22:56:51

rwd
Member
Registered: 2009-02-08
Posts: 646

Re: trouble setting up EFI boot on Macbook Pro

EFI  boot won't work so far. I get  to the grey Apple firmware startup screen and  see a blinking   folder icon with a question mark. This is what I've done up to now:


- I booted via bios-compatibility to my single-OS Arch on my original harddisk.

  I have  an OCZ vertex II ssd  on which I would like a EFI system  to replace the original harddisk with. The ssd previously had grub (not grub2)   installed on the MBR,

- I created a new GPT table using gdisk.on the ssd with the following layout:

[user1@arch-macbookpro ~]$ gdisk -l /dev/sdb
GPT fdisk (gdisk) version 0.6.13

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 117231408 sectors, 55.9 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 8735A4C5-F1A4-4BF5-81B9-3791E0670FB5
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 117231374
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          411647   200.0 MiB   EF00  EFI System
   2          411648        31868927   15.0 GiB    0700  Linux/Windows data
   3        31868928       117231374   40.7 GiB    0700  Linux/Windows data

- I created a fat32 filesystem on the  EFI System disk, ext4 on the second and a luks container  containing an ext4 filesystem on the third partition.

- I copied the contents of the partitions of my original harddisk to the partitions of the ssd using rsync and changed the uuids in fstab and crypttab to those of the new partitions

- mounted ssd again and chrooted into it:

    mount /dev/sdb2 /media/temproot/
    mount /dev/sdb1 /media/temproot/efi
    mount /dev/mapper/luks_sdb3 /media/temproot/mnt/data/
    mount -t proc none /media/temproot/proc
    mount -t sysfs none /media/temproot/sys
    mount --bind /dev /media/temproot/dev
chroot /media/temproot

- while chrooted I uninstalled grub, installed grub2-efi-bzr from aur using clyde and chose the x86_64 version in PKGBUILD  and followed instructions

# modprobe dm-mod
# mkdir /efi/efi/grub2
#  sudo cp /etc/grub.d/{unifont.pf2,ascii.pf2} /efi/efi/grub2/
# grub2_efi_x86_64_bzr-install --boot-directory=/efi/efi --bootloader-id=grub2_efi_x86_64_bzr --no-floppy --recheck

- I now have the following in /media/temproot/efi/efi:

./grub2
./grub2/unifont.pf2
./grub2/ascii.pf2
./grub2_efi_x86_64_bzr
./grub2_efi_x86_64_bzr/device.map
./grub2_efi_x86_64_bzr/acpi.mod
./grub2_efi_x86_64_bzr/affs.mod
./grub2_efi_x86_64_bzr/(....)

- I created /media/temproot/efi/efi/grub2_efi_x86_64_bzr/grub.cfg with the following contents, based on the grub.cfg.example file. I only made changes to the 'menuentry' parts. (And  I added the ' video=efifb agp=off' parts based on the gentoo wiki, but leaving them out gives the same boot problem')

# DEVICE NAME CONVERSIONS
#
#  Linux           Grub
# -------------------------
#  /dev/fd0        (fd0)
#  /dev/sda        (hd0)
#  /dev/sdb2       (hd1,2)
#  /dev/sda3       (hd0,3)
#

# Load Graphical modules
insmod efi_gop
#insmod efi_uga

# Load Font module
insmod font


# Setup GFXTERM along with loading unifont.pf2 font file

if loadfont ${prefix}/unifont.pf2
then
   insmod gfxterm
   set gfxmode="auto"
   set gfxpayload=keep
   terminal_output gfxterm

   set color_normal=light-blue/black
   set color_highlight=light-cyan/blue

   insmod png
   insmod jpeg
   background_image ${prefix}/archlinux.png
fi

insmod part_gpt
insmod part_msdos
insmod fat
insmod ext2

# Timeout for menu
set timeout=5

# Set default boot entry as Entry 0
set default=0

# (0) Arch Linux
menuentry "Arch Linux" {
set root=(hd0,gpt2)
linux /vmlinuz26 root=/dev/sda2 ro nomodeset add_efi_memmap video=efifb agp=off
initrd /kernel26.img
}
# (1) Arch Linux
menuentry "Arch Linux fallback" {
set root=(hd0,gpt2)
linux /vmlinuz26-fallback root=/dev/sda2 ro nomodeset add_efi_memmap video=efifb agp=off
initrd /kernel26-fallback.img
}

To set it to bios-compatibility mode and get rid of the 30 second  delay before grub I previously I had done this from within the OSX terminal using the OSX installation cd:

bless --device /dev/disk0s1 --setBoot --legacy

With this I hoped to get the EFI mode back:

bless --device /dev/disk0s1 --setBoot

Still   obviously something isn't right.
- Are paths or mount points wrong? It seems a bit odd to have both a /efi/grub2 and an /efi/grub2_efi_x86_64_bzr on the EFI System partition
- Do in need something in /boot ?
-  Do I need   the original OSX EFI System partition instead of the one I created? The one on the original harddisk was nuked with dd.
-  Could grub that was previously on the harddisk   still be on the MBR and cause trouble?

Last edited by rwd (2010-11-25 18:02:38)

Offline

#4 2010-11-25 09:09:26

skodabenz
Banned
From: Tamilnadu, India
Registered: 2010-04-11
Posts: 382

Re: trouble setting up EFI boot on Macbook Pro

My mistake, it should be (in this order)

grub2_efi_x86_64_bzr-install --boot-directory=/efi/efi --bootloader-id=grub2_efi_x86_64_bzr --no-floppy --recheck

sudo cp /etc/grub.d/{unifont.pf2,ascii.pf2} /efi/efi/grub2_efi_x86_64_bzr/

sudo cp  /etc/grub.d/grub.cfg.example /efi/efi/grub2_efi_x86_64_bzr/grub.cfg

No need for  /efi/grub2. Are u sure your MBP has 64-bit EFI? And what modules you added while generating  /efi/efi/grub2_efi_x86_64_bzr/grub2.efi using grub2_efi_x86_64_bzr-mkimage? As for Mac specific efi instructions I cant help u there as I do not own a Mac. I use x86_64 UEFI 2.3 firmware.


My new forum user/nick name is "the.ridikulus.rat" .

Offline

#5 2010-11-27 18:53:42

rwd
Member
Registered: 2009-02-08
Posts: 646

Re: trouble setting up EFI boot on Macbook Pro

Thanks for the tips skodabenz. I am getting some progress, in the sense that the Grub menu shows up. But selecting any item  results in black screen with a prompt in the top-left. These are the things that I've been trying, each time swapping harddisk with the SSD:

- following the tips on http://grub.enbug.org/TestingOnMacbook I verified that the firmware is 64 bit using the mac OSX cd.

- Also I changed the path of the the contents of /efi/efi/grub2_efi_x86_64_bzr to /efi/EFI/BOOT/
and renamed grub.efi to BOOTX64.EFI as that is where the firmware seems to expect it

- Furthermore since efi is on a separate partition I added  '/boot/' to the initrd  and kernel lines (see grub.cfg. below).

One or more of these changes made that I when booting with the alt key pressed I can get into the grub menu.  Just before the grub menu appears though I see an error message that is too quick to read. Something like "error 'prefix' ...". Selecting any item in the grub menu results in a prompt.

- To be sure that it wasn't a typo in grub.cfg I tried this within the chroot, and it doesn't show any errors:
   

cat /efi/EFI/BOOT/grub.cfg | /bin/grub2_efi_x86_64_bzr-script-check --verbose

- I then decided to compile more modules so I did:

    grub2_efi_x86_64_bzr-mkimage -d /usr/lib/grub2_efi_x86_64_bzr/x86_64-efi -O x86_64-efi -p "" -o /efi/EFI/BOOT/BOOTX64.EFI minicmd part_msdos part_gpt fat ext2 hfsplus ntfs reiserfs xfs iso9660 ls search loopback linux chain reboot halt appleldr help configfile hexdump loadbios fixvideo sh

- Still no boot, so I installed the 2.6.36-ck kernel from aur.

- Then I tried the ahci force tip mentioned in  https://wiki.archlinux.org/index.php/Solid_State_Drives
and added to menu items in the grub.cfg 'insmod setpci' and added to the menu items 'setpci -d 10de:0d85 90.b=40' with the pci id determined from 'lspci -nn'

A strange thing I noticed was that even though when booting from the SSD there is only one drive, when I press 'c' in the grub menu and then 'ls' I get this output, so now there is both a hd0 and hd1:

(hd0) (hd1) (hd1,gpt3) (hd1,gpt2) (hd1,gpt1) (cd0)

a 'ls (hd1,gpt2)' shows the contents of the partition that contains /boot. When I change the items in grub cfg to set 'root=(hd0,gpt2)' I get 'no such partition' error. When I change it to 'set root=(hd1,gpt2)' I get the black screen with a prompt. 

A little research showed the cause for this:

[root@arch-macbookpro boot]# cat /boot/grub2_efi_x86_64_bzr/device.map
(hd0)    /dev/disk/by-id/ata-Hitachi_HTS545025B9SA02_100610PBL2003SKV6ZPV
(hd1)    /dev/disk/by-id/usb-OCZ-VERT_EX2_FCF0FEFFEFFCF0F33F5231144FF5FD-0:0

I guess I have to change this file and reinstall grub2. Will post the results in a next post.

This is the grub.cfg so far. None of these menu items work:

# Example Config file for GRUB2 - The GNU GRand Unified Bootloader
# /boot/grub2_efi/grub.cfg.example
# DEVICE NAME CONVERSIONS
#
#  Linux           Grub
# -------------------------
#  /dev/fd0        (fd0)
#  /dev/sda        (hd0)
#  /dev/sdb2       (hd1,2)
#  /dev/sda3       (hd0,3)
#
# Load Graphical modules
set debug=video
insmod efi_gop
#insmod efi_uga
# Load Font module
insmod font
# Setup GFXTERM along with loading unifont.pf2 font file
if loadfont ${prefix}/unifont.pf2
then
   insmod gfxterm
   set gfxmode="auto"
   set gfxpayload=keep
   terminal_output gfxterm

   set color_normal=light-blue/black
   set color_highlight=light-cyan/blue

   insmod png
   insmod jpeg
   # background_image ${prefix}/archlinux.png
fi
insmod part_gpt
insmod part_msdos
insmod fat
insmod ext2
insmod setpci

# Timeout for menu
set timeout=3
# Set default boot entry as Entry 0
set default=0
menuentry "Arch Linux - with bios dump" {
    #search --set -f /boot/vmlinuz26
    #setpci -d 10de:0d85 90.b=40    
    set root=(hd1,gpt2)
    loadbios /boot/vbios.bin /boot/int10.bin
    linux /boot/vmlinuz26-ck root=/dev/sda2 rootfstype=ext4 video=efifb agp=off
    initrd /boot/kernel26-ck.img
}
menuentry "Arch Linux - Linux (with bios dump and fix video)" {
    #search --set -f /boot/vmlinuz26
    #setpci -d 10de:0d85 90.b=40
    set root=(hd1,gpt2)
    fix_video
    loadbios /boot/vbios.bin /boot/int10.bin
    linux /boot/vmlinuz26-ck root=/dev/sda2  rootfstype=ext4 video=efifb agp=off
    initrd /boot/kernel26-ck.img
}
menuentry "Arch Linux" {
    #search --set -f /boot/vmlinuz26
    #setpci -d 10de:0d85 90.b=40
    set root=(hd1,gpt2)
    fakebios
    linux /boot/vmlinuz26-ck root=/dev/sda2 rootfstype=ext4 video=efifb agp=off
    initrd /boot/kernel26-ck.img
}
menuentry "Arch Linux test" {
    #setpci -d 10de:0d85 90.b=40
    set root=(hd1,gpt2)
    linux /boot/vmlinuz26-ck root=/dev/sda2 rootfstype=ext4 video=efifb agp=off
    initrd /boot/kernel26-ck.img
}
menuentry "Arch Linux test2" {
    #setpci -d 10de:0d85 90.b=40
    set root=(hd1,2)
    linux /boot/vmlinuz26-ck root=/dev/sda2 rootfstype=ext4 video=efifb
    initrd /boot/kernel26-ck.img
}
menuentry "Arch Linux test uuid" {
    #setpci -d 10de:0d85 90.b=40
    search --no-floppy --fs-uuid d76f36b4-109a-48cd-81de-941f169b2213 --set root
    linux /boot/vmlinuz26-ck root=/dev/disk/by-uuid/d76f36b4-109a-48cd-81de-941f169b2213 ro rootfstype=ext4 video=efifb
    initrd /boot/kernel26-ck.img
}

Last edited by rwd (2010-11-27 20:35:01)

Offline

#6 2010-11-27 20:14:47

skodabenz
Banned
From: Tamilnadu, India
Registered: 2010-04-11
Posts: 382

Re: trouble setting up EFI boot on Macbook Pro

I don't know anything about setpci. Can you wait for at least 1 min and see whether the black screen with the prompt leads to boot messages? SOmetimes grub2 takes longer to load initramfs into the RAM in efi booting. /EFI/BOOT/BOOTX64.EFI is for removable devices, but if it working for you then it is ok.

Try adding noefi to the kernel parameters

linux /boot/vmlinuz26-ck root=/dev/disk/by-uuid/d76f36b4-109a-48cd-81de-941f169b2213 ro rootfstype=ext4 noefi video=efifb agp=off

Try grub-efi-fedora  http://aur.archlinux.org/packages.php?ID=38466 if grub2-efi is creating problems

Last edited by skodabenz (2010-11-27 20:18:18)


My new forum user/nick name is "the.ridikulus.rat" .

Offline

#7 2010-12-03 21:45:44

rwd
Member
Registered: 2009-02-08
Posts: 646

Re: trouble setting up EFI boot on Macbook Pro

Thanks again skodabenz. Booting works with  the 'noefi' kernel line and   'fakebios' line in grub.cfg   to have keyboard. And After patching a 2.6.35 kernel with a kernel patch that switches EFI to 'physical mode' ,  I was able to boot without needing 'noefi' and 'fakebios'. Also backlight and keyboard led control now works.

I haven't managed to get the proprietary nvidia driver going though.I  built  the nvidia package (v. 260.19.21-2) using ABS to adjust paths to my kernel26-custom package and using it fails this output (I also tried with fakebios and loadbios) :

[    22.413] (EE) NVIDIA(0): Failed to initialize the display subsystem for the NVIDIA
[    22.413] (EE) NVIDIA(0):     graphics device!
[    22.414] (EE) NVIDIA(0): Failed to determine chip display capabilities
[    22.414] (EE) NVIDIA(GPU-0): Failed to get supported display device(s)
[    22.414] (EE) NVIDIA(0): Failed to initialize dac HAL
[    22.428] (II) UnloadModule: "nvidia"
[    22.428] (II) UnloadModule: "wfb"
[    22.428] (II) UnloadModule: "fb"
[    22.428] (EE) Screen(s) found, but none have a usable configuration.
[    22.428] 
Fatal server error:
[    22.428] no screens found
[    22.428] 

I suspect something is not right with the bios image loaded with loadbios. When I perform 'loadbios /boot/vbios.bin' manually from the grub commandline I get 'ROM image is present'. But 'sudo dmidecode' gives:

# dmidecode 2.10
# No SMBIOS nor DMI entry point found, sorry.

Also hdparm -I /dev/sda shows that the SSD is running in UMDA6 (ata/133) mode, so no ahci and 'trim' support right now I assume.

There are some options left that I'm going  to try, like grub-efi-fedora, and updating firmware of the chipset.

Last edited by rwd (2010-12-05 11:46:10)

Offline

#8 2011-05-17 00:33:55

steve___
Member
Registered: 2008-02-24
Posts: 439

Re: trouble setting up EFI boot on Macbook Pro

@rwd - How did you make our with your grub.cfg?  I'm trying to get my SSD to run in AHCI mode.  Were you able to get the 'setpci' command to work?

Offline

#9 2011-05-17 06:59:36

rwd
Member
Registered: 2009-02-08
Posts: 646

Re: trouble setting up EFI boot on Macbook Pro

Steve, I used

hdparm -I /dev/sda

to check  whether the drive was in ahci mode or not after the setpci tweak , and it seemed to indicate it wasn't. But maybe that is not the right way to check it. Right now I'm back to running arch bios-compatibility mode.

Offline

#10 2011-05-17 17:34:06

steve___
Member
Registered: 2008-02-24
Posts: 439

Re: trouble setting up EFI boot on Macbook Pro

Hmm ok.  I'll try and dig into it.

Are your reads slow?  I am getting around 130mb/sec and should be getting around 270mb/sec.  I'm using this command to benchmark:

hdparm -Tt /dev/sda

I am using this drive, fwiw:

Intel X25-M (G2)

    SSD: Intel X25-M Generation 2
    Model Number: SSDSA2M080G2C
    Capacity: 80 GB

I was hoping the setpci command would speed things up.

Last edited by steve___ (2011-05-17 17:35:48)

Offline

Board footer

Powered by FluxBB