Compare commits

...

No commits in common. "c8" and "c9" have entirely different histories.
c8 ... c9

18 changed files with 1228 additions and 3218 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/plymouth-1e36e303e08ba425fecbcff4dde22c8ee936638c.tar.bz2
SOURCES/plymouth-1ea1020.tar.gz

View File

@ -1 +1 @@
7847967f397a536ccf5fb2d43aa561ac5e5dff6c SOURCES/plymouth-1e36e303e08ba425fecbcff4dde22c8ee936638c.tar.bz2
99c241db2da7e2e2d03acacd58c79b2fa19e13e3 SOURCES/plymouth-1ea1020.tar.gz

View File

@ -0,0 +1,26 @@
From 696f93e5996634473fb554e07ba2d0775be2a814 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 1 Oct 2019 12:11:09 +0200
Subject: [PATCH] Revert "configure: bump so name"
This reverts commit be27b260042e76aba988b88a4f26983247e02bde.
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 2257374..507145e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ PKG_PROG_PKG_CONFIG
LT_INIT([dlopen disable-static pic-only])
## increment if the interface has additions, changes, removals.
-LT_CURRENT=5
+LT_CURRENT=4
## increment any time the source changes; set to
## 0 if you increment CURRENT
--
2.23.0

View File

@ -0,0 +1,158 @@
From 58161da08c108243d59d58c6c1f9d3c97bb9a3ad Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 7 Mar 2022 12:25:56 +0100
Subject: [PATCH 1/6] ply-utils: Reintroduce ply_string_has_prefix helper
ply_string_has_prefix was dropped in commit c7965ea19abf ("ply-utils:
Drop unused ply_string_has_prefix helper"). We have a need for this
helper again, so reintroduce it.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/libply/ply-utils.c | 9 +++++++++
src/libply/ply-utils.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c
index f90ac40..f457579 100644
--- a/src/libply/ply-utils.c
+++ b/src/libply/ply-utils.c
@@ -432,60 +432,69 @@ ply_copy_string_array (const char *const *array)
int i;
for (i = 0; array[i] != NULL; i++) {
}
copy = calloc (i + 1, sizeof(char *));
for (i = 0; array[i] != NULL; i++) {
copy[i] = strdup (array[i]);
}
return copy;
}
void
ply_free_string_array (char **array)
{
int i;
if (array == NULL)
return;
for (i = 0; array[i] != NULL; i++) {
free (array[i]);
array[i] = NULL;
}
free (array);
}
+bool
+ply_string_has_prefix (const char *str, const char *prefix)
+{
+ if (str == NULL || prefix == NULL)
+ return false;
+
+ return strncmp (str, prefix, strlen (prefix)) == 0;
+}
+
double
ply_get_timestamp (void)
{
const double nanoseconds_per_second = 1000000000.0;
double timestamp;
struct timespec now = { 0L, /* zero-filled */ };
clock_gettime (CLOCK_MONOTONIC, &now);
timestamp = ((nanoseconds_per_second * now.tv_sec) + now.tv_nsec) /
nanoseconds_per_second;
return timestamp;
}
void
ply_save_errno (void)
{
assert (errno_stack_position < PLY_ERRNO_STACK_SIZE);
errno_stack[errno_stack_position] = errno;
errno_stack_position++;
}
void
ply_restore_errno (void)
{
assert (errno_stack_position > 0);
errno_stack_position--;
errno = errno_stack[errno_stack_position];
}
diff --git a/src/libply/ply-utils.h b/src/libply/ply-utils.h
index d7b7622..b4565c3 100644
--- a/src/libply/ply-utils.h
+++ b/src/libply/ply-utils.h
@@ -56,60 +56,61 @@ typedef enum
#ifndef PLY_HIDE_FUNCTION_DECLARATIONS
#define ply_round_to_multiple(n, m) (((n) + (((m) - 1))) & ~((m) - 1))
bool ply_open_unidirectional_pipe (int *sender_fd,
int *receiver_fd);
int ply_connect_to_unix_socket (const char *path,
ply_unix_socket_type_t type);
int ply_listen_to_unix_socket (const char *path,
ply_unix_socket_type_t type);
bool ply_get_credentials_from_fd (int fd,
pid_t *pid,
uid_t *uid,
gid_t *gid);
bool ply_write (int fd,
const void *buffer,
size_t number_of_bytes);
bool ply_write_uint32 (int fd,
uint32_t value);
bool ply_read (int fd,
void *buffer,
size_t number_of_bytes);
bool ply_read_uint32 (int fd,
uint32_t *value);
bool ply_fd_has_data (int fd);
bool ply_set_fd_as_blocking (int fd);
char **ply_copy_string_array (const char *const *array);
void ply_free_string_array (char **array);
+bool ply_string_has_prefix (const char *str, const char *prefix);
double ply_get_timestamp (void);
void ply_save_errno (void);
void ply_restore_errno (void);
bool ply_directory_exists (const char *dir);
bool ply_file_exists (const char *file);
bool ply_character_device_exists (const char *device);
ply_module_handle_t *ply_open_module (const char *module_path);
ply_module_handle_t *ply_open_built_in_module (void);
ply_module_function_t ply_module_look_up_function (ply_module_handle_t *handle,
const char *function_name);
void ply_close_module (ply_module_handle_t *handle);
bool ply_create_directory (const char *directory);
bool ply_create_file_link (const char *source,
const char *destination);
void ply_show_new_kernel_messages (bool should_show);
ply_daemon_handle_t *ply_create_daemon (void);
bool ply_detach_daemon (ply_daemon_handle_t *handle,
int exit_code);
int ply_utf8_character_get_size (const char *string,
size_t n);
int ply_utf8_string_get_length (const char *string,
size_t n);
--
2.37.0.rc1

View File

