Re: [edk2] Filesystem issues since "OvmfPkg: enable SATA controller"

2015-11-10 Thread Gary Ching-Pang Lin
On Tue, Nov 10, 2015 at 04:55:16PM +, Mark Rutland wrote:
> I've been trying to test an EFI application on x86_64 using Ubuntu 14.04's 
> QEMU
> 2.0.0. I have a directory 'foo' containing the application, and I get QEMU to
> create a virtual FAT device:
> 
> $ qemu-system-x86_64 -nographic \
>   -bios src/edk2/Build/OvmfX64/RELEASE_GCC48/FV/OVMF.fd \
>   -hda fat:foo
> 
> However, I'm unable to access the root filesystem:
> 
> UEFI Interactive Shell v2.1
> EDK II
> UEFI v2.50 (EDK II, 0x0001)
> Mapping table
>   FS0: Alias(s):HD7a1:;BLK3:
>   PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)/HD(1,MBR,0xBE1AFDFA,0x3F,0xFBFC1)
>  BLK2: Alias(s):
>   PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)
>  BLK4: Alias(s):
>   PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)
>  BLK0: Alias(s):
>   PciRoot(0x0)/Pci(0x1,0x0)/Floppy(0x0)
>  BLK1: Alias(s):
>   PciRoot(0x0)/Pci(0x1,0x0)/Floppy(0x1)
> Press ESC in 1 seconds to skip startup.nsh or any other key to continue.
> Shell> fs0:
> FS0:\> dir
> ls: File Not Found - 'FS0:\'
> 
> With git, I bisected this down to the commit "OvmfPkg: enable SATA 
> controller".
> 
> Any ideas as to what the problem could be?
> 
I also encountered the error before, and it only happened when I used '-bios'
to specify the OVMF image. It never happened while using 'pflash'.

Cheers,

Gary Lin

> I don't have a newer qemu-system-x86_64 lying around, so I haven't been able 
> to
> test with that.
> 
> Thanks,
> Mark.
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2] NetworkPkg:Enable Http Boot over Ipv6 stack

2015-11-08 Thread Gary Ching-Pang Lin
On Tue, Nov 03, 2015 at 04:13:27PM +0800, Zhang Lubo wrote:
> v2:
> *Rewrite the logic of setting ipv6 gateway in httpboot driver and update some 
> comment.
> 
> Fix a potential bug which can cause assert when setting ipv6 Gateway. If 
> there is no
> router in network environment, it will fail to find out the gateway address 
> which can
> route the message to Http Server Ip . When it check the IP6 route table again 
> 1 seconds
> later, it will assert while the router table structure had been freed last 
> time without
> retrieve new relevant data form ip6 driver.
> 
> Cc: Fu Siyuan 
> Cc: Ye Ting 
> CC: Wu Jiaxin 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo 
> ---
>  NetworkPkg/HttpBootDxe/HttpBootClient.c|  234 -
>  NetworkPkg/HttpBootDxe/HttpBootComponentName.c |5 +-
>  NetworkPkg/HttpBootDxe/HttpBootDhcp4.c |   12 +-
>  NetworkPkg/HttpBootDxe/HttpBootDhcp4.h |   11 +
>  NetworkPkg/HttpBootDxe/HttpBootDhcp6.c |  984 +++
>  NetworkPkg/HttpBootDxe/HttpBootDhcp6.h |  198 
>  NetworkPkg/HttpBootDxe/HttpBootDxe.c   |  903 +++---
>  NetworkPkg/HttpBootDxe/HttpBootDxe.h   |  159 +++-
>  NetworkPkg/HttpBootDxe/HttpBootDxe.inf |9 +
>  NetworkPkg/HttpBootDxe/HttpBootImpl.c  |  109 ++-
>  NetworkPkg/HttpBootDxe/HttpBootImpl.h  |2 +-
>  NetworkPkg/HttpBootDxe/HttpBootSupport.c   |  292 +-
>  NetworkPkg/HttpBootDxe/HttpBootSupport.h   |   70 ++
>  NetworkPkg/HttpDxe/HttpDns.c   |  207 +++-
>  NetworkPkg/HttpDxe/HttpDns.h   |   20 +
>  NetworkPkg/HttpDxe/HttpDriver.c|  806 +++-
>  NetworkPkg/HttpDxe/HttpDriver.h|  143 ++-
>  NetworkPkg/HttpDxe/HttpDxe.inf |5 +
>  NetworkPkg/HttpDxe/HttpImpl.c  |  358 +++
>  NetworkPkg/HttpDxe/HttpImpl.h  |1 -
>  NetworkPkg/HttpDxe/HttpProto.c | 1210 
> 
>  NetworkPkg/HttpDxe/HttpProto.h |  182 +++-
>  22 files changed, 5017 insertions(+), 903 deletions(-)
>  create mode 100644 NetworkPkg/HttpBootDxe/HttpBootDhcp6.c
>  create mode 100644 NetworkPkg/HttpBootDxe/HttpBootDhcp6.h
> 
--8<--
> diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
> index 588e1bb..f5df660 100644
> --- a/NetworkPkg/HttpDxe/HttpImpl.c
> +++ b/NetworkPkg/HttpDxe/HttpImpl.c
--8<--
> @@ -377,28 +383,39 @@ EfiHttpRequest (
>  }
>} 
>  
>if (Configure) {
>  //
> -// Parse Url for IPv4 address, if failed, perform DNS resolution.
> +// Parse Url for IPv4 or IPv6 address, if failed, perform DNS resolution.
>  //
> -Status = NetLibAsciiStrToIp4 (HostName, &HttpInstance->RemoteAddr);
> +if (!HttpInstance->LocalAddressIsIPv6) {
> +  Status = NetLibAsciiStrToIp4 (HostName, &HttpInstance->RemoteAddr);
> +} else {
> +  Status = NetLibAsciiStrToIp6 (HostName, &HttpInstance->RemoteIpv6Addr);
The 'HostName' shouldn't be passed to NetLibAsciiStrToIp6 directly since it
contains '[' and ']' and NetLibAsciiStrToIp6 doesn't expect that, and
HttpInitTcp() would complain that the IP address cannot be found.

Gary Lin

> +}
> +
>  if (EFI_ERROR (Status)) {
> -  HostNameStr = AllocateZeroPool ((AsciiStrLen (HostName) + 1) * sizeof 
> (UINT16));
> +  HostNameStr = AllocateZeroPool ((AsciiStrLen (HostName) + 1) * sizeof 
> (CHAR16));
>if (HostNameStr == NULL) {
>  Status = EFI_OUT_OF_RESOURCES;
>  goto Error1;
>}
> -
> +  
>AsciiStrToUnicodeStr (HostName, HostNameStr);
> -  Status = HttpDns4 (HttpInstance, HostNameStr, 
> &HttpInstance->RemoteAddr);
> +  if (!HttpInstance->LocalAddressIsIPv6) {
> +Status = HttpDns4 (HttpInstance, HostNameStr, 
> &HttpInstance->RemoteAddr);
> +  } else {
> +Status = HttpDns6 (HttpInstance, HostNameStr, 
> &HttpInstance->RemoteIpv6Addr);
> +  }
> +  
>FreePool (HostNameStr);
>if (EFI_ERROR (Status)) {
>  goto Error1;
>}
>  }
>  
> +
>  //
>  // Save the RemotePort and RemoteHost.
>  //
>  ASSERT (HttpInstance->RemoteHost == NULL);
>  HttpInstance->RemotePort = RemotePort;

--8<--

 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [patch] MdeModulePkg:Fix a bug that HttpLib can not parse Ipv6 address correctly.

2015-11-06 Thread Gary Ching-Pang Lin
On Fri, Nov 06, 2015 at 04:11:45PM +0800, Zhang Lubo wrote:
> v2:
> *Add a Url Parse state machine to indicate the host is ipv6 expressed url and 
> can parse
> the ipv6 address correctly.
> 
This patch works for me. The IPv6 address was extracted from my url.

Tested-by: Gary Ching-Pang Lin 

> Cc: Fu Siyuan 
> Cc: Ye Ting 
> CC: Wu Jiaxin 
> CC: Gary Ching-Pang Lin 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo 
> ---
>  MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 33 
> 
>  1 file changed, 29 insertions(+), 4 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c 
> b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> index aeb52d0..500b3c7 100644
> --- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> +++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> @@ -68,10 +68,11 @@ typedef enum {
>UrlParserFragmentStart, // "#"
>UrlParserFragment,
>UrlParserUserInfo,
>UrlParserHostStart, // "@"
>UrlParserHost,
> +  UrlParserHostIpv6,  // "["(Ipv6 address) "]"
>UrlParserPortStart, // ":"
>UrlParserPort,
>UrlParserStateMax
>  } HTTP_URL_PARSE_STATE;
>  
> @@ -136,17 +137,20 @@ UriPercentDecode (
>This function return the updated state accroding to the input state and 
> next character of
>the authority.
>  
>@param[in]   Char   Next character.
>@param[in]   State  Current value of the parser state machine.
> +  @param[in]   IsRightBracket TRUE if there is an sign ']' in the 
> authority component and 
> +  indicates the next part is ':' before 
> Port.
>  
>@return  Updated state value.
>  **/
>  HTTP_URL_PARSE_STATE
>  NetHttpParseAuthorityChar (
>IN  CHAR8  Char,
> -  IN  HTTP_URL_PARSE_STATE   State
> +  IN  HTTP_URL_PARSE_STATE   State,
> +  IN  BOOLEAN*IsRightBracket
>)
>  {
>  
>//
>// RFC 3986:
> @@ -167,16 +171,31 @@ NetHttpParseAuthorityChar (
>return UrlParserHostStart;
>  }
>  break;
>  
>case UrlParserHost:
> -  case UrlParserHostStart:
> +  case UrlParserHostStart:  
> +if (Char == '[') {
> +  return UrlParserHostIpv6;
> +}
> +
>  if (Char == ':') {
>return UrlParserPortStart;
>  }
> +
>  return UrlParserHost;
> -
> +
> +  case UrlParserHostIpv6:  
> +if (Char == ']') {
> +  *IsRightBracket = TRUE;
> +}
> +
> +if (Char == ':' && *IsRightBracket == TRUE) {
> +  return UrlParserPortStart;
> +}
> +return UrlParserHostIpv6;
> +
>case UrlParserPort:
>case UrlParserPortStart:
>  return UrlParserPort;
>  
>default:
> @@ -208,10 +227,11 @@ NetHttpParseAuthority (
>CHAR8 *Authority;
>UINT32Length;
>HTTP_URL_PARSE_STATE  State;
>UINT32Field;
>UINT32OldField;
> +  BOOLEAN   IsrightBracket;
>
>ASSERT ((UrlParser->FieldBitMap & BIT (HTTP_URI_FIELD_AUTHORITY)) != 0);
>  
>//
>// authority   = [ userinfo "@" ] host [ ":" port ]
> @@ -220,16 +240,17 @@ NetHttpParseAuthority (
>  State = UrlParserUserInfo;
>} else {
>  State = UrlParserHost;
>}
>  
> +  IsrightBracket = FALSE;
>Field = HTTP_URI_FIELD_MAX;
>OldField = Field;
>Authority = Url + UrlParser->FieldData[HTTP_URI_FIELD_AUTHORITY].Offset;
>Length = UrlParser->FieldData[HTTP_URI_FIELD_AUTHORITY].Length;
>for (Char = Authority; Char < Authority + Length; Char++) {
> -State = NetHttpParseAuthorityChar (*Char, State);
> +State = NetHttpParseAuthorityChar (*Char, State, &IsrightBracket);
>  switch (State) {
>  case UrlParserStateMax:
>return EFI_INVALID_PARAMETER;
>  
>  case UrlParserHostStart:
> @@ -241,10 +262,14 @@ NetHttpParseAuthority (
>break;
>
>  case UrlParserHost:
>Field = HTTP_URI_FIELD_HOST;
>break;
> +
> +case UrlParserHostIpv6:
> +  Field = HTTP_URI_FIELD_HOST;
> +  break;
>
>  case UrlParserPort:
>Field = HTTP_URI_FIELD_PORT;
>break;
>  
> -- 
> 1.9.5.msysgit.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2] NetworkPkg:Enable Http Boot over Ipv6 stack

2015-11-04 Thread Gary Ching-Pang Lin
On Tue, Nov 03, 2015 at 04:13:27PM +0800, Zhang Lubo wrote:
> v2:
> *Rewrite the logic of setting ipv6 gateway in httpboot driver and update some 
> comment.
> 
> Fix a potential bug which can cause assert when setting ipv6 Gateway. If 
> there is no
> router in network environment, it will fail to find out the gateway address 
> which can
> route the message to Http Server Ip . When it check the IP6 route table again 
> 1 seconds
> later, it will assert while the router table structure had been freed last 
> time without
> retrieve new relevant data form ip6 driver.
> 

Hi Lubo,

I applied the patch and it worked as expected except the IP expressed
url. I checked the code and found the function(*) to parse the url couldn't
handle IPv6 and just treat the colon as a separator of the host name and port.
Is this a known issue?

Cheers,

Gary Lin

(*) MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c::NetHttpParseAuthority()

> Cc: Fu Siyuan 
> Cc: Ye Ting 
> CC: Wu Jiaxin 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo 
> ---
>  NetworkPkg/HttpBootDxe/HttpBootClient.c|  234 -
>  NetworkPkg/HttpBootDxe/HttpBootComponentName.c |5 +-
>  NetworkPkg/HttpBootDxe/HttpBootDhcp4.c |   12 +-
>  NetworkPkg/HttpBootDxe/HttpBootDhcp4.h |   11 +
>  NetworkPkg/HttpBootDxe/HttpBootDhcp6.c |  984 +++
>  NetworkPkg/HttpBootDxe/HttpBootDhcp6.h |  198 
>  NetworkPkg/HttpBootDxe/HttpBootDxe.c   |  903 +++---
>  NetworkPkg/HttpBootDxe/HttpBootDxe.h   |  159 +++-
>  NetworkPkg/HttpBootDxe/HttpBootDxe.inf |9 +
>  NetworkPkg/HttpBootDxe/HttpBootImpl.c  |  109 ++-
>  NetworkPkg/HttpBootDxe/HttpBootImpl.h  |2 +-
>  NetworkPkg/HttpBootDxe/HttpBootSupport.c   |  292 +-
>  NetworkPkg/HttpBootDxe/HttpBootSupport.h   |   70 ++
>  NetworkPkg/HttpDxe/HttpDns.c   |  207 +++-
>  NetworkPkg/HttpDxe/HttpDns.h   |   20 +
>  NetworkPkg/HttpDxe/HttpDriver.c|  806 +++-
>  NetworkPkg/HttpDxe/HttpDriver.h|  143 ++-
>  NetworkPkg/HttpDxe/HttpDxe.inf |5 +
>  NetworkPkg/HttpDxe/HttpImpl.c  |  358 +++
>  NetworkPkg/HttpDxe/HttpImpl.h  |1 -
>  NetworkPkg/HttpDxe/HttpProto.c | 1210 
> 
>  NetworkPkg/HttpDxe/HttpProto.h |  182 +++-
>  22 files changed, 5017 insertions(+), 903 deletions(-)
>  create mode 100644 NetworkPkg/HttpBootDxe/HttpBootDhcp6.c
>  create mode 100644 NetworkPkg/HttpBootDxe/HttpBootDhcp6.h
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [patch] NetworkPkg:Enable Http Boot over Ipv6 stack

2015-11-02 Thread Gary Ching-Pang Lin
On Tue, Nov 03, 2015 at 03:20:29PM +0800, Gary Ching-Pang Lin wrote:
> On Mon, Nov 02, 2015 at 10:31:13AM +0800, Zhang Lubo wrote:
> > This patch is used to add new features to support Http boot over ipv6 stack.
> > 
> Hi Lubo,
> 
> In NetworkPkg/HttpBootDxe/HttpBootDhcp6.c::HttpBootParseDhcp6Packet() the
> section to check if the packet is a Http offer, it checks the dhcp6 option 3
> (HTTP_BOOT_DHCP6_IDX_VENDOR_CLASS) instead of the option 60
> (HTTP_BOOT_DHCP6_OPT_BOOT_FILE_PARAM) which is mentioned in UEFI 2.5 p.1211.
Oops, I read the wrong page. It's for IPv4. Ignore my comment here.

Sorry for the noise.

Gary Lin

> The string in the comment is also wrong. It should be "HTTPClient" instead
> of "HttpClient".
> 
> Cheers,
> 
> Gary Lin
> 

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] OvmfPkg: raise DXEFV size to 9 MB

2015-10-07 Thread Gary Ching-Pang Lin
With gcc5 and enabling SECURE_BOOT and NETWORK_IP6, the build
failed with this error:

GenFv: ERROR 3000: Invalid
  the required fv image size 0x814c18 exceeds the set fv image size 0x80

Raise the DXEFV size to 9 MB to fix the build error.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Ching-Pang Lin 
---
 OvmfPkg/OvmfPkgIa32.fdf| 6 +++---
 OvmfPkg/OvmfPkgIa32X64.fdf | 6 +++---
 OvmfPkg/OvmfPkgX64.fdf | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 20b6df2..d4ae2f9 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -79,10 +79,10 @@ [FD.OVMF_CODE]
 
 [FD.MEMFD]
 BaseAddress   = 0x80
-Size  = 0x90
+Size  = 0xA0
 ErasePolarity = 1
 BlockSize = 0x1
-NumBlocks = 0x90
+NumBlocks = 0xA0
 
 0x00|0x006000
 
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize
@@ -103,7 +103,7 @@ [FD.MEMFD]
 
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize
 FV = PEIFV
 
-0x10|0x80
+0x10|0x90
 
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
 FV = DXEFV
 
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 6852e0e..5b4d9dc 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -79,10 +79,10 @@ [FD.OVMF_CODE]
 
 [FD.MEMFD]
 BaseAddress   = 0x80
-Size  = 0x90
+Size  = 0xA0
 ErasePolarity = 1
 BlockSize = 0x1
-NumBlocks = 0x90
+NumBlocks = 0xA0
 
 0x00|0x006000
 
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize
@@ -103,7 +103,7 @@ [FD.MEMFD]
 
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize
 FV = PEIFV
 
-0x10|0x80
+0x10|0x90
 
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
 FV = DXEFV
 
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 7fbd038..8b4dd60 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -79,10 +79,10 @@ [FD.OVMF_CODE]
 
 [FD.MEMFD]
 BaseAddress   = 0x80
-Size  = 0x90
+Size  = 0xA0
 ErasePolarity = 1
 BlockSize = 0x1
-NumBlocks = 0x90
+NumBlocks = 0xA0
 
 0x00|0x006000
 
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize
@@ -103,7 +103,7 @@ [FD.MEMFD]
 
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize
 FV = PEIFV
 
-0x10|0x80
+0x10|0x90
 
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
 FV = DXEFV
 
-- 
2.1.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Confused about OVMF and qemu debugging

2015-09-04 Thread Gary Ching-Pang Lin
On Fri, Sep 04, 2015 at 03:56:11AM +, Shubha Ramani wrote:
> Using this link I was able to get qemu installed on my Ubuntu virtual 
> machine. UEFI/OVMF - Ubuntu Wiki
> 
> |   |
> |   |   |   |   |   |
> | UEFI/OVMF - Ubuntu WikiOVMF is a port of Intel's tianocore firmware to the 
> qemu virtual machine. This allows easy debugging and experimentation with 
> UEFI firmware;  |
> |  |
> | View on wiki.ubuntu.com | Preview by Yahoo |
> |  |
> |   |
> 
> Also it referred me to this link to get a sample bios 
> image:http://people.canonical.com/~jk/ovmf/
> 
> 1) Is this the appropriate bios image to use to test out UEFI apps before 
> moving to real hardware ?
We test our bootloaders on OVMF before shipping them.
It may not be the same as the real hardware, but at least you can test the
basic functions

> 2) Can I connect gdb and debug efi applications - say by using gdbserver on 
> Ubuntu ? If so, what are the steps to do this ?
Yes, it's possbile. Check this page:
http://wiki.osdev.org/UEFI#Using_GNU_toolchain_for_compiling_and_debugging_EFI_applications

You need some kind of trick to stop your application before attaching gdb, but
it's still useful in some cases.

Cheers,

Gary Lin

> I will never need to boot beyond the UEFI. I only develop EDK2 apps which run 
> in UEFI.  The issueis that it's cumbersome to debug complex apps on buggy 
> bios/hardware. It's better to get theapps debugged on a stable simulator like 
> qemu, then move onto the UEFI/hardware under development.
> Please advise - 
> thanks,
> Shubha
> Shubha D. ramanishubharam...@gmail.com
> shubharam...@yahoo.com
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Network disconnected after NBP was loaded

2015-08-30 Thread Gary Ching-Pang Lin
On Mon, Aug 31, 2015 at 03:33:41AM +, Fu, Siyuan wrote:
> Yes wireless connection will be stay in associated state.
> 
Fair enough. Then I only have to take care of the IP address, gateway, etc.
from the device path.

Thanks!

Gary Lin

> -Original Message-
> From: Gary Ching-Pang Lin [mailto:g...@suse.com] 
> Sent: Monday, August 31, 2015 11:15 AM
> To: Fu, Siyuan 
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] Network disconnected after NBP was loaded
> 
> On Mon, Aug 31, 2015 at 02:29:02AM +, Fu, Siyuan wrote:
> > Hi, Gary
> > 
> > After NBP (boot loader) file download, the device path of the NIC will be 
> > update to include the IP address configuration and boot file URL info, and 
> > this device path could also be found in the loaded image protocol on the 
> > image handle of the NBP file. The boot loader could continue use this IP 
> > address and doesn't need to make DHCP again. Please refer section 23.7.3.1 
> > Device Path in UEFI 2.5 for details.
> 
> OK. So in this case, the bootloader just retreives the IP address from the 
> device path and sets up the connection again. This should be easy.
> 
> Another question came to me is: how about the wireless connection? Will the 
> AP still be associated and authenticated?
> 
> Thanks,
> 
> Gary Lin
> 
> > 
> > Best Regards
> > Siyuan
> > 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> > Gary Ching-Pang Lin
> > Sent: Friday, August 28, 2015 4:02 PM
> > To: edk2-devel@lists.01.org
> > Subject: [edk2] Network disconnected after NBP was loaded
> > 
> > Hi,
> > 
> > I was under the impression that the UEFI firmware would maintain the 
> > network connection unless a EFI program or OS determine to create a new 
> > connection.
> > Take PXE for example. After the bootloader is loaded, it can utilize the 
> > PxeBaseCode protocol to download the OS image with the existed connection 
> > without starting the DHCP process again. However, the current 
> > implementation of HttpBoot seems to be another case.
> > 
> > In HttpBootDxeLoadFile() in NetworkPkg/HttpBootDxe/HttpBootImpl.c, the 
> > driver closes the DHCP4 connection right after the file is loaded. This 
> > means the bootloader has to set up the network connection on its own if it 
> > needs to load a remote file.
> > 
> > My question is: what's the expection for a bootloader/Network Boot Program?
> > Should the bootloader always create its own connection for HTTP Boot?
> > 
> > Thanks,
> > 
> > Gary Lin
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
> > 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Network disconnected after NBP was loaded

2015-08-30 Thread Gary Ching-Pang Lin
On Mon, Aug 31, 2015 at 02:29:02AM +, Fu, Siyuan wrote:
> Hi, Gary
> 
> After NBP (boot loader) file download, the device path of the NIC will be 
> update to include the IP address configuration and boot file URL info, and 
> this device path could also be found in the loaded image protocol on the 
> image handle of the NBP file. The boot loader could continue use this IP 
> address and doesn't need to make DHCP again. Please refer section 23.7.3.1 
> Device Path in UEFI 2.5 for details.

OK. So in this case, the bootloader just retreives the IP address from the
device path and sets up the connection again. This should be easy.

Another question came to me is: how about the wireless connection? Will
the AP still be associated and authenticated?

Thanks,

Gary Lin

> 
> Best Regards
> Siyuan
> 
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Gary 
> Ching-Pang Lin
> Sent: Friday, August 28, 2015 4:02 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] Network disconnected after NBP was loaded
> 
> Hi,
> 
> I was under the impression that the UEFI firmware would maintain the network 
> connection unless a EFI program or OS determine to create a new connection.
> Take PXE for example. After the bootloader is loaded, it can utilize the 
> PxeBaseCode protocol to download the OS image with the existed connection 
> without starting the DHCP process again. However, the current implementation 
> of HttpBoot seems to be another case.
> 
> In HttpBootDxeLoadFile() in NetworkPkg/HttpBootDxe/HttpBootImpl.c, the driver 
> closes the DHCP4 connection right after the file is loaded. This means the 
> bootloader has to set up the network connection on its own if it needs to 
> load a remote file.
> 
> My question is: what's the expection for a bootloader/Network Boot Program?
> Should the bootloader always create its own connection for HTTP Boot?
> 
> Thanks,
> 
> Gary Lin
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] Network disconnected after NBP was loaded

