Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] How to install Gentoo on U/EFI mainboard
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
GenProm
Tux's lil' helper
Tux's lil' helper


Joined: 18 Aug 2011
Posts: 78
Location: Germany

PostPosted: Tue Sep 20, 2011 9:23 pm    Post subject: [solved] How to install Gentoo on U/EFI mainboard Reply with quote

Hi fellow Gentoo users,

As im getting a new mainboard, i want to know how to install Grub with UEFI mode.

What steps are necessary ? What kernel config options do i need ? Any special USE flags?

As the handbook gives no information on this topic im lost.

How do i install grub in the right partition and the general process is a bit blurry for me.

Google doesn’t give any useful infos except the arch wiki but i dont know if this is 100% compatible...

For the record: It is no mac, its a normal ASROCK mainboard, and no i cant go back to bios cause ASRock doesnt seem to find it necessary to offer compatibility with old bios.

My plan as for now:

sda1 200 mb /boot ext2
sda2 220 mb /boot/efi fat32
sda3 extended
sda5 30 gb / ext4
sda6 30gb /home etx4
sda7 rest of the hdd /mnt/data

I will make this partitions with gdisk for GTP part table. As kernel, i would go with the genkernel one for now, i guess, just to make sure that it works....

then emerege grub-efi or something, i actually dont know the name of the x64 uefi grub...

mount sda2 on /boot/efi and create the efi folder
then : grub_efi_x86_64-install --boot-directory=/boot/efi/efi --bootloader-id=grub --no-floppy --recheck
But this could differ in gentoo so please help here...

In the Arch wiki they load the dm-mod module, what does this do ? Do i need it in gentoo ? Can i compile it in the kernel ? Do i need to build a new efi build with this module in it ? I know a lot of questiuons, but im lost on this one...

Then i would do:
cp /usr/share/grub/unicode.pf2 /boot/efi/efi/grub/
grub-mkconfig -o /boot/efi/efi/grub/grub.cfg

I will amend the grub.cfg for my kernel i just build and will copy the kernel in /boot and use /kernel-name in the grub.cfg
Also i will copy the UFE shell into that dir /boot/efi/efi/grub/.

Then it should boot right?

Thanks for your help. If this successful, i will gladly add this into the handbook, cause it lacks the new uefi/efi install completely....

Oh on a side note, is it possible to boot the gentoo dvd in uefi mode ? If so, how ?
_________________
Thank you for your help.

Manuel


Last edited by GenProm on Sat Sep 24, 2011 10:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
GenProm
Tux's lil' helper
Tux's lil' helper


Joined: 18 Aug 2011
Posts: 78
Location: Germany

PostPosted: Sat Sep 24, 2011 9:44 pm    Post subject: Reply with quote

Hi

First of all the good news: This moatherboard does support legacy boot, if it does not find a gtp/uefi partition it will boot mbr just fine.

Also i manged to install Gentoo with UEFI mode/Bootloader. Used two howto's and mixed the working parts.... Will post it here shortly.

But i got problems with my atheros wifi card, it is not detected, i dont know if it is related to kernel version or UEFI so currently going back to normal install...
_________________
Thank you for your help.

Manuel
Back to top
View user's profile Send private message
GenProm
Tux's lil' helper
Tux's lil' helper


Joined: 18 Aug 2011
Posts: 78
Location: Germany

PostPosted: Sat Sep 24, 2011 9:58 pm    Post subject: Reply with quote

Hi

Here we go, its a pretty fas writeup, but it should work. Give it a try if you want and please give feedback if it works.

Quote:


If you have no Mac, you should have x84_64 EFI mode.

To install Gentoo in the UEFI mode, boot up Ubuntu in UEFI mode and format the disk in GTP.

GTP will overwrite the classical MBR and then make your partitions.

gdisk /dev/sda

"w" Enter

Reenter gdisk and delete all old mbr partitions

Make a new one, 200MB, type: EF00

Create your system partitions:

sda2 type:0700 /
sda3 " /home
sda4 " /mnt/data

Write GTP table and reboot.

make the filesystems on the partitions, as you like.

For the 200MB use: mkfs.vfat -F32 /dev/sda1

Continue Gentoo install....

Mount sysfs for writing grub later:

mount -t sysfs /sys /mnt/gentoo/sys

Kernel config:

CONFIG_EFI=y
CONFIG_RELOCATABLE=y
CONFIG_FB_EFI=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_EFI_PARTITION=y
CONFIG_EFI_VARS=y

fstab:

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sda1 /boot/efi vfat noauto 1 2
/dev/sda2 / ext4 noatime 0 1
/dev/sda3 /home ext4 defaults,rw,user,noatime 0 0
/dev/sda4 /mnt/data ext4 defaults,rw,user,exec,suid,noatime

Add: GRUB_PLATFORMS="efi-64" to your make.conf or use USE frlag for efi-64: USE="grub_platforms_efi-64"

