]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
device-manager: Support kernels with CONFIG_VT=n
authorn3rdopolis <bluescreen_avenger@verizon.net>
Tue, 18 Oct 2022 17:06:28 +0000 (13:06 -0400)
committerRay Strode <rstrode@redhat.com>
Sun, 27 Nov 2022 02:04:19 +0000 (21:04 -0500)
At the moment, plymouth requires VT support be enabled in the kernel
to show graphical splashes.

This is because:

1. it relies on the tty to show details
2. when VT support is disabled the kernel will use ttyS0 as the default
console which makes plymouth disable graphical splashes since it assumes
the machine is a server with a serial console.

This commit addresses the first problem by disabling the
escape-to-toggle-details feature and addresses the second problem by
introducing a new kernel parameter plymouth.graphical that is like
the "splash" option and "plymouth.ignore-serial-consoles" option
combined.

src/libply-splash-core/ply-device-manager.c
src/main.c

index 12dce53071b0dfde854b9dd26b6f4988696845c0..04a17e8e1fc79dace5b57578a87b180c4cc0ddff 100644 (file)
@@ -859,16 +859,26 @@ ply_device_manager_new (const char                *default_tty,
                         ply_device_manager_flags_t flags)
 {
         ply_device_manager_t *manager;
+        ply_terminal_t *terminal;
 
         manager = calloc (1, sizeof(ply_device_manager_t));
         manager->loop = NULL;
+
         manager->xkb_context = xkb_context_new (XKB_CONTEXT_NO_FLAGS);
+
         parse_vconsole_conf (manager);
 
+        terminal = ply_terminal_new (default_tty, manager->keymap);
+
+        if (!ply_terminal_is_vt (terminal)) {
+                ply_terminal_free (terminal);
+                terminal = NULL;
+        }
+
         manager->terminals = ply_hashtable_new (ply_hashtable_string_hash, ply_hashtable_string_compare);
         manager->renderers = ply_hashtable_new (ply_hashtable_string_hash, ply_hashtable_string_compare);
-        manager->local_console_terminal = ply_terminal_new (default_tty, manager->keymap);
         manager->input_devices = ply_hashtable_new (ply_hashtable_string_hash, ply_hashtable_string_compare);
+        manager->local_console_terminal = terminal;
         manager->keyboards = ply_list_new ();
         manager->text_displays = ply_list_new ();
         manager->pixel_displays = ply_list_new ();
index 2ec15de862f1685d5728c8c0c8cb7c3c10f4ec94..ced0f74339d3cd4204fa79d603eb9631d00938c3 100644 (file)
@@ -108,6 +108,7 @@ typedef struct
         uint32_t                is_inactive : 1;
         uint32_t                is_shown : 1;
         uint32_t                should_force_details : 1;
+        uint32_t                should_force_default_splash : 1;
         uint32_t                splash_is_becoming_idle : 1;
 
         char                   *override_splash_path;
@@ -907,6 +908,11 @@ plymouth_should_show_default_splash (state_t *state)
                 return true;
         }
 
+        if (state->should_force_default_splash) {
+                ply_trace ("using default splash because kernel command line has option \"plymouth.graphical\"");
+                return true;
+        }
+
         ply_trace ("no default splash because kernel command line lacks \"splash\" or \"rhgb\"");
         return false;
 }
@@ -1558,6 +1564,14 @@ static void
 on_escape_pressed (state_t *state)
 {
         ply_trace ("escape key pressed");
+
+        if (state->local_console_terminal != NULL) {
+                if (!ply_terminal_is_vt (state->local_console_terminal))
+                        return;
+        } else {
+                return;
+        }
+
         if (validate_input (state, "", "\e"))
                 toggle_between_splash_and_details (state);
 }
@@ -2039,8 +2053,10 @@ initialize_environment (state_t *state)
 
                 ply_trace ("checking if '%s' exists", state->default_tty);
                 if (!ply_character_device_exists (state->default_tty)) {
-                        ply_trace ("nope, forcing details mode");
-                        state->should_force_details = true;
+                        if (!state->should_force_default_splash) {
+                                ply_trace ("nope, forcing details mode");
+                                state->should_force_details = true;
+                        }
 
                         state->default_tty = find_fallback_tty (state);
                         ply_trace ("going to go with '%s'", state->default_tty);
@@ -2198,6 +2214,7 @@ main (int    argc,
         bool no_daemon = false;
         bool debug = false;
         bool ignore_serial_consoles = false;
+        bool graphical_boot = false;
         bool attach_to_session;
         ply_daemon_handle_t *daemon_handle = NULL;
         char *mode_string = NULL;
@@ -2226,6 +2243,7 @@ main (int    argc,
                                         "tty", "TTY to use instead of default", PLY_COMMAND_OPTION_TYPE_STRING,
                                         "no-boot-log", "Do not write boot log file", PLY_COMMAND_OPTION_TYPE_FLAG,
                                         "ignore-serial-consoles", "Ignore serial consoles", PLY_COMMAND_OPTION_TYPE_FLAG,
+                                        "graphical-boot", "Use graphical splashes even if the kernel console is not a VT", PLY_COMMAND_OPTION_TYPE_FLAG,
                                         NULL);
 
         if (!ply_command_parser_parse_arguments (state.command_parser, state.loop, argv, argc)) {
@@ -2247,6 +2265,7 @@ main (int    argc,
                                         "no-daemon", &no_daemon,
                                         "debug", &debug,
                                         "ignore-serial-consoles", &ignore_serial_consoles,
+                                        "graphical-boot", &graphical_boot,
                                         "debug-file", &debug_buffer_path,
                                         "pid-file", &pid_file,
                                         "tty", &tty,
@@ -2318,6 +2337,11 @@ main (int    argc,
         signal (SIGABRT, on_crash);
         signal (SIGSEGV, on_crash);
 
+        if (graphical_boot || ply_kernel_command_line_has_argument ("plymouth.graphical")) {
+                state.should_force_default_splash = true;
+                ignore_serial_consoles = true;
+        }
+
         /* before do anything we need to make sure we have a working
          * environment.
          */