Hi Laszlo,
I have not built nor tested an OVMF configuration, so my recommendation is to
work with Gerd Hoffman to:
1. Get his configuration working
2. Get sockets working
3. Remove the pieces that you do not want from Gerd's configuration
As for sockets, it was designed to use the UEFI 2 networking stack so you
should be using IFCONFIG instead of IPCONFIG. From these emails, I would
suggest using a static IP address. Once the IP address is assigned to the
adapter and verified with the command "ifconfig -l" then it should be possible
to run the socket test applications. Note that for DNS lookup to work the
shell's default device needs to contain the file /Efi/StdLib/etc/resolv.conf
and it needs to point to your DNS servers.
Lee
-----Original Message-----
From: Laszlo Ersek [mailto:[email protected]]
Sent: Thursday, January 17, 2013 8:54 AM
To: [email protected]
Subject: [edk2] running the StdLib socket test apps in OVMF [was: ovmf pxeboot]
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
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel