This is my first howto so please be kind!
Having read an interesting thread about boot splashes here:
http://www.linuxquestions.org/questi...e-13-x-808823/
Which didn't seem to go anywhere I decided to see if I could do it. I've tried splashy etc but have had no success ( possibly becase I'm on a 64 bit system ), so I decided on using only the available tools, the result was this, please see the attached screen shot for an idea of what you are going to end up with.
If you like lots of text during boot up and think that eye candy is for wimps then move along there's nothing for you here
Most IMPORTANT we will be making some small but important changes to some system scripts, if you get it wrong you may find that your system is unbootable so please make sure that before you start you have an aternate way to boot your system eg a "live" cd or rescue partition and also backup files BEFORE you change them so that you can remove/fix any changes you have made, if you don't do this and you can't boot your system then you will have learned an important lesson!
First You need to make sure busybox is installed:
Code:
sudo slackpkg install mkinitrd
If you have not built an initrd before you will need to run this command
This will build an initrd ( not needed ) and also install busybox to /boot/initrd-tree/bin/busybox if you don't want to actually build an initrd then you could just extract the busybox binary from the archive like so:
Code:
mkdir initrd
cd initrd
tar -xvf /usr/share/mkinitrd/initrd-tree.tar.gz ./bin/busybox
If you do just extract the binary you will have to change the path to it in rc.S-Wrap
Second set up the frame buffer by adding : "vga=791 quiet" to your kernel options in your boot loader, in Grub2 ( which I use ) its the line starting with "linux" in the fisrst menu entry in the file /boot/grub/grub.cfg, I assume lilo is similar but I don't use it so if you do please consult the lilo documentation, update your bootloader as appoporiate.
Prepare a splash pic by grabbing a suitable picture eg::
http://www.technama.com/wp-content/u...r-1024x768.jpg
You will need to convert this to ppm format GIMP works fine or you can use imagemagic if you prefer as long as the size of the picture matches your frame buffer size ie 1024x768. And save it to ~/startup.ppm
Reboot and make sure your frame buffer is set up properly by switching to a vtty ( CTRL-ALT-F6 ) and entering this command:
Code:
/boot/initrd-tree/bin/busybox fbsplash -s ~/startup.ppm
If all is well you should see a nice pretty picture of tux,switch back to X ( ALT-F7 ), busybox will complain if the picture is the wrong size or format.
Third copy and paste the following two scripts into a text editor and save them to /etc/rc.d/rc.S-Wrap and /etc/rc.d/rc.M-Wrap ( you will need to be root for this ) eg:
Code:
sudo gedit
or
sudo vim
Then make them executable by using this command
Code:
sudo chmod +x /etc/rc.d/rc.S-Wrap /etc/rc.d/rc.M-Wrap
rc.S-Wrap:
Code:
#!/bin/sh
#rc.S-Wrap
#This is the wrapper for rc.S
#
if [ -f /etc/output.conf ];then
. /etc/output.conf
else
#1st time so guess
OUT_S=40
OUT_M=40
fi
TOTAL=$((OUT_S+OUT_M))
MULTI=$(echo "scale=2; 100/$TOTAL" | bc -l)
COUNT=1
OUT_S_CHECK=0
#size of term
COLOUMNS=$(tput cols)
BOX=$(($(tput lines)-3))
TEXTLINE=$(($(tput lines)-2))
#log output
S_LOG="Starting rc.S\n"
STARTUP=/etc/rc.d/rc.S
#no kerenel messages
setterm -msg off -cursor off -foreground green
tput clear
/boot/initrd-tree/bin/busybox fbsplash -i /boot/GSplash/fb.config -f /boot/GSplash/fbfifo -s /boot/GSplash/startup.ppm &
"$STARTUP" &> /boot/GSplash/fifo &
while read DATA
do
OUT_S_CHECK=$((OUT_S_CHECK+1))
#count number of echos for next time round
echo "$COUNT\n" > /boot/GSplash/fbfifo
COUNT=$(echo "scale=2; $COUNT+$MULTI" | bc -l)
S_LOG=$(echo "${S_LOG}\n${DATA}")
if [ ${#DATA} -lt $COLOUMNS ];then
XPOS=$((COLOUMNS/2-${#DATA}/2))
else
XPOS=0
DATA=${DATA:0:$COLOUMNS};
fi
tput cup $BOX 0
setterm -clear rest
tput cup $TEXTLINE $XPOS
echo -en "$DATA"
done < /boot/GSplash/fifo
#number of echos has changed
if (( OUT_S != OUT_S_CHECK ));then
echo "OUT_S=$OUT_S_CHECK" > /boot/GSplash/output.conf.temp
fi
echo -e "$S_LOG" > /tmp/S_LOG
rc.M-Wrap:
Code:
#!/bin/sh
#rc.M-Wrap
#This is the wrapper for rc.M
#
if [ -f /etc/output.conf ];then
. /etc/output.conf
else
#1st time so guess
OUT_S=40
OUT_M=40
fi
TOTAL=$((OUT_S+OUT_M))
MULTI=$(echo "scale=2; 100/$TOTAL" | bc -l)
COUNT=$(echo "scale=2; ($OUT_S*$MULTI)" | bc -l)
OUT_M_CHECK=0
#size of term
COLOUMNS=$(tput cols)
BOX=$(($(tput lines)-3))
TEXTLINE=$(($(tput lines)-2))
#log output
S_LOG="Starting rc.M\n"
STARTUP=/etc/rc.d/rc.M
( "$STARTUP";echo "EOFEOF" ) &> /boot/GSplash/fifo &
while read DATA
do
S_LOG=$(echo "${S_LOG}\n${DATA}")
#we need this because rc.local don't exit ??
if [ "X$DATA" != "XEOFEOF" ];then
OUT_M_CHECK=$((OUT_M_CHECK+1))
#count number of echos for next time round
echo "$COUNT\n" > /boot/GSplash/fbfifo
COUNT=$(echo "scale=2; $COUNT+$MULTI" | bc -l)
#make it touch the end ( i'm anal that way )
if [ $(echo "scale=2; $COUNT > 100 " | bc -l) = 1 ];then
COUNT=100
fi
if (( ${#DATA} < COLOUMNS ));then
XPOS=$((COLOUMNS/2-${#DATA}/2))
else
XPOS=0
DATA=${DATA:0:$COLOUMNS}
fi
tput cup $BOX 0
setterm -clear rest
tput cup $TEXTLINE $XPOS
echo -en "$DATA"
else
break;
fi
done < /boot/GSplash/fifo
if [ -f /boot/GSplash/output.conf.temp ];then
#count changed
mv /boot/GSplash/output.conf.temp /etc/output.conf
echo "OUT_M=$OUT_M_CHECK" >> /etc/output.conf
elif (( OUT_M != OUT_M_CHECK ));then
echo "OUT_S=$OUT_S" > /etc/output.conf
echo "OUT_M=$OUT_M_CHECK" >> /etc/output.conf
fi
#log it and tdy up
echo -e "$S_LOG" >> /tmp/S_LOG
echo "exit\n" > /boot/GSplash/fbfifo
clear
setterm -default
exit 0
Next we need to change /etc/inittab so first back it up
Code:
sudo cp /etc/inittab /etc/inittab.BAK
then open the file as root
Code:
sudo gedit /etc/inittab
Find the line:"si:S:sysinit:/etc/rc.d/rc.S" ( in my inittab its line 27 ) and change it to "si:S:sysinit:/etc/rc.d/rc.S-Wrap".
Now find the line:"rc:2345:wait:/etc/rc.d/rc.M" ( in my inittab its line 33 ) and change it to "rc:2345:wait:/etc/rc.d/rc.M-Wrap" and save it
Check your changes thoroughly. now prepare the various files we need, you should already have a splash screen prepared from earlier.
Make a config file ( details later just copy and paste for now )
Code:
BAR_LEFT=312
BAR_TOP=550
BAR_WIDTH=400
BAR_HEIGHT=11
BAR_R=64
BAR_G=64
BAR_B=64
And save it as ~/fb.config
Now run the following commands
Code:
sudo mkdir /boot/GSplash
sudo mkfifo /boot/GSplash/fbfifo
sudo mkfifo /boot/GSplash/fifo
sudo cp ~/startup.ppm ~/fb.config /boot/GSplash
Reboot and ( hopefully! ) you will now have a nice graphical boot!
What does what:
The fb.config file is reasonably self explanatory, the first 4 lines set the size and shape of the progress bar and the last 3 lines set the background colour of the bar, there seems to be no way to change the foreground colours of the bar oh well!
The two "wrapper" scripts just capture the output of the real startup scripts and format them nicely to display at the bottom of the screen.
The two pipes are used to control the status bar ( /boot/GSplash/fbfifo ) and and pipe the output from the startup scripts to the wrapper scripts ( /boot/GSplash/fifo ), "why not just use the '|' to pipe the output to the wrappers" I hear you cry, simple I need to get some variables from inside the while loops to the main script, as the '|' command starts a subshell the parent script can't read the variables from the child proccess, creating a pipe gets around this problem.
When you first boot with this in place the scripts can not know how many startup items you have and so can't accurately set the progress bar so they count the number of lines echoed to the bottom of the screen ready for the next rebbot, if your startup changes the number of echoes to the wrappers the progress bar counts will be updated ready for the next boot but this should only happen when you add or remove a startup item/serveice.
There is also a log file created in /tmp/S_LOG in case you want to examine the details of the boot up, if you don't want a log just comment out the appropriate lines in rc.S-Wrap and rc.M-Wrap.
What you can customize:
The splash pic, just create a new one at /boot/GSplash/startup.ppm making sure that the size and type is set correctly.
The size, shape and background colour of the progress bar as defined in /boot/GSplash/fb.config
The text colour can be changed at line 33 of /etc/rc.d/rc.S-Wrap, see the setterm man page for details.
I hope some people find this useful, any problems, additions or if I've forgotton somthing please post.