Jaunty Plymouth PPA Plugin Development Tutorial (so far)

Jonathan Greig redteam316 at gmail.com
Sat Mar 14 01:19:10 PDT 2009


Ray/Charlie,
I know you still need some documentation. I posted this on the Ubuntu forums
in the Plymouth PPA Thread thats been started (
http://ubuntuforums.org/showthread.php?p=6892088#post6892088 ) to help
others get involved with the project. Towards the bottom, I figured out how
to get a single plugin without neccessarily relying on the rest of the full
source, so a one-off makefile shouldn't be too hard now that I got that
working. Most of the info here I collected from the mailing list and my own
experimentation. Maybe some of this could go into a readme.ubuntu file?

I'm also planning on making PHENIX (Plymouth Hyper-Extension for *NIX), a
plugin creator/switcher/tester. The script below will eventually be part of
it. The name deriving from mythology as Plymouth is rising in place of RHGB
and Usplash. Extension being somewhat synonymous with plug-in.

Also I do have some more questions:
1) I thought I read somewhere that plugins could be combined. By this, I'm
assuming that they need to be constructed as separate .cpp/.h files so the
creator can pick and choose what to include? Or is there something else in
mind later down the road for Plymouth?
2) I thought I read somewhere that OpenGL could be integrated into plymouth.
Are there any examples or did I just overlook something. If OpenGL could be
used, technically, couldn't any other lib such as SDL be used also? What
limitations are there on other libs?
3) I'm still learning the plymouth API bit by bit. Is there an easy way to
poll for keyboard strokes without invoking a prompt? I know the text plugin
has something like this but the function is empty? Think Galaxan Plymouth (I
hope this doesn't sound too odd lol but this would be more entertaining at
bootup).
4) What about sounds?


Thoughts? Errors? Typos? Bueller?

-----------------------------------------------------

[SIZE="6"][b]Jaunty Plymouth PPA Plugin Development Tutorial[/b][/SIZE]
[b]1)[/b] Make sure you have the proper driver installed for your graphics
card.
The NVIDIA Blob 180.37 appears to work fine with kernel 2.6.28-9 for 8xxx
series GPU's.

[b]2)[/b] Create a file in the "/etc/apt/sources.list.d" directory called
"PlymouthPPA.list"

[b]3)[/b] Open up PlymouthPPA.list and add the following lines to it:
[code]
## PPA for Plymouth Developers
deb http://ppa.launchpad.net/plymouth-dev/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/plymouth-dev/ppa/ubuntu jaunty main
[/code]

[b]4)[/b] Paste the following text into a file and save it as
PlymouthPPA.key (This is for package authentication)
[code]
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.0.10

mI0ESZry+wEEALgDkQimObkreCwcP37Cqtn/UFSCFn4/T6yG3+x58O3fQP8Iu7O7krAK9UuC
VqemCdhqIz1SVHsKQXa6uCtMRW0Nx0OD7F1kxH9mNwNCXe52zD0ppRsK//Gjj+MCkZV3Thi1
0o2R1Upj6GeAxkvF7Q/5IxRMFWWpUjLShnD3YrhfABEBAAG0JUxhdW5jaHBhZCBQUEEgZm9y
IFBseW1vdXRoIERldmVsb3BlcnOItgQTAQIAIAUCSZry+wIbAwYLCQgHAwIEFQIIAwQWAgMB
Ah4BAheAAAoJENLY63m8yx9XV9IEALBEHP+5M+mzzUIbW8WWmYrs/zsKc74kMQ2/M1V0/+Jz
jUDKAaDO7IO/spuOwrLldPEyVeJaadhYkuwDUi3/75P6wO56n/NdZxAE4J8eDdurOPTF1OAn
pNVpwhf/3dcDOtU2OmyPnQ/8xc9zo4sXqVj3nfl6PK726GOCpsts6vcp
=zUTq
-----END PGP PUBLIC KEY BLOCK-----
[/code]

[b]5)[/b] Add the key either through synaptic/adept or with the terminal:
[code]
sudo apt-key add PlymouthPPA.key
[/code]

[b]6)[/b] Open up synaptic/adept or a terminal and update your package list
and install these packages:
[code]
sudo apt-get update
sudo apt-get install git-core build-essential g++ gcc make automake autoconf
libcairo-dev libtool libpango1.0-dev libgtk2.0-dev libgtk2.0-0
sudo apt-get install plymouth libplymouth2 libplymouth-dev
[/code]

[b]7)[/b] Open up your /boot/grub/menu.list and append vga=XXX to your
kernel line, where XXX is the number for your desired resolution.
If you don't know what this should be, you can use vga=ask. If your driver
supports KMS, then this step is probably completely unneccesary.

