X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=discover%2Fpxe-parser.c;h=810396a6c88dc370552d8fff575234b2ac922044;hb=ec80a0397adc1fd405dedce961a17d164241851a;hp=67cb7882f46b77c85da01a8db7faa076773df7d3;hpb=0134e4d24ea0d09c4daf64ea513099d246186d32;p=petitboot 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 #include @@ -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)