summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-07-09 16:12:51 +0800
committerGeoff Levand <geoff@infradead.org>2013-07-23 09:44:45 -0700
commitec80a0397adc1fd405dedce961a17d164241851a (patch)
tree58c0ec35d364786fb0f7339a732a1da9822a4170 /discover
parent0134e4d24ea0d09c4daf64ea513099d246186d32 (diff)
downloadtalos-petitboot-ec80a0397adc1fd405dedce961a17d164241851a.tar.gz
talos-petitboot-ec80a0397adc1fd405dedce961a17d164241851a.zip
discover/pxe: Handle initrds
We may see initrds specified on the kernel argument line, or as their own configuration directive. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover')
-rw-r--r--discover/pxe-parser.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/discover/pxe-parser.c b/discover/pxe-parser.c
index 67cb788..810396a 100644
--- a/discover/pxe-parser.c
+++ b/discover/pxe-parser.c
@@ -1,4 +1,5 @@
+#define _GNU_SOURCE
#include <string.h>
#include <talloc/talloc.h>
@@ -21,6 +22,13 @@ static void pxe_process_pair(struct conf_context *ctx,
struct discover_boot_option *opt = ctx->parser_info;
struct pb_url *url;
+ /* quirk in the syslinux config format: initrd can be separated
+ * by an '=' */
+ if (!name && !strncasecmp(value, "initrd=", strlen("initrd="))) {
+ name = "initrd";
+ value += strlen("initrd=");
+ }
+
if (!name)
return;
@@ -45,10 +53,26 @@ static void pxe_process_pair(struct conf_context *ctx,
url = pb_url_join(ctx->dc, ctx->dc->conf_url, value);
opt->boot_image = create_url_resource(opt, url);
+ } else if (streq(name, "INITRD")) {
+ url = pb_url_join(ctx->dc, ctx->dc->conf_url, value);
+ opt->initrd = create_url_resource(opt, url);
+
} else if (streq(name, "APPEND")) {
+ char *str, *end;
+
opt->option->boot_args = talloc_strdup(opt->option, value);
- /* todo: initrd extraction */
+
+ str = strcasestr(value, "INITRD=");
+ if (str) {
+ str += strlen("INITRD=");
+ end = strchrnul(str, ' ');
+ *end = '\0';
+
+ url = pb_url_join(ctx->dc, ctx->dc->conf_url, str);
+ opt->initrd = create_url_resource(opt, url);
+ }
}
+
}
static int pxe_parse(struct discover_context *dc, char *buf, int len)
OpenPOWER on IntegriCloud