Ray Strode [Tue, 30 Aug 2022 18:41:36 +0000 (14:41 -0400)]
details: Don't replay boot buffer on serial consoles
commit 0e59dde8 changed the details plugin to clear the terminal when
first opening it. This was done to prevent duplicate messages from
showing up when toggling back and forth between details and graphical
splashes.
That has the negative side effect of purging serial console output too
though. Furthermore, it makes little sense to replay the boot buffer
on serial consoles, since serial consoles don't aggressively purge
scrollback like VTs do.
This commit adds a check to make sure the terminal is a VT before trying
to clear and replay the scrollback buffer.
shiptux [Sat, 27 Aug 2022 07:09:57 +0000 (15:09 +0800)]
ply-device-manager: Add plymouth.force-frame-buffer-on-boot parameter, allow to choose force framebuffer mode.
Some hardware vendor may not open source display driver. (Such as pangu
M900). They load drm driver via kernel modules. On such devices, drm driver
load more slowly then other devices, which may cause logo show later and no
seem to get the Plymouth decryption screen to show. To avoid this problem,
add a bootargs for people who want to forced use fb in plymouth.
When found "plymouth.force-frame-buffer-on-boot flags" in kernel parameter,
During the system start, PLY_DEVICE_MANAGER_FLAGS_FORCE_FRAM_BUFFER will be
add to device_manager_flags. Then "force_fb" mode will enable, and the
renderer_type set as framebuffer.
systemd: Add mkinitcpio support to plymouth-switch-root-initramfs.service
plymouth-switch-root-initramfs.service commands plymouth to release
rootfs to allow the shutdown ramfs to unmount rootfs. However, it only
integrates with dracut. Arch Linux uses mkinitcpio by default, and it
uses shutdown ramfs when layered block storage (e.g. LUKS) is used for
rootfs. Therefore, it fails to unmount rootfs on shutdown if LUKS and
plymouth are used together.
Add a new trigger for plymouth-switch-root-initramfs.service to start
when /run/initramfs/shutdown exists (/run/initramfs/bin/sh may not exist
with mkinitcpio when systemd-based initramfs is used), and add a
dependency to start it after mkinitcpio generates the shutdown ramfs.
Hans de Goede [Wed, 28 Sep 2022 13:16:15 +0000 (15:16 +0200)]
ply-device-manager: Also ignore SimpleDRM devs in coldplug enumeration path
Plymouth has 2 hw discovery paths:
1. Enumerating devices already known by udev at plymouth startup
2. Devices which are hotplugged after startup
At boot we have udevd which is enumerating hw and plymouthd racing
with each other, which means that plymouthd may discover the new
SimpleDRM device through either 1. or 2.
Before this patch a check for SimpleDRM was missing from path 1, causing
it to be treated as a normal device instead of being ignored as intended:
plymouth-debug.log for the simpledrm being enumerated in path 1:
ply-device-manager.c:344: create_devices_for_subsystem:
found device /sys/devices/platform/simple-framebuffer.0/drm/card0
ply-device-manager.c:351: create_devices_for_subsystem:
device is initialized
ply-device-manager.c:360: create_devices_for_subsystem:
found node /dev/dri/card0
ply-device-manager.c:283: create_devices_for_udev_device:
found DRM device /dev/dri/card0
ply-device-manager.c:885: create_devices_for_terminal_and_rende:
creating devices for /dev/dri/card0 (renderer type: 1)
plymouth-debug.log for the simpledrm *not* being enumerated in path 1:
ply-device-manager.c:344: create_devices_for_subsystem:
found device /sys/devices/platform/simple-framebuffer.0/drm/card0
ply-device-manager.c:367: create_devices_for_subsystem:
it's not initialized
followed by path 2 enumerating the device very shortly after this:
ply-device-manager.c:532: on_udev_event:
got add event for device /dev/dri/card0
ply-device-manager.c:462: verify_add_or_change:
ignoring since we only handle SimpleDRM devices after timeout
Note how path 2 does correctly ignore SimpleDRM devices, where as
path 1 does not. This commit fixes this by moving the verify_drm_device()
check in to create_devices_for_udev_device() which runs in both paths.
Kate Hsuan [Fri, 10 Jun 2022 05:52:37 +0000 (13:52 +0800)]
plugins: splash: two-step: Secure boot check and a warning image
Secure boot is used against several security threats when malware tries to
infect the firmware of the system. Users may inadvertently disable or
software may intentionally disable the secure boot. Consequently, the
system is running on an insecure platform with incorrect configuration. If
Plymouth could offer a warning to the user, the user could reboot and
reconfigure their system or asks for help immediately.
This work can be used to check the secure boot configuration and put a red
warning image on the screen if the secure boot is disabled. Also, this
check can be utterly disabled through the kernel parameter for testing.
If the parameter "secure_boot.warn_if_disabled=false" appears in the
kernel parameter, the secure boot check will be disabled.
This checks the secure boot status. If the secure boot are enabled,
return true. Otherwise, return false.
The system secure boot settings is at
/sys/firmware/efi/efivars/SecureBoot* and the fifth byte should be
0x1 which means the system secure boot is enabled.
Ray Strode [Tue, 12 Apr 2022 20:16:49 +0000 (16:16 -0400)]
command-parser: Don't add duplicate command to command list
ply_command_parser_get_options inexplicably adds a duplicate
command to the list of available subcommands every time it's
called. This must be some sort of cut and paste bug, it shouldn't
be modifying the list.
That leads to double frees when freeing the command parser.
That commit freed the command parser a little too early, though,
before the event loop gets freed and the event loop exit handlers
are run.
The command parser uses an exit handler to clear a weak reference
on the event loop, so freeing the command parser before the event
loop can lead to crash.
Add String.Length function which returns the length of a string.
It will make it possible to get the number of bullets from the
display prompt callback inside scripts.
Add display_prompt function which will be called for both passwords
and questions. This will make it possible to get a plaintext password
string.
SetDisplayPromptFunction will make it possible to set this callback
from a theme script.
Hans de Goede [Mon, 28 Feb 2022 15:46:34 +0000 (16:46 +0100)]
ply-device-manager: Accept new simpledrm/fbdev devices from udev events after timeout
Before the device-timeout elapses verify_add_or_change () blocks new
simpledrm and fbdev getting added through udev add events because we
really only want native drm devices.
Then when the timeout triggers the list of udev devices existing at
that point int time is rescanned and any drm (including simpledrm) and
fbdev devices are added (filtering out duplicates).
But what if a simpledrm or fbdev device for some reason only shows
up after the timeout? Before this change those would then be ignored
for ever.
Add a manager->device_timeout_elapsed check and make verify_add_or_change ()
accept any drm + fbdev devices after the timeout. Note this addresses
a mostly theoretically issue since in practice a simpledrm or fbdev device
showing up later is very unlikely.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Mon, 28 Feb 2022 15:07:11 +0000 (16:07 +0100)]
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>
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>
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>
Hans de Goede [Mon, 28 Feb 2022 15:17:53 +0000 (16:17 +0100)]
ply-device-manager: Fix double-assignment of subsystem
The subsystem variable is also initialized with udev_device_get_subsystem ()
a couple of lines lower.
Remove the first initialization, so that udev_device_get_subsystem ()
does not get called unnecessary when the function exits early because
of the action value.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Oleg Solovyov [Wed, 8 Dec 2021 16:15:47 +0000 (19:15 +0300)]
drm: Retry setting scanout buffer on failure
Plymouth currently assumes that setting the scanout buffer will succeed.
if it fails because of a driver bug or transient failure it should try
again next frame.