@ -1,871 +0,0 @@
From f55051678452647e035853ee94a89cb54ea2aa4a Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 17 Jul 2020 16:06:44 -0400
Subject: [PATCH] src: die during shutdown with everything else
plymouthd currently avoids getting killed at shutdown. This causes
filesystems to fail to remount read-only in some cases.
This commit changes things up so that plymouthd dies with everyone else,
but spawns a process to hold open the drm device that can keep the splash
up until the very end.
In order to keep this process alive until the very end, it gets run
from within the initramfs (if available). This requires adding service
files to jump back into the initramfs at shutdown
---
configure.ac | 1 +
scripts/plymouth-populate-initrd.in | 2 +
src/Makefile.am | 7 +++
src/main.c | 11 +++-
src/plugins/renderers/drm/Makefile.am | 3 +-
src/plugins/renderers/drm/plugin.c | 62 +++++++++++++++++++
src/plymouthd-drm-escrow.c | 18 ++++++
systemd-units/Makefile.am | 28 ++++++---
systemd-units/plymouth-halt.service.in | 1 +
systemd-units/plymouth-poweroff.service.in | 1 +
systemd-units/plymouth-reboot.service.in | 1 +
.../plymouth-switch-root-initramfs.service.in | 12 ++++
12 files changed, 134 insertions(+), 13 deletions(-)
create mode 100644 src/plymouthd-drm-escrow.c
create mode 100644 systemd-units/plymouth-switch-root-initramfs.service.in
diff --git a/configure.ac b/configure.ac
index 970e19f..1dc8cdb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -319,36 +319,37 @@ AC_CONFIG_FILES([Makefile po/Makefile.in
src/plugins/controls/label/Makefile
src/Makefile
src/client/ply-boot-client.pc
src/client/Makefile
src/upstart-bridge/Makefile
themes/Makefile
themes/spinfinity/Makefile
themes/fade-in/Makefile
themes/tribar/Makefile
themes/text/Makefile
themes/details/Makefile
themes/solar/Makefile
themes/glow/Makefile
themes/spinner/Makefile
themes/script/Makefile
themes/bgrt/Makefile
images/Makefile
scripts/plymouth-generate-initrd
scripts/plymouth-populate-initrd
scripts/plymouth-set-default-theme
scripts/Makefile
systemd-units/plymouth-halt.service
systemd-units/plymouth-kexec.service
systemd-units/plymouth-poweroff.service
systemd-units/plymouth-quit.service
systemd-units/plymouth-quit-wait.service
systemd-units/plymouth-read-write.service
systemd-units/plymouth-reboot.service
systemd-units/plymouth-start.service
systemd-units/plymouth-switch-root.service
+ systemd-units/plymouth-switch-root-initramfs.service
systemd-units/systemd-ask-password-plymouth.path
systemd-units/systemd-ask-password-plymouth.service
systemd-units/Makefile
docs/Makefile
])
AC_OUTPUT
diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in
index 60fd063..535a896 100755
--- a/scripts/plymouth-populate-initrd.in
+++ b/scripts/plymouth-populate-initrd.in
@@ -1,54 +1,55 @@
#!/bin/bash
#
# inst bits ruthlessly and viciously stolen from dracut
[ -z "$DESTDIR" ] || exit 0
# For running on a (cross-compiled) sysroot, the following
# settings are needed:
# PLYMOUTH_SYSROOT - the sysroot directory
# PLYMOUTH_LDD - an optional ldd command that works on foreign binaries
# PLYMOUTH_LDD_PATH - optional PATH ldd is run with
[ -z "$PLYMOUTH_LDD" ] && PLYMOUTH_LDD="ldd"
[ -z "$PLYMOUTH_LDD_PATH" ] && PLYMOUTH_LDD_PATH="$PATH"
[ -z "$PLYMOUTH_LIBEXECDIR" ] && PLYMOUTH_LIBEXECDIR="@PLYMOUTH_LIBEXECDIR@"
[ -z "$PLYMOUTH_DATADIR" ] && PLYMOUTH_DATADIR="@PLYMOUTH_DATADIR@"
[ -z "$PLYMOUTH_PLUGIN_PATH" ] && PLYMOUTH_PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"
[ -z "$PLYMOUTH_LOGO_FILE" ] && PLYMOUTH_LOGO_FILE="@PLYMOUTH_LOGO_FILE@"
[ -n "$PLYMOUTH_THEME_NAME" ] && THEME_OVERRIDE=1
[ -z "$PLYMOUTH_THEME_NAME" ] && PLYMOUTH_THEME_NAME=$(plymouth-set-default-theme)
[ -z "$PLYMOUTH_CONFDIR" ] && PLYMOUTH_CONFDIR="@PLYMOUTH_CONF_DIR@"
[ -z "$PLYMOUTH_POLICYDIR" ] && PLYMOUTH_POLICYDIR="@PLYMOUTH_POLICY_DIR@"
[ -z "$PLYMOUTH_DAEMON_PATH" ] && PLYMOUTH_DAEMON_PATH="@PLYMOUTH_DAEMON_DIR@/plymouthd"
[ -z "$PLYMOUTH_CLIENT_PATH" ] && PLYMOUTH_CLIENT_PATH="@PLYMOUTH_CLIENT_DIR@/plymouth"
+[ -z "$PLYMOUTH_DRM_ESCROW_PATH" ] && PLYMOUTH_DRM_ESCROW_PATH="@PLYMOUTH_LIBEXECDIR@/plymouth/plymouth-drm-escrow"
[ -z "$SYSTEMD_UNIT_DIR" ] && SYSTEMD_UNIT_DIR="@SYSTEMD_UNIT_DIR@"
[ -z "$SUPPORTED_LANGUAGES" ] && SUPPORTED_LANGUAGES="pt fr de it ru es en zh ja ko zh as bn gu hi kn ml mr or pa ta te"
# Generic substring function. If $2 is in $1, return 0.
strstr() { [ "${1#*$2*}" != "$1" ]; }
ddebug() {
[ "$verbose" = "true" ] && echo "$@"
}
# normalize_path <path>
# Prints the normalized path, where it removes any duplicated
# and trailing slashes.
# Example:
# $ normalize_path ///test/test//
# /test/test
normalize_path() {
shopt -q -s extglob
set -- "${1//+(\/)//}"
shopt -q -u extglob
echo "${1%/}"
}
# convert_abs_rel <from> <to>
# Prints the relative path, when creating a symlink to <to> from <from>.
# Example:
# $ convert_abs_rel /usr/bin/test /bin/test-2
# ../../bin/test-2
# $ ln -s $(convert_abs_rel /usr/bin/test /bin/test-2) /usr/bin/test
convert_abs_rel() {
@@ -390,60 +391,61 @@ verbose=false
INITRDDIR=""
while [ $# -gt 0 ]; do
case $1 in
--verbose|-v)
verbose=true
;;
--targetdir|-t)
shift
INITRDDIR="$1"
;;
--help|-h)
usage normal
;;
*)
usage error
break
;;
esac
shift
done
[ -z "$INITRDDIR" ] && usage error
ddebug "Running with PLYMOUTH_SYSROOT=$PLYMOUTH_SYSROOT"
ddebug "Running with PLYMOUTH_LDD=$PLYMOUTH_LDD"
ddebug "Running with PLYMOUTH_LDD_PATH=$PLYMOUTH_LDD_PATH"
mkdir -p ${INITRDDIR}${PLYMOUTH_DATADIR}/plymouth/themes
inst ${PLYMOUTH_DAEMON_PATH} $INITRDDIR
inst ${PLYMOUTH_CLIENT_PATH} $INITRDDIR
+inst ${PLYMOUTH_DRM_ESCROW_PATH} $INITRDDIR
inst ${PLYMOUTH_DATADIR}/plymouth/themes/text/text.plymouth $INITRDDIR
inst ${PLYMOUTH_PLUGIN_PATH}/text.so $INITRDDIR
inst ${PLYMOUTH_DATADIR}/plymouth/themes/details/details.plymouth $INITRDDIR
inst ${PLYMOUTH_PLUGIN_PATH}/details.so $INITRDDIR
inst ${PLYMOUTH_LOGO_FILE} $INITRDDIR
inst @RELEASE_FILE@ $INITRDDIR
inst ${PLYMOUTH_POLICYDIR}/plymouthd.defaults $INITRDDIR
inst ${PLYMOUTH_CONFDIR}/plymouthd.conf $INITRDDIR
if [ -z "$PLYMOUTH_THEME_NAME" ]; then
echo "No default plymouth plugin is set" >&2
exit 1
fi
if [ $THEME_OVERRIDE ]; then
conf=$INITRDDIR/${PLYMOUTH_CONFDIR}/plymouthd.conf
echo "modifying plymouthd.conf: Theme=$PLYMOUTH_THEME_NAME" >&2
# make sure the section and key exist so we can modify them
grep -q "^ *\[Daemon\]" $conf || echo "[Daemon]" >> $conf
grep -q "^ *Theme *=" $conf || echo "Theme=fade-in" >> $conf
sed -i "s/^ *Theme *=.*/# theme modified by plymouth-populate-initrd\nTheme=$PLYMOUTH_THEME_NAME/" $conf
fi
PLYMOUTH_MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//')
PLYMOUTH_THEME_DIR="${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}"
PLYMOUTH_IMAGE_DIR=$(grep "ImageDir *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ImageDir *= *//')
if [ ! -f ${PLYMOUTH_SYSROOT}${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so ]; then
echo "The default plymouth plugin (${PLYMOUTH_MODULE_NAME}) doesn't exist" >&2
exit 1
diff --git a/src/Makefile.am b/src/Makefile.am
index 95ed019..78f3f78 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,52 +1,59 @@
SUBDIRS = libply libply-splash-core libply-splash-graphics . plugins client
if ENABLE_UPSTART_MONITORING
SUBDIRS += upstart-bridge
endif
AM_CPPFLAGS = -I$(top_srcdir) \
-I$(srcdir)/libply \
-I$(srcdir)/libply-splash-core \
-I$(srcdir) \
+ -DPLYMOUTH_DRM_ESCROW_DIRECTORY=\"$(libexecdir)/plymouth\" \
-DPLYMOUTH_LOG_DIRECTORY=\"$(localstatedir)/log\" \
-DPLYMOUTH_SPOOL_DIRECTORY=\"$(localstatedir)/spool/plymouth\" \
-DPLYMOUTH_TIME_DIRECTORY=\"$(localstatedir)/lib/plymouth/\" \
-DPLYMOUTH_LOGO_FILE=\"$(logofile)\"
plymouthdbindir = $(plymouthdaemondir)
plymouthdbin_PROGRAMS = plymouthd
plymouthd_CFLAGS = $(PLYMOUTH_CFLAGS) \
-rdynamic \
-DPLYMOUTH_PLUGIN_PATH=\"$(PLYMOUTH_PLUGIN_PATH)\" \
-DPLYMOUTH_THEME_PATH=\"$(PLYMOUTH_THEME_PATH)/\" \
-DPLYMOUTH_POLICY_DIR=\"$(PLYMOUTH_POLICY_DIR)/\" \
-DPLYMOUTH_RUNTIME_DIR=\"$(PLYMOUTH_RUNTIME_DIR)\" \
-DPLYMOUTH_CONF_DIR=\"$(PLYMOUTH_CONF_DIR)/\" \
-DPLYMOUTH_RUNTIME_THEME_PATH=\"$(PLYMOUTH_RUNTIME_THEME_PATH)/\"
plymouthd_LDADD = $(PLYMOUTH_LIBS) libply/libply.la libply-splash-core/libply-splash-core.la
plymouthd_SOURCES = \
ply-boot-protocol.h \
ply-boot-server.h \
ply-boot-server.c \
plugins/splash/details/plugin.c \
main.c
+escrowdir = $(libexecdir)/plymouth
+escrow_PROGRAMS = plymouthd-drm-escrow
+
+plymouthd_drm_escrow_LDFLAGS = -all-static
+plymouthd_drm_escrow_SOURCES = plymouthd-drm-escrow.c
+
plymouthdrundir = $(localstatedir)/run/plymouth
plymouthdspooldir = $(localstatedir)/spool/plymouth
plymouthdtimedir = $(localstatedir)/lib/plymouth
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = ply-splash-core.pc ply-splash-graphics.pc
plymouthd_defaultsdir = $(PLYMOUTH_POLICY_DIR)
dist_plymouthd_defaults_DATA = plymouthd.defaults
plymouthd_confdir = $(PLYMOUTH_CONF_DIR)
dist_plymouthd_conf_DATA = plymouthd.conf
install-data-hook:
-mkdir -p $(DESTDIR)$(plymouthdrundir)
-mkdir -p $(DESTDIR)$(plymouthdspooldir)
-mkdir -p $(DESTDIR)$(plymouthdtimedir)
EXTRA_DIST = ply-splash-core.pc.in ply-splash-graphics.pc.in
MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/main.c b/src/main.c
index 8848ad0..8372f2f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2181,65 +2181,70 @@ main (int argc,
if (daemon_handle == NULL) {
ply_error ("plymouthd: cannot daemonize: %m");
return EX_UNAVAILABLE;
}
}
if (debug)
debug_buffer = ply_buffer_new ();
signal (SIGABRT, on_crash);
signal (SIGSEGV, on_crash);
/* before do anything we need to make sure we have a working
* environment.
*/
if (!initialize_environment (&state)) {
if (errno == 0) {
if (daemon_handle != NULL)
ply_detach_daemon (daemon_handle, 0);
return 0;
}
ply_error ("plymouthd: could not setup basic operating environment: %m");
if (daemon_handle != NULL)
ply_detach_daemon (daemon_handle, EX_OSERR);
return EX_OSERR;
}
/* Make the first byte in argv be '@' so that we can survive systemd's killing
- * spree when going from initrd to /, and so we stay alive all the way until
- * the power is killed at shutdown.
+ * spree when going from initrd to /
* http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons
+ *
+ * If the system is shutting down, we let systemd slay us because otherwise we
+ * may prevent the root fs from getting remounted read-only.
*/
- argv[0][0] = '@';
+ if (state.mode != PLY_BOOT_SPLASH_MODE_SHUTDOWN &&
+ state.mode != PLY_BOOT_SPLASH_MODE_REBOOT) {
+ argv[0][0] = '@';
+ }
state.boot_server = start_boot_server (&state);
if (state.boot_server == NULL) {
ply_trace ("plymouthd is already running");
if (daemon_handle != NULL)
ply_detach_daemon (daemon_handle, EX_OK);
return EX_OK;
}
state.boot_buffer = ply_buffer_new ();
if (attach_to_session) {
state.should_be_attached = attach_to_session;
if (!attach_to_running_session (&state)) {
ply_trace ("could not redirect console session: %m");
if (!no_daemon)
ply_detach_daemon (daemon_handle, EX_UNAVAILABLE);
return EX_UNAVAILABLE;
}
}
state.progress = ply_progress_new ();
state.splash_delay = NAN;
state.device_timeout = NAN;
ply_progress_load_cache (state.progress,
get_cache_file_for_mode (state.mode));
diff --git a/src/plugins/renderers/drm/Makefile.am b/src/plugins/renderers/drm/Makefile.am
index 271b17f..22a819b 100644
--- a/src/plugins/renderers/drm/Makefile.am
+++ b/src/plugins/renderers/drm/Makefile.am
@@ -1,23 +1,24 @@
if ENABLE_DRM_RENDERER
AM_CPPFLAGS = -I$(top_srcdir) \
-I$(srcdir)/../../../libply \
-I$(srcdir)/../../../libply-splash-core \
-I$(srcdir)/../../.. \
-I$(srcdir)/../.. \
-I$(srcdir)/.. \
- -I$(srcdir)
+ -I$(srcdir) \
+ -DPLYMOUTH_DRM_ESCROW_DIRECTORY=\"$(libexecdir)/plymouth\"
plugindir = $(libdir)/plymouth/renderers
plugin_LTLIBRARIES = drm.la
drm_la_CFLAGS = $(PLYMOUTH_CFLAGS) $(DRM_CFLAGS)
drm_la_LDFLAGS = -module -avoid-version -export-dynamic
drm_la_LIBADD = $(PLYMOUTH_LIBS) $(DRM_LIBS) \
../../../libply/libply.la \
../../../libply-splash-core/libply-splash-core.la
drm_la_SOURCES = $(srcdir)/plugin.c
endif
MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c
index 4dbf8da..38bae36 100644
--- a/src/plugins/renderers/drm/plugin.c
+++ b/src/plugins/renderers/drm/plugin.c
@@ -131,73 +131,79 @@ typedef struct
bool connected;
bool uses_hw_rotation;
} ply_output_t;
struct _ply_renderer_backend
{
ply_event_loop_t *loop;
ply_terminal_t *terminal;
int device_fd;
char *device_name;
drmModeRes *resources;
ply_renderer_input_source_t input_source;
ply_list_t *heads;
ply_hashtable_t *heads_by_controller_id;
ply_hashtable_t *output_buffers;
ply_output_t *outputs;
int outputs_len;
int connected_count;
int32_t dither_red;
int32_t dither_green;
int32_t dither_blue;
uint32_t is_active : 1;
uint32_t requires_explicit_flushing : 1;
uint32_t use_preferred_mode : 1;
+ uint32_t watching_for_termination : 1;
int panel_width;
int panel_height;
ply_pixel_buffer_rotation_t panel_rotation;
int panel_scale;
};
ply_renderer_plugin_interface_t *ply_renderer_backend_get_interface (void);
static bool open_input_source (ply_renderer_backend_t *backend,
ply_renderer_input_source_t *input_source);
static void flush_head (ply_renderer_backend_t *backend,
ply_renderer_head_t *head);
+static void close_device (ply_renderer_backend_t *backend);
+
+static void watch_for_termination (ply_renderer_backend_t *backend);
+static void stop_watching_for_termination (ply_renderer_backend_t *backend);
+
/* A small helper to determine if we should try to keep the current mode
* or pick the best mode ourselves, we keep the current mode only if the
* user specified a specific mode using video= on the commandline.
*/
static bool
should_use_preferred_mode (void)
{
bool use_preferred_mode = true;
if (ply_kernel_command_line_get_string_after_prefix ("video="))
use_preferred_mode = false;
ply_trace ("should_use_preferred_mode: %d", use_preferred_mode);
return use_preferred_mode;
}
static bool
ply_renderer_buffer_map (ply_renderer_backend_t *backend,
ply_renderer_buffer_t *buffer)
{
struct drm_mode_map_dumb map_dumb_buffer_request;
void *map_address;
if (buffer->map_address != MAP_FAILED) {
buffer->map_count++;
return true;
}
memset (&map_dumb_buffer_request, 0, sizeof(struct drm_mode_map_dumb));
@@ -918,158 +924,214 @@ static void
destroy_backend (ply_renderer_backend_t *backend)
{
ply_trace ("destroying renderer backend for device %s", backend->device_name);
free_heads (backend);
free (backend->device_name);
ply_hashtable_free (backend->output_buffers);
ply_hashtable_free (backend->heads_by_controller_id);
free (backend->outputs);
free (backend);
}
static void
activate (ply_renderer_backend_t *backend)
{
ply_renderer_head_t *head;
ply_list_node_t *node;
ply_trace ("taking master and scanning out");
backend->is_active = true;
drmSetMaster (backend->device_fd);
node = ply_list_get_first_node (backend->heads);
while (node != NULL) {
head = (ply_renderer_head_t *) ply_list_node_get_data (node);
/* Flush out any pending drawing to the buffer */
flush_head (backend, head);
node = ply_list_get_next_node (backend->heads, node);
}
+
+ watch_for_termination (backend);
}
static void
deactivate (ply_renderer_backend_t *backend)
{
ply_trace ("dropping master");
drmDropMaster (backend->device_fd);
backend->is_active = false;
+
+ stop_watching_for_termination (backend);
}
static void
on_active_vt_changed (ply_renderer_backend_t *backend)
{
if (ply_terminal_is_active (backend->terminal)) {
ply_trace ("activating on vt change");
activate (backend);
} else {
ply_trace ("deactivating on vt change");
deactivate (backend);
}
}
static bool
load_driver (ply_renderer_backend_t *backend)
{
int device_fd;
ply_trace ("Opening '%s'", backend->device_name);
device_fd = open (backend->device_name, O_RDWR);
if (device_fd < 0) {
ply_trace ("open failed: %m");
return false;
}
backend->device_fd = device_fd;
drmDropMaster (device_fd);
return true;
}
static void
unload_backend (ply_renderer_backend_t *backend)
{
if (backend == NULL)
return;
ply_trace ("unloading backend");
if (backend->device_fd >= 0) {
drmClose (backend->device_fd);
backend->device_fd = -1;
}
destroy_backend (backend);
backend = NULL;
}
+static void
+on_term_signal (ply_renderer_backend_t *backend)
+{
+ pid_t pid;
+
+ ply_trace ("got SIGTERM, launching drm escrow to protect splash, and dying");
+
+ pid = fork();
+
+ if (pid == 0) {
+ const char *argv[] = { PLYMOUTH_DRM_ESCROW_DIRECTORY "/plymouthd-drm-escrow", NULL };
+
+ dup (backend->device_fd);
+ execve (argv[0], (char * const *) argv, NULL);
+
+ ply_trace ("could not launch drm escrow process: %m");
+
+ _exit (1);
+ }
+
+
+ close_device (backend);
+
+ exit (0);
+}
+
+static void
+watch_for_termination (ply_renderer_backend_t *backend)
+{
+ if (backend->watching_for_termination)
+ return;
+
+ ply_trace ("watching for termination signal");
+ ply_event_loop_watch_signal (backend->loop, SIGTERM, (ply_event_handler_t) on_term_signal, backend);
+ backend->watching_for_termination = true;
+}
+
+static void
+stop_watching_for_termination (ply_renderer_backend_t *backend)
+{
+ if (!backend->watching_for_termination)
+ return;
+
+ ply_trace ("stopping watching for termination signal");
+ ply_event_loop_stop_watching_signal (backend->loop, SIGTERM);
+ backend->watching_for_termination = false;
+}
+
static bool
open_device (ply_renderer_backend_t *backend)
{
assert (backend != NULL);
assert (backend->device_name != NULL);
if (!load_driver (backend))
return false;
if (backend->terminal == NULL)
return true;
if (!ply_terminal_open (backend->terminal)) {
ply_trace ("could not open terminal: %m");
return false;
}
if (!ply_terminal_is_vt (backend->terminal)) {
ply_trace ("terminal is not a VT");
ply_terminal_close (backend->terminal);
return false;
}
ply_terminal_watch_for_active_vt_change (backend->terminal,
(ply_terminal_active_vt_changed_handler_t)
on_active_vt_changed,
backend);
+ watch_for_termination (backend);
+
return true;
}
static void
close_device (ply_renderer_backend_t *backend)
{
ply_trace ("closing device");
free_heads (backend);
+ stop_watching_for_termination (backend);
+
if (backend->terminal != NULL) {
ply_terminal_stop_watching_for_active_vt_change (backend->terminal,
(ply_terminal_active_vt_changed_handler_t)
on_active_vt_changed,
backend);
}
unload_backend (backend);
}
static void
output_get_controller_info (ply_renderer_backend_t *backend,
drmModeConnector *connector,
ply_output_t *output)
{
int i;
drmModeEncoder *encoder;
assert (backend != NULL);
output->possible_controllers = 0xffffffff;
for (i = 0; i < connector->count_encoders; i++) {
encoder = drmModeGetEncoder (backend->device_fd,
connector->encoders[i]);
if (encoder == NULL)
continue;
if (encoder->encoder_id == connector->encoder_id && encoder->crtc_id) {
diff --git a/src/plymouthd-drm-escrow.c b/src/plymouthd-drm-escrow.c
new file mode 100644
index 0000000..9097db9
--- /dev/null
+++ b/src/plymouthd-drm-escrow.c
@@ -0,0 +1,18 @@
+#include <signal.h>
+#include <unistd.h>
+
+int
+main(int argc, char **argv)
+{
+ signal (SIGTERM, SIG_IGN);
+
+ /* Make the first byte in argv be '@' so that we can survive systemd's killing
+ * spree until the power is killed at shutdown.
+ * http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons
+ */
+ argv[0][0] = '@';
+
+ while (pause());
+
+ return 0;
+}
diff --git a/systemd-units/Makefile.am b/systemd-units/Makefile.am
index b1d843b..bfede17 100644
--- a/systemd-units/Makefile.am
+++ b/systemd-units/Makefile.am
@@ -1,78 +1,88 @@
systemd_unit_templates = \
plymouth-switch-root.service.in \
+ plymouth-switch-root-initramfs.service.in \
plymouth-start.service.in \
plymouth-read-write.service.in \
plymouth-quit.service.in \
plymouth-quit-wait.service.in \
plymouth-reboot.service.in \
plymouth-kexec.service.in \
plymouth-poweroff.service.in \
plymouth-halt.service.in \
systemd-ask-password-plymouth.path.in \
systemd-ask-password-plymouth.service.in
if ENABLE_SYSTEMD_INTEGRATION
systemdunitdir=$(SYSTEMD_UNIT_DIR)
systemdunit_DATA = $(systemd_unit_templates:.in=)
install-data-hook:
$(MKDIR_P) -m 0755 \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/initrd-switch-root.target.wants\
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysinit.target.wants \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/multi-user.target.wants \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/reboot.target.wants \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/kexec.target.wants \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/poweroff.target.wants \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/halt.target.wants
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/initrd-switch-root.target.wants && \
rm -f plymouth-start.service plymouth-switch-root.service && \
$(LN_S) ../plymouth-start.service && \
$(LN_S) ../plymouth-switch-root.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysinit.target.wants && \
rm -f plymouth-start.service plymouth-read-write.service && \
$(LN_S) ../plymouth-start.service && \
$(LN_S) ../plymouth-read-write.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/multi-user.target.wants && \
rm -f plymouth-quit.service plymouth-quit-wait.service && \
$(LN_S) ../plymouth-quit.service && \
$(LN_S) ../plymouth-quit-wait.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/reboot.target.wants && \
- rm -f plymouth-reboot.service && \
- $(LN_S) ../plymouth-reboot.service)
+ rm -f plymouth-reboot.service \
+ plymouth-switch-root-initramfs.service && \
+ $(LN_S) ../plymouth-reboot.service && \
+ $(LN_S) ../plymouth-switch-root-initramfs.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/kexec.target.wants && \
rm -f plymouth-kexec.service && \
$(LN_S) ../plymouth-kexec.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/poweroff.target.wants && \
- rm -f plymouth-poweroff.service && \
- $(LN_S) ../plymouth-poweroff.service)
+ rm -f plymouth-poweroff.service \
+ plymouth-switch-root-initramfs.service && \
+ $(LN_S) ../plymouth-poweroff.service && \
+ $(LN_S) ../plymouth-switch-root-initramfs.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/halt.target.wants && \
- rm -f plymouth-halt.service && \
- $(LN_S) ../plymouth-halt.service)
+ rm -f plymouth-halt.service \
+ plymouth-switch-root-initramfs.service && \
+ $(LN_S) ../plymouth-halt.service && \
+ $(LN_S) ../plymouth-switch-root-initramfs.service)
uninstall-hook:
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/initrd-switch-root.target.wants && \
rm -f plymouth-start.service plymouth-switch-root.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysinit.target.wants && \
rm -f plymouth-start.service plymouth-read-write.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/multi-user.target.wants && \
rm -f plymouth-quit.service plymouth-quit-wait.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/reboot.target.wants && \
- rm -f plymouth-reboot.service)
+ rm -f plymouth-reboot.service \
+ plymouth-switch-root-initramfs.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/kexec.target.wants && \
rm -f plymouth-kexec.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/poweroff.target.wants && \
- rm -f plymouth-poweroff.service)
+ rm -f plymouth-poweroff.service \
+ plymouth-switch-root-initramfs.service)
(cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/halt.target.wants && \
- rm -f plymouth-halt.service)
+ rm -f plymouth-halt.service \
+ plymouth-switch-root-initramfs.service)
rmdir --ignore-fail-on-non-empty \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysinit.target.wants \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/multi-user.target.wants \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/reboot.target.wants \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/kexec.target.wants \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/poweroff.target.wants \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/halt.target.wants
endif
EXTRA_DIST = $(systemd_unit_templates) $(systemdunit_DATA)
DISTCLEANFILES=$(systemdunit_DATA)
diff --git a/systemd-units/plymouth-halt.service.in b/systemd-units/plymouth-halt.service.in
index cb87c1f..00f7eed 100644
--- a/systemd-units/plymouth-halt.service.in
+++ b/systemd-units/plymouth-halt.service.in
@@ -1,13 +1,14 @@
[Unit]
Description=Show Plymouth Halt Screen
After=getty@tty1.service display-manager.service plymouth-start.service
Before=systemd-halt.service
DefaultDependencies=no
ConditionKernelCommandLine=!plymouth.enable=0
ConditionVirtualization=!container
[Service]
ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=shutdown --attach-to-session
ExecStartPost=-@PLYMOUTH_CLIENT_DIR@/plymouth show-splash
+KillMode=none
Type=forking
RemainAfterExit=yes
diff --git a/systemd-units/plymouth-poweroff.service.in b/systemd-units/plymouth-poweroff.service.in
index cf05e47..a1f78eb 100644
--- a/systemd-units/plymouth-poweroff.service.in
+++ b/systemd-units/plymouth-poweroff.service.in
@@ -1,13 +1,14 @@
[Unit]
Description=Show Plymouth Power Off Screen
After=getty@tty1.service display-manager.service plymouth-start.service
Before=systemd-poweroff.service
DefaultDependencies=no
ConditionKernelCommandLine=!plymouth.enable=0
ConditionVirtualization=!container
[Service]
ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=shutdown --attach-to-session
ExecStartPost=-@PLYMOUTH_CLIENT_DIR@/plymouth show-splash
+KillMode=none
Type=forking
RemainAfterExit=yes
diff --git a/systemd-units/plymouth-reboot.service.in b/systemd-units/plymouth-reboot.service.in
index 3624550..8fff576 100644
--- a/systemd-units/plymouth-reboot.service.in
+++ b/systemd-units/plymouth-reboot.service.in
@@ -1,13 +1,14 @@
[Unit]
Description=Show Plymouth Reboot Screen
After=getty@tty1.service display-manager.service plymouth-start.service
Before=systemd-reboot.service
DefaultDependencies=no
ConditionKernelCommandLine=!plymouth.enable=0
ConditionVirtualization=!container
[Service]
ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=reboot --attach-to-session
ExecStartPost=-@PLYMOUTH_CLIENT_DIR@/plymouth show-splash
+KillMode=none
Type=forking
RemainAfterExit=yes
diff --git a/systemd-units/plymouth-switch-root-initramfs.service.in b/systemd-units/plymouth-switch-root-initramfs.service.in
new file mode 100644
index 0000000..cb20459
--- /dev/null
+++ b/systemd-units/plymouth-switch-root-initramfs.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Tell Plymouth To Jump To initramfs
+DefaultDependencies=no
+After=plymouth-halt.service plymouth-reboot.service plymouth-poweroff.service dracut-shutdown.service
+ConditionPathExists=/run/initramfs/bin/sh
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=-@PLYMOUTH_CLIENT_DIR@/plymouth update-root-fs --new-root-dir=/run/initramfs
+Type=oneshot
+RemainAfterExit=yes
--
2.26.0

