|
|
a85e8e |
From 535107794dc13438bd2cd0c298667a0eb430c839 Mon Sep 17 00:00:00 2001
|
|
|
a85e8e |
From: Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a85e8e |
Date: Fri, 24 Jan 2014 18:09:25 +0100
|
|
|
a85e8e |
Subject: [PATCH 042/260] * util/grub-install.c: List available targets.
|
|
|
a85e8e |
|
|
|
a85e8e |
---
|
|
|
a85e8e |
ChangeLog | 4 ++++
|
|
|
a85e8e |
include/grub/util/install.h | 2 ++
|
|
|
a85e8e |
util/grub-install-common.c | 30 ++++++++++++++++++++++++++++++
|
|
|
a85e8e |
util/grub-install.c | 10 ++++++++--
|
|
|
a85e8e |
4 files changed, 44 insertions(+), 2 deletions(-)
|
|
|
a85e8e |
|
|
|
a85e8e |
diff --git a/ChangeLog b/ChangeLog
|
|
|
a85e8e |
index eee8e78a7..20e8baaa2 100644
|
|
|
a85e8e |
--- a/ChangeLog
|
|
|
a85e8e |
+++ b/ChangeLog
|
|
|
a85e8e |
@@ -1,3 +1,7 @@
|
|
|
a85e8e |
+2014-01-24 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ * util/grub-install.c: List available targets.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
2014-01-23 Colin Watson <cjwatson@ubuntu.com>
|
|
|
a85e8e |
|
|
|
a85e8e |
* util/grub-install.c (write_to_disk): Add an info message.
|
|
|
a85e8e |
diff --git a/include/grub/util/install.h b/include/grub/util/install.h
|
|
|
a85e8e |
index bc987aadc..aedcd29f9 100644
|
|
|
a85e8e |
--- a/include/grub/util/install.h
|
|
|
a85e8e |
+++ b/include/grub/util/install.h
|
|
|
a85e8e |
@@ -138,6 +138,8 @@ grub_install_get_platform_cpu (enum grub_install_plat platid);
|
|
|
a85e8e |
const char *
|
|
|
a85e8e |
grub_install_get_platform_platform (enum grub_install_plat platid);
|
|
|
a85e8e |
|
|
|
a85e8e |
+char *
|
|
|
a85e8e |
+grub_install_get_platforms_string (void);
|
|
|
a85e8e |
|
|
|
a85e8e |
typedef enum {
|
|
|
a85e8e |
GRUB_COMPRESSION_AUTO,
|
|
|
a85e8e |
diff --git a/util/grub-install-common.c b/util/grub-install-common.c
|
|
|
a85e8e |
index 6ea0a8e17..c8bedcb2e 100644
|
|
|
a85e8e |
--- a/util/grub-install-common.c
|
|
|
a85e8e |
+++ b/util/grub-install-common.c
|
|
|
a85e8e |
@@ -668,6 +668,36 @@ static struct
|
|
|
a85e8e |
};
|
|
|
a85e8e |
|
|
|
a85e8e |
char *
|
|
|
a85e8e |
+grub_install_get_platforms_string (void)
|
|
|
a85e8e |
+{
|
|
|
a85e8e |
+ char **arr = xmalloc (sizeof (char *) * ARRAY_SIZE (platforms));
|
|
|
a85e8e |
+ int platform_strins_len = 0;
|
|
|
a85e8e |
+ char *platforms_string;
|
|
|
a85e8e |
+ char *ptr;
|
|
|
a85e8e |
+ unsigned i;
|
|
|
a85e8e |
+ for (i = 0; i < ARRAY_SIZE (platforms); i++)
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ arr[i] = xasprintf ("%s-%s", platforms[i].cpu,
|
|
|
a85e8e |
+ platforms[i].platform);
|
|
|
a85e8e |
+ platform_strins_len += strlen (arr[i]) + 2;
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+ ptr = platforms_string = xmalloc (platform_strins_len);
|
|
|
a85e8e |
+ qsort (arr, ARRAY_SIZE (platforms), sizeof (char *), grub_qsort_strcmp);
|
|
|
a85e8e |
+ for (i = 0; i < ARRAY_SIZE (platforms); i++)
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ strcpy (ptr, arr[i]);
|
|
|
a85e8e |
+ ptr += strlen (arr[i]);
|
|
|
a85e8e |
+ *ptr++ = ',';
|
|
|
a85e8e |
+ *ptr++ = ' ';
|
|
|
a85e8e |
+ free (arr[i]);
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+ ptr[-2] = 0;
|
|
|
a85e8e |
+ free (arr);
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ return platforms_string;
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+char *
|
|
|
a85e8e |
grub_install_get_platform_name (enum grub_install_plat platid)
|
|
|
a85e8e |
{
|
|
|
a85e8e |
return xasprintf ("%s-%s", platforms[platid].cpu,
|
|
|
a85e8e |
diff --git a/util/grub-install.c b/util/grub-install.c
|
|
|
a85e8e |
index 787dc90fc..2e6226a37 100644
|
|
|
a85e8e |
--- a/util/grub-install.c
|
|
|
a85e8e |
+++ b/util/grub-install.c
|
|
|
a85e8e |
@@ -256,7 +256,7 @@ static struct argp_option options[] = {
|
|
|
a85e8e |
OPTION_HIDDEN, 0, 2},
|
|
|
a85e8e |
{"target", OPTION_TARGET, N_("TARGET"),
|
|
|
a85e8e |
/* TRANSLATORS: "TARGET" as in "target platform". */
|
|
|
a85e8e |
- 0, N_("install GRUB for TARGET platform [default=%s]"), 2},
|
|
|
a85e8e |
+ 0, N_("install GRUB for TARGET platform [default=%s]; available targets: %s"), 2},
|
|
|
a85e8e |
{"grub-setup", OPTION_SETUP, "FILE", OPTION_HIDDEN, 0, 2},
|
|
|
a85e8e |
{"grub-mkrelpath", OPTION_MKRELPATH, "FILE", OPTION_HIDDEN, 0, 2},
|
|
|
a85e8e |
{"grub-mkdevicemap", OPTION_MKDEVICEMAP, "FILE", OPTION_HIDDEN, 0, 2},
|
|
|
a85e8e |
@@ -340,7 +340,13 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
|
|
|
a85e8e |
case OPTION_BOOT_DIRECTORY:
|
|
|
a85e8e |
return xasprintf (text, GRUB_DIR_NAME, GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME);
|
|
|
a85e8e |
case OPTION_TARGET:
|
|
|
a85e8e |
- return xasprintf (text, get_default_platform ());
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ char *plats = grub_install_get_platforms_string ();
|
|
|
a85e8e |
+ char *ret;
|
|
|
a85e8e |
+ ret = xasprintf (text, get_default_platform (), plats);
|
|
|
a85e8e |
+ free (plats);
|
|
|
a85e8e |
+ return ret;
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
case ARGP_KEY_HELP_POST_DOC:
|
|
|
a85e8e |
return xasprintf (text, program_name, GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME);
|
|
|
a85e8e |
default:
|
|
|
a85e8e |
--
|
|
|
a85e8e |
2.13.0
|
|
|
a85e8e |
|