Linux_Logo Display
Using psplash to implement custom boot splash screen on embedded Linux development boards.
Introduction
psplash is a lightweight boot splash screen tool for embedded Linux, used to display a static logo and progress bar.
Applicable Scenarios: H618 series development boards (Ubuntu 22.04) and other ARM Linux development boards.
Environment Setup
# Install dependencies
sudo apt update
sudo apt install build-essential autoconf automake libtool git libgdk-pixbuf2.0-dev -y
# Download source code
git clone git://git.yoctoproject.org/psplash
cd psplash
psplash Compilation
1. Create autogen.sh script
2. Execute and test
# Run the auto-configuration script to generate Makefile.am
chmod +x autogen.sh
./autogen.sh
# Generate Makefile and compile
./configure --host=arm-linux
make
# Test run
sudo ./psplash
# Expected result: The screen displays the default poky logo
Logo Replacement
Method 1: Simple Replacement
Method 2: Custom Filename
Modify source code:
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,7 @@ AM_CFLAGS = $(GCC_FLAGS) $(EXTRA_GCC_FLAGS) -D_GNU_SOURCE -DFONT_HEADER=\"$(FONT
psplash_SOURCES = psplash.c psplash.h psplash-fb.c psplash-fb.h \
psplash-console.c psplash-console.h \
psplash-colors.h psplash-config.h \
- psplash-poky-img.h psplash-bar-img.h $(FONT_NAME)-font.h
+ logo-img.h psplash-bar-img.h $(FONT_NAME)-font.h
BUILT_SOURCES = psplash-poky-img.h psplash-bar-img.h
--- a/psplash.c
+++ b/psplash.c
@@ -13,7 +13,8 @@
#include "psplash.h"
#include "psplash-config.h"
#include "psplash-colors.h"
-#include "psplash-poky-img.h"
+//#include "psplash-poky-img.h"
+#include "logo-img.h"
#include "psplash-bar-img.h"
Recompile: make clean && make
Configure Boot Startup
1. Create startup script /etc/init.d/psplash.sh
#!/bin/sh
read CMDLINE < /proc/cmdline
for x in $CMDLINE; do
case $x in
psplash=false)
echo "Boot splashscreen disabled"
exit 0;
;;
esac
done
export TMPDIR=/mnt/.psplash
mount tmpfs -t tmpfs $TMPDIR -o,size=40k
rotation=0
if [ -e /etc/rotation ]; then
read rotation < /etc/rotation
fi
/usr/bin/psplash --angle $rotation &
2. Create /usr/lib/systemd/system/psplash.service service
[Unit]
Description=Psplash Boot Logo
DefaultDependencies=no
[Service]
ExecStart=/etc/init.d/psplash.sh
Restart=always
Type=simple
[Install]
WantedBy=multi-user.target
3. Deploy and enable
sudo cp psplash /usr/bin/
sudo chmod 755 /usr/bin/psplash
sudo chmod 755 /etc/init.d/psplash.sh
sudo systemctl enable psplash.service
sudo reboot
Other Customizations
- Disable progress bar and boot messages
--- a/psplash-config.h
+++ b/psplash-config.h
@@ -13,7 +13,7 @@
/* Text to output on program start; if undefined, output nothing */
#ifndef PSPLASH_DISABLE_STARTUP_MSG
-#define PSPLASH_STARTUP_MSG ""
+//#define PSPLASH_STARTUP_MSG ""
#endif
/* Bool indicating if the image is fullscreen, as opposed to split screen */
@@ -23,7 +23,7 @@
/* Bool indicated if the progress bar should be disabled */
#ifndef PSPLASH_DISABLE_PROGRESS_BAR
-#define PSPLASH_SHOW_PROGRESS_BAR 1
+//#define PSPLASH_SHOW_PROGRESS_BAR 1
#endif
/* Position of the image split from top edge, numerator of fraction */
diff --git a/psplash.c b/psplash.c
index 261dd1c..b506c0f 100644
- Disable kernel console buffer logs
--- a/source/kernel/linux-5.4-h618/arch/arm64/configs/linux_h618_defconfig
+++ b/source/kernel/linux-5.4-h618/arch/arm64/configs/linux_h618_defconfig
@@ -449,6 +449,7 @@ CONFIG_INPUT_UINPUT=y
CONFIG_INPUT_SENSOR=y
CONFIG_SUNXI_GPADC=y
# CONFIG_SERIO_SERPORT is not set
+CONFIG_VT_HW_CONSOLE_BINDING=y
# CONFIG_LEGACY_PTYS is not set
CONFIG_SERIAL_NONSTANDARD=y
CONFIG_N_HDLC=m
@@ -540,9 +541,6 @@ CONFIG_HDMI2_CEC_USER=y
CONFIG_TV_DISP2_SUNXI=y
CONFIG_DISP2_SUNXI_DEBUG=y
CONFIG_DISP2_SUNXI_COMPOSER=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
-CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER=y
CONFIG_LOGO=y
CONFIG_SUNXI_GPU_TYPE="mali-g31"
CONFIG_SOUND=y
Frequently Asked Questions
- Q: Compilation error "command not found"?
A: sudo apt install build-essential autoconf automake libtool -y
- Q: No display after running?
A: sudo ./psplash; Check: ls -l /dev/fb0
- Q: Boot startup not taking effect?
A: sudo systemctl status psplash.service; sudo journalctl -u psplash.service
- Q: Logo displays incorrectly?
A: Ensure PNG format, regenerate: ./make-image-header.sh logo.png POKY