X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=devices%2Fkboot-parser.c;h=448575929abc1fa9e7e3cefbe13ab4a64dbc9f59;hp=27f302565d885e94373a825acd47c4c27e59e895;hb=fd3ec2d5f95590cf5fbfe065a8334b90e5fbde75;hpb=0ad5daa6572ad340244998f8f2243905d8f3974f;ds=sidebyside diff --git a/devices/kboot-parser.c b/devices/kboot-parser.c index 27f3025..4485759 100644 --- a/devices/kboot-parser.c +++ b/devices/kboot-parser.c @@ -10,7 +10,7 @@ #include #include -#include "udev-helper.h" +#include "parser.h" #include "params.h" #define buf_size 1024 @@ -106,6 +106,7 @@ static int parse_option(struct boot_option *opt, char *config) opt->boot_image_file = join_paths(mountpoint, config); cmdline = malloc(buf_size); + *cmdline = 0; for (pos++; pos;) { pos = get_param_pair(pos, &name, &value, ' '); @@ -121,6 +122,7 @@ static int parse_option(struct boot_option *opt, char *config) root = value; } else { + strcat(cmdline, " "); *(value - 1) = '='; strcat(cmdline, name); } @@ -146,10 +148,10 @@ static int parse_option(struct boot_option *opt, char *config) cmdline = tmp; } - printf("kboot cmdline: %s", cmdline); + pb_log("kboot cmdline: %s", cmdline); opt->boot_args = cmdline; - asprintf(&opt->description, "%s %s", opt->boot_image_file, cmdline); + asprintf(&opt->description, "%s %s", config, cmdline); return 1; } @@ -164,11 +166,14 @@ static void parse_buf(struct device *dev, char *buf) pos = get_param_pair(pos, &name, &value, '\n'); - printf("kboot param: '%s' = '%s'\n", name, value); + pb_log("kboot param: '%s' = '%s'\n", name, value); if (name == NULL || param_is_ignored(name)) continue; + if (*name == '#') + continue; + memset(&opt, 0, sizeof(opt)); opt.name = strdup(name);