2015-08-28 Thread Gary Ching-Pang Lin
Hi,

I was under the impression that the UEFI firmware would maintain the network
connection unless a EFI program or OS determine to create a new connection.
Take PXE for example. After the bootloader is loaded, it can utilize the
PxeBaseCode protocol to download the OS image with the existed connection
without starting the DHCP process again. However, the current implementation
of HttpBoot seems to be another case.

In HttpBootDxeLoadFile() in NetworkPkg/HttpBootDxe/HttpBootImpl.c, the driver
closes the DHCP4 connection right after the file is loaded. This means the
bootloader has to set up the network connection on its own if it needs to load
a remote file.

My question is: what's the expection for a bootloader/Network Boot Program?
Should the bootloader always create its own connection for HTTP Boot?

Thanks,

Gary Lin
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] OvmfPkg: Build HTTP utilities driver

2015-08-27 Thread Gary Ching-Pang Lin
On Thu, Aug 27, 2015 at 12:54:13PM +0200, Laszlo Ersek wrote:
> Gary,
> 
> On 08/27/15 05:41, Gary Ching-Pang Lin wrote:
> > The HTTP driver now needs the HTTP utilities driver to parse the
> > headers of HTTP requests.
> 
> Can you point out the SVN rev / git commit that makes this necessary?
> I'd like to reference that patch in this commit message.
> 
It's r18316 / 5ca29abe5297. That commit removed HttpUtilities.* from
HttpDxe and make the driver consume EFI_HTTP_UTILITIES_PROTOCOL instead.

