This is an old revision of the document!


Under construction!!! Incomplete code segments ahead!

Plymouth boot splash Background and Assumptions

Plymouth is a boot splash application from Freedesktop.org. It is the default splash mechanism for several more common Linux distributions. The common feature of these other distributions that TinyCore does not have is that all the distribution's programs and libraries are available once the file systems are mounted, and plymouth assumes that this is the case. Following this assumptions, it also comes with tools for changing the theme by rebuilding the base initrd of the distribution in which it is installed. Since these assumptions don't apply to TinyCore, we have to do a few things differently. It also means that a fair amount of the support code that comes with plymouth isn't needed in TinyCore, so that helps keep the size down.

The scant documentation that comes with plymouth warns that it is hard to work with, and that is true. Also, comments in the code are few and far between.

Plymouth has several ways that it can display graphics. One of these, using the frame buffer, is easiest for TinyCore as it is compilied into the kernel. These instructions will target this method, as it requires the least effort. For systems running in virtual machines or without kernel supported graphics, this should work fine. If you have Intel or Radeon graphics that is supported using DRM, additional steps are required. If you are using the frame buffer mode and kernel graphics modules load during the boot process, the graphics may become distorted. This is the case with Intel i915 graphics; others have not been tested.

Adding a Boot Splash

This article assumes the user is comfortable at the command line. Using these instructions, the user will:

  • create temporary files and directories
  • output the final files to a temp directory
  • compile applications from source

Required:

  1. compiletc
  2. gtk2-dev
  3. libtool-dev
  4. automake
  5. Xlibs
  6. ImageMagick

Abbreviated steps

  1. Compile plymouth
  2. Create and populate the plymouth initrd directory
  3. Create Theme
  4. Update extlinux.conf | syslinux.cfg | pxelinux.cfg

Compile Plymouth

Change to the root of your development directory, which should be persistent. Create a directory to use as the plymouth initrd source directory:

PLYROOT=$(pwd)
mkdir plymouth-initrd

Create the following script as compile-plymouth.sh and make it executable:

cat >compile-plymouth.sh <<EOF
#/bin/sh
#
./autogen.sh \
  --bindir=/bin \
  --sbindir=/sbin \
  --libexecdir=/usr/libexec \
  --sysconfdir=/etc \
  --sharedstatedir=/var \
  --localstatedir=/var \
  --libdir=/lib \
  --includedir=/usr/include \
  --datarootdir=/usr/share \
  --disable-pango \
  --enable-gtk \
  --enable-libdrm_intel \
  --enable-libdrm_radeon \
  --disable-libdrm_nouveau \
  --enable-libkms \
  --enable-drm \
  --enable-tracing \
  --enable-gdm-transition \
  --disable-upstart-monitoring \
  --disable-systemd-integration \
  --with-system-root-install \
  --without-rhgb-compat-link \
  --without-gdm-autostart-file \
  --with-logo=/usr/share/plymouth/themes/TinyCore/header-image.png \
  --with-background-color=0x7f7f7f \
  --with-background-start-color-stop=0x303030 \
  --with-background-end-color-stop=0xcfcfcf
EOF
chmod a+x compile-plymouth.sh

The installation will not be persistent, so you will need to copy the following files into a new initrd source directory. Create plymouth-initrd-files.lst in the current directory from the following list:

cat >plymouth-initrd-files.lst <<EOF
/etc
/etc/init.d
/etc/init.d/rcS
/etc/plymouth
/bin
/bin/plymouth
/lib
/lib/libply.so.2.1.0
/lib/libply.so.2
/lib/libply.so
/lib/libply-splash-core.so.2.1.0
/lib/libply-splash-core.so.2
/lib/libply-splash-core.so
/lib/libply-boot-client.so.2.1.0
/lib/libply-boot-client.so.2
/lib/libply-boot-client.so
/lib/libply-splash-graphics.so.2
/lib/libply-splash-graphics.so.2.1.0
/lib/libply-splash-graphics.so
/lib/plymouth
/lib/plymouth/fade-throbber.so
/lib/plymouth/details.so
/lib/plymouth/script.so
/lib/plymouth/throbgress.so
/lib/plymouth/text.so
/lib/plymouth/two-step.so
/lib/plymouth/space-flares.so
/lib/plymouth/renderers
/lib/plymouth/renderers/x11.so
/lib/plymouth/renderers/drm.so
/lib/plymouth/renderers/frame-buffer.so
/var
/var/run
/var/run/plymouth
/var/lib
/var/lib/plymouth
/var/spool
/var/spool/plymouth
/sbin
/sbin/plymouthd
/usr
/usr/lib
EOF

Unpack the plymouth source code and cd into the new directory (plymouth-0.8.8). Execute the above script from within the source code directory:

tar xfz plymouth-0.8.8.tar.gz
cd plymouth-0.8.8
../compile-plymouth.sh

If there are no errors, make and install plymouth. From this point on, most of the commands will require su capability, so it will be easier if we go ahead and do it now. The rest of this wiki will assume that this is the case. If not, you will need to insert a sudo in most of the command steps:

sudo sh
make install

Create and Populate the plymouth initrd directory

Cd into the plymouth-initrd directory and copy the new files into it:

cd $PLYROOT/plymouth-initrd
cat ../plymouth-initrd-files.lst | cpio -o -H newc | cpio -i -H newc -d

Strip the executables to cut the size down further:

find . | xargs file | grep "executable" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip --strip-unneeded
find . | xargs file | grep "shared object" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip --strip-debug

The following step depends on your current version of TinyCore. For versions 4.7.2 and later:

cd $PLYROOT/plymouth-initrd/etc/init.d
vi rcS

Add the following two lines to rcS between the mount commands and the tc-config script:

/sbin/plymouthd --mode=boot --attach-to-session --pid-file=/var/log/plymouth/plymouthd.pid >/dev/null 2>&1
/bin/plymouth --show-splash >/dev/null 2>&1

For versions prior to 4.7.2:

cd $PLYROOT/plymouth-initrd/etc/init.d
cp /etc/init.d/tc-config .
vi tc-config

Remove or comment out the first echo command from tc-config (before the mount commands), and add the same two lines from above between the mount commands and the big case statement near the beginning of the script.

Beginning with TinyCore 4.7.2, rcS is split from tc-config to accomodate boot splash code. Because the mount commands in rcS will not change between TinyCore versions, we can make our changes to this file and not worry about having to migrate changes to tc-config as TinyCore continues to improve.

To support graphics, plymouth assumes that libpng12 will be available, so we will have to add it to the initrd. Normally this is supplied by Xlibs, but it won't be available at boot so we'll have to copy it into the initrd. Cd to the base plymouth initrd source directory, the execute the following:

cd $PLYROOT/plymouth-initrd/usr/lib
cp /tmp/tcloop/Xlibs/usr/lib/libpng12.so.0.46.0 .
ln -s libpng12.so.0.46.0 libpng12.so.0
ln -s libpng12.so.0.46.0 libpng12.so

Create Theme

To create a default theme we will use the TinyCore desktop logo, and create a set of spinner graphics for the startup progress. From the base plymouth initrd source directory:

mkdir -p $PLYROOT/plymouth-initrd/usr/share/plymouth/themes/TinyCore
cd $PLYROOT/plymouth-initrd/usr/share/plymouth/themes/TinyCore
cp /tmp/tcloop/Xlibs/usr/local/share/pixmaps/core.png header-image.png
# adjust the following values to change the size and thickness of the spinner graphics
OD=51
ID=49
CD=24
CW=3
for a in $(seq -w 1 36)
  do convert -size ${OD}x${OD} gradient:none-white -rotate 90 +distort polar $(($OD/2)) +repage -transverse -rotate $((${a#0}*10)) \
  \( -size ${ID}x${ID} xc:none -fill none -stroke white -strokewidth $(($CW*2)) -draw "circle $CD,$CD $CD,$CW" \) \
  -gravity center -compose src_out -composite +repage -crop ${OD}x${OD}+0+0 animation-00$a.png
done
for a in $(seq -w 1 36)
  do ln -s animation-00$a.png throbber-00$a.png
done
for a in box.png bullet.png entry.png lock.png
  do convert -size 1x1 xc:none $a
done
cat >TinyCore.plymouth <<EOF
[Plymouth Theme]
Name=TinyCore
Description=TinyCore Theme
ModuleName=two-step

[two-step]
ImageDir=/usr/share/plymouth/themes/TinyCore
HorizontalAlignment=.5
VerticalAlignment=.5
Transition=none
TransitionDuration=0.0
BackgroundStartColor=0x3b3738
BackgroundEndColor=0x3b3738
EOF

Finally, we need to tell plymouth about the default theme. Return to the base plymouth initrd source directory:

cd $PLYROOT/plymouth-initrd/etc/plymouth
cat >plymouthd.conf <<EOF
# Administrator customizations go in this file
[Daemon]
Theme=TinyCore
EOF

Create and install the plymouth initrd

To create the plymouth initrd archive, from the base of the plymouth initrd source directory:

cd $PLYROOT/plymouth-initrd
find | cpio -o -H newc | gzip -c >../plymouth-initrd.gz

Copy the new plymouth-initrd.gz file to the same directory as core.gz on your system. Edit the boot configuration file for your system, adding plymouth-initrd.gz after core.gz in the APPEND (or INITRD), separated by a comma and no spaces. Also add the keywords splash and logo.nologo in the APPEND line.

After bootup, the plymouthd daemon will continue to run in the background. If desired, it can be forced to exit with the following command:

sudo /bin/plymouth --quit

An easy place to do this automatically is to add this line to .xsession after the background is set.

Test the plymouth initrd

Reboot and enjoy!

If the splash does not work as expected, add plymouth.debug=file:/var/log/plymouthd-debug.log to the APPEND line in the boot configuration file. This may provide some help as to where the problem lies.

Print/export
QR Code
QR Code wiki:boot_splash (generated for current page)