diff --git a/0001-Add-label-ft-plugin.patch b/0001-Add-label-ft-plugin.patch index 303bfab..d7d475c 100644 --- a/0001-Add-label-ft-plugin.patch +++ b/0001-Add-label-ft-plugin.patch @@ -1,3 +1,25 @@ +From 04fd53750abc1f792ab6d5bdf7416bd7c42451b2 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Mon, 25 Jan 2016 08:58:03 +0100 +Subject: [PATCH 1/2] Add label-ft plugin + +This adds a FreeType-based label plugin with minimal dependencies. +Is is a replacement for the label plugin, except that it lacks support for +Unicode and different fonts families. +It's purpose is to be included in the initrd, which isn't easily possible +with the label plugin due to it's massive dependency list. + +Signed-off-by: Fabian Vogt +--- + configure.ac | 10 + + src/libply-splash-graphics/ply-label.c | 5 + + src/plugins/controls/Makefile.am | 6 +- + src/plugins/controls/label-ft/Makefile.am | 22 ++ + src/plugins/controls/label-ft/plugin.c | 501 ++++++++++++++++++++++++++++++ + 5 files changed, 543 insertions(+), 1 deletion(-) + create mode 100644 src/plugins/controls/label-ft/Makefile.am + create mode 100644 src/plugins/controls/label-ft/plugin.c + diff -Nura plymouth-0.9.5+git20200921+20778f2/configure.ac plymouth-0.9.5+git20200921+20778f2_new/configure.ac --- plymouth-0.9.5+git20200921+20778f2/configure.ac 2020-10-05 21:49:25.578220035 +0800 +++ plymouth-0.9.5+git20200921+20778f2_new/configure.ac 2020-10-05 22:07:57.754186183 +0800 diff --git a/0002-Install-label-ft-plugin-into-initrd-if-available.patch b/0002-Install-label-ft-plugin-into-initrd-if-available.patch index 3dac383..91e7292 100644 --- a/0002-Install-label-ft-plugin-into-initrd-if-available.patch +++ b/0002-Install-label-ft-plugin-into-initrd-if-available.patch @@ -1,3 +1,15 @@ +From 2c4145e4b7e146541ba8e33aee5e0125423d97bc Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 20 Jan 2016 14:03:18 +0100 +Subject: [PATCH 2/2] Install label-ft plugin into initrd, if available + +It is small and useful enough to include it by default. + +Signed-off-by: Fabian Vogt +--- + scripts/plymouth-populate-initrd.in | 9 +++++++++ + 1 file changed, 9 insertions(+) + diff -Nura plymouth-0.9.5+git20200921+20778f2/scripts/plymouth-populate-initrd.in plymouth-0.9.5+git20200921+20778f2_new/scripts/plymouth-populate-initrd.in --- plymouth-0.9.5+git20200921+20778f2/scripts/plymouth-populate-initrd.in 2020-10-05 23:05:13.055563514 +0800 +++ plymouth-0.9.5+git20200921+20778f2_new/scripts/plymouth-populate-initrd.in 2020-10-05 23:08:35.098420945 +0800 diff --git a/0003-fix_null_deref.patch b/0003-fix_null_deref.patch index 7ebb0dc..376c8d8 100644 --- a/0003-fix_null_deref.patch +++ b/0003-fix_null_deref.patch @@ -1,3 +1,20 @@ +From 99ee02fe20ae53323fe5756416e6a7d96a3baf8a Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Thu, 21 Jan 2016 10:39:21 +0100 +Subject: [PATCH 1/3] ply-label: Don't crash if label plugin fails + +The label plugin's create_control function can return NULL if allocation +failed, for example, but ply-label.c ignores that and uses the NULL control, +causing various SEGVs. + +Signed-off-by: Fabian Vogt +--- + src/libply-splash-graphics/ply-label.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +Index: plymouth-0.9.2/src/libply-splash-graphics/ply-label.c +=================================================================== + diff -Nura plymouth-0.9.5+git20200921+20778f2/src/libply-splash-graphics/ply-label.c plymouth-0.9.5+git20200921+20778f2_new/src/libply-splash-graphics/ply-label.c --- plymouth-0.9.5+git20200921+20778f2/src/libply-splash-graphics/ply-label.c 2020-10-05 23:11:23.011964608 +0800 +++ plymouth-0.9.5+git20200921+20778f2_new/src/libply-splash-graphics/ply-label.c 2020-10-05 23:17:39.139340680 +0800 diff --git a/plymouth-log-on-default.patch b/plymouth-log-on-default.patch new file mode 100644 index 0000000..d1aa8a0 --- /dev/null +++ b/plymouth-log-on-default.patch @@ -0,0 +1,224 @@ +diff -Nura plymouth-0.9.5~git20220412.e960111/src/libply/ply-buffer.c plymouth-0.9.5~git20220412.e960111_new/src/libply/ply-buffer.c +--- plymouth-0.9.5~git20220412.e960111/src/libply/ply-buffer.c 2022-04-15 16:39:24.000000000 +0800 ++++ plymouth-0.9.5~git20220412.e960111_new/src/libply/ply-buffer.c 2022-05-07 12:10:27.891589631 +0800 +@@ -46,6 +46,10 @@ + #define PLY_BUFFER_MAX_BUFFER_CAPACITY (255 * 4096) + #endif + ++#ifndef PLY_BUFFER_MAX_LOG_BUFFER_CAPACITY ++#define PLY_BUFFER_MAX_LOG_BUFFER_CAPACITY (1024 * 4096) ++#endif ++ + struct _ply_buffer + { + char *data; +@@ -67,6 +71,20 @@ + return true; + } + ++static bool ++ply_buffer_increase_log_capacity (ply_buffer_t *buffer) ++{ ++ assert (buffer != NULL); ++ ++ if ((buffer->capacity * 2) > PLY_BUFFER_MAX_LOG_BUFFER_CAPACITY) ++ return false; ++ ++ buffer->capacity *= 2; ++ ++ buffer->data = realloc (buffer->data, buffer->capacity); ++ return true; ++} ++ + void + ply_buffer_remove_bytes (ply_buffer_t *buffer, + size_t bytes_to_remove) +@@ -195,6 +213,36 @@ + ply_buffer_remove_bytes (buffer, length); + } + ++ assert (buffer->size + length < buffer->capacity); ++ ++ memcpy (buffer->data + buffer->size, ++ bytes, length); ++ ++ buffer->size += length; ++ buffer->data[buffer->size] = '\0'; ++} ++ ++void ++ply_buffer_append_log_bytes (ply_buffer_t *buffer, ++ const void *bytes_in, ++ size_t length) ++{ ++ assert (buffer != NULL); ++ assert (bytes_in != NULL); ++ assert (length != 0); ++ ++ const uint8_t *bytes = bytes_in; ++ ++ if (length > PLY_BUFFER_MAX_BUFFER_CAPACITY) { ++ bytes += length - (PLY_BUFFER_MAX_BUFFER_CAPACITY - 1); ++ length = (PLY_BUFFER_MAX_BUFFER_CAPACITY - 1); ++ } ++ ++ while ((buffer->size + length) >= buffer->capacity) { ++ if (!ply_buffer_increase_log_capacity (buffer)) ++ ply_buffer_remove_bytes (buffer, length); ++ } ++ + assert (buffer->size + length < buffer->capacity); + + memcpy (buffer->data + buffer->size, +diff -Nura plymouth-0.9.5~git20220412.e960111/src/libply/ply-buffer.h plymouth-0.9.5~git20220412.e960111_new/src/libply/ply-buffer.h +--- plymouth-0.9.5~git20220412.e960111/src/libply/ply-buffer.h 2022-04-15 16:39:24.000000000 +0800 ++++ plymouth-0.9.5~git20220412.e960111_new/src/libply/ply-buffer.h 2022-05-07 12:10:27.892589638 +0800 +@@ -34,7 +34,10 @@ + void ply_buffer_append_bytes (ply_buffer_t *buffer, + const void *bytes, + size_t number_of_bytes); +- ++void ply_buffer_append_log_bytes (ply_buffer_t *buffer, ++ const void *bytes, ++ size_t length); ++ + void ply_buffer_append_from_fd (ply_buffer_t *buffer, + int fd); + #define ply_buffer_append(buffer, format, args ...) \ +diff -Nura plymouth-0.9.5~git20220412.e960111/src/main.c plymouth-0.9.5~git20220412.e960111_new/src/main.c +--- plymouth-0.9.5~git20220412.e960111/src/main.c 2022-04-15 16:39:24.000000000 +0800 ++++ plymouth-0.9.5~git20220412.e960111_new/src/main.c 2022-05-07 12:10:27.892589638 +0800 +@@ -1225,8 +1225,7 @@ + } + + /* do not let any tty opened where we could write after deactivate */ +- if (ply_kernel_command_line_has_argument ("plymouth.debug")) +- ply_logger_close_file (ply_logger_get_error_default ()); ++ ply_logger_close_file (ply_logger_get_error_default ()); + + } + +@@ -1854,71 +1853,39 @@ + } + + static void +-check_verbosity (state_t *state) ++initialize_debug (state_t *state) + { +- char *stream; + +- ply_trace ("checking if tracing should be enabled"); ++ if (!ply_is_tracing ()) ++ ply_toggle_tracing (); + +- if (!debug_buffer_path) +- debug_buffer_path = ply_kernel_command_line_get_key_value ("plymouth.debug=file:"); +- +- stream = ply_kernel_command_line_get_key_value ("plymouth.debug=stream:"); +- if (stream != NULL || debug_buffer_path != NULL || +- ply_kernel_command_line_has_argument ("plymouth.debug")) { +- int fd; +- +- ply_trace ("tracing should be enabled!"); +- if (!ply_is_tracing ()) +- ply_toggle_tracing (); +- +- if (debug_buffer == NULL) +- debug_buffer = ply_buffer_new (); +- +- if (stream != NULL) { +- ply_trace ("streaming debug output to %s instead of screen", stream); +- fd = open (stream, O_RDWR | O_NOCTTY | O_CREAT, 0600); +- +- if (fd < 0) +- ply_trace ("could not stream output to %s: %m", stream); +- else +- ply_logger_set_output_fd (ply_logger_get_error_default (), fd); +- free (stream); +- } else { +- const char *device; +- char *file; +- +- device = state->default_tty; ++ if (debug_buffer == NULL) ++ debug_buffer = ply_buffer_new (); + +- ply_trace ("redirecting debug output to %s", device); +- +- if (strncmp (device, "/dev/", strlen ("/dev/")) == 0) +- file = strdup (device); +- else +- asprintf (&file, "/dev/%s", device); +- +- fd = open (file, O_RDWR | O_APPEND); ++ char *stream = ply_kernel_command_line_get_key_value ("plymouth.debug=stream:"); ++ if (stream != NULL) ++ { ++ int fd = open (stream, O_RDWR | O_NOCTTY | O_CREAT, 0600); ++ if (fd < 0) ++ ply_trace ("could not stream output to %s: %m", stream); ++ else ++ ply_logger_set_output_fd (ply_logger_get_error_default (), fd); ++ free (stream); ++ } + +- if (fd < 0) +- ply_trace ("could not redirected debug output to %s: %m", device); +- else +- ply_logger_set_output_fd (ply_logger_get_error_default (), fd); ++ if (!debug_buffer_path) ++ debug_buffer_path = ply_kernel_command_line_get_key_value ("plymouth.debug=file:"); + +- free (file); +- } +- } else { +- ply_trace ("tracing shouldn't be enabled!"); ++ if (debug_buffer_path == NULL) ++ { ++ if (state->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN || state->mode == PLY_BOOT_SPLASH_MODE_REBOOT) ++ debug_buffer_path = strdup (PLYMOUTH_LOG_DIRECTORY "/plymouth-shutdown-debug.log"); ++ else ++ debug_buffer_path = strdup (PLYMOUTH_LOG_DIRECTORY "/plymouth-debug.log"); + } + +- if (debug_buffer != NULL) { +- if (debug_buffer_path == NULL) { +- if (state->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN || +- state->mode == PLY_BOOT_SPLASH_MODE_REBOOT) +- debug_buffer_path = strdup (PLYMOUTH_LOG_DIRECTORY "/plymouth-shutdown-debug.log"); +- else +- debug_buffer_path = strdup (PLYMOUTH_LOG_DIRECTORY "/plymouth-debug.log"); +- } +- ++ if (debug_buffer != NULL) ++ { + ply_logger_add_filter (ply_logger_get_error_default (), + (ply_logger_filter_handler_t) + on_error_message, +@@ -2007,7 +1974,7 @@ + } + } + +- check_verbosity (state); ++ initialize_debug (state); + check_logging (state); + + ply_trace ("source built on %s", __DATE__); +@@ -2033,7 +2000,7 @@ + const void *bytes, + size_t number_of_bytes) + { +- ply_buffer_append_bytes (debug_buffer, bytes, number_of_bytes); ++ ply_buffer_append_log_bytes (debug_buffer, bytes, number_of_bytes); + } + + static void +@@ -2156,7 +2123,7 @@ + bool should_help = false; + bool no_boot_log = false; + bool no_daemon = false; +- bool debug = false; ++ bool debug = true; + bool ignore_serial_consoles = false; + bool attach_to_session; + ply_daemon_handle_t *daemon_handle = NULL; diff --git a/plymouth.changes b/plymouth.changes index d67e708..d56dd4d 100644 --- a/plymouth.changes +++ b/plymouth.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sat Apr 30 05:36:09 UTC 2022 - Cliff Zhao + +- Add plymouth-log-on-default.patch: Enable plymouth log by default, + help to resolve random appear problems (bsc#1193736). +- Pick back patch information for label-ft. + ------------------------------------------------------------------- Tue Apr 05 01:26:27 UTC 2022 - Cliff Zhao diff --git a/plymouth.spec b/plymouth.spec index c1644dd..62b3921 100644 --- a/plymouth.spec +++ b/plymouth.spec @@ -48,6 +48,8 @@ Patch6: plymouth-install-label-library-and-font-file-to-initrd.patch Patch7: plymouth-quiet-dracut-build-info.patch # PATCH-FIX-OPENSUSE plymouth-watermark-config.patch bsc#1189613 qzhao@suse.com -- Add two-step water mark config support. Patch9: plymouth-watermark-config.patch +# PATCH-FIX-OPENSUSE plymouth-log-on-default.patch bsc#1193736 qzhao@suse.com -- Enable plymouth log by default, help to resolve random appear problems. +Patch10: plymouth-log-on-default.patch # PATCH-FIX-UPSTREAM 0001-Add-label-ft-plugin.patch boo#959986 fvogt@suse.com -- add ability to output text in initrd needed for encryption. Patch1000: 0001-Add-label-ft-plugin.patch # PATCH-FIX-UPSTREAM 0002-Install-label-ft-plugin-into-initrd-if-available.patch boo#959986 fvogt@suse.com -- add ability to output text in initrd needed for encryption.