X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fncurses%2Fps3-main.c;h=3b9fab167af22e444e4a3f67e1fc68240dbea32e;hp=d9a66fad74a94ca140d0a916452f5063c61ef0e5;hb=9939af2652ce479645eaa78e891ee06f33845a99;hpb=614da699a86959da0e1ba08533ab938cd224e7f8 diff --git a/ui/ncurses/ps3-main.c b/ui/ncurses/ps3-main.c index d9a66fa..3b9fab1 100644 --- a/ui/ncurses/ps3-main.c +++ b/ui/ncurses/ps3-main.c @@ -90,7 +90,7 @@ static int opts_parse(struct opts *opts, int argc, char *argv[]) }; static const char short_options[] = "hl:trV"; static const struct opts default_values = { - .log_file = "pb-cui.log", + .log_file = "/var/log/petitboot/petitboot-nc.log", }; *opts = default_values; @@ -267,13 +267,13 @@ static int ps3_svm_cb(struct pmenu_item *item) } /** - * ps3_kexec_cb - The kexec callback. + * ps3_boot_cb - The kexec callback. * - * Writes config data to PS3 flash then calls pb_run_kexec(). + * Writes config data to PS3 flash then calls pb_boot(). * Adds a video mode arg to the kernel command line if needed. */ -static int ps3_kexec_cb(struct cui *cui, struct cui_opt_data *cod) +static int ps3_boot_cb(struct cui *cui, struct cui_opt_data *cod) { struct ps3_cui *ps3 = ps3_from_cui(cui); int result; @@ -294,24 +294,24 @@ static int ps3_kexec_cb(struct cui *cui, struct cui_opt_data *cod) /* Add a default kernel video mode. */ - if (!cod->kd->args) { + if (!cod->bd->args) { altered_args = 1; orig_args = NULL; - cod->kd->args = talloc_asprintf(NULL, "video=ps3fb:mode:%u", + cod->bd->args = talloc_asprintf(NULL, "video=ps3fb:mode:%u", (unsigned int)ps3->values.video_mode); - } else if (!strstr(cod->kd->args, "video=")) { + } else if (!strstr(cod->bd->args, "video=")) { altered_args = 1; - orig_args = cod->kd->args; - cod->kd->args = talloc_asprintf(NULL, "%s video=ps3fb:mode:%u", + orig_args = cod->bd->args; + cod->bd->args = talloc_asprintf(NULL, "%s video=ps3fb:mode:%u", orig_args, (unsigned int)ps3->values.video_mode); } else altered_args = 0; - result = pb_run_kexec(cod->kd); + result = pb_boot(cod->bd, ps3->cui->dry_run); if (altered_args) { - talloc_free(cod->kd->args); - cod->kd->args = orig_args; + talloc_free(cod->bd->args); + cod->bd->args = orig_args; } return result; @@ -597,7 +597,6 @@ int main(int argc, char *argv[]) int result; int cui_result; unsigned int mode; - FILE *log; result = opts_parse(&opts, argc, argv); @@ -616,9 +615,13 @@ int main(int argc, char *argv[]) return EXIT_SUCCESS; } - log = fopen(opts.log_file, "a"); - assert(log); - pb_log_set_stream(log); + if (strcmp(opts.log_file, "-")) { + FILE *log = fopen(opts.log_file, "a"); + + assert(log); + pb_log_set_stream(log); + } else + pb_log_set_stream(stderr); #if defined(DEBUG) pb_log_always_flush(1); @@ -655,7 +658,7 @@ int main(int argc, char *argv[]) if (!result && (ps3.values.video_mode != (uint16_t)mode)) ps3_set_video_mode(ps3.values.video_mode); - ps3.cui = cui_init(&ps3, ps3_kexec_cb, ps3_sixaxis_map); + ps3.cui = cui_init(&ps3, ps3_boot_cb, ps3_sixaxis_map); if (!ps3.cui) return EXIT_FAILURE;