PXE boot

John Baldwin jhb at freebsd.org
Thu Sep 4 19:11:42 UTC 2014


On Thursday, September 04, 2014 04:33:46 PM Sinha, Prokash wrote:
> On 9/4/14 9:31 AM, "Sinha, Prokash" <psinha at panasas.com> wrote:
> >Thanks once again...
> >
> >This is the part - that you spelled out is why I had a trace in the
> >pxe_enable(...) routine. As well as at pxe_init( ...) routine, just to be
> >sure
> >the pxe.c routines are working like ( as you said ) devsw invocation. But
> >did not see the trace messages, could be serial console is not acting (
> >though I doubt it).
> >
> >Now gave me a base, off of what I could debug ...

Hmm, the console should be working (cons_probe() is called before 
pxe_enable()).  However, if you are using 'console=comconsole' in loader.conf 
to set a serial console, you won't see early messages because loader.conf is 
processed after main() calls interact() at the bottom of the function.  If you 
want to see early loader messages on serial, you will need to build pxeboot 
with BOOT_PXELDR_ALWAYS_SERIAL defined as a make variable (so on the command 
line, or in /etc/make.conf or /etc/src.conf).  That will force a serial 
console for early loader messages.

> >
> >-prokash
> >
> >On 9/4/14 7:57 AM, "John Baldwin" <jhb at freebsd.org> wrote:
> >>On Wednesday, September 03, 2014 11:16:05 PM Sinha, Prokash wrote:
> >>> Thanks much, John !
> >>> 
> >>> When it starts executing ? How ?. Who starts executing these. From the
> >>> Makefile it's org is 0x7c00. So I would assume that it would be loaded
> >>>
> >>>at
> >>>
> >>> that absolute real-mode address !. I don't understand this part. But,
> >>>
> >>>if I
> >>>
> >>> put traces, I see pxe_open, and pxe_close are being called, but after
> >>>
> >>>all
> >>>
> >>> these pxe_calls are done, the loader's main is invoked at Rebooting Š
> >>>
> >>>time.
> >>>
> >>> We are using a net boot server, and I see mountd- authenticated Š
> >>>
> >>>message
> >>>
> >>> storm on the boot server side.
> >>> 
> >>> Wondering what could cause such a message storm, while pxe_open() ->
> >>>
> >>>net
> >>>
> >>> if_open( ) executes.
> >>
> >>The PXE BIOS uses TFTP to fetch the pxeboot binary (and it will do its
> >>own
> >>DHCP, etc. as part of doing that).  It writes the binary it downloads
> >>starting
> >>at address 0x7c00.  Once the download is complete, it jumps to 0x7c00
> >>similar
> >>to how booting from a disk loads the first sector at address 0x7c00 and
> >>then
> >>jumps to it.
> >>
> >>The PXE calls in libi386 should not be invoked until the loader main()
> >>routine
> >>
> >>runs:
> >>    /*
> >>    
> >>     * Special handling for PXE and CD booting.
> >>     */
> >>    
> >>    if (kargs->bootinfo == 0) {
> >>	
> >>	/*
> >>	
> >>	 * We only want the PXE disk to try to init itself in the below
> >>	 * walk through devsw if we actually booted off of PXE.
> >>	 */
> >>	
> >>	if (kargs->bootflags & KARGS_FLAGS_PXE)
> >>	
> >>	    pxe_enable(kargs->pxeinfo ? PTOV(kargs->pxeinfo) : NULL);
> >>	
> >>	else if (kargs->bootflags & KARGS_FLAGS_CD)
> >>	
> >>	    bc_add(initial_bootdev);
> >>    
> >>    }
> >>
> >>That enables the PXE devsw driver so that it will do something later when
> >>
> >>main() calls all the devsw init routines:
> >>    /*
> >>    
> >>     * March through the device switch probing for things.
> >>     */
> >>    
> >>    for (i = 0; devsw[i] != NULL; i++)
> >>	
> >>	if (devsw[i]->dv_init != NULL)
> >>	
> >>	    (devsw[i]->dv_init)();
> >>    
> >>    printf("BIOS %dkB/%dkB available memory\n", bios_basemem / 1024,
> >>
> >>bios_extmem / 1024);

-- 
John Baldwin


More information about the freebsd-hackers mailing list