From: Rob Herring <robherring2@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 01/10] pxe: Use ethact setting for pxe
Date: Sun, 2 Dec 2012 21:00:20 -0600 [thread overview]
Message-ID: <1354503629-25621-2-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1354503629-25621-1-git-send-email-robherring2@gmail.com>
From: Rob Herring <rob.herring@calxeda.com>
Get the MAC address using eth_getenv_enetaddr_by_index so that the MAC
address of ethact is used. This enables using the a NIC other than the
first one for PXE boot.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
common/cmd_pxe.c | 34 +++++++++-------------------------
1 file changed, 9 insertions(+), 25 deletions(-)
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index ee75db9..306c483 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -55,37 +55,21 @@ static char *from_env(char *envvar)
*/
static int format_mac_pxe(char *outbuf, size_t outbuf_len)
{
- size_t ethaddr_len;
- char *p, *ethaddr;
+ uchar ethaddr[6];
- ethaddr = from_env("ethaddr");
-
- if (!ethaddr)
- return -ENOENT;
-
- ethaddr_len = strlen(ethaddr);
-
- /*
- * ethaddr_len + 4 gives room for "01-", ethaddr, and a NUL byte at
- * the end.
- */
- if (outbuf_len < ethaddr_len + 4) {
- printf("outbuf is too small (%d < %d)\n",
- outbuf_len, ethaddr_len + 4);
+ if (outbuf_len < 21) {
+ printf("outbuf is too small (%d < 21)\n", outbuf_len);
return -EINVAL;
}
- strcpy(outbuf, "01-");
-
- for (p = outbuf + 3; *ethaddr; ethaddr++, p++) {
- if (*ethaddr == ':')
- *p = '-';
- else
- *p = tolower(*ethaddr);
- }
+ if (!eth_getenv_enetaddr_by_index("eth", eth_get_dev_index(),
+ ethaddr))
+ return -ENOENT;
- *p = '\0';
+ sprintf(outbuf, "01-%02x-%02x-%02x-%02x-%02x-%02x",
+ ethaddr[0], ethaddr[1], ethaddr[2],
+ ethaddr[3], ethaddr[4], ethaddr[5]);
return 1;
}
--
1.7.10.4
next prev parent reply other threads:[~2012-12-03 3:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-03 3:00 [U-Boot] [PATCH 00/10] PXE support updates Rob Herring
2012-12-03 3:00 ` Rob Herring [this message]
2013-07-08 15:48 ` [U-Boot] [PATCH 01/10] pxe: Use ethact setting for pxe Joe Hershberger
2012-12-03 3:00 ` [U-Boot] [PATCH 02/10] pxe: make string parameters const Rob Herring
2012-12-03 3:00 ` [U-Boot] [PATCH 03/10] pxe: fix handling of different localboot values Rob Herring
2012-12-03 3:00 ` [U-Boot] [PATCH 04/10] bootz: un-staticize do_bootz Rob Herring
2012-12-03 3:00 ` [U-Boot] [PATCH 05/10] pxe: use bootz instead of bootm when enabled Rob Herring
2012-12-03 12:22 ` Wolfgang Denk
2012-12-03 14:16 ` Rob Herring
2012-12-03 19:17 ` [U-Boot] [PATCH v2] pxe: try bootz if bootm fails to find a valid image Rob Herring
2013-07-08 15:52 ` Joe Hershberger
2012-12-03 3:00 ` [U-Boot] [PATCH 06/10] pxe: always display a menu when present Rob Herring
2012-12-03 3:00 ` [U-Boot] [PATCH 07/10] pxe: simplify menu display and selection Rob Herring
2012-12-03 3:00 ` [U-Boot] [PATCH 08/10] pxe: add support for ontimeout token Rob Herring
2012-12-03 3:00 ` [U-Boot] [PATCH 09/10] pxe: add support for per arch and SoC default paths Rob Herring
2012-12-03 3:00 ` [U-Boot] [PATCH 10/10] pxe: add ipappend support Rob Herring
2013-05-14 19:48 ` [U-Boot] [PATCH 00/10] PXE support updates Rob Herring
2013-05-14 20:32 ` Joe Hershberger
2013-06-16 15:24 ` Rob Herring
2013-06-17 2:29 ` Joe Hershberger
2013-06-21 15:33 ` Joe Hershberger
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=1354503629-25621-2-git-send-email-robherring2@gmail.com \
--to=robherring2@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox