summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-01-21 15:30:20 +1100
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-05-05 15:03:27 +1000
commit633b04ede5aad3933c6d90895e806638cc4d004c (patch)
treef1a51fe12371c05dedfaa2299705d06763a7e9c5 /discover
parent366ff957d2900eae6d26ad2f002b735302e7eb41 (diff)
downloadpetitboot-633b04ede5aad3933c6d90895e806638cc4d004c.zip
petitboot-633b04ede5aad3933c6d90895e806638cc4d004c.tar.gz
discover: Add support for multiple bootdev arguments
To support multiple autoboot options while retaining backwards compatability, interpret the petitboot,bootdev parameter as optionally having several space-separated values. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Diffstat (limited to 'discover')
-rw-r--r--discover/platform-powerpc.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index bda9368..895f0ec 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -388,6 +388,47 @@ static void populate_network_config(struct platform_powerpc *platform,
talloc_free(val);
}
+static int read_bootdev(void *ctx, char **pos, struct autoboot_option *opt)
+{
+ char *delim = strchr(*pos, ' ');
+ int len, prefix = 0, rc = -1;
+ enum device_type type;
+
+ if (!strncmp(*pos, "uuid:", strlen("uuid:"))) {
+ prefix = strlen("uuid:");
+ opt->boot_type = BOOT_DEVICE_UUID;
+ rc = 0;
+ } else if (!strncmp(*pos, "mac:", strlen("mac:"))) {
+ prefix = strlen("mac:");
+ opt->boot_type = BOOT_DEVICE_UUID;
+ rc = 0;
+ } else {
+ type = find_device_type(*pos);
+ if (type != DEVICE_TYPE_UNKNOWN) {
+ opt->type = type;
+ opt->boot_type = BOOT_DEVICE_TYPE;
+ rc = 0;
+ }
+ }
+
+ if (opt->boot_type == BOOT_DEVICE_UUID) {
+ if (delim)
+ len = (int)(delim - *pos) - prefix;
+ else
+ len = strlen(*pos);
+
+ opt->uuid = talloc_strndup(ctx, *pos + prefix, len);
+ }
+
+ /* Always advance pointer to next option or end */
+ if (delim)
+ *pos = delim + 1;
+ else
+ *pos += strlen(*pos);
+
+ return rc;
+}
+
static void populate_bootdev_config(struct platform_powerpc *platform,
struct config *config)
OpenPOWER on IntegriCloud