+void pboot_exec_option(void *data)
+{
+ struct boot_option *opt = data;
+ char *kexec_opts[10];
+ int nr_opts = 2;
+
+ kexec_opts[0] = "/sbin/kexec";
+ kexec_opts[1] = "-f";
+ if (opt->initrd_file) {
+ kexec_opts[nr_opts] = malloc(10 + strlen(opt->initrd_file));
+ sprintf(kexec_opts[nr_opts], "--initrd=%s", opt->initrd_file);
+ nr_opts++;
+ }
+ if (opt->boot_args) {
+ kexec_opts[nr_opts] = malloc(10 + strlen(opt->boot_args));
+ sprintf(kexec_opts[nr_opts], "--command-line=%s",
+ opt->boot_args);
+ nr_opts++;
+ }
+
+ kexec_opts[nr_opts++] = opt->boot_image_file;
+ kexec_opts[nr_opts] = NULL;
+ execv(kexec_opts[0], kexec_opts);
+}