From owner-freebsd-emulation@FreeBSD.ORG Sat Jul 10 08:03:02 2010 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86541106566C; Sat, 10 Jul 2010 08:03:02 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.16.84]) by mx1.freebsd.org (Postfix) with ESMTP id 3884A8FC08; Sat, 10 Jul 2010 08:03:02 +0000 (UTC) Received: from pampa.cs.huji.ac.il ([132.65.80.32]) by kabab.cs.huji.ac.il with esmtp id 1OXV1Y-0005oN-Ni; Sat, 10 Jul 2010 11:03:00 +0300 X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2 To: Lawrence Stewart In-reply-to: <4C38047E.9010506@freebsd.org> References: <4C38047E.9010506@freebsd.org> Comments: In-reply-to Lawrence Stewart message dated "Sat, 10 Jul 2010 15:26:22 +1000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 10 Jul 2010 11:03:00 +0300 From: Daniel Braniss Message-ID: Cc: freebsd-emulation@freebsd.org, Pawel Jakub Dawidek , John Baldwin Subject: Re: vbox + gpxe + pxeboot = fail X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2010 08:03:02 -0000 Hi Lawrence, > 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 as far as i remember, the gpxe rom only worked with direct connected, no bridge nor nat, so I guess you figured out why :-) danny