Aug 9, 2013

GENTOO ON MAC BOOK PRO 8.1 - Grub2 EFI

My wish is Dual Boot Gentoo Linux and Windows 7 on MacBook Pro 8.1 , I decided to install Gentoo Linux first, preparing a partition for windows 7 for installing later. Thus I need to install GRUB. For someone who wish to have single boot Linux on macBook this Stub Kernel Tutorial is good reference

Preparing Hard Disk

I managed to have 1 MB on first partition, /dev/sda1 unpartitioned marked as bios_grub, 2nd Partition /dev/sda2 for EFI System, Partitioned in FAT 32 mounted to /boot/efi , here is my complete Partition lay out and mount point :

Gentoo Installation

No special thing need to do in installing Gentoo Linux on MacBook Pro 8.1, just follow GENTOO HANDBOOK, well ... it is depending on your Needs and wish, Gentoo known as very flexible. In my case, I'm going to have dual boot Gentoo Linux and Windows 7, I barely need Windows 7 to run some of Cell Phone Repair BOX Helper like GPG-JTAG Pro, Volcano Box, RIFF Box etc and they can run only on Windows Machine.
Important Note : To enable Installing Grub Efi on EFI/UEFI System, we need to boot Machine in EFI Mode, thus during the start in installing Gentoo by using SysrescueCD, hold option Button until you see to boot EFI BOOT (With CD Icon) and Choose EFI BOOT (with CD Icon)

Grub2 Installation

Grub2 is Marked as Stable in Gentoo Linux we just need to configure building Grub efi and Grub Configuration reside at /dev/sda2 partitioned as FAT 32 mounted to /boot/efi :
># mkdosfs -F 32 /dev/sda2
># mkdir /boot/efi (presumed You have completed installing Stage3)
># mount /dev/sda2 /boot/efi
># echo "GRUB_PLATFORMS="efi-64" >> /etc/portage/make.conf
># echo "sys-boot/grub ~amd64" >> /etc/portage/package.accept_keywords
># echo "sys-boot/efibootmgr ~amd64" >> /etc/portage/package.accept_keywords
># emerge grub
Presumed we are on chroot environment during Installation process
># grub2-install --target=x86_64-efi --boot-directory=/boot/efi --efi-directory=/boot/efi --bootloader-id=grub2 --no-floppy --recheck
Configure your kernel to have EFI aware
># grub2-mkconfig -o /boot/efi/grub2/grub.cfg
... it should be detect your kernel installed in /boot
Note : optional
To make life easier I managed to create a scripts named : grub2-efiupdate and placed in /usr/bin
># nano -w /usr/bin/grub2-efiupdate

#!/bin/bash
grub2-mkconfig -o /boot/efi/grub2/grub.cfg
save the file > ctrl+x > y
># chmod +x /usr/bin/grub2-efiupdate
Every times we modify grub2 or having new kernel compilation just run (by root) grub2-efiupdate
Finalizing your installation and reboot. Here is mine :

I still have 2-3 seconds white screen on MacBook Pro 8.1 before Grub2 present during booting, ... well 2-3 seconds is not annoying for me, and fully acceptable. MacBook Pro 8.1 running nicely with Gentoo Linux

Real Multilib Userland on Linux

Read multilib requirement on Android rom building and other stuff. About two years absent from getting rid with android rom. I have time to...