From: Rob Herring <robherring2@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 03/10] pxe: fix handling of different localboot values
Date: Sun, 2 Dec 2012 21:00:22 -0600 [thread overview]
Message-ID: <1354503629-25621-4-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>
Add support for value of -1 For localboot. A value of -1 means return to
u-boot prompt.
The localboot value is often 0, so we need to distinguish the value from
localboot being selected. A value of greater than or equal to 0 means
attempt local boot command.
If localboot is selected, we don't want to try other entries.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
common/cmd_pxe.c | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 8b897ad..02ed645 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -437,6 +437,7 @@ struct pxe_label {
char *fdt;
int attempted;
int localboot;
+ int localboot_val;
struct list_head list;
};
@@ -575,7 +576,7 @@ static int label_localboot(struct pxe_label *label)
* If the label specifies an 'append' line, its contents will overwrite that
* of the 'bootargs' environment variable.
*/
-static void label_boot(struct pxe_label *label)
+static int label_boot(struct pxe_label *label)
{
char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL };
int bootm_argc = 3;
@@ -585,21 +586,22 @@ static void label_boot(struct pxe_label *label)
label->attempted = 1;
if (label->localboot) {
- label_localboot(label);
- return;
+ if (label->localboot_val >= 0)
+ label_localboot(label);
+ return 0;
}
if (label->kernel == NULL) {
printf("No kernel given, skipping %s\n",
label->name);
- return;
+ return 1;
}
if (label->initrd) {
if (get_relfile_envaddr(label->initrd, "ramdisk_addr_r") < 0) {
printf("Skipping %s for failure retrieving initrd\n",
label->name);
- return;
+ return 1;
}
bootm_argv[2] = getenv("ramdisk_addr_r");
@@ -610,7 +612,7 @@ static void label_boot(struct pxe_label *label)
if (get_relfile_envaddr(label->kernel, "kernel_addr_r") < 0) {
printf("Skipping %s for failure retrieving kernel\n",
label->name);
- return;
+ return 1;
}
if (label->append)
@@ -638,7 +640,7 @@ static void label_boot(struct pxe_label *label)
if (get_relfile_envaddr(label->fdt, "fdt_addr_r") < 0) {
printf("Skipping %s for failure retrieving fdt\n",
label->name);
- return;
+ return 1;
}
} else
bootm_argv[3] = getenv("fdt_addr");
@@ -647,6 +649,7 @@ static void label_boot(struct pxe_label *label)
bootm_argc = 4;
do_bootm(NULL, 0, bootm_argc, bootm_argv);
+ return 1;
}
/*
@@ -887,7 +890,6 @@ static int parse_integer(char **c, int *dst)
{
struct token t;
char *s = *c;
- unsigned long temp;
get_token(c, &t, L_SLITERAL);
@@ -896,12 +898,7 @@ static int parse_integer(char **c, int *dst)
return -EINVAL;
}
- if (strict_strtoul(t.val, 10, &temp) < 0) {
- printf("Expected unsigned integer: %s\n", t.val);
- return -EINVAL;
- }
-
- *dst = (int)temp;
+ *dst = simple_strtol(t.val, NULL, 10);
free(t.val);
@@ -1092,7 +1089,8 @@ static int parse_label(char **c, struct pxe_menu *cfg)
break;
case T_LOCALBOOT:
- err = parse_integer(c, &label->localboot);
+ label->localboot = 1;
+ err = parse_integer(c, &label->localboot_val);
break;
case T_EOL:
@@ -1350,8 +1348,11 @@ static void handle_pxe_menu(struct pxe_menu *cfg)
* we give up.
*/
- if (err == 1)
- label_boot(choice);
+ if (err == 1) {
+ err = label_boot(choice);
+ if (!err)
+ return;
+ }
else if (err != -ENOENT)
return;
--
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 ` [U-Boot] [PATCH 01/10] pxe: Use ethact setting for pxe Rob Herring
2013-07-08 15:48 ` Joe Hershberger
2012-12-03 3:00 ` [U-Boot] [PATCH 02/10] pxe: make string parameters const Rob Herring
2012-12-03 3:00 ` Rob Herring [this message]
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-4-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