On 01/17/13 16:00, Gerd Hoffmann wrote:
> 
> I'm running ovmf with networking enabled and ipxe efi roms.  Network
> driver seems to work properly.  In efi shell I can ifconfig the
> interface with a static ip address and ping the default gateway.

I tried something similar, but didn't get this far.

(1) Following OvmfPkg/README, I downloaded and extracted the e1000
driver from
<http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=17515&lang=eng>
(btw, extracting the driver from a package available only as a 32-bit
Windows binary was quite a big hoop to jump through).

(2) I had to modify the FD.MEMFD layout to build OvmfPkg with "-D
NETWORK_ENABLE -D FD_SIZE_2MB -D SECURE_BOOT_ENABLE" (reported by Gerd);
see the first patch.

I don't understand how FD.MEMFD is used when composing FD.OVMF, but when
I removed that section from the fdf altogether, the resultant flash
device hung very quickly after boot.

(3) I applied the second patch so that I'd be able to see where the
crash in name resolution was happening (discussed earlier on the list),
and the third patch because it was necessary to build AppPkg / StdLib
(that problem was also discussed recently on the list). I managed to
build StdLib & AppPkg with

    build -p AppPkg/AppPkg.dsc

(4) I prepared a disk image using "virt-make-fs", with the following
directory structure:

    Efi
    Efi/Boot
    Efi/StdLib
    Efi/StdLib/etc
    Efi/StdLib/etc/host.conf
    Efi/StdLib/etc/hosts
    Efi/StdLib/etc/networks
    Efi/StdLib/etc/protocols
    Efi/StdLib/etc/resolv.conf
    Efi/StdLib/etc/services
    Efi/StdLib/tmp
    Efi/Tools
    Efi/Tools/DataSink.efi
    Efi/Tools/DataSource.efi
    Efi/Tools/Enquire.efi
    Efi/Tools/GetAddrInfo.efi
    Efi/Tools/GetHostByAddr.efi
    Efi/Tools/GetHostByDns.efi
    Efi/Tools/GetHostByName.efi
    Efi/Tools/GetNameInfo.efi
    Efi/Tools/GetNetByAddr.efi
    Efi/Tools/GetNetByName.efi
    Efi/Tools/GetServByName.efi
    Efi/Tools/GetServByPort.efi
    Efi/Tools/Hello.efi
    Efi/Tools/Main.efi
    Efi/Tools/OobRx.efi
    Efi/Tools/OobTx.efi
    Efi/Tools/RawIp4Rx.efi
    Efi/Tools/RawIp4Tx.efi
    Efi/Tools/RecvDgram.efi
    Efi/Tools/SetHostName.efi
    Efi/Tools/SetSockOpt.efi
    Efi/Tools/SocketDxe.efi
    Efi/Tools/WebServer.efi

I pointed "resolv.conf" at "nameserver 192.168.122.1" (dnsmasq on the host).

(5) When booting this disk with the OVMF build from (2), I can see the
following traffic on virbr0:

17:27:26.660574 IP 0.0.0.0.bootpc > 255.255.255.255.bootps:
                BOOTP/DHCP, Request from 52:54:00:17:3a:5a, length 347
17:27:26.660733 IP 192.168.122.1.1024 > 255.255.255.255.bootpc:
                BOOTP/DHCP, Reply, length 334
17:27:42.660855 IP 0.0.0.0.bootpc > 255.255.255.255.bootps:
                BOOTP/DHCP, Request from 52:54:00:17:3a:5a, length 347
17:27:42.661034 IP 192.168.122.1.1024 > 255.255.255.255.bootpc:
                BOOTP/DHCP, Reply, length 334
17:27:53.367868 IP 0.0.0.0 > 224.0.0.1: igmp query v2
17:27:53.367890 IP6 3731:362e:652d:7268:656c:3633:961f:dd31
                > ff02::1: HBH ICMP6, multicast listener querymax
                resp delay: 1000 addr: ::, length 24

and dnsmasq logs

  DHCPDISCOVER(virbr0) 52:54:00:17:3a:5a
  DHCPOFFER(virbr0) 192.168.122.82 52:54:00:17:3a:5a
  DHCPDISCOVER(virbr0) 52:54:00:17:3a:5a
  DHCPOFFER(virbr0) 192.168.122.82 52:54:00:17:3a:5a
  DHCPDISCOVER(virbr0) 52:54:00:17:3a:5a
  DHCPOFFER(virbr0) 192.168.122.82 52:54:00:17:3a:5a
  DHCPDISCOVER(virbr0) 52:54:00:17:3a:5a
  DHCPOFFER(virbr0) 192.168.122.82 52:54:00:17:3a:5a

(The MAC matches the emulated e1000 NIC's MAC.)

(6) In the UEFI shell, the card is listed as follows:

  Shell> dh -p net
  Handle dump by protocol 'Net'
   92: DevPath (..3,0x0)/MAC(525400173A5A,0x0))
       Load Net Pxebc MNPSb ARPSb DHCPv4Sb TCPv4Sb IPv4Sb IPv4Config
       UDPv4Sb MTFTPv4Sb

which, according to the Shell Command Reference Manual, correspond to
the protocols

  Load        Load File Protocol
  Net         Simple Network Protocol
  Pxebc       PXE Base Code Protocol
  MNPSb       Managed Network Service Binding Protocol
  ARPSb       ARP Service Binding Protocol
  DHCPv4Sb    DHCPv4 Service Binding Protocol
  TCPv4Sb     TCPv4 Service Binding Protocol
  IPv4Sb      IPv4 Service Binding Protocol
  IPv4Config  IPv4 Configuration Protocol
  UDPv4Sb     UDPv4 Service Binding Protocol
  MTFTPv4Sb   MTFTPv4 Service Binding Protocol

