This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== Building gPXE on a Mac ====== Though driver support is not there yet, you can build gPXE on a Mac running OS X, either targeting the Mac's EFI interface (for development) or the normal PC BIOS interface (for virtualized testing or cross-compiling). Since the native OS X toolchain doesn't produce ELF executables, though, it's necessary to build a cross-compiling one. ===== Building the cross toolchain ===== Download the most recent versions of gcc and binutils from ftp://ftp.gnu.org/gnu; I tested with gcc 4.3.3 and binutils 2.19.1, but any newer version should also work. You only need the "core" distribution of gcc, since we're only interested in compiling C code. Create a directory for your work, put the tarballs there, and change to it in the shell. The following commands will build the toolchain and install it: $ export PATH=$PATH:/usr/local/bin $ tar xjf binutils-2.19.1.tar.bz2 $ cd binutils-2.19.1/ $ ./configure --prefix=/usr/local --target=i386-elf --enable-install-libbfd --enable-install-libiberty --disable-nls $ make $ sudo make install $ cd .. $ tar xjf gcc-core-4.3.3.tar.bz2 $ mkdir gcc-build $ cd gcc-build $ ../gcc-4.3.3/configure --prefix=/usr/local --target=i386-elf --enable-languages=c --disable-libssp $ make $ sudo make install $ cd .. The modification to your ''$PATH'' is necessary because the toolchain is installed in /usr/local/bin, the usual place for non-system installs. Since OS X doesn't have a good command-line package management facility, we'd like to make it reasonably easy to separate custom installs from the base system. With the toolchain installed, you should be able to run e.g. ''i386-elf-gcc -v'' and get version information. ===== Building gPXE ===== Get the latest gPXE from git (as of this writing the OS X build fixes are not in any numbered release) and go to the ''src/'' subdirectory as you normally would for a build from source. To compile a //PC bios// gPXE, use your normal make commandline with ''CROSS_COMPILE=i386-elf-'' (don't forget the trailing dash!) on the end. For instance, $ make bin/gpxe.dsk CROSS_COMPILE=i386-elf- To compile an //EFI// gPXE suitable for running on the Mac (remember, no driver support yet, this is only for development): $ make bin-i386-efi/rtl8139.efi CROSS_COMPILE=i386-elf- BINUTILS_DIR=/usr/local BFD_DIR=/usr/local/i386-apple-darwin9.6.0/i386-elf I don't know of any Mac that has an rtl8139 card, but it's necessary to be specific with the driver to exclude ''undionly'', since that requires 16-bit code support that's not present in EFI targets. Once Mac ethernet drivers are supported, you'll want to build with a useful driver instead of ''rtl8139''. The extra arguments for binutils and BFD are necessary to build the ''util/elf2efi32'' application. ===== Running gPXE on a Mac ===== There are two ways of booting with your shiny new EFI image: rEFIt and a "blessed" external drive. ==== rEFIt ==== rEFIt is an EFI bootloader; while its main purpose is to choose between operating systems at startup, it also includes an EFI shell that you can use to test gPXE. Download it from http://refit.sourceforge.net/#download and install following the directions on that site, then place ''//driver//.efi'' in the newly created ''/efi/tools'' directory. After //two// reboots if you used the provided installer, or one if you used ''enable.sh'', you should be presented with a boot menu. Navigate to the "shell" option and type the basename of your gPXE EFI image at the prompt. If all went well, you should see a gPXE banner followed by something resembling "no valid NIC found", and be dropped back at the shell. Using rEFIt's installer installs a tool called "rEFItBlesser" that runs at system shutdown to "bless" the rEFIt image to run on next startup, and "unblesses" it as OS X is starting up. That means rEFIt won't run after a hard reboot or when waking from sleep. Using ''enable.sh'' causes the rEFIt image to be blessed permanently until you change the blessing back with the Startup Disk preference pane. It's up to you which you'd rather use; rEFIt's website has good documentation. ==== Blessed external drive ==== Mount your USB or FireWire external drive, create an ''efi'' folder therein, and copy ''//driver//.efi'' to that folder. Assuming it's mounted at ''/Volumes/gPXE'', run $ sudo bless --folder /Volumes/gPXE/efi --file /Volumes/gPXE/efi/driver.efi You can add ''--setBoot'' to set that external drive as the default for all future boots, ''--setBoot --nextonly'' to set it as the default only for the next startup, or use the Startup Disk preference pane after ''//driver//.efi'' (replace it with the actual name of your EFI image) has been blessed. Use ''bless --info //mountpoint//'' to see what, if anything, is blessed on the partition mounted at //mountpoint//, or ''bless --getBoot'' to see the default boot device. If you're feeling particularly daring, you can mount and use the "EFI System Partition", ''/dev/disk0s1'', for gPXE. This may be a good long-term solution once gPXE on Macs is running stably. Note that the blessing method is thus far untested.


Navigation

* [[:start|Home]] * [[:about|About our Project]] * [[:download|Download]] * [[:screenshots|Screenshots]] * Documentation * [[:howtos|HowTo Guides]] * [[:appnotes|Application Notes]] * [[:faq:|FAQs]] * [[:doc|General Doc]] * [[:talks|Videos, Talks, and Papers]] * [[:hardwareissues|Hardware Issues]] * [[:mailinglists|Mailing lists]] * [[http://support.etherboot.org/|Bugtracker]] * [[:contributing|Contributing]] * [[:editing_permission|Wiki Edit Permission]] * [[:wiki:syntax|Wiki Syntax]] * [[:contact|Contact]] * [[:relatedlinks|Related Links]] * [[:commerciallinks|Commercial Links]] * [[:acknowledgements|Acknowledgements]] * [[:logos|Logo Art]]

QR Code
QR Code macbuild (generated for current page)