Gary Lin

> You don't need to resubmit, I can edit the reference into the commit
> message when I commit the patch.
> 
> Thanks
> Laszlo
> 
> 
> > Add the driver into OVMF so that the
> > HTTP driver can work properly.
> > 
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Gary Ching-Pang Lin 
> > ---
> >  OvmfPkg/OvmfPkgIa32.dsc| 1 +
> >  OvmfPkg/OvmfPkgIa32.fdf| 1 +
> >  OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
> >  OvmfPkg/OvmfPkgIa32X64.fdf | 1 +
> >  OvmfPkg/OvmfPkgX64.dsc | 1 +
> >  OvmfPkg/OvmfPkgX64.fdf | 1 +
> >  6 files changed, 6 insertions(+)
> > 
> > diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> > index 5741eac..d92a327 100644
> > --- a/OvmfPkg/OvmfPkgIa32.dsc
> > +++ b/OvmfPkg/OvmfPkgIa32.dsc
> > @@ -562,6 +562,7 @@ [Components]
> >  !endif
> >  !if $(HTTP_BOOT_ENABLE) == TRUE
> >NetworkPkg/DnsDxe/DnsDxe.inf
> > +  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> >NetworkPkg/HttpDxe/HttpDxe.inf
> >NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> >  !endif
> > diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
> > index 0e4ee49..f3dcfff 100644
> > --- a/OvmfPkg/OvmfPkgIa32.fdf
> > +++ b/OvmfPkg/OvmfPkgIa32.fdf
> > @@ -326,6 +326,7 @@ [FV.DXEFV]
> >  !endif
> >  !if $(HTTP_BOOT_ENABLE) == TRUE
> >INF  NetworkPkg/DnsDxe/DnsDxe.inf
> > +  INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> >INF  NetworkPkg/HttpDxe/HttpDxe.inf
> >INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> >  !endif
> > diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> > index 753ab27..1c39cc7 100644
> > --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> > +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> > @@ -569,6 +569,7 @@ [Components.X64]
> >  !endif
> >  !if $(HTTP_BOOT_ENABLE) == TRUE
> >NetworkPkg/DnsDxe/DnsDxe.inf
> > +  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> >NetworkPkg/HttpDxe/HttpDxe.inf
> >NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> >  !endif
> > diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
> > index 74412d4..3a509da 100644
> > --- a/OvmfPkg/OvmfPkgIa32X64.fdf
> > +++ b/OvmfPkg/OvmfPkgIa32X64.fdf
> > @@ -326,6 +326,7 @@ [FV.DXEFV]
> >  !endif
> >  !if $(HTTP_BOOT_ENABLE) == TRUE
> >INF  NetworkPkg/DnsDxe/DnsDxe.inf
> > +  INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> >INF  NetworkPkg/HttpDxe/HttpDxe.inf
> >INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> >  !endif
> > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> > index 540333d..778ea28 100644
> > --- a/OvmfPkg/OvmfPkgX64.dsc
> > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > @@ -567,6 +567,7 @@ [Components]
> >  !endif
> >  !if $(HTTP_BOOT_ENABLE) == TRUE
> >NetworkPkg/DnsDxe/DnsDxe.inf
> > +  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> >NetworkPkg/HttpDxe/HttpDxe.inf
> >NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> >  !endif
> > diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
> > index e9ba97b..153dd82 100644
> > --- a/OvmfPkg/OvmfPkgX64.fdf
> > +++ b/OvmfPkg/OvmfPkgX64.fdf
> > @@ -326,6 +326,7 @@ [FV.DXEFV]
> >  !endif
> >  !if $(HTTP_BOOT_ENABLE) == TRUE
> >INF  NetworkPkg/DnsDxe/DnsDxe.inf
> > +  INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
> >INF  NetworkPkg/HttpDxe/HttpDxe.inf
> >INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> >  !endif
> > 
> 
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] OvmfPkg: Build HTTP utilities driver