View File

@ -0,0 +1,159 @@
From ccb1a425efa1a21ba0d6730b8eba030c5f1d4ada Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 28 Feb 2022 16:07:11 +0100
Subject: [PATCH 2/6] ply-device-manager: Treat SimpleDRM drm devices as fbdev
devices
Simple-framebuffer devices driven by simpledrm lack information
like panel-rotation info and physical size, causing the splash
to briefly render on its side / without HiDPI scaling, switching
to the correct rendering when the native driver loads.
To avoid this treat simpledrm devices as fbdev devices and only
use them after the timeout.
Also adds 2 exceptions to this:
1. If nomodeset is passed on the kernel commandline then no native
drivers will load, so in this case it is best to immediately use
SimpleDRM devices when they are detected.
2. On some devics the firmware leave the panel black at boot. In this
case it is desirable to show the splash to the user ASAP so that there
is some visual feedback that the device is booting. Add a support for a
"plymouth.use-simpledrm" kernel cmdline option to show the splash
immediately on SimpleDRM devices rather then waiting for the native
driver to load.
Closes #167
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/libply-splash-core/ply-device-manager.c | 39 +++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
index aed7bac..b2484b4 100644
--- a/src/libply-splash-core/ply-device-manager.c
+++ b/src/libply-splash-core/ply-device-manager.c
@@ -378,78 +378,117 @@ create_devices_for_subsystem (ply_device_manager_t *manager,
static void
on_drm_udev_add_or_change (ply_device_manager_t *manager,
const char *action,
const char *device_path,
struct udev_device *device)
{
ply_renderer_t *renderer;
bool changed;
renderer = ply_hashtable_lookup (manager->renderers, (void *) device_path);
if (renderer == NULL) {
/* We also try to create the renderer again on change events,
* renderer creation fails when no outputs are connected and
* this may have changed.
*/
create_devices_for_udev_device (manager, device);
return;
}
/* Renderer exists, bail if this is not a change event */
if (strcmp (action, "change"))
return;
changed = ply_renderer_handle_change_event (renderer);
if (changed) {
free_displays_for_renderer (manager, renderer);
create_pixel_displays_for_renderer (manager, renderer);
}
}
+static bool
+verify_drm_device (struct udev_device *device)
+{
+ const char *id_path;
+
+ /*
+ * Simple-framebuffer devices driven by simpledrm lack information
+ * like panel-rotation info and physical size, causing the splash
+ * to briefly render on its side / without HiDPI scaling, switching
+ * to the correct rendering when the native driver loads.
+ * To avoid this treat simpledrm devices as fbdev devices and only
+ * use them after the timeout.
+ */
+ id_path = udev_device_get_property_value (device, "ID_PATH");
+ if (!ply_string_has_prefix (id_path, "platform-simple-framebuffer"))
+ return true; /* Not a SimpleDRM device */
+
+ /*
+ * With nomodeset, no native drivers will load, so SimpleDRM devices
+ * should be used immediately.
+ */
+ if (ply_kernel_command_line_has_argument ("nomodeset"))
+ return true;
+
+ /*
+ * Some firmwares leave the panel black at boot. Allow enabling SimpleDRM
+ * use from the cmdline to show something to the user ASAP.
+ */
+ if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm"))
+ return true;
+
+ return false;
+}
+
static bool
verify_add_or_change (ply_device_manager_t *manager,
const char *action,
const char *device_path,
struct udev_device *device)
{
const char *subsystem = udev_device_get_subsystem (device);
if (strcmp (action, "add") && strcmp (action, "change"))
return false;
subsystem = udev_device_get_subsystem (device);
if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) {
if (manager->local_console_managed && manager->local_console_is_text) {
ply_trace ("ignoring since we're already using text splash for local console");
return false;
}
+
+ if (!verify_drm_device (device)) {
+ ply_trace ("ignoring since we only handle SimpleDRM devices after timeout");
+ return false;
+ }
} else {
ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem);
return false;
}
return true;
}
static bool
duplicate_device_path (ply_list_t *events, const char *device_path)
{
struct udev_device *device;
ply_list_node_t *node;
for (node = ply_list_get_first_node (events);
node; node = ply_list_get_next_node (events, node)) {
device = ply_list_node_get_data (node);
if (strcmp (udev_device_get_devnode (device), device_path) == 0)
return true;
}
return false;
}
static void
process_udev_add_or_change_events (ply_device_manager_t *manager, ply_list_t *events)
{
const char *action, *device_path;
struct udev_device *device;
--
2.37.0.rc1

View File

@ -1,142 +0,0 @@
From b9faf90fe5939fedfd710e1e8385f4d5c12e1df7 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 15 Jun 2020 10:35:45 -0400
Subject: [PATCH 2/2] throbgress: update for api change
---
src/plugins/splash/throbgress/plugin.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/plugins/splash/throbgress/plugin.c b/src/plugins/splash/throbgress/plugin.c
index 86be064..68cca70 100644
--- a/src/plugins/splash/throbgress/plugin.c
+++ b/src/plugins/splash/throbgress/plugin.c
@@ -715,61 +715,61 @@ update_status (ply_boot_splash_plugin_t *plugin,
}
static void
on_boot_progress (ply_boot_splash_plugin_t *plugin,
double duration,
double percent_done)
{
ply_list_node_t *node;
double total_duration;
if (plugin->mode == PLY_BOOT_SPLASH_MODE_UPDATES ||
plugin->mode == PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE ||
plugin->mode == PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE)
return;
total_duration = duration / percent_done;
/* Fun made-up smoothing function to make the growth asymptotic:
* fraction(time,estimate)=1-2^(-(time^1.45)/estimate) */
percent_done = 1.0 - pow (2.0, -pow (duration, 1.45) / total_duration) * (1.0 - percent_done);
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
ply_list_node_t *next_node;
view_t *view;
view = ply_list_node_get_data (node);
next_node = ply_list_get_next_node (plugin->views, node);
- ply_progress_bar_set_percent_done (view->progress_bar, percent_done);
+ ply_progress_bar_set_fraction_done (view->progress_bar, percent_done);
node = next_node;
}
}
static void
hide_splash_screen (ply_boot_splash_plugin_t *plugin,
ply_event_loop_t *loop)
{
assert (plugin != NULL);
ply_trace ("hiding splash");
if (plugin->loop != NULL) {
stop_animation (plugin, NULL);
ply_event_loop_stop_watching_for_exit (plugin->loop, (ply_event_loop_exit_handler_t)
detach_from_event_loop,
plugin);
detach_from_event_loop (plugin);
}
plugin->is_visible = false;
}
static void
show_password_prompt (ply_boot_splash_plugin_t *plugin,
const char *text,
int number_of_bullets)
{
ply_list_node_t *node;
@@ -920,61 +920,61 @@ display_question (ply_boot_splash_plugin_t *plugin,
show_prompt (plugin, prompt, entry_text);
redraw_views (plugin);
unpause_views (plugin);
}
static void
display_message (ply_boot_splash_plugin_t *plugin,
const char *message)
{
show_message (plugin, message);
}
static void
system_update (ply_boot_splash_plugin_t *plugin,
int progress)
{
ply_list_node_t *node;
if (plugin->mode != PLY_BOOT_SPLASH_MODE_UPDATES &&
plugin->mode != PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE &&
plugin->mode != PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE)
return;
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
ply_list_node_t *next_node;
view_t *view;
view = ply_list_node_get_data (node);
next_node = ply_list_get_next_node (plugin->views, node);
- ply_progress_bar_set_percent_done (view->progress_bar, (double) progress / 100.f);
+ ply_progress_bar_set_fraction_done (view->progress_bar, (double) progress / 100.f);
node = next_node;
}
}
ply_boot_splash_plugin_interface_t *
ply_boot_splash_plugin_get_interface (void)
{
static ply_boot_splash_plugin_interface_t plugin_interface =
{
.create_plugin = create_plugin,
.destroy_plugin = destroy_plugin,
.add_pixel_display = add_pixel_display,
.remove_pixel_display = remove_pixel_display,
.show_splash_screen = show_splash_screen,
.update_status = update_status,
.on_boot_progress = on_boot_progress,
.hide_splash_screen = hide_splash_screen,
.on_root_mounted = on_root_mounted,
.become_idle = become_idle,
.display_normal = display_normal,
.display_password = display_password,
.display_question = display_question,
.display_message = display_message,
.system_update = system_update,
};
return &plugin_interface;
}
/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
--
2.21.0

