Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
From ia32/MBR-boot to EFI/GPT/amd64
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
mas-
n00b
n00b


Joined: 07 Jun 2011
Posts: 34

PostPosted: Fri Nov 30, 2012 9:09 pm    Post subject: From ia32/MBR-boot to EFI/GPT/amd64 Reply with quote

I just finished the above mentioned upgrade and learnt a few things the hard way. Here are the main gotchas I encountered and the hints derived from them, so that those interested to upgrade to amd64 and EFI boot can perhaps avoid them:

1. Most modern EFI bios only boot x64 binaries via EFI. So you need to upgrade to amd64 first (or stay with BIOS/mbr boot, but this is about the upgrade process). Interestingly I did not find that spelled out clear enough (for my brain at least) - so avoid the pain to try getting EFI to boot when you are on x86 (ia32), won't work!

2. There is no shortcut to installing amd64 from scratch following the install handbook. I tried a few shortcuts and they all ended in a mess. This sucks btw!

3. After the basic reinstallation steps do first re-emerge the basic system. Only then add - stepwise - your desired use flags and packages. I tried to do it all over in one run with a giant "emerge -avuDN world" and got hung in a fabulous number of circular dependencies and the like. What helped was going stepwise and building it up in 3-4 steps. Admittedly I have >1200 packages installed here so if you run a simple system that may or may not work better for you.

4. Back-up your boot partition, delete this partition and recreate the EFI boot partition with gdisk (package gpt-fdisk) with the correct type (EF00) and vfat-32 filesystem. Don't try to do a EFI boot from a non GPT (aka MBR) partitioned harddrive. It will otherwise just boot the good oldfashioned way (not using EFI).

5. Recompile the kernel and enable everything with EFI, efistub, efi-framebuffer, etc. in it. And compile your kernel command line in as well! This is not the only way to do it, but by far the easiest. You can still install several different boot options by putting different kernels on your boot partition and running 8. several times on these kernels.

6. Before your EFI bios can "see" any of your nice new EFIstub enabled kernels you need to first boot into an EFI environment and then use efibootmgr to tell the BIOS what to boot. The easiest way to defeat this hen-and-egg-problem is to use the Shellx64.efi Bootshell. There you can just "start" your EFI-enabled kernel like a command.

7. The Shellx64.efi will only be detected by your BIOS if you put it into the root directory of your EFI bootdisk. It won't work under EFI/boot or elsewhere. That is also something I did not find spelled out clear enough for me. So mount the EFI partition on /boot and put that Shellx64.efi under exaclty this name under it.

8. After the first boot via this method into your kernel you are almost there. Use efibootmgr to tell the BIOS where your kernels sits. Reboot, voila, upgrade complete.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


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

PostPosted: Sat Dec 01, 2012 12:54 am    Post subject: Re: From ia32/MBR-boot to EFI/GPT/amd64 Reply with quote

mas- wrote:
1. Most modern EFI bios only boot x64 binaries via EFI. So you need to upgrade to amd64 first (or stay with BIOS/mbr boot, but this is about the upgrade process). Interestingly I did not find that spelled out clear enough (for my brain at least) - so avoid the pain to try getting EFI to boot when you are on x86 (ia32), won't work!


It is possible to install a 32-bit version of Linux on a 64-bit computer using EFI; however, this involves using a 64-bit version of GRUB (or ELILO would probably work) to launch the 32-bit kernel. The resulting system won't have access to the EFI runtime variables, so efibootmgr won't work. Overall, this is probably a sub-optimal solution, and installing a 64-bit kernel on a 64-bit computer is generally the best way to go.

Quote:
4. Back-up your boot partition, delete this partition and recreate the EFI boot partition with gdisk (package gpt-fdisk) with the correct type (EF00) and vfat-32 filesystem. Don't try to do a EFI boot from a non GPT (aka MBR) partitioned harddrive. It will otherwise just boot the good oldfashioned way (not using EFI).


I can't say I've tried installing Linux to an MBR-partitioned hard disk on an EFI system; however, at least some systems do support booting from MBR-partitioned USB flash drives. Thus, I suspect that you'll be able to install to an MBR disk on some computers, although perhaps not on all of them.

Quote:
5. Recompile the kernel and enable everything with EFI, efistub, efi-framebuffer, etc. in it. And compile your kernel command line in as well! This is not the only way to do it, but by far the easiest. You can still install several different boot options by putting different kernels on your boot partition and running 8. several times on these kernels.


Be aware that firmware interfaces vary greatly in terms of their boot managers. It's possible to select from any of several boot options on some, but with some implementations, doing so is awkward. With a few, it's impossible. If you've got such a system, an EFI boot manager is a necessity if you want to have a choice of kernels. The two best ones for this job are rEFInd and gummiboot. Alternatively, you can use a boot loader with boot manager features, such as GRUB or ELILO. Using a separate boot manager or boot loader can also give you extra boot options -- you can set up separate entries with distinct options for each one, or even edit the boot options on a boot-by-boot basis.

Quote:
7. The Shellx64.efi will only be detected by your BIOS if you put it into the root directory of your EFI bootdisk. It won't work under EFI/boot or elsewhere. That is also something I did not find spelled out clear enough for me. So mount the EFI partition on /boot and put that Shellx64.efi under exaclty this name under it.


Again, this detail varies greatly from one implementation to another. Many offer no option to launch an EFI shell unless you register it via efibootmgr. The location may also vary from one implementation to another, but I don't have hard data on what's most common. Both rEFInd and gummiboot auto-detect EFI shell programs placed in certain locations, so again, they're valuable additions if your firmware is deficient on this score.
Back to top
View user's profile Send private message
mas-
n00b
n00b


Joined: 07 Jun 2011
Posts: 34

PostPosted: Sat Dec 01, 2012 3:25 pm    Post subject: Reply with quote

BTW: These finding were made on a Asrock H77 Pro4/MVP with the most current EFI Bios available for it.
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