Successfully set up UEFI booting yesterday on amd64 (MB: ASUS P8P67). It was/is sort of chicken and egg problem - to be able to setup it, one has to have the system already booted in UEFI mode; one can do so with the help of EFI boot capable usb flashdrive. Short summary is

[note: grub2.00_beta2 works for me; _beta1 has a bug preventing it from booting later on]

step 2) Booting the computer in UEFI mode from flashdrive

Automated grub2-install on UEFI system (step 3) is quite adept and ready, but it relies on access to EFI variables, which basically means two things: 1) the kernel have to support them - the easy part - AND2) the machine have to be already booted in UEFI mode - the not so straightforward part, "chicken and egg problem", that can be overcome with an EFI bootable flashdrive.

* EFI bootable USB flashdrive can be created with (assuming FAT formatted drive, mounted under /media/flashdrive)

* Kernel support: (re)compile kernel with CONFIG_EFI_VARS=y [menuconfig: [*] Firmware Drivers/EFI Variable Support via sysfs]. (copy kernel to /media/flashdrive/vmlinuz for convenience)
[note: support for EFI variables can be compiled as module, which is called 'efivars' BUT 'modprobe efivars' alone e.g. on a machine booted e.g. from MBR flashdrive does not make the efi vars available (or at least it did not on my asus P8P67 motherboard)].

* ls -l /dev/root to remind which partition is root -> /dev/sdaX

* Reboot machine from the flashdrive in UEFI mode - motherboard/notebook manual should contain instructions on how to do this.

* GRUB2 command line should appear - the system can be booted with something like
grub> linux /vmlinuz root=/dev/sdaX
grub> boot
[if there is no kernel on the flash, use "grub> set root=(hd1,gptX)" first to mount gptX partiton and linux /boot/vmlinuz root=/dev/sdaX ... see GRUB doc for more info]
[note: flashdrive is hd0, first disk is hd1; still, kernel booted for me with root=/dev/sdaX; also I encountered error: no video mode activated Booting in blind mode (and no messages during the boot were visible), but the system booted (to X) just fine)
[note (caveat): booting from 'classical' MBR bootable flashdrive 'laying somewhere around' will most probably not make EFI variables available, even when kernel with compiled in support is used; MBR booting - at least on my motherboard - thwarts the UEFI mode and prevent the kernel from accessing the UEFI variables]

step 3) GRUB2 installation

Look at /sys/firmware/efi/vars to see whether the EFI variables are accessible

grub2-install from above should setup the option to boot GRUB2 in EFI. This does not necessarily mean that the system will boot to GRUB2 after restart. It is now possible/necessary to select that GRUB2 option "in BIOS" =in EFI vendor user interface (e.g. on an ASUS P8P67 MB press Del to enter setup ... and set it there)
[note: this can probably also be done from within linux with efibootmgr command]

step 5) Chainloading Windows7 x64

basically, add

menuentry 'Windows7' {
chainloader /efi/Microsoft/Boot/bootmgfw.efi
}

to the end of /boot/efi/EFI/GRUB2/grub.cfg (don't worry about the don't edit exclamation at the beginning of the file)

Hey, another masochist here....just built a new system based on the ASUS Rampage IV Extreme...and of course, Gentoo is going on it.

I knew I would need to go UEFI, but this stuff is bleeding edge (it's bled away my entire weekend). So far, I can launch the grub2 command line from the bios, but that's it! I've been trying to follow the ArchLinux docs on this.

So, you look like you are way ahead of me...so a few questions...1) where did you put your kernel images on the hdd and 2) Does your motherboard see your hdd? I'm using a SATA 6 GB port and my the UEFI can see it as a disk drive and I can get to the EFI system partition I created, but it refuses to list it as a boot device. There is no where in the BIOS I can find to tell it where to look for grub, so I don't know if this is something handled by efibootmgr or not...it must be.

So you have GRUB2 already installed on your hard drive? How did you do it?

As is written above, BIOS (or, rather, what I would call EFI vendor interface) sees GRUB2 (i.e. it offers it as a choice to boot if you press F8 during boot (F8 works on my ASUS P8P67 motherboard, might be different for other boards)), but only after successful run of grub2-install on a system that is already booted in EFI mode (and to be able to boot it from hdd in efi mode, you need the option on the bios). To overcome this chicken-egg problem, I used (had to use) an EFI-bootable flashdrive [I put the kernel on it for convenience] (see above for the instructions on how to prepare it), than reboot the system, press F8, select [EFI:<flashdrive>] from the menu -- but first I would recommend you to have working system (able to boot to Xwindows) ready, since so far I've been unable to make keyboard work on console

Have you booted your system with usb flashdrive in EFI mode?

(just to be sure - you used GPT partition table?) What are the partitions you have on your hdd?

Well, I did a grub2-install before I have an efivars system and copied that to the shell executable in the efi directory and that gave me access to the grub shell from the UEFI bios.

The directions from archlinux I was following were not quite working...so I managed for find the current gentoo wiki on UEFI and am using that. I've scratched what I was doing and am no starting from scratch. So yeah, a usb booted EFI kernel is really the only way to go. I'm working through that now.

And yes, I've been using GPT partitions, but I originally created them as MBR partitions and converted them with gdisk. I've since blown all that away and just created the partitions with GPT. I know a lot more now than I did when I started 2 days ago, that's for sure.

Anyway, I don't know if you've seen this or used it, but this is the guide I'm going by now:

I realize this thread is a couple of weeks old, but you might want to look into rEFInd, which is my fork of the rEFIt EFI boot manager. When coupled with a 3.3.x kernel and its EFI stub loader, you can boot an EFI system without messing with GRUB. There is still the chicken-and-egg problem of telling the EFI about your boot loader from a BIOS boot, but you can generally use a default name or boot from a USB flash drive or optical disc, at least initially.

If you're not quite ready to jump to a 3.3.x kernel, IMHO either ELILO or GRUB Legacy is superior to GRUB 2 on EFI systems. (I've got a Web page that describes all the major boot loaders for Linux.)

I was able to get through this. Took me about a week of research...the most difficult part was figuring out how to find and boot an EFI live cd (or usb, as it turned out). After I finally got that, grub2 installed fine and I've been dual booting windows 7 and gentoo without any issues whatsoever. It's just very 'different' from the old grub and not at all well documented. Lot's of documentation out there, but it's often incomplete or out of date. Anyway, I made it.