]> git.ozlabs.org Git - petitboot/blobdiff - discover/boot.c
Consolidate petitboot,tty and petitboot,console
[petitboot] / discover / boot.c
index c25627d0a9bd83ec4162a788e53a44f811a49f72..dc6da7d5254d9a3b420cd01ed698f2a0af1053ee 100644 (file)
@@ -220,7 +220,7 @@ static void boot_hook_setenv(struct boot_task *task)
        unsetenv("boot_initrd");
        unsetenv("boot_dtb");
        unsetenv("boot_args");
-       unsetenv("boot_tty");
+       unsetenv("boot_console");
 
        setenv("boot_image", task->local_image, 1);
        if (task->local_initrd)
@@ -229,8 +229,8 @@ static void boot_hook_setenv(struct boot_task *task)
                setenv("boot_dtb", task->local_dtb, 1);
        if (task->args)
                setenv("boot_args", task->args, 1);
-       if (task->boot_tty)
-               setenv("boot_tty", task->boot_tty, 1);
+       if (task->boot_console)
+               setenv("boot_console", task->boot_console, 1);
 }
 
 static int hook_filter(const struct dirent *dirent)
@@ -517,7 +517,7 @@ struct boot_task *boot(void *ctx, struct discover_boot_option *opt,
        struct pb_url *image = NULL, *initrd = NULL, *dtb = NULL;
        struct pb_url *image_sig = NULL, *initrd_sig = NULL, *dtb_sig = NULL,
                *cmdline_sig = NULL;
-       const struct config *config;
+       const struct config *config = config_get();
        struct boot_task *boot_task;
        const char *boot_desc;
        int rc;
@@ -574,12 +574,10 @@ struct boot_task *boot(void *ctx, struct discover_boot_option *opt,
                boot_task->args = NULL;
        }
 
-       if (cmd && cmd->tty)
-               boot_task->boot_tty = talloc_strdup(boot_task, cmd->tty);
-       else {
-               config = config_get();
-               boot_task->boot_tty = config ? config->boot_tty : NULL;
-       }
+       if (cmd && cmd->console && !config->manual_console)
+               boot_task->boot_console = talloc_strdup(boot_task, cmd->console);
+       else
+               boot_task->boot_console = config ? config->boot_console : NULL;
 
        if (boot_task->verify_signature || boot_task->decrypt_files) {
                if (cmd && cmd->args_sig_file) {