aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2012-04-14 22:23:21 -0500
committerJohn Rigby <john.rigby@linaro.org>2012-12-06 13:51:49 -0700
commit4b3efae8a83f8c79342a9362204f36b85078e29b (patch)
treec763d4c6d74e61f8da57093e3b9a199dfc2aa1cf
parentc27d56064f9ab335e8de32421843313cadb89932 (diff)
pxe: simplify menu display and selection
Menus with lots of entries and long append lines are hard to read. Just show a numbered list using the label or name and make the choice by entering the number. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
-rw-r--r--common/cmd_pxe.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 83bf67365..5d672af96 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -448,6 +448,7 @@ static int get_relfile_envaddr(char *file_path, char *envaddr_name)
* list - lets these form a list, which a pxe_menu struct will hold.
*/
struct pxe_label {
+ char num[4];
char *name;
char *menu;
char *kernel;
@@ -537,21 +538,9 @@ static void label_destroy(struct pxe_label *label)
static void label_print(void *data)
{
struct pxe_label *label = data;
- const char *c = label->menu ? label->menu : label->kernel;
+ const char *c = label->menu ? label->menu : label->name;
- printf("%s:\t%s\n", label->name, c);
-
- if (label->kernel)
- printf("\t\tkernel: %s\n", label->kernel);
-
- if (label->append)
- printf("\t\tappend: %s\n", label->append);
-
- if (label->initrd)
- printf("\t\tinitrd: %s\n", label->initrd);
-
- if (label->fdt)
- printf("\tfdt: %s\n", label->fdt);
+ printf("%s:\t%s\n", label->num, c);
}
/*
@@ -638,8 +627,10 @@ static int label_boot(struct pxe_label *label)
return 1;
}
- if (label->append)
+ if (label->append) {
setenv("bootargs", label->append);
+ printf("append: %s\n", label->append);
+ }
bootm_argv[1] = getenv("kernel_addr_r");
@@ -1288,6 +1279,7 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)
struct list_head *pos;
struct menu *m;
int err;
+ int i = 1;
/*
* Create a menu and add items for all the labels.
@@ -1300,7 +1292,8 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)
list_for_each(pos, &cfg->labels) {
label = list_entry(pos, struct pxe_label, list);
- if (menu_item_add(m, label->name, label) != 1) {
+ sprintf(label->num, "%d", i++);
+ if (menu_item_add(m, label->num, label) != 1) {
menu_destroy(m);
return NULL;
}