Samuel Jacob's Weblog

Just another technical blog

Network Booting

without comments

After creating Ace bootable CD, I decided to try to make Ace bootable from network also to completely avoid creation of disk images. Network booting also helps to boot test machine (real machine) on the same network with ease.

Earlier I had grub installed (on a disk) on a test machine (real machine) with network support. Grub can get the kernel using tftp and boots the system.

Now I wanted to avoid installing grub on a disk. So I had only one option diskless boot. So I decided to use PXE(Preboot eXecution Environment).

To make PXE work, I needed a DHCP server and TFTP server. There are lot of tools available for Linux but for Windows, very very less tools available. After some internet searches, I found and downloaded perfect tools: Dual Server http://sourceforge.net/projects/dhcp-dns-server/ and TFTP Server http://sourceforge.net/projects/tftp-server/ both projects are developed and maintained by Achal Dhir. The other tftp/dhcp servers available windows doesn’t have large set of options provided by Dual Server and TFTP server.

Since I wanted to try PXE boot on emulators, I needed to create software network tap adapter. Without software tap adapter, emulated network card cant talk to the physical network. So I downloaded OpenVPN, which has tool to create tap devices from http://openvpn.net/index.php/downloads.html

If you are using real machine, you may need to download and install PXE roms from etherboot.org http://rom-o-matic.net/

To boot from network, grub should be compiled with appropriate network driver and other flags. Since grub has some problem with compiling under Windows, I used a Linux machine to compile.
cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/grub co grub
cd grub
./configure –-enable-diskless –-enable-pxe –-enable-rtl8139
You might want to compile in the preset menu also using the –preset option.

Now configure Dual DHCP server to provide IP address, boot file information to qemu
#qemu-ne2k-pci
[52:54:00:12:34:56]
IP_Addr=192.168.2.200
HostName=QemuBox
DNS_Server=192.168.2.10
Router=192.168.2.10
Boot_File=pxegrub-ne2k-pci
Next_Server=192.168.2.10

Then configure TFTP server for the correct tftp home folder.

Now it is time to run, Qemu. Note – Windows port of Qemu 0.9.0 has some problem with obtaining DHCP, so install Qemu 0.9.1 and run the following command, it will boot from network.

qemu -L “$QEMU_BIOS_DIR” -M pc -m 32 -no-kqemu -hdc c.img -boot n -net nic,model=ne2k_pci,macaddr=52:54:00:12:34:56,vlan=0 -net tap,vlan=0,ifname=tap0

I am able to PXE boot qemu only with NE2000 cards, for other cards it failing. PXE boot on vmware only works if I configure grub using ifconfig command. Otherwise vmware machines get assigned with some wrong gateway address. No luck to PXE boot Ace on bochs.

For booting my test machine(real machine), I setup my router (DD-WRT box) with boot-dhcp option in DNSMasq.
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=4662&highlight=pxe

Written by samueldotj

July 5th, 2008 at 2:35 am

Posted in Ace,Tools,Windows