1 Running gPXE within qemu
2 ========================
4 Michael Brown <mbrown@fensystems.co.uk>
6 To get qemu running is fairly simple:
8 1. Build the utilities in this directory:
11 2. Get the qemu source code:
12 svn co svn://svn.savannah.nongnu.org/qemu/trunk qemu
14 2a. Patch the qemu code. There is currently a bug that causes qemu to
15 execute gPXE incredibly slowly. The bug seems to be related
16 to the relative prioritisation of CPU and I/O operations within
17 qemu. This patch (which I found via Google) isn't a proper fix,
18 but it does work around the problem:
19 patch -p0 < qemu-patch
21 3. Configure qemu with
23 ./configure --target-list=i386-softmmu,x86_64-softmmu
29 5. As root, set up a TAP virtual network device:
31 chmod o+rw /dev/net/tun
32 ./tunctl -u <username> -t tap0
33 /sbin/ifconfig tap0 up 10.254.254.2 netmask 255.255.255.0
35 6. As root, add the following fragment to /etc/dhcpd.conf:
36 subnet 10.254.254.0 netmask 255.255.255.252 {
37 range dynamic-bootp 10.254.254.1 10.254.254.1;
39 You will also need to add in any of your usual declarations for
40 gPXE, e.g. 'filename "vmlinuz.ltsp";'. Note that this setup
41 assumes that your DHCP server, TFTP server etc. all live on the
42 machine you are using for running qemu. If not, then you're on
45 7. As root, restart dhcpd
46 /etc/init.d/dhcpd restart
48 8. Build gPXE floppy disk images and pad to 1.44MB
54 ./qemu/i386-softmmu/qemu -L qemu/pc-bios \
55 -net nic,model=rtl8139 -net tap,ifname=tap0 \
56 -boot a -fda ../../src/bin/rtl8139.dsk
58 You should see qemu start up, load up gPXE and attempt to boot from
66 You can use the program "serial-console" to obtain a virtual serial
67 console for gPXE running within qemu. Run "./serial-console" on a
68 spare tty (e.g. a separate xterm window) before starting qemu, and
69 ensure that you have enabled CONSOLE_SERIAL in config.h.
71 When serial-console starts, it will print out the message "Slave pty
72 is /dev/pts/XX", where XX is a number. You need to append the option
76 to the qemu command line.
78 There is a manual page for "serial-console"; use "man
79 ./serial-console.1" to view it.