All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 6/7] net: Optionally use pxe client arch from variable
Date: Thu, 12 May 2016 15:51:45 +0200	[thread overview]
Message-ID: <1463061105-230381-1-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1462561267-92773-7-git-send-email-agraf@suse.de>

The client architecture that we pass to a dhcp server depends on the target
payload that we want to execute. An EFI binary has a different client arch
than a legacy binary or a u-boot binary.

So let's parameterize the pxe client arch field to allow an override via
the distro script, so that our efi boot path can tell the dhcp server that
it's actually an efi firmware.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v3 -> v4:

  - Fix compile build for !CONFIG_LIB_UUID
---
 net/bootp.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/net/bootp.c b/net/bootp.c
index d718e35..c1c32a1 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -431,10 +431,10 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
 {
 	u8 *start = e;
 	u8 *cnt;
-#if defined(CONFIG_BOOTP_PXE)
+#ifdef CONFIG_LIB_UUID
 	char *uuid;
-	u16 clientarch;
 #endif
+	int clientarch = -1;
 
 #if defined(CONFIG_BOOTP_VENDOREX)
 	u8 *x;
@@ -490,12 +490,19 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
 	}
 #endif
 
-#if defined(CONFIG_BOOTP_PXE)
+#ifdef CONFIG_BOOTP_PXE_CLIENTARCH
 	clientarch = CONFIG_BOOTP_PXE_CLIENTARCH;
-	*e++ = 93;	/* Client System Architecture */
-	*e++ = 2;
-	*e++ = (clientarch >> 8) & 0xff;
-	*e++ = clientarch & 0xff;
+#endif
+
+	if (getenv("bootp_arch"))
+		clientarch = getenv_ulong("bootp_arch", 16, clientarch);
+
+	if (clientarch > 0) {
+		*e++ = 93;	/* Client System Architecture */
+		*e++ = 2;
+		*e++ = (clientarch >> 8) & 0xff;
+		*e++ = clientarch & 0xff;
+	}
 
 	*e++ = 94;	/* Client Network Interface Identifier */
 	*e++ = 3;
@@ -503,6 +510,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
 	*e++ = 0;	/* major revision */
 	*e++ = 0;	/* minor revision */
 
+#ifdef CONFIG_LIB_UUID
 	uuid = getenv("pxeuuid");
 
 	if (uuid) {
-- 
1.8.5.6

  parent reply	other threads:[~2016-05-12 13:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 19:01 [U-Boot] [PATCH v2 0/7] efi_loader: PXE boot support Alexander Graf
2016-05-06 19:01 ` [U-Boot] [PATCH v2 1/7] efi_loader: Add network access support Alexander Graf
2016-05-10 21:25   ` [U-Boot] [PATCH v3 " Alexander Graf
2016-05-14 19:49     ` Simon Glass
2016-05-14 20:34       ` Alexander Graf
2016-05-16 13:24         ` Simon Glass
2016-05-16 18:06           ` Alexander Graf
2016-05-18 17:21             ` Simon Glass
2016-05-19 16:18               ` Alexander Graf
2016-05-19 16:34                 ` Simon Glass
2016-05-30 17:56   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-05-06 19:01 ` [U-Boot] [PATCH v2 2/7] bootp: Move vendor class identifier set to function Alexander Graf
2016-05-06 19:28   ` Tom Rini
2016-05-30 17:56   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-05-06 19:01 ` [U-Boot] [PATCH v2 3/7] net: Move the VCI and client arch values to Kconfig Alexander Graf
2016-05-06 19:28   ` Tom Rini
2016-05-30 17:56   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-05-06 19:01 ` [U-Boot] [PATCH v2 4/7] net: Fix client identifiers for ARM Alexander Graf
2016-05-06 19:28   ` Tom Rini
2016-05-30 17:56   ` [U-Boot] [U-Boot,v2,4/7] " Tom Rini
2016-05-06 19:01 ` [U-Boot] [PATCH v2 5/7] net: Move CONFIG_SPL_NET_VCI_STRING into Kconfig Alexander Graf
2016-05-06 19:28   ` Tom Rini
2016-05-30 17:57   ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-05-06 19:01 ` [U-Boot] [PATCH v2 6/7] net: Optionally use pxe client arch from variable Alexander Graf
2016-05-06 19:28   ` Tom Rini
2016-05-12 13:51   ` Alexander Graf [this message]
2016-05-30 17:57     ` [U-Boot] [U-Boot, v4, " Tom Rini
2016-05-06 19:01 ` [U-Boot] [PATCH v2 7/7] distro: Add efi pxe boot code Alexander Graf
2016-05-06 19:28   ` Tom Rini
2016-05-30 17:57   ` [U-Boot] [U-Boot,v2,7/7] " Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1463061105-230381-1-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.