2015-08-26 Thread Gary Ching-Pang Lin
The HTTP driver now needs the HTTP utilities driver to parse the
headers of HTTP requests. Add the driver into OVMF so that the
HTTP driver can work properly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Ching-Pang Lin 
---
 OvmfPkg/OvmfPkgIa32.dsc| 1 +
 OvmfPkg/OvmfPkgIa32.fdf| 1 +
 OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
 OvmfPkg/OvmfPkgIa32X64.fdf | 1 +
 OvmfPkg/OvmfPkgX64.dsc | 1 +
 OvmfPkg/OvmfPkgX64.fdf | 1 +
 6 files changed, 6 insertions(+)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 5741eac..d92a327 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -562,6 +562,7 @@ [Components]
 !endif
 !if $(HTTP_BOOT_ENABLE) == TRUE
   NetworkPkg/DnsDxe/DnsDxe.inf
+  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
   NetworkPkg/HttpDxe/HttpDxe.inf
   NetworkPkg/HttpBootDxe/HttpBootDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 0e4ee49..f3dcfff 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -326,6 +326,7 @@ [FV.DXEFV]
 !endif
 !if $(HTTP_BOOT_ENABLE) == TRUE
   INF  NetworkPkg/DnsDxe/DnsDxe.inf
+  INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
   INF  NetworkPkg/HttpDxe/HttpDxe.inf
   INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 753ab27..1c39cc7 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -569,6 +569,7 @@ [Components.X64]
 !endif
 !if $(HTTP_BOOT_ENABLE) == TRUE
   NetworkPkg/DnsDxe/DnsDxe.inf
+  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
   NetworkPkg/HttpDxe/HttpDxe.inf
   NetworkPkg/HttpBootDxe/HttpBootDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 74412d4..3a509da 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -326,6 +326,7 @@ [FV.DXEFV]
 !endif
 !if $(HTTP_BOOT_ENABLE) == TRUE
   INF  NetworkPkg/DnsDxe/DnsDxe.inf
+  INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
   INF  NetworkPkg/HttpDxe/HttpDxe.inf
   INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 540333d..778ea28 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -567,6 +567,7 @@ [Components]
 !endif
 !if $(HTTP_BOOT_ENABLE) == TRUE
   NetworkPkg/DnsDxe/DnsDxe.inf
+  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
   NetworkPkg/HttpDxe/HttpDxe.inf
   NetworkPkg/HttpBootDxe/HttpBootDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index e9ba97b..153dd82 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -326,6 +326,7 @@ [FV.DXEFV]
 !endif
 !if $(HTTP_BOOT_ENABLE) == TRUE
   INF  NetworkPkg/DnsDxe/DnsDxe.inf
+  INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
   INF  NetworkPkg/HttpDxe/HttpDxe.inf
   INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
 !endif
-- 
2.1.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v3 2/2] OvmfPkg: Add HttpBoot support

2015-08-23 Thread Gary Ching-Pang Lin
On Sat, Aug 22, 2015 at 08:20:35PM -0700, Jordan Justen wrote:
> I committed this patch. Thanks!
> 
> I did have a question. I see that we need the HTTP_BOOT_ENABLE flag,
> or the release build will overflow the 1MB image size. Is that the
> only reason to only optionally enable the feature?
> 
It's still a driver under development and there are some missing features
e.g. Http Utility protocol, DHCPv6 support, etc., so I make it optional.

Gary Lin

> -Jordan
> 
> On 2015-08-19 20:48:44, Gary Ching-Pang Lin wrote:
> > This commit introdues a new build option to OvmfPkg: HTTP_BOOT_ENABLE.
> > When HttpBoot is enabled, a new Network boot option will show in the
> > boot manager menu with the device path like this:
> > 
> > PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)/IPv4(0.0.0.0)/Uri()
> > 
> > It works like the PXE one but fetches the NBP from the given http
> > url instead of the tftp service.
> > 
> > A simple testing environment can be set up with the QEMU tap network
> > and dnsmasq + lighttpd.
> > 
> > Here is the example of the dnsmasq config:
> > 
> >   interface=
> >   dhcp-range=192.168.111.100,192.168.111.120,12h
> >   dhcp-option=60,"HTTPClient"
> >   dhcp-boot="http:///"
> > 
> > It's similar to the PXE server settings except the tftp function is
> > disabled, the option 60 must be "HTTPClient", and the boot uri is a
> > http url.
> > 
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Gary Ching-Pang Lin 
> > Reviewed-by: Fu Siyuan 
> > ---
> >  OvmfPkg/OvmfPkgIa32.dsc| 10 ++
> >  OvmfPkg/OvmfPkgIa32.fdf|  5 +
> >  OvmfPkg/OvmfPkgIa32X64.dsc | 10 ++
> >  OvmfPkg/OvmfPkgIa32X64.fdf |  5 +
> >  OvmfPkg/OvmfPkgX64.dsc | 10 ++
> >  OvmfPkg/OvmfPkgX64.fdf |  5 +
> >  6 files changed, 45 insertions(+)
> > 
> > diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> > index 4ab618d..9a6de15 100644
> > --- a/OvmfPkg/OvmfPkgIa32.dsc
> > +++ b/OvmfPkg/OvmfPkgIa32.dsc
> > @@ -35,6 +35,7 @@ [Defines]
> >#
> >DEFINE SECURE_BOOT_ENABLE  = FALSE
> >DEFINE NETWORK_IP6_ENABLE  = FALSE
> > +  DEFINE HTTP_BOOT_ENABLE= FALSE
> >  
> >  [BuildOptions]
> >GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
> > @@ -129,6 +130,10 @@ [LibraryClasses]
> >
> > AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
> >  !endif
> >  
> > +!if $(HTTP_BOOT_ENABLE) == TRUE
> > +  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
> > +!endif
> > +
> >
> > S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
> >SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
> >
> > OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
> > @@ -551,6 +556,11 @@ [Components]
> >MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
> >MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
> >  !endif
> > +!if $(HTTP_BOOT_ENABLE) == TRUE
> > +  NetworkPkg/DnsDxe/DnsDxe.inf
> > +  NetworkPkg/HttpDxe/HttpDxe.inf
> > +  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> > +!endif
> >OvmfPkg/VirtioNetDxe/VirtioNet.inf
> >  
> >#
> > diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
> > index 16675f8..0e4ee49 100644
> > --- a/OvmfPkg/OvmfPkgIa32.fdf
> > +++ b/OvmfPkg/OvmfPkgIa32.fdf
> > @@ -324,6 +324,11 @@ [FV.DXEFV]
> >INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
> >INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
> >  !endif
> > +!if $(HTTP_BOOT_ENABLE) == TRUE
> > +  INF  NetworkPkg/DnsDxe/DnsDxe.inf
> > +  INF  NetworkPkg/HttpDxe/HttpDxe.inf
> > +  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
> > +!endif
> >INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
> >  
> >  #
> > diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> > index 90ca42a..2f8006d 100644
> > --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> > +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> > @@ -35,6 +35,7 @@ [Defines]
> >#
> >DEFINE SECURE_BOOT_ENABLE  = FALSE
> >DEFINE NETWORK_IP6_ENABLE  = FALSE
> > +  DEFINE HTTP_BOOT_ENABLE= FALSE
> >  
> >  [BuildOptions]
> >GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
> > @@ -134,6 +135,10 @@ [LibraryClasses]
> &

Re: [edk2] [PATCH v3 1/2] NetworkPkg: Remove the hostname from the http request URL

2015-08-19 Thread Gary Ching-Pang Lin
On Thu, Aug 20, 2015 at 05:04:38AM +, Fu, Siyuan wrote:
> The patch is good, do you have access authority of edk2? Or I can help to 
> commit this patch.
> 
> Reviewed-by: Fu Siyuan 
> 
I don't have the access right. That would be great if you can help me.