[b]8 )[/b] At this point, you should have plymouth installed and can reboot
to see the wacky bizcom/fedora hack. So reboot and when you're back you can
install the plymouth source so you can improve it or create plugins.

[b]9)[/b] Create a directory somewhere that you plan to download the source
to. This can be /home/username/plymouth or whatever location you desire.

[b]10)[/b] Open up a terminal, cd to the plymouth directory you just made,
and git the source code :)
[code]
git clone git://git.freedesktop.org/git/plymouth
[/code]

[b]11)[/b] Now go to the newly created plymouth directory and it will have a
file called autogen.sh in it. In the terminal type:
[code]
./autogen.sh --prefix=/usr --with-logo=/usr/share/plymouth/bizcom.png
[/code]
replacing bizcom.png with something a little nicer if you like.

[b]12)[/b] Now if you didn't get any error messages, you should be ready to
type:
[code]
make
[/code]
from there, you can "sudo make install" if you wish but you're probably
better off not doing so unless you are developing for the plymouth library
rather than a plugin. If you just want to make your own plugin, then keep
reading...

[b]13)[/b] Browse to the
"/yourplymouthgitdirectory/plymouth/src/plugins/splash/plugin-name"
directory and you will notice that there are Makefiles in each splash
directory. Open a terminal here and type:
[code]
make
[/code]
on a successful compilation of the plugin, you will notice a new directory
called .libs (if you can't see it, then enable viewing of hidden files and
folders). This directory is where the .so plugin file is stored. To install
the built plugin, type:
[code]
sudo make install
[/code]
in the plugin directory where you made it.

[SIZE="5"][b]How to change the default plugin for bootup[/b][/SIZE]
[code]
sudo /usr/sbin/plymouth-set-default-plugin spinfinity
[/code]
replace spinfinity with whatever plugin name you want to use. For instance,
replace spinfinity with solar.

[SIZE="5"][b]How to test a plugin without rebooting[/b][/SIZE]

If you want to test the plugin without having to restart the machine, save
this script and run it in a terminal:
sudo sh phenix-test-plugin.sh [TimeInSeconds]
[code]
#!/bin/bash
# Phenix - Plymouth Hyper-Extension for *NIX
# Plugin Testing Script
# Copyright (c) 2009 Jonathan Greig (red_team316)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
USA.

echo "Testing Plymouth Plugin..."
init 3                             # change to runlevel 3 (typical runlevel
for text console login)
chvt 8                             # switch to virtual terminal 8
plymouthd                          # start the plymouth daemon
sleep 1                            # wait a second
plymouth --show-splash             # show splash while we...
sleep "$1"                         # wait X amount of seconds before
quitting
plymouth --quit                    # stop plymouth
init 5                             # change to runlevel 5 (typical runlevel
for desktop login)
chvt 7                             # switch back to the desktop
echo "Done."
[/code]

[SIZE="5"][b]The proper way to install a plugin from source[/b][/SIZE]
In the "/yourplymouthgitdirectory/plymouth/src/plugins/splash/plugin-name"
directory type:
[code]
make
sudo make install
sudo /usr/sbin/plymouth-set-default-plugin the-name-of-the-plugin
sudo /usr/libexec/plymouth/plymouth-update-initrd
[/code]

[SIZE="5"][b]How to make a single plugin[/b][/SIZE]
On Jaunty, with the PPA packages and git source installed, you can copy one
of the plugin directories to somewhere else on your drive and work on it
from there.
[code]
pkg-config --cflags plymouth-1
[/code]
returns "-I/usr/include/plymouth-1", so you will need to add the extra ply/
or plybootsplash/ in your #include lines. Otherwise you can simply specify
them manually at the terminal as such:
[code]
gcc -fPIC -I/usr/include/plymouth-1/plybootsplash
-I/usr/include/plymouth-1/ply `pkg-config --libs plymouth-1` -shared -o
plugin.so plugin.c
[/code]
You will need to remove the include "config.h" from your plugin. Since
you're working separate of the git source, it isn't really needed, but it's
still good to take a look at config.h to familiarize yourself with whats in
there.
You will also need to add several #defines with the headers at the top of
the plugin and manually specify the paths to the required files there. If
you are wondering what these #defines originally were, then look at the
Makefile
that was generated for the splash in the git source. Once you that done,
your splash should build with no problems. plugin.so will be generated in
the same directory. You can now manually transfer the .so file to
/usr/lib/plymouth/whateveryourpluginnameis.so and the graphics folder to
/usr/share/plymouth/whateveryourpluginnameis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/plymouth/attachments/20090314/1686f70e/attachment.html 


More information about the plymouth mailing list