Date: Sat, 10 Jul 2010 15:26:22 +1000 From: Lawrence Stewart <lstewart@freebsd.org> To: freebsd-emulation@freebsd.org Cc: Pawel Jakub Dawidek <pjd@freebsd.org>, John Baldwin <jhb@freebsd.org> Subject: vbox + gpxe + pxeboot = fail Message-ID: <4C38047E.9010506@freebsd.org>
next in thread | raw e-mail | index | archive | help
Hi All, I had some frustration trying to get FreeBSD to pxeboot inside a vbox VM a while back. The thread is available here: http://lists.freebsd.org/pipermail/freebsd-emulation/2010-April/007681.html I left things for a while and came back to them yesterday with some fresh resolve to nut the problem out. I have some new insights I wanted to share. I'm using gpxe 1.0.1 from http://kernel.org/pub/software/utils/boot/gpxe/ and doing the builds on a Debian VM. To create a rom for the vbox AMD adapter types, I'm following the details at: http://www.etherboot.org/wiki/romburning/vbox I turned the instructions to pad the rom into a python script you can grab from here: http://people.freebsd.org/~lstewart/misc/vbox/rompad.py Here's what I've figured out so far: - The problem stems from the pxe boot rom environment provided by gpxe. It sends and receives packets correctly, but somehow the IP addresses get mangled (I think this happens inside gpxe) so it thinks the replies it is waiting for should be coming in on one IP address when they actually arrive on the real valid IP address. - Using the binary only vbox on Win XP which uses the Intel pxe boot rom has no problems and works perfectly i.e. further evidence this is isolated to gpxe - By changing the line "if (udpread_p->status > 0) {" to "if (udpread_p->status > 1) {" in sys/boot/i386/libi386/pxe.c, our pxeboot is able to work around the problem and I can pxeboot FreeBSD just fine. gpxe therefore is correctly reading the packets off the wire and passing them to our pxeboot code. gpxe just sets the failure status code because it thinks the packet is not the one we were waiting for because of the IP address being mismatched. The file in the gpxe distribution that I've been adding debug printf's to is: src/arch/i386/interface/pxe/pxe_udp.c By doing a "%s/DBG/dbg_printf/g" in that file, you get debugging output that shows you the failures and the IP address it thinks the pkt should be coming in on. In my case, it correctly sends UDP packets to 172.16.7.21, and then waits for the reply on 172.16.7.50 (but sees that the reply actually comes in on 172.16.7.43 which is the IP of the VM). Because .43 != .50, gpxe returns status failure (i.e. 1) but does still correctly read the pkt and pass it to our pxeboot hence why my hack of ignoring the status actually allows things to work. I've put an unmodified copy of pxe_udp.c at: http://people.freebsd.org/~lstewart/misc/vbox/pxe_udp.c If anyone is able to see any obvious problems in that file I'd love to hear about it. I suspect the problem is embedded somewhere a bit deeper in the gpxe code though so I'll ping the gpxe folks and see what they have to say. Cheers, Lawrence
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C38047E.9010506>