How to build 64-bit, EFI-enabled grub on Mac OS X

# in your dev directory..
mkdir grub; cd grub

mkdir objconv; cd objconv
# "objconv" is required by the grub build. Its home page is http://www.agner.org/optimize
wget http://www.agner.org/optimize/objconv.zip
unzip objconv.zip
unzip source.zip
g++ -o objconv -O2 *.cpp
sudo cp objconv /usr/local/bin

# rehash if you are running csh
cd ..

# you may want to pick a more recent release; release_1_97 was the latest as of this writing
# http://svn.savannah.gnu.org/viewvc/tags/?root=grub&sortby=date#dirlist
svn co svn://svn.sv.gnu.org/grub/tags/release_1_97
cd release_1_97
./autogen.sh
./configure --with-platform=efi --target=x86_64

# edit kern/misc.c and add after line 53:
# void *memcpy (void *dest, const void *src, grub_size_t n);
# void *memmove (void *dest, const void *src, grub_size_t n);

# edit symlist.c and add after line 19:
# #include <string .h>
make -j `hwprefs cpu_count`
sudo make install

# This all results in:
# /usr/local/bin/x86_64-grub-editenv
# /usr/local/bin/x86_64-grub-fstest
# /usr/local/bin/x86_64-grub-mkelfimage
# /usr/local/bin/x86_64-grub-mkfont
# /usr/local/bin/x86_64-grub-mkimage