Building rEFInd with EDKII on Mac OS X

rEFInd is a fork of the rEFIt EFI boot manager. I ran into some issues building rEFInd on Mac OS X with the EDKII using the Makefile(s) provided by the author, which are intended to be used for building on Linux. A number of gcc and ld options used are incompatible with the Mac OS X toolchain. Rather than do the right thing and figure out what the appropriate options are, I’ve just dumped the rEFInd source into a new Package in the EDKII and added DSC and DEC files to get it to build on OS X.

The build information files can be found on github.

Building

  • Prepare and build your EDKII environment (outside of the scope of this document).

  • Clone the repository into the root directory of the EDKII.

      $ cd /path/to/edk2
      $ git clone https://github.com/snarez/refind-edk2.git RefindPkg
    
  • Download the latest version of the rEFInd source into the RefindPkg directory and unpack it.

      $ cd RefindPkg
      $ wget http://downloads.sourceforge.net/project/refind/0.4.5/refind-src-0.4.5.zip
      $ unzip refind-src-0.4.5.zip
    
  • Create a symlink so that the path referred to in the DSC file makes sense.

      $ ln -s refind-0.4.5 refind
    
  • Build the package.

      $ cd ..
      $ source edksetup.sh
      $ build -p RefindPkg/RefindPkg.dsc
    

This works for me on Mac OS X 10.7.4 with Xcode 4.4.1 and its command line tools. Drop me a line if you have any problems.