Thanks,

Gary Lin

> 
> 
> 
> -----Original Message-
> From: Gary Ching-Pang Lin [mailto:g...@suse.com] 
> Sent: Thursday, August 20, 2015 11:49 AM
> To: edk2-devel@lists.01.org
> Cc: Laszlo Ersek; Justen, Jordan L; Fu, Siyuan
> Subject: [PATCH v3 1/2] NetworkPkg: Remove the hostname from the http request 
> URL
> 
> Per RFC7230, the URL must be a absolute-path when making a request directly 
> to the server. Since proxy is not supported now, all requests to the HTTP 
> driver are actually direct requests. This commit removes the scheme and the 
> hostname from the URL in the http request if the URL is an absolute-URI so 
> that the HTTP server can interpret the request properly.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Gary Ching-Pang Lin 
> Reviewed-by: Ye Ting 
> ---
>  NetworkPkg/HttpDxe/HttpImpl.c | 19 ++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
> index 545fe42..6684f77 100644
> --- a/NetworkPkg/HttpDxe/HttpImpl.c
> +++ b/NetworkPkg/HttpDxe/HttpImpl.c
> @@ -227,6 +227,7 @@ EfiHttpRequest (
>CHAR16*HostNameStr;
>HTTP_TOKEN_WRAP   *Wrap;
>HTTP_TCP_TOKEN_WRAP   *TcpWrap;
> +  CHAR8 *FileUrl;
>  
>if ((This == NULL) || (Token == NULL)) {
>  return EFI_INVALID_PARAMETER;
> @@ -450,7 +451,23 @@ EfiHttpRequest (
>//
>// Create request message.
>//
> -  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, Url);
> +  FileUrl = Url;
> +  if (*FileUrl != '/') {
> +//
> +// Convert the absolute-URI to the absolute-path
> +//
> +while (*FileUrl != ':')
> +  FileUrl++;
> +if ((*(FileUrl+1) == '/') && (*(FileUrl+2) == '/')) {
> +  FileUrl += 3;
> +  while (*FileUrl != '/')
> +FileUrl++;
> +} else {
> +  Status = EFI_INVALID_PARAMETER;
> +  goto Error3;
> +}
> +  }
> +  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, FileUrl);
>if (RequestStr == NULL) {
>  Status = EFI_OUT_OF_RESOURCES;
>  goto Error3;
> --
> 2.1.4
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v3 1/2] NetworkPkg: Remove the hostname from the http request URL

2015-08-19 Thread Gary Ching-Pang Lin
Per RFC7230, the URL must be a absolute-path when making a request
directly to the server. Since proxy is not supported now, all requests
to the HTTP driver are actually direct requests. This commit removes
the scheme and the hostname from the URL in the http request if the URL
is an absolute-URI so that the HTTP server can interpret the request
properly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Ching-Pang Lin 
Reviewed-by: Ye Ting 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 545fe42..6684f77 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -227,6 +227,7 @@ EfiHttpRequest (
   CHAR16*HostNameStr;
   HTTP_TOKEN_WRAP   *Wrap;
   HTTP_TCP_TOKEN_WRAP   *TcpWrap;
+  CHAR8 *FileUrl;
 
   if ((This == NULL) || (Token == NULL)) {
 return EFI_INVALID_PARAMETER;
@@ -450,7 +451,23 @@ EfiHttpRequest (
   //
   // Create request message.
   //
-  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, Url);
+  FileUrl = Url;
+  if (*FileUrl != '/') {
+//
+// Convert the absolute-URI to the absolute-path
+//
+while (*FileUrl != ':')
+  FileUrl++;
+if ((*(FileUrl+1) == '/') && (*(FileUrl+2) == '/')) {
+  FileUrl += 3;
+  while (*FileUrl != '/')
+FileUrl++;
+} else {
+  Status = EFI_INVALID_PARAMETER;
+  goto Error3;
+}
+  }
+  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, FileUrl);
   if (RequestStr == NULL) {
 Status = EFI_OUT_OF_RESOURCES;
 goto Error3;
-- 
2.1.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v3 0/2] Add HttpBoot support to OvmfPkg

2015-08-19 Thread Gary Ching-Pang Lin
V3: Amended the HTTP driver patch per Siyuan Fu's suggestion.
Also reworded that patch to explain the problem more clearly.

V2: Updated my git config to generate the reviewer-friendly diff.

This patch series fixes a http request bug in HttpDxe and adds the
HttpBoot support to OvmfPkg.

I've tested the HttpBoot implementation with a simple environment:

[QEMU] <---(tap0)---> [HOST]
 Ovmf   DHCP server
HTTP server

With a proper config for the dhcp and http server in the host, the firmware
successfully fetched the remote EFI file and executed it. It's recommended
to update gnu-efi to the latest version to detect the IPv4 device path
correctly.

Known issues:
* DHCPv6 support is not implemented in HttpBootDxe at this moment.
* The unexpected TCP disconnection isn't handled in HttpDxe so the GET request
  may fail while fetching the EFI image from some featureless http daemon such
  as thttpd.

Gary Ching-Pang Lin (2):
  NetworkPkg: Remove the hostname from the http request URL
  OvmfPkg: Add HttpBoot support

 NetworkPkg/HttpDxe/HttpImpl.c | 19 ++-
 OvmfPkg/OvmfPkgIa32.dsc   | 10 ++
 OvmfPkg/OvmfPkgIa32.fdf   |  5 +
 OvmfPkg/OvmfPkgIa32X64.dsc| 10 ++
 OvmfPkg/OvmfPkgIa32X64.fdf|  5 +
 OvmfPkg/OvmfPkgX64.dsc| 10 ++
 OvmfPkg/OvmfPkgX64.fdf|  5 +
 7 files changed, 63 insertions(+), 1 deletion(-)

-- 
2.1.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v3 2/2] OvmfPkg: Add HttpBoot support

2015-08-19 Thread Gary Ching-Pang Lin
This commit introdues a new build option to OvmfPkg: HTTP_BOOT_ENABLE.
When HttpBoot is enabled, a new Network boot option will show in the
boot manager menu with the device path like this:

PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)/IPv4(0.0.0.0)/Uri()

It works like the PXE one but fetches the NBP from the given http
url instead of the tftp service.

A simple testing environment can be set up with the QEMU tap network
and dnsmasq + lighttpd.

Here is the example of the dnsmasq config:

  interface=
  dhcp-range=192.168.111.100,192.168.111.120,12h
  dhcp-option=60,"HTTPClient"
  dhcp-boot="http:///"

It's similar to the PXE server settings except the tftp function is
disabled, the option 60 must be "HTTPClient", and the boot uri is a
http url.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Ching-Pang Lin 
Reviewed-by: Fu Siyuan 
---
 OvmfPkg/OvmfPkgIa32.dsc| 10 ++
 OvmfPkg/OvmfPkgIa32.fdf|  5 +
 OvmfPkg/OvmfPkgIa32X64.dsc | 10 ++
 OvmfPkg/OvmfPkgIa32X64.fdf |  5 +
 OvmfPkg/OvmfPkgX64.dsc | 10 ++
 OvmfPkg/OvmfPkgX64.fdf |  5 +
 6 files changed, 45 insertions(+)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 4ab618d..9a6de15 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -35,6 +35,7 @@ [Defines]
   #
   DEFINE SECURE_BOOT_ENABLE  = FALSE
   DEFINE NETWORK_IP6_ENABLE  = FALSE
+  DEFINE HTTP_BOOT_ENABLE= FALSE
 
 [BuildOptions]
   GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
@@ -129,6 +130,10 @@ [LibraryClasses]
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif
 
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
+!endif
+
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -551,6 +556,11 @@ [Components]
   MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  NetworkPkg/DnsDxe/DnsDxe.inf