This is the only device supporting "Net" (Simple Network Protocol).

(7) The "ipconfig" command reports

  Shell> ipconfig
  MAC Address: 52 54 00 17 3A 5A
  Broadcast MAC: FF FF FF FF FF FF
  ipconfig: Locate protocol error - 'PXE DHCP4 protocol'

Manual configuration ("ipconfig 192.168.122.82 -m 255.255.255.0") fails
with the exact same error.

(8) The example socket apps GetHostByDns, GetHostByName neither crash
nor work:

  fs0:\Efi\Tools> GetHostByName redhat.com
  ERROR - host not found, h_errno: 1

  fs0:\Efi\Tools> GetHostByDns redhat.com
  ERROR - host not found, h_errno: 2

However they (occasionally) seem to re-initiate the traffic visible in (5).

(9) The DataSource utility (which would send to port 1234) doesn't seem
to produce any host-visible traffic. It also doesn't increase iptables
counters.

  fs0:\Efi\Tools> DataSource
    <remote IP address> [Use TCP]

  fs0:\Efi\Tools> DataSource 192.168.122.1 UseTcp
  Connecting to 192.168.122.1:1234
  Connecting to 192.168.122.1:1234
  Connecting to 192.168.122.1:1234
  Connecting to 192.168.122.1:1234
  Connecting to 192.168.122.1:1234
  Connecting to 192.168.122.1:1234
  ...


Has anyone set up networking in OVMF (without ipxe)?

Thanks!
Laszlo
From 21a076f09ff80495c1d9de5db67113d9a3b40e24 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <ler...@redhat.com>
Date: Thu, 17 Jan 2013 02:59:44 +0100
Subject: [PATCH 1/3] bump FD.MEMFD size


Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 OvmfPkg/OvmfPkgX64.fdf |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index fcdac03..6600ceb 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -46,12 +46,12 @@ FV = SECFV
 
 [FD.MEMFD]
 BaseAddress   = 0x800000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvBase
-Size          = 0x600000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
+Size          = 0x700000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfMemFvSize
 ErasePolarity = 1
 BlockSize     = 0x10000
-NumBlocks     = 0x60
+NumBlocks     = 0x70
 
-0x0|0x600000
+0x0|0x700000
 FV = MAINFV
 
 
################################################################################
-- 
1.7.1

From bdc224e2b7fce501dcddc20c97271f0a93f97cff Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <ler...@redhat.com>
Date: Tue, 15 Jan 2013 21:48:54 +0100
Subject: [PATCH 2/3] StdLib/EfiSocketLib: add EFIAPI calling conv to PFN_NET_* 
funcptr types


Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 StdLib/EfiSocketLib/Socket.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/StdLib/EfiSocketLib/Socket.h b/StdLib/EfiSocketLib/Socket.h
index 43a7084..0064411 100644
--- a/StdLib/EfiSocketLib/Socket.h
+++ b/StdLib/EfiSocketLib/Socket.h
@@ -362,7 +362,7 @@ typedef struct {
 **/
 typedef
 EFI_STATUS
-(* PFN_NET_CONFIGURE) (
+(EFIAPI *PFN_NET_CONFIGURE) (
   IN VOID * pProtocol,
   IN VOID * pConfigData
   );
@@ -378,7 +378,7 @@ EFI_STATUS
 **/
 typedef
 EFI_STATUS
-(* PFN_NET_IO_START) (
+(EFIAPI *PFN_NET_IO_START) (
   IN VOID * pProtocol,
   IN VOID * pToken
   );
@@ -394,7 +394,7 @@ EFI_STATUS
 **/
 typedef
 EFI_STATUS
-(* PFN_NET_POLL) (
+(EFIAPI *PFN_NET_POLL) (
   IN VOID * pProtocol
   );
 
-- 
1.7.1

From 8914ced147b688e9de5910843e6e39f055bf95da Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <ler...@redhat.com>
Date: Thu, 17 Jan 2013 16:56:09 +0100
Subject: [PATCH 3/3] StdLib fixups


Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 StdLib/Include/Containers/Fifo.h              |    2 +-
 StdLib/LibC/Uefi/InteractiveIO/IIOutilities.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/StdLib/Include/Containers/Fifo.h b/StdLib/Include/Containers/Fifo.h
index 3b232fe..3d4670d 100644
--- a/StdLib/Include/Containers/Fifo.h
+++ b/StdLib/Include/Containers/Fifo.h
@@ -152,7 +152,7 @@ typedef size_t     (EFIAPI *cFIFO_Flush)   (cFIFO *Self, 
size_t NumToFlush);
 
     @param[in]    Self              Pointer to the FIFO instance.
 **/
-typedef void        (EFIAPI *cFIFO_Truncate)  (cFIFO *Self);
+typedef size_t        (EFIAPI *cFIFO_Truncate)  (cFIFO *Self);
 
 /** Cleanly delete a FIFO instance.
 
diff --git a/StdLib/LibC/Uefi/InteractiveIO/IIOutilities.c 
b/StdLib/LibC/Uefi/InteractiveIO/IIOutilities.c
index 2da0628..e674c07 100644
--- a/StdLib/LibC/Uefi/InteractiveIO/IIOutilities.c
+++ b/StdLib/LibC/Uefi/InteractiveIO/IIOutilities.c
@@ -264,7 +264,7 @@ IIO_GetOutputSize (
 
     @return   Returns the difference between the starting and ending 
coordinates.
 **/
-UINT32
+INT32
 EFIAPI
 IIO_CursorDelta (
   cIIO         *This,
-- 
1.7.1

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to