summaryrefslogtreecommitdiffstats
path: root/commands/boot.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-07-20 15:35:22 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-07-26 08:31:35 +0200
commitff6bc088015606f8b272c694c2a622a006d702e3 (patch)
tree0a16fefca7f2fb6a86fb3feb010e4138e3c2fe48 /commands/boot.c
parent0d054f330377d64e994b93c842f447b4a00b3169 (diff)
downloadbarebox-ff6bc088015606f8b272c694c2a622a006d702e3.tar.gz
barebox-ff6bc088015606f8b272c694c2a622a006d702e3.tar.xz
bootentries: Add title/description
We currently have to special case blspec entries vs. boot scripts in the common boot code since we want to print different informations about them. This adds a 'title' and 'description' which can be filled in with different information by bootscripts and blspec entries and so we get rid of the special handling. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/boot.c')
-rw-r--r--commands/boot.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/commands/boot.c b/commands/boot.c
index edf9eab60b..19f2fb5024 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -130,7 +130,8 @@ static int bootscript_create_entry(struct bootentries *bootentries, const char *
be = blspec_entry_alloc(bootentries);
be->entry.me.type = MENU_ENTRY_NORMAL;
be->scriptpath = xstrdup(name);
- be->entry.me.display = xstrdup(basename(be->scriptpath));
+ be->entry.title = xstrdup(basename(be->scriptpath));
+ be->entry.description = basprintf("script: %s", name);
return 0;
}
@@ -273,6 +274,8 @@ static void bootsources_menu(char *entries[], int num_entries)
return;
bootentries_for_each_entry(bootentries, entry) {
+ if (!entry->me.display)
+ entry->me.display = xstrdup(entry->title);
entry->me.action = bootsource_action;
menu_add_entry(bootentries->menu, &entry->me);
}
@@ -305,17 +308,11 @@ static void bootsources_list(char *entries[], int num_entries)
if (!bootentries)
return;
- printf(" %-20s %-20s %s\n", "device", "hwdevice", "title");
- printf(" %-20s %-20s %s\n", "------", "--------", "-----");
+ printf("%-20s\n", "title");
+ printf("%-20s\n", "------");
- bootentries_for_each_entry(bootentries, entry) {
- struct blspec_entry *ble = container_of(entry, struct blspec_entry, entry);
-
- if (ble->scriptpath)
- printf("%-40s %s\n", basename(ble->scriptpath), entry->me.display);
- else
- printf("%s\n", entry->me.display);
- }
+ bootentries_for_each_entry(bootentries, entry)
+ printf("%-20s %s\n", entry->title, entry->description);
blspec_free(bootentries);
}
@@ -349,11 +346,11 @@ static int boot(const char *name)
}
bootentries_for_each_entry(bootentries, entry) {
- printf("booting %s\n", entry->me.display);
+ printf("booting %s\n", entry->title);
ret = boot_entry(entry);
if (!ret)
break;
- printf("booting %s failed: %s\n", entry->me.display, strerror(-ret));
+ printf("booting %s failed: %s\n", entry->title, strerror(-ret));
}
return ret;