+  NetworkPkg/HttpDxe/HttpDxe.inf
+  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
   #
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 16675f8..0e4ee49 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -324,6 +324,11 @@ [FV.DXEFV]
   INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  INF  NetworkPkg/DnsDxe/DnsDxe.inf
+  INF  NetworkPkg/HttpDxe/HttpDxe.inf
+  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
 #
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 90ca42a..2f8006d 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -35,6 +35,7 @@ [Defines]
   #
   DEFINE SECURE_BOOT_ENABLE  = FALSE
   DEFINE NETWORK_IP6_ENABLE  = FALSE
+  DEFINE HTTP_BOOT_ENABLE= FALSE
 
 [BuildOptions]
   GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
@@ -134,6 +135,10 @@ [LibraryClasses]
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif
 
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
+!endif
+
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -558,6 +563,11 @@ [Components.X64]
   MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  NetworkPkg/DnsDxe/DnsDxe.inf
+  NetworkPkg/HttpDxe/HttpDxe.inf
+  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
   #
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index e6c525a..74412d4 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -324,6 +324,11 @@ [FV.DXEFV]
   INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  INF  NetworkPkg/DnsDxe/DnsDxe.inf
+  INF  NetworkPkg/HttpDxe/HttpDxe.inf
+  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
 #
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index b72eaa9..5407d9d 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -35,6 +35,7 @@ [Defines]
   #
   DEFINE SECURE

[edk2] [PATCH v2 1/2] NetworkPkg: Remove the hostname from the http request url

2015-08-17 Thread Gary Ching-Pang Lin
The hostname is already set in the header of the http request.
The url shouldn't contain the hostname since the hostname will
be prepended to the url when the server interprets the request.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Ching-Pang Lin 
Reviewed-by: Ye Ting 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 545fe42..030dcfe 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -227,6 +227,7 @@ EfiHttpRequest (
   CHAR16*HostNameStr;
   HTTP_TOKEN_WRAP   *Wrap;
   HTTP_TCP_TOKEN_WRAP   *TcpWrap;
+  CHAR8 *FileUrl;
 
   if ((This == NULL) || (Token == NULL)) {
 return EFI_INVALID_PARAMETER;
@@ -450,7 +451,18 @@ EfiHttpRequest (
   //
   // Create request message.
   //
-  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, Url);
+  FileUrl = Url;
+  while (*FileUrl != ':')
+FileUrl++;
+  if ((*(FileUrl+1) == '/') && (*(FileUrl+2) == '/')) {
+FileUrl += 3;
+while (*FileUrl != '/')
+  FileUrl++;
+  } else {
+Status = EFI_INVALID_PARAMETER;
+goto Error3;
+  }
+  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, FileUrl);
   if (RequestStr == NULL) {
 Status = EFI_OUT_OF_RESOURCES;
 goto Error3;
-- 
2.1.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 0/2] Add HttpBoot support to OvmfPkg

2015-08-17 Thread Gary Ching-Pang Lin
V2: Updated my git config to generate the reviewer-friendly diff.

This patch series fixes a http request bug in HttpDxe and adds the
HttpBoot support to OvmfPkg.

I've tested the HttpBoot implementation with a simple environment:

[QEMU] <---(tap0)---> [HOST]
 Ovmf   DHCP server
HTTP server

With a proper config for the dhcp and http server in the host, the firmware
successfully fetched the remote EFI file and executed it. It's recommended
to update gnu-efi to the latest version to detect the IPv4 device path
correctly.

Known issues:
* DHCPv6 support is not implemented in HttpBootDxe at this moment.
* The unexpected TCP disconnection isn't handled properly in HttpDxe and the
  GET request may fail while fetching the EFI image from some featureless
  http daemon such as thttpd.

Gary Ching-Pang Lin (2):
  NetworkPkg: Remove the hostname from the http request url
  OvmfPkg: Add HttpBoot support

 NetworkPkg/HttpDxe/HttpImpl.c | 14 +-
 OvmfPkg/OvmfPkgIa32.dsc   | 10 ++
 OvmfPkg/OvmfPkgIa32.fdf   |  5 +
 OvmfPkg/OvmfPkgIa32X64.dsc| 10 ++
 OvmfPkg/OvmfPkgIa32X64.fdf|  5 +
 OvmfPkg/OvmfPkgX64.dsc| 10 ++
 OvmfPkg/OvmfPkgX64.fdf|  5 +
 7 files changed, 58 insertions(+), 1 deletion(-)

-- 
2.1.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 2/2] OvmfPkg: Add HttpBoot support

2015-08-17 Thread Gary Ching-Pang Lin
This commit introdues a new build option to OvmfPkg: HTTP_BOOT_ENABLE.
When HttpBoot is enabled, a new Network boot option will show in the
boot manager menu with the device path like this:

PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)/IPv4(0.0.0.0)/Uri()

It works like the PXE one but fetches the NBP from the given http
url instead of the tftp service.

A simple testing environment can be set up with the QEMU tap network
and dnsmasq + lighttpd.

Here is the example of the dnsmasq config:

  interface=
  dhcp-range=192.168.111.100,192.168.111.120,12h
  dhcp-option=60,"HTTPClient"
  dhcp-boot="http:///"

It's similar to the PXE server settings except the tftp function is
disabled, the option 60 must be "HTTPClient", and the boot uri is a
http url.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Ching-Pang Lin 
---
 OvmfPkg/OvmfPkgIa32.dsc| 10 ++
 OvmfPkg/OvmfPkgIa32.fdf|  5 +
 OvmfPkg/OvmfPkgIa32X64.dsc | 10 ++
 OvmfPkg/OvmfPkgIa32X64.fdf |  5 +
 OvmfPkg/OvmfPkgX64.dsc | 10 ++
 OvmfPkg/OvmfPkgX64.fdf |  5 +
 6 files changed, 45 insertions(+)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 4ab618d..9a6de15 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -35,6 +35,7 @@ [Defines]
   #
   DEFINE SECURE_BOOT_ENABLE  = FALSE
   DEFINE NETWORK_IP6_ENABLE  = FALSE
+  DEFINE HTTP_BOOT_ENABLE= FALSE
 
 [BuildOptions]
   GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
@@ -129,6 +130,10 @@ [LibraryClasses]
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif
 
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
+!endif
+
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -551,6 +556,11 @@ [Components]
   MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  NetworkPkg/DnsDxe/DnsDxe.inf
+  NetworkPkg/HttpDxe/HttpDxe.inf
+  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
   #
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 16675f8..0e4ee49 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -324,6 +324,11 @@ [FV.DXEFV]
   INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  INF  NetworkPkg/DnsDxe/DnsDxe.inf
+  INF  NetworkPkg/HttpDxe/HttpDxe.inf
+  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
 #
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 90ca42a..2f8006d 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -35,6 +35,7 @@ [Defines]
   #
   DEFINE SECURE_BOOT_ENABLE  = FALSE
   DEFINE NETWORK_IP6_ENABLE  = FALSE
+  DEFINE HTTP_BOOT_ENABLE= FALSE
 
 [BuildOptions]
   GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
@@ -134,6 +135,10 @@ [LibraryClasses]
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif
 
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
+!endif
+
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -558,6 +563,11 @@ [Components.X64]
   MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  NetworkPkg/DnsDxe/DnsDxe.inf
+  NetworkPkg/HttpDxe/HttpDxe.inf
+  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
   #
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index e6c525a..74412d4 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -324,6 +324,11 @@ [FV.DXEFV]
   INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  INF  NetworkPkg/DnsDxe/DnsDxe.inf
+  INF  NetworkPkg/HttpDxe/HttpDxe.inf
+  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
 #
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index b72eaa9..5407d9d 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -35,6 +35,7 @@ [Defines]
   #
   DEFINE SECURE_BOOT_ENABLE  = FALSE
   DEF

