This is an old revision of the document!
====== How to use gPXE with QEMU ====== ===== QEMU 0.9.1 or later ===== In QEMU 0.9.1, there is a new option, ''-bootp'', which advertises a filename in BOOTP replies from QEMU's internal DHCP server. Combined with ''-net user'', this option eliminates the need for a special DHCP server setup and TUN/TAP devices. An example command (modified contrib/bochs/README.qemu): ''qemu -net nic,model=rtl8139 -net user -boot a -fda ../../src/bin/rtl8139.pdsk -bootp http://server/file.gpxe'' Note that you can use this in conjunction with the ''-tftp'' option to test gPXE locally. See the [[http://bellard.org/qemu/qemu-doc.html|QEMU documentation]]. For example, where ''gpxe/src/bin/gpxe.usb'' is the USB image built by the default gPXE ''make'': ''qemu -bootp tftp://10.0.2.2/pxelinux.0 -tftp /path/to/pxelinux/dir gpxe/src/bin/gpxe.usb'' ===== QEMU 0.9.0 or earlier ===== For versions of QEMU before 0.9.1, the instructions from [[http://git.etherboot.org/?p=gpxe.git;a=blob;f=contrib/bochs/README.qemu;hb=HEAD|contrib/bochs/README.qemu]] can be used. ===== Debugging gPXE with QEMU ===== The QEMU monitor (''CTRL+ALT+2'') supports debug commands to inspect registers and memory (try ''help'' or tab complete). Some useful commands include ''stop'', ''info registers'', and ''x'' (dump memory). ==== Memory dumps ==== Unfortunately, QEMU only honors paged virtual memory. Since gPXE sets up a virtual memory segment with a non-zero base address, all virtual addresses need to be adjusted before using them to inspect memory in QEMU. The virtual memory offset is available inside gPXE as ''virt_offset'' (see ''arch/i386/transitions/librm.S''). It can be printed out by placing a ''printf'' call in ''core/main.c''. When dumping memory, remember to add the value of ''virt_offset'' to any virtual memory addresses. QEMU is effectively using physical memory only.