Add the layman overlay "scarabeus" for grub 1.99-rc2 for UEFI boot support

Create the structure and write grub into its place:

mkdir /boot/efi

mount /dev/sda1 /boot/efi

mkdir /boot/efi/efi/boot -p

cp /usr/share/grub2/{unicode.pf2,ascii.pf2} /boot/efi/efi/boot

grub2-mkimage -d /lib/grub2/x86_64-efi -O x86_64-efi -p "" -o /boot/efi/efi/boot/grub2.efi part_gpt btrfs fat ext2 normal chain boot configfile linux multiboot efi_gop linux

cp /lib/grub2/x86_64-efi/*.mod /boot/efi/efi/boot/
cp /lib/grub2/x86_64-efi/*.lst /boot/efi/efi/boot/

efibootmgr --create --gpt --disk /dev/sda --part 1 --write-signature --label "GRUB2" --loader "\\EFI\\boot\\grub2.efi"

Write a /boot/efi/efi/boot/grub.cfg:

set prefix(hd0,gpt1)/efi/boot
pager=1
timeout=20

menuentry "Gentoo Linux" {
set root=(hd0,gpt2)
linux /boot/bzImage root=/dev/sda3 ro raid=noautodetect
}

NOTE: Grub will not boot a kernel who needs an initramfs to boot!!!


_________________
Thank you for your help.

Manuel
Back to top
View user's profile Send private message
cjmayo
n00b
n00b


Joined: 05 Nov 2004
Posts: 24

PostPosted: Wed Oct 05, 2011 8:15 pm    Post subject: Reply with quote

I think it can be simpler (using sys-boot/grub-1.99-r2 now in the tree).

After the step:
Code:
mount /dev/sda1 /boot/efi

All that is needed (assuming system was booted using EFI) is:
Code:
grub2-install
grub2-mkconfig -o /boot/grub2/grub.cfg


You should now have:
/boot/efi/EFI/grub/grubx64.efi
Populated /boot/grub2 with grub.cfg

And if you do
Code:
efibootmgr -v
you should see a line containing File(\EFI\grub\grubx64.efi) selected as BootCurrent


A couple of prerequisites though:
- Kernels are named: /boot/vmlinuz-* /vmlinuz-* /boot/kernel-*
- Only a single platform is selected in GRUB_PLATFORMS (one of the efi types) when grub is emerged.

If your disk is already booting in Gentoo you may be able to get it into EFI mode without using a LiveCD (I believe you can even convert from MBR to GPT in-place too but I haven't tried that myself), this works for me with an Asus board:

Create a shellx64.efi in EFI System Partition:
Code:
grub2-mkimage -d /lib64/grub2/x86_64-efi -O x86_64-efi -p "" -o /boot/efi/shellx64.efi btrfs ext2 fat part_gpt part_msdos \
   boot chain configfile efi_gop linux multiboot normal


Boot into Grub shell using Motherboard BIOS "Launch EFI Shell from filesystem device" and then start Linux using:
Code:
set root=(hd0,msdos3)
linux /boot/vmlinuz-3.0.4-gentoo ro root=/dev/sda3
boot

Obviously changing (hd0,msdos3), vmlinuz (tab completion should work) and /dev/sda3 to suit
Back to top
View user's profile Send private message
g0del
n00b
n00b


Joined: 27 Jul 2011
Posts: 36

PostPosted: Thu Oct 06, 2011 1:44 am    Post subject: Reply with quote

I have a UEFI system as well, however it was the new 3.x kernels that stopped my wifi driver working. In the 3.x kernels the atheros drivers have been moved, I have an ath9k pci /pcie card. The drivers now reside (make menuconfig ) in
Code:
Device Drivers->Network Device Support->Wireless Lan->Atheros Wireless Cards.  ath9k PCI/PCIe bus support.
selecting that option enabled the WiFi driver
Back to top
View user's profile Send private message
Clad in Sky
l33t
l33t


Joined: 04 May 2007
Posts: 751
Location: Germany

PostPosted: Sat Oct 15, 2011 5:40 pm    Post subject: Reply with quote

For some reason, I wasn't able to get booting in UEFI mode to work.
I tried to use elilo instead of Grub2 (perhaps that was my mistake?) and I used System Rescue CD to install Gentoo (which was booted in Legacy Mode). Dunno if it is necessary to boot in UEFI mode to install Gentoo for booting from UEFI, but this might be the reason.

When using elilo, I got a strange error, saying it couldn't find /lib/modules/some2.6.38-kernel/modules.dep.
The strange thing is, I compiled a 3.0.6 kernel, so of course elilo wouldn't find the 2.6.38 modules.dep.
Any idea what went wrong there?
_________________
Kali Ma
Now it's autumn of the aeons
Dance with your sword
Now it's time for the harvest
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