View File

@ -0,0 +1,213 @@
From 7fbd59d04e971d327c3aaba417765f25c3168447 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 28 Sep 2022 15:14:00 +0200
Subject: [PATCH 3/6] ply-device-manager: Move verify_drm_device() higher up in
the file
Move verify_drm_device() higher up in ply-device-manager.c, this is
a preparation patch for the next patch in this series.
This is a pure move without any changes to the moved block.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/libply-splash-core/ply-device-manager.c | 68 ++++++++++-----------
1 file changed, 34 insertions(+), 34 deletions(-)
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
index b2484b4..015bd70 100644
--- a/src/libply-splash-core/ply-device-manager.c
+++ b/src/libply-splash-core/ply-device-manager.c
@@ -236,60 +236,94 @@ fb_device_has_drm_device (ply_device_manager_t *manager,
ply_trace ("trying to find associated drm node for fb device (path: %s)", id_path);
udev_enumerate_scan_devices (card_matches);
/* there should only ever be at most one match so we don't iterate through
* the list, but just look at the first entry */
card_entry = udev_enumerate_get_list_entry (card_matches);
if (card_entry != NULL) {
struct udev_device *card_device = NULL;
const char *card_node;
const char *card_path;
card_path = udev_list_entry_get_name (card_entry);
card_device = udev_device_new_from_syspath (manager->udev_context, card_path);
card_node = udev_device_get_devnode (card_device);
if (card_node != NULL && drm_device_in_use (manager, card_node))
has_drm_device = true;
else
ply_trace ("no card node!");
udev_device_unref (card_device);
} else {
ply_trace ("no card entry!");
}
udev_enumerate_unref (card_matches);
return has_drm_device;
}
+static bool
+verify_drm_device (struct udev_device *device)
+{
+ const char *id_path;
+
+ /*
+ * Simple-framebuffer devices driven by simpledrm lack information
+ * like panel-rotation info and physical size, causing the splash
+ * to briefly render on its side / without HiDPI scaling, switching
+ * to the correct rendering when the native driver loads.
+ * To avoid this treat simpledrm devices as fbdev devices and only
+ * use them after the timeout.
+ */
+ id_path = udev_device_get_property_value (device, "ID_PATH");
+ if (!ply_string_has_prefix (id_path, "platform-simple-framebuffer"))
+ return true; /* Not a SimpleDRM device */
+
+ /*
+ * With nomodeset, no native drivers will load, so SimpleDRM devices
+ * should be used immediately.
+ */
+ if (ply_kernel_command_line_has_argument ("nomodeset"))
+ return true;
+
+ /*
+ * Some firmwares leave the panel black at boot. Allow enabling SimpleDRM
+ * use from the cmdline to show something to the user ASAP.
+ */
+ if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm"))
+ return true;
+
+ return false;
+}
+
static bool
create_devices_for_udev_device (ply_device_manager_t *manager,
struct udev_device *device)
{
const char *device_path;
bool created = false;
device_path = udev_device_get_devnode (device);
if (device_path != NULL) {
const char *subsystem;
ply_renderer_type_t renderer_type = PLY_RENDERER_TYPE_NONE;
subsystem = udev_device_get_subsystem (device);
ply_trace ("device subsystem is %s", subsystem);
if (subsystem != NULL && strcmp (subsystem, SUBSYSTEM_DRM) == 0) {
ply_trace ("found DRM device %s", device_path);
renderer_type = PLY_RENDERER_TYPE_DRM;
} else if (strcmp (subsystem, SUBSYSTEM_FRAME_BUFFER) == 0) {
ply_trace ("found frame buffer device %s", device_path);
if (!fb_device_has_drm_device (manager, device))
renderer_type = PLY_RENDERER_TYPE_FRAME_BUFFER;
else
ply_trace ("ignoring, since there's a DRM device associated with it");
}
if (renderer_type != PLY_RENDERER_TYPE_NONE) {
ply_terminal_t *terminal = NULL;
@@ -378,94 +412,60 @@ create_devices_for_subsystem (ply_device_manager_t *manager,
static void
on_drm_udev_add_or_change (ply_device_manager_t *manager,
const char *action,
const char *device_path,
struct udev_device *device)
{
ply_renderer_t *renderer;
bool changed;
renderer = ply_hashtable_lookup (manager->renderers, (void *) device_path);
if (renderer == NULL) {
/* We also try to create the renderer again on change events,
* renderer creation fails when no outputs are connected and
* this may have changed.
*/
create_devices_for_udev_device (manager, device);
return;
}
/* Renderer exists, bail if this is not a change event */
if (strcmp (action, "change"))
return;
changed = ply_renderer_handle_change_event (renderer);
if (changed) {
free_displays_for_renderer (manager, renderer);
create_pixel_displays_for_renderer (manager, renderer);
}
}
-static bool
-verify_drm_device (struct udev_device *device)
-{
- const char *id_path;
-
- /*
- * Simple-framebuffer devices driven by simpledrm lack information
- * like panel-rotation info and physical size, causing the splash
- * to briefly render on its side / without HiDPI scaling, switching
- * to the correct rendering when the native driver loads.
- * To avoid this treat simpledrm devices as fbdev devices and only
- * use them after the timeout.
- */
- id_path = udev_device_get_property_value (device, "ID_PATH");
- if (!ply_string_has_prefix (id_path, "platform-simple-framebuffer"))
- return true; /* Not a SimpleDRM device */
-
- /*
- * With nomodeset, no native drivers will load, so SimpleDRM devices
- * should be used immediately.
- */
- if (ply_kernel_command_line_has_argument ("nomodeset"))
- return true;
-
- /*
- * Some firmwares leave the panel black at boot. Allow enabling SimpleDRM
- * use from the cmdline to show something to the user ASAP.
- */
- if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm"))
- return true;
-
- return false;
-}
-
static bool
verify_add_or_change (ply_device_manager_t *manager,
const char *action,
const char *device_path,
struct udev_device *device)
{
const char *subsystem = udev_device_get_subsystem (device);
if (strcmp (action, "add") && strcmp (action, "change"))
return false;
subsystem = udev_device_get_subsystem (device);
if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) {
if (manager->local_console_managed && manager->local_console_is_text) {
ply_trace ("ignoring since we're already using text splash for local console");
return false;
}
if (!verify_drm_device (device)) {
ply_trace ("ignoring since we only handle SimpleDRM devices after timeout");
return false;
}
} else {
ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem);
return false;
}
return true;
}
--
2.37.0.rc1

View File

@ -0,0 +1,88 @@
From 5a493ef808b769f4ccc4f3acc1ecf048b8e3efdc Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 28 Feb 2022 16:20:43 +0100
Subject: [PATCH 4/6] ply-device-manager: Remove unnecessary subsystem != NULL
check
The ply-device-manager.c already assumes that the return value of
udev_device_get_subsystem () is never NULL in many places, including
in the condition of the "else if" just below the check which is
being removed.
Remove the one lonely check for it being NULL for consistency.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/libply-splash-core/ply-device-manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
index 015bd70..6b7ccd6 100644
--- a/src/libply-splash-core/ply-device-manager.c
+++ b/src/libply-splash-core/ply-device-manager.c
@@ -286,61 +286,61 @@ verify_drm_device (struct udev_device *device)
*/
if (ply_kernel_command_line_has_argument ("nomodeset"))
return true;
/*
* Some firmwares leave the panel black at boot. Allow enabling SimpleDRM
* use from the cmdline to show something to the user ASAP.
*/
if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm"))
return true;
return false;
}
static bool
create_devices_for_udev_device (ply_device_manager_t *manager,
struct udev_device *device)
{
const char *device_path;
bool created = false;
device_path = udev_device_get_devnode (device);
if (device_path != NULL) {
const char *subsystem;
ply_renderer_type_t renderer_type = PLY_RENDERER_TYPE_NONE;
subsystem = udev_device_get_subsystem (device);
ply_trace ("device subsystem is %s", subsystem);
- if (subsystem != NULL && strcmp (subsystem, SUBSYSTEM_DRM) == 0) {
+ if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) {
ply_trace ("found DRM device %s", device_path);
renderer_type = PLY_RENDERER_TYPE_DRM;
} else if (strcmp (subsystem, SUBSYSTEM_FRAME_BUFFER) == 0) {
ply_trace ("found frame buffer device %s", device_path);
if (!fb_device_has_drm_device (manager, device))
renderer_type = PLY_RENDERER_TYPE_FRAME_BUFFER;
else
ply_trace ("ignoring, since there's a DRM device associated with it");
}
if (renderer_type != PLY_RENDERER_TYPE_NONE) {
ply_terminal_t *terminal = NULL;
if (!manager->local_console_managed) {
terminal = manager->local_console_terminal;
}
created = create_devices_for_terminal_and_renderer_type (manager,
device_path,
terminal,
renderer_type);
if (created) {
if (renderer_type == PLY_RENDERER_TYPE_DRM)
manager->found_drm_device = 1;
if (renderer_type == PLY_RENDERER_TYPE_FRAME_BUFFER)
manager->found_fb_device = 1;
}
}
}
--
2.37.0.rc1

View File

@ -0,0 +1,103 @@
From 406376fbe89078678d68392ea76151ecb4f0e30a Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 28 Feb 2022 16:36:58 +0100
Subject: [PATCH 5/6] ply-device-manager: verify_add_or_change(): Move
local_console_is_text check
Move the local_console_is_text check outside of the
"if (subsytem == SUBSYSTEM_DRM)" block.
This check is equally relevant for SUBSYSTEM_FRAME_BUFFER.
Note by itself this is a no-op since verify_add_or_change() *always*
returns false for SUBSYSTEM_FRAME_BUFFER devices.
This is a preparation patch for making verify_add_or_change() not
return false when manager->device_timeout_elapsed is set.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/libply-splash-core/ply-device-manager.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
index 6b7ccd6..bff4982 100644
--- a/src/libply-splash-core/ply-device-manager.c
+++ b/src/libply-splash-core/ply-device-manager.c
@@ -423,68 +423,68 @@ on_drm_udev_add_or_change (ply_device_manager_t *manager,
/* We also try to create the renderer again on change events,
* renderer creation fails when no outputs are connected and
* this may have changed.
*/
create_devices_for_udev_device (manager, device);
return;
}
/* Renderer exists, bail if this is not a change event */
if (strcmp (action, "change"))
return;
changed = ply_renderer_handle_change_event (renderer);
if (changed) {
free_displays_for_renderer (manager, renderer);
create_pixel_displays_for_renderer (manager, renderer);
}
}
static bool
verify_add_or_change (ply_device_manager_t *manager,
const char *action,
const char *device_path,
struct udev_device *device)
{
const char *subsystem = udev_device_get_subsystem (device);
if (strcmp (action, "add") && strcmp (action, "change"))
return false;
+ if (manager->local_console_managed && manager->local_console_is_text) {
+ ply_trace ("ignoring since we're already using text splash for local console");
+ return false;
+ }
+
subsystem = udev_device_get_subsystem (device);
if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) {
- if (manager->local_console_managed && manager->local_console_is_text) {
- ply_trace ("ignoring since we're already using text splash for local console");
- return false;
- }
-
if (!verify_drm_device (device)) {
ply_trace ("ignoring since we only handle SimpleDRM devices after timeout");
return false;
}
} else {
ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem);
return false;
}
return true;
}
static bool
duplicate_device_path (ply_list_t *events, const char *device_path)
{
struct udev_device *device;
ply_list_node_t *node;
for (node = ply_list_get_first_node (events);
node; node = ply_list_get_next_node (events, node)) {
device = ply_list_node_get_data (node);
if (strcmp (udev_device_get_devnode (device), device_path) == 0)
return true;
}
return false;
}
static void
--
2.37.0.rc1