Re: [edk2] [PATCH 0/2] Add HttpBoot support to OvmfPkg

2015-08-16 Thread Gary Ching-Pang Lin
On Fri, Aug 14, 2015 at 07:58:31AM -0700, Blibbet wrote:
> 
> On 08/14/2015 02:03 AM, Gary Ching-Pang Lin wrote:
> > Although the current HttpBoot implementation is incomplete, it would be
> > easier to develop and test the software stack with a virtual machine.
> 
> THANKS for adding to OVMF!
> 
> Besides "1219 UEFI.Next Feature - UEFI TLS API", what else is missing?
> 
The DHCPv6 support in HttpBoot is not implemented. Besides, the unexpected
disconnection wasn't handled in HttpIo. I was using thttpd in the beginning,
and the http daemon dropped the connection after a http request but HttpIo
thought it's still alive and failed the next request.

I started to suspect the strange devpath I had might be caused by gnu-efi.
I'll update my finding and post a v2 patchset after fixing the git config
requested by Laszlo.

Cheers,

Gary Lin
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 0/2] Add HttpBoot support to OvmfPkg

2015-08-14 Thread Gary Ching-Pang Lin
On Fri, Aug 14, 2015 at 10:27:31AM +0100, David Woodhouse wrote:
> On Fri, 2015-08-14 at 17:03 +0800, Gary Ching-Pang Lin wrote:
> > I've tested the HttpBoot implementation with a simple test 
> > environment:
> 
> Is this tested with IPv6?
No, IPv6 is not implemented in HttpBootDxe, so I only tested IPv4.

Gary Lin
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 0/2] Add HttpBoot support to OvmfPkg

2015-08-14 Thread Gary Ching-Pang Lin
I've tested the HttpBoot implementation with a simple test environment:

[QEMU] <---(tap0)---> [HOST]
 Ovmf   DHCP server
HTTP server

With a proper config for the dhcp and http server in the host, the firmware
successfully fetched the remote EFI file and executed it. However, the EFI
file couldn't get the correct device path so it's still not good enough for
the bootloader development.

Although the current HttpBoot implementation is incomplete, it would be
easier to develop and test the software stack with a virtual machine.

Gary Ching-Pang Lin (2):
  NetworkPkg: Remove the hostname for the http request url
  OvmfPkg: Add HttpBoot support

 NetworkPkg/HttpDxe/HttpImpl.c | 14 +-
 OvmfPkg/OvmfPkgIa32.dsc   | 10 ++
 OvmfPkg/OvmfPkgIa32.fdf   |  5 +
 OvmfPkg/OvmfPkgIa32X64.dsc| 10 ++
 OvmfPkg/OvmfPkgIa32X64.fdf|  5 +
 OvmfPkg/OvmfPkgX64.dsc| 10 ++
 OvmfPkg/OvmfPkgX64.fdf|  5 +
 7 files changed, 58 insertions(+), 1 deletion(-)

-- 
2.1.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel



[edk2] [PATCH 1/2] NetworkPkg: Remove the hostname for the http request url

2015-08-14 Thread Gary Ching-Pang Lin
The hostname is already set in the header of the http request.
The url shouldn't contain the hostname since the hostname will
be prepended to the url when the server interprets the request.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Ching-Pang Lin 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 545fe42..030dcfe 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -227,6 +227,7 @@ EfiHttpRequest (
   CHAR16*HostNameStr;
   HTTP_TOKEN_WRAP   *Wrap;
   HTTP_TCP_TOKEN_WRAP   *TcpWrap;
+  CHAR8 *FileUrl;
 
   if ((This == NULL) || (Token == NULL)) {
 return EFI_INVALID_PARAMETER;
@@ -450,7 +451,18 @@ EfiHttpRequest (
   //
   // Create request message.
   //
-  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, Url);
+  FileUrl = Url;
+  while (*FileUrl != ':')
+FileUrl++;
+  if ((*(FileUrl+1) == '/') && (*(FileUrl+2) == '/')) {
+FileUrl += 3;
+while (*FileUrl != '/')
+  FileUrl++;
+  } else {
+Status = EFI_INVALID_PARAMETER;
+goto Error3;
+  }
+  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, FileUrl);
   if (RequestStr == NULL) {
 Status = EFI_OUT_OF_RESOURCES;
 goto Error3;
-- 
2.1.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 2/2] OvmfPkg: Add HttpBoot support

2015-08-14 Thread Gary Ching-Pang Lin
This commit introdues a new build option to OvmfPkg: HTTP_BOOT_ENABLE.
When HttpBoot is enabled, a new Network boot option will show in the
boot manager menu with the device path like this:

PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)/IPv4(0.0.0.0)/Uri()

It works like the PXE one but fetches the NBP from the given http
url instead of the tftp service.

A simple testing environment can be set up with the QEMU tap network
and dnsmasq + lighttpd.

Here is the example of the dnsmasq config:

  interface=
  dhcp-range=192.168.111.100,192.168.111.120,12h
  dhcp-option=60,"HTTPClient"
  dhcp-boot="http:///"

It's similar to the PXE server settings except the tftp function is
disabled, the option 60 must be "HTTPClient", and the boot uri is a
http url.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Ching-Pang Lin 
---
 OvmfPkg/OvmfPkgIa32.dsc| 10 ++
 OvmfPkg/OvmfPkgIa32.fdf|  5 +
 OvmfPkg/OvmfPkgIa32X64.dsc | 10 ++
 OvmfPkg/OvmfPkgIa32X64.fdf |  5 +
 OvmfPkg/OvmfPkgX64.dsc | 10 ++
 OvmfPkg/OvmfPkgX64.fdf |  5 +
 6 files changed, 45 insertions(+)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 4ab618d..9a6de15 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -35,6 +35,7 @@
   #
   DEFINE SECURE_BOOT_ENABLE  = FALSE
   DEFINE NETWORK_IP6_ENABLE  = FALSE
+  DEFINE HTTP_BOOT_ENABLE= FALSE
 
 [BuildOptions]
   GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
@@ -129,6 +130,10 @@
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif
 
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
+!endif
+
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -551,6 +556,11 @@
   MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  NetworkPkg/DnsDxe/DnsDxe.inf
+  NetworkPkg/HttpDxe/HttpDxe.inf
+  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
   #
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 16675f8..0e4ee49 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -324,6 +324,11 @@ FILE FREEFORM = 
PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
   INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  INF  NetworkPkg/DnsDxe/DnsDxe.inf
+  INF  NetworkPkg/HttpDxe/HttpDxe.inf
+  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
 #
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 90ca42a..2f8006d 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -35,6 +35,7 @@
   #
   DEFINE SECURE_BOOT_ENABLE  = FALSE
   DEFINE NETWORK_IP6_ENABLE  = FALSE
+  DEFINE HTTP_BOOT_ENABLE= FALSE
 
 [BuildOptions]
   GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
@@ -134,6 +135,10 @@
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
 !endif
 
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf
+!endif
+
   
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
@@ -558,6 +563,11 @@
   MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  NetworkPkg/DnsDxe/DnsDxe.inf
+  NetworkPkg/HttpDxe/HttpDxe.inf
+  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
   #
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index e6c525a..74412d4 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -324,6 +324,11 @@ FILE FREEFORM = 
PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
   INF  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   INF  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
 !endif
+!if $(HTTP_BOOT_ENABLE) == TRUE
+  INF  NetworkPkg/DnsDxe/DnsDxe.inf
+  INF  NetworkPkg/HttpDxe/HttpDxe.inf
+  INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+!endif
   INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
 #
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index b72eaa9..5407d9d 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -35,6 +35,7 @@
   #
   DEF