I did this on a new build (new hard drive) on a current slave system. So you can adapt the techniques a bit if you're doing this off a livecd or just migrating a current system.
First you'll want to download a UEFI compatible livecd ( or make your own ). I recommend SysRecueCD http://www.sysresccd.org/Download based on Gentoo. Just download the iso and burn it to a cd, then set it aside.
You'll want to build a EFI partition either using parted or gdisk (assuming this is a clean disk, add your other partitions into this string of commands like normal):
Add this line to your make.conf (or modify for your arch needs) :
Then emerge efi/grub2:
Create the filesystem (has to be fat):
If you want to have a legacy boot loader on this drive then I'd recommend using a directory inside of /boot ( like /boot/efi ) for the efi partition. Otherwise you can use /boot.
You'll probably want the following options enabled in your kenerl :
Compile your new kernel, then copy over your vmlinuz/bzimage to /boot :
NOTE: kernels must be in the following format for grub2 to autodetect "kernel-(version)" or "vmlinuz-(version)"
Make the config file with grub2 :
Now if you're currently booted off a UEFI medium, then great. Otherwise you need to use the sysrescuecd linked above or another medium. Reboot and check your BIOS settings. I am running a Sabertooth 990fx r2.0 and changed:
That forced the board to only boot of UEFI so I knew that the livecd wouldn't be booted in legacy/mbr mode. After you're booted off a uefi medium you can verify by looking for the directory `/sys/firmware/efi` .
If it exists you should be good. If it doesn't then you either :
A) Aren't booted right off the UEFI medium - check bios settings
B) Check livecd you're using to make sure it supports efi bootmgr and the kernel
C) modprobe efivars - if the kernel built it in as a module
You shouldn't have to worry about B or C if using the sysrescd.
Get back in your new build environment if you had to reboot
Finally install the EFI grub bootmgr :
It should tell you if it was successful. If so - reboot off your new UEFI grub2 disk!
You may want to go back into your BIOS if you enabled UEFI only mode, and put it into mix mode in case you ever want to boot off a non-uefi medium.
1337x
ReplyDelete