View File

@ -0,0 +1,162 @@
From eb40956898e35121525e253305f6d40b45cfbf23 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 28 Feb 2022 16:36:58 +0100
Subject: [PATCH 6/6] ply-device-manager: verify_add_or_change(): Move
local_console_is_text check
Move the local_console_is_text check outside of the
"if (subsytem == SUBSYSTEM_DRM)" block.
This check is equally relevant for SUBSYSTEM_FRAME_BUFFER.
Note by itself this is a no-op since verify_add_or_change() *always*
returns false for SUBSYSTEM_FRAME_BUFFER devices.
This is a preparation patch for making verify_add_or_change() not
return false when manager->device_timeout_elapsed is set.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/libply-splash-core/ply-device-manager.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
index bff4982..29b26fc 100644
--- a/src/libply-splash-core/ply-device-manager.c
+++ b/src/libply-splash-core/ply-device-manager.c
@@ -287,60 +287,64 @@ verify_drm_device (struct udev_device *device)
if (ply_kernel_command_line_has_argument ("nomodeset"))
return true;
/*
* Some firmwares leave the panel black at boot. Allow enabling SimpleDRM
* use from the cmdline to show something to the user ASAP.
*/
if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm"))
return true;
return false;
}
static bool
create_devices_for_udev_device (ply_device_manager_t *manager,
struct udev_device *device)
{
const char *device_path;
bool created = false;
device_path = udev_device_get_devnode (device);
if (device_path != NULL) {
const char *subsystem;
ply_renderer_type_t renderer_type = PLY_RENDERER_TYPE_NONE;
subsystem = udev_device_get_subsystem (device);
ply_trace ("device subsystem is %s", subsystem);
if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) {
+ if (!manager->device_timeout_elapsed && !verify_drm_device (device)) {
+ ply_trace ("ignoring since we only handle SimpleDRM devices after timeout");
+ return false;
+ }
ply_trace ("found DRM device %s", device_path);
renderer_type = PLY_RENDERER_TYPE_DRM;
} else if (strcmp (subsystem, SUBSYSTEM_FRAME_BUFFER) == 0) {
ply_trace ("found frame buffer device %s", device_path);
if (!fb_device_has_drm_device (manager, device))
renderer_type = PLY_RENDERER_TYPE_FRAME_BUFFER;
else
ply_trace ("ignoring, since there's a DRM device associated with it");
}
if (renderer_type != PLY_RENDERER_TYPE_NONE) {
ply_terminal_t *terminal = NULL;
if (!manager->local_console_managed) {
terminal = manager->local_console_terminal;
}
created = create_devices_for_terminal_and_renderer_type (manager,
device_path,
terminal,
renderer_type);
if (created) {
if (renderer_type == PLY_RENDERER_TYPE_DRM)
manager->found_drm_device = 1;
if (renderer_type == PLY_RENDERER_TYPE_FRAME_BUFFER)
manager->found_fb_device = 1;
}
}
}
@@ -430,66 +434,61 @@ on_drm_udev_add_or_change (ply_device_manager_t *manager,
/* Renderer exists, bail if this is not a change event */
if (strcmp (action, "change"))
return;
changed = ply_renderer_handle_change_event (renderer);
if (changed) {
free_displays_for_renderer (manager, renderer);
create_pixel_displays_for_renderer (manager, renderer);
}
}
static bool
verify_add_or_change (ply_device_manager_t *manager,
const char *action,
const char *device_path,
struct udev_device *device)
{
const char *subsystem = udev_device_get_subsystem (device);
if (strcmp (action, "add") && strcmp (action, "change"))
return false;
if (manager->local_console_managed && manager->local_console_is_text) {
ply_trace ("ignoring since we're already using text splash for local console");
return false;
}
subsystem = udev_device_get_subsystem (device);
- if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) {
- if (!verify_drm_device (device)) {
- ply_trace ("ignoring since we only handle SimpleDRM devices after timeout");
- return false;
- }
- } else {
+ if (strcmp (subsystem, SUBSYSTEM_DRM)) {
ply_trace ("ignoring since we only handle subsystem %s devices after timeout", subsystem);
return false;
}
return true;
}
static bool
duplicate_device_path (ply_list_t *events, const char *device_path)
{
struct udev_device *device;
ply_list_node_t *node;
for (node = ply_list_get_first_node (events);
node; node = ply_list_get_next_node (events, node)) {
device = ply_list_node_get_data (node);
if (strcmp (udev_device_get_devnode (device), device_path) == 0)
return true;
}
return false;
}
static void
process_udev_add_or_change_events (ply_device_manager_t *manager, ply_list_t *events)
{
const char *action, *device_path;
struct udev_device *device;
ply_list_node_t *node;
--
2.37.0.rc1

View File

@ -1,39 +0,0 @@
0.222:RCkernelparam
0.223:RChostname
0.238:RCmountfs
0.275:RCswap
0.330:microcode_ctl
0.357:cpuspeed
0.365:ip6tables
0.380:iptables
0.385:isdn
0.504:auditd
0.508:restorecond
0.523:rsyslog
0.530:irqbalance
0.533:rpcbind
0.549:nfslock
0.561:mdmonitor
0.563:rpcidmapd
0.578:rpcgssd
0.579:messagebus
0.580:fuse
0.594:netfs
0.600:acpid
0.611:haldaemon
0.660:pcscd
0.691:udev-post
0.703:portreserve
0.712:setroubleshoot
0.749:bluetooth
0.738:sshd
0.763:ntpd
0.807:sendmail
0.876:crond
0.902:kerneloops
0.907:smolt
0.915:atd
0.927:avahi-daemon
0.941:cups
0.983:anacron
0.992:local

View File

@ -1,8 +0,0 @@
/var/log/boot.log
{
missingok
daily
copytruncate
rotate 7
notifempty
}

View File

@ -1,12 +1,12 @@
[Plymouth Theme]
Name=Charge
Description=A theme that features a stylized 8 and spinner
Description=A theme that features the shadowy hull of a Fedora logo charge up and and finally burst into into full form.
ModuleName=two-step
[two-step]
ImageDir=/usr/share/plymouth/themes/charge
HorizontalAlignment=.5
VerticalAlignment=.75
VerticalAlignment=.5
Transition=none
TransitionDuration=0.0
BackgroundStartColor=0x202020

View File

@ -1,2 +0,0 @@
#!/bin/bash
dracut -f

View File

@ -1,4 +1,4 @@
From f72cdd6969c483d7811e5684fa3143deff55a0c7 Mon Sep 17 00:00:00 2001
From 0f44635c348f99aeb7b7c24d88a26aa2202c4396 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 17 Jun 2019 13:54:42 -0400
Subject: [PATCH] populate-initrd: ship label plugin
@ -9,10 +9,10 @@ This gives us font rendering at early boot.
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in
index 616ecc4..60fd063 100755
index 66acdde..7ad6409 100755
--- a/scripts/plymouth-populate-initrd.in
+++ b/scripts/plymouth-populate-initrd.in
@@ -1,55 +1,56 @@
@@ -1,56 +1,57 @@
#!/bin/bash
#
# inst bits ruthlessly and viciously stolen from dracut
@ -37,6 +37,7 @@ index 616ecc4..60fd063 100755
[ -z "$PLYMOUTH_POLICYDIR" ] && PLYMOUTH_POLICYDIR="@PLYMOUTH_POLICY_DIR@"
[ -z "$PLYMOUTH_DAEMON_PATH" ] && PLYMOUTH_DAEMON_PATH="@PLYMOUTH_DAEMON_DIR@/plymouthd"
[ -z "$PLYMOUTH_CLIENT_PATH" ] && PLYMOUTH_CLIENT_PATH="@PLYMOUTH_CLIENT_DIR@/plymouth"
[ -z "$PLYMOUTH_DRM_ESCROW_PATH" ] && PLYMOUTH_DRM_ESCROW_PATH="@PLYMOUTH_LIBEXECDIR@/plymouth/plymouthd-drm-escrow"
[ -z "$SYSTEMD_UNIT_DIR" ] && SYSTEMD_UNIT_DIR="@SYSTEMD_UNIT_DIR@"
+[ -z "$SUPPORTED_LANGUAGES" ] && SUPPORTED_LANGUAGES="pt fr de it ru es en zh ja ko zh as bn gu hi kn ml mr or pa ta te"
@ -69,7 +70,7 @@ index 616ecc4..60fd063 100755
convert_abs_rel() {
local __current __absolute __abssize __cursize __newpath
local -i __i __level
@@ -434,59 +435,77 @@ if [ $THEME_OVERRIDE ]; then
@@ -436,59 +437,77 @@ if [ $THEME_OVERRIDE ]; then
conf=$INITRDDIR/${PLYMOUTH_CONFDIR}/plymouthd.conf
echo "modifying plymouthd.conf: Theme=$PLYMOUTH_THEME_NAME" >&2
# make sure the section and key exist so we can modify them
@ -150,5 +151,5 @@ index 616ecc4..60fd063 100755
# vim:ts=8:sw=4:sts=4:et
--
2.21.0
2.32.0

File diff suppressed because it is too large Load Diff