diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-07-09 16:12:51 +0800 |
---|---|---|
committer | Geoff Levand <geoff@infradead.org> | 2013-07-23 09:44:45 -0700 |
commit | ec80a0397adc1fd405dedce961a17d164241851a (patch) | |
tree | 58c0ec35d364786fb0f7339a732a1da9822a4170 /discover/pxe-parser.c | |
parent | 0134e4d24ea0d09c4daf64ea513099d246186d32 (diff) | |
download | talos-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/pxe-parser.c')
-rw-r--r-- | discover/pxe-parser.c | 26 |
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) |