resend to the mailing list.
---------- Forwarded message ----------
From: <[email protected]>
Date: 2013/11/7
Subject: Re: [edk2] How can NBP get PXE server's IP address?
To: "Fu, Siyuan" <[email protected]>
Hi Siyuan-san,
Okay, now I understood how to get the PXE Server's IP clearly by the PXE
Base Code Protocol. Thanks!
Elilo source code is very helpful for me.
It seems NBP can inherit all network environment from NBP's caller through
the PXE Base Code Protocol.
I believe I can definitely proceed to the next step .
P.S.
I thought that NBP could get a similar information described in "9.3.5.21.2
Device Path Examples", UEFI spec 2.3.1, by the device path protocol.
---
PciRoot(0)/Pci(19|0)/Mac(001320F5FA77,0x01)/
IPv4(192.168.0.100,TCP,Static,192.168.0.1)/ iSCSI(iqn.1991-
05.com.microsoft:iscsitarget-iscsidisk-
target,0x1,0x0,None,None,None,TCP)/ HD(1,GPT,15E39A00-1DD2-1000-
8D7F-00A0C92408FC,0x22,0x2710000)
---
Best regards,
-nao
2013/11/6 Fu, Siyuan <[email protected]>
Hi, Nao
>
>
>
> You can’t get the server’s IP address directly from the device path, as
> you see the image device path only contains the MAC address. But you can
> use this MAC address to find out the NIC handle and the
> EFI_PXE_BASE_CODE_PROTOCOL which you used to download the NBP file:
>
> 1. Use BS.LocateHandle to find all the handles that support
> PxeBaseCodeProtocol.
>
> 2. Use NetLibGetMacAddress() or NetLibGetMacString() to determine
> the handle which is used for this NBP download.
>
> Then you can access the EFI_PXE_BASE_CODE_PROTOCOL.Mode structure, which
> contains most of the information you needed for following PXE operation
>
>
>
> The ELILO 3.16 (Elilo-3.16-source\fs\netfs.c) is a good example.
>
> netfs_install() finds out all PXE handles.
>
> netfs_extract_ip() shows how to extract DHCP and boot server’s IP
> address.
>
> Other interfaces in NetFsProtocol shows how to produce a common
> file system API base on PxeBaseCodeProtocol.
>
>
>
> Best, Regards
>
> Siyuan
>
>
>
> *From:* [email protected] [mailto:[email protected]]
> *Sent:* Wednesday, November 06, 2013 12:17 AM
> *To:* [email protected]
> *Subject:* [edk2] How can NBP get PXE server's IP address?
>
>
>
> Hello,
>
> I'm trying to develop an UEFI NBP. However I cannot figure out how to get
> PXE server's IP address.
>
> According to the following Zimmer-san's blog, it should be able to get it
> through the device path protocol.
>
> http://vzimmer.blogspot.jp/2013/10/configuring-ipv6-network-boot.html
> ---
> The bootx64.efi or bootia32.efi program, also known as the Network Boot
> Program (NBP), when executed on the local client (hopefully with UEFI
> Secure Boot logic applied prior to passing control into the image) can use
> any of the UEFI networking API's in the protocols defined in the UEFI Spec
> to download further .efi images, data files, or the operating system
> kernel. The device path protocol on the loaded image protocol of the NBP
> can be used by the NBP code's implementation to find the network address of
> the boot server from which the NBP was loaded, too.
> ---
>
> Here is the code I wrote based on the HelloWorld, and the result I got
> on VMware Player 6.0 is the attached image .
> The IP address, 208.65.3.10, shown in the image is not my PXE server. I
> don't know what IP address it is.
>
> I searched UEFI NBP example on Internet, and also looked at syslinux,
> elilo and iPXE source code, but I couldn't find any reference.
>
> Please advise me how to get the PXE IP address
>
>
> gBS->HandleProtocol(
> ImageHandle,
> &gEfiLoadedImageProtocolGuid,
> (VOID **) &ImageInfo
> );
> gBS->HandleProtocol(
> ImageInfo->DeviceHandle,
> &gEfiDevicePathProtocolGuid,
> (VOID *) &DevicePath
> );
> Print (
> L"Image device : %s\n",
> DevicePathToStr (DevicePath)
> );
>
> isMulti = IsDevicePathMultiInstance(DevicePath);
> isMultiStr = isMulti ? L"TRUE" : L"FALSE";
> Print (L"isMulti : %s\n", isMultiStr);
>
> Print (L"DevicePath->Type : %x\nDevicePath->SubType :
> %x\nDevicePath->Length[0] : %x\nDevicePath->Length[1] : %x\n",
>
>
> DevicePath->Type,DevicePath->SubType,DevicePath->Length[0],DevicePath->Length[1]);
>
> DevicePath->Type = 3;
> DevicePath->SubType = 12;
>
> Remaining = DevicePath;
> do {
> Print (L"i=%d >>> ", i++);
>
> Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid,
> &Remaining, &MyHandle);
>
> gBS->HandleProtocol(
> MyHandle,
> &gEfiDevicePathProtocolGuid,
> (VOID *) &DevicePath
> );
> Print (
> L"Image device : %s\n",
> DevicePathToStr (DevicePath)
> );
>
> } while (!EFI_ERROR (Status) && !IsDevicePathEnd (Remaining));
>
> Best regards,
>
> -nao
>
>
>
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel