Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1043095
  • 博文数量: 326
  • 博客积分: 10135
  • 博客等级: 上将
  • 技术积分: 2490
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-22 23:53
文章分类

全部博文(326)

文章存档

2014年(1)

2012年(4)

2011年(1)

2010年(4)

2009年(41)

2008年(44)

2007年(63)

2006年(168)

我的朋友

分类: LINUX

2006-05-28 15:38:33

Introduction

Welcome to the graphical world of Linux!

This is the home of the graphical boot process for the linux kernel although it is not yet a part of the official kernel. It is, however included in several major distributions. If your favorite linux doesn't include this patch in their kernel send them an email requesting it to be included!

Features:

  • Nice graphics (JPEG)
  • Antialiased text rendering (TrueType)
  • Animations (MNG)
  • Progress Bar
  • Display of boot messages above or below a graphic. ("verbose" and "silent" modes)
  • Fully themeable

Now Available for Linux Kernel 2.6.15!

There's a Bootsplash Mailinglist now. Go to the subscription page to join the discussion, get help or just for the latest news.

- boot messages are shown, as normal.

- boot messages are hidden and, in this example, a gradient filled progress bar is shown as well as TrueType text. Pressing F2 changes to Verbose mode.

 

Kernel stuff

ATTENTION!
Please read the following information very carefully. This kernel patch is free software; you may redistribute it under the terms of the GNU General Public License. This kernel patch comes with absolutely no warranty.

Requirements

* To use the Linux bootsplash screen, you have to recompile your kernel. The bootsplash patch is available for 2.4.18-2.4.22 and 2.6.0-test9. The patches should also apply to newer versions of the Linux kernel.

If you are not familiar with this procedure, please ask one of your geek friends or get hold of a distribution that already comes with the bootsplash screen.

* You need to have a working framebuffer device with 16bit colordepth, preferably vesafb (i.e. vga=0x317 for 1024x768)

* You need a bootsplash theme. Get one or .

* You need the splash utility, see .

If all requirements are met, lets get started:

Patching and Compiling the Kernel

First off, make sure, your kernel sources are installed in /usr/src/linux. Now download the version of the bootsplash patch that fits to your kernel.

  • bootsplash version 3.1.6 (2006/1/22, Linux 2.6.15)
  • bootsplash version 3.0.7 (2006/1/22, Linux 2.4.30)

Note: check for bootsplash patches not mentioned here. The patches might work well with other kernel versions. However, this is not tested.

 

yourbox:~ # cd /usr/src/linux
yourbox:/usr/src/linux # patch -p1 < /path/to/bootsplash-3.0.7-2.4.20-vanilla.diff
patching file drivers/char/console.c
patching file drivers/char/keyboard.c
patching file drivers/char/n_tty.c
patching file drivers/video/Config.in
patching file drivers/video/Makefile
patching file drivers/video/fbcon-jpegdec.c
patching file drivers/video/fbcon-jpegdec.h
patching file drivers/video/fbcon-splash.c
patching file drivers/video/fbcon-splash.h
patching file drivers/video/fbcon-splash16.c
patching file drivers/video/fbcon.c
patching file include/video/fbcon.h
patching file kernel/panic.c
yourbox:/usr/src/linux #

Now you have to change your kernel configuration, using make config, make menuconfig or make xconfig. Go to "Console drivers" -> "Frame-Buffer support" and select "VESA VGA graphics console" (or possibly another framebuffer driver, if one is available for your graphics hardware) and turn on "Use splash screen instead of boot logo". Also be sure to enable "Initial Ramdisk support" in "Block Devices" Save your new config and compile a new kernel. Copy the kernel to your /boot directory and make sure that you have a boot entry for it in your bootloader config.

Preparing the picture

As there are no filesystems accessible when the bootsplash is first shown, it can be attached to an initial ramdisk. If you dont have an initial ramdisk normally, just use an empty one.

Get the sources of the bootsplash utilities from:

# cd ~/splash
# tar xvjf splashutils.tar.bz2
splashutils/
splashutils/Makefile
splashutils/splash.c
[..]
splashutils/ChangeLog
splashutils/COPYING
# cd splashutils
# make splash
gcc -Os -Wall -c -o splash.o splash.c
gcc -Os -Wall -o splash splash.o
strip splash
# cp splash /sbin/
# cd ..

Next you need to attach the picture plus a header, defining text windows and such to the initrd (in the example, this is done for 1024x768. specify other resolutions, if available) :

/sbin/splash -s -f /etc/bootsplash/themes/yourtheme/config/bootsplash-1024x768.cfg >> /boot/initrd.splash

If you want to use more than one resolution for the bootsplash, call the above command several times, once for each resolution config file.

Finishing up

run lilo, if appropriate, and reboot your system. You should get the bootsplash screen.

During boot you will likely see the following in your messages:

vesafb: framebuffer at 0xf0000000, mapped to 0xdc816000, size 65472k
vesafb: mode is 1024x768x16, linelength=2048, pages=41
vesafb: protected mode interface info at c000:5137
vesafb: scrolling: redraw
vesafb: directcolor: size=0:5:6:5, shift=0:11:5:0
Looking for splash picture.... silenjpeg size 11165 bytes, found (1024x768, 4912 bytes, v3)
Got silent jpeg.

User space stuff

  1. When you have a kernel with bootsplash capability (see ) you can use the bootsplash and control it's behaviour with a set of userspace utilities:

    • "splash" is used to attach a picture to an initrd or change the picture while the system is running. splash can also be used to trigger command execution when a specified runlevel script is reached. This can for example be used to show animations during bootup.

    • "fbresolution", written by Florent Villard (warly@mandrakesoft.com) shows the currently used resolution.

    • "fbmngplay" is a utility to display mng animations on the framebuffer console using libmng. fbmngplay is official part of libmng.

    • "fbtruetype" is a utility to render text using a truetype font to the framebuffer console.

      The kernel bootsplash can be configured using the /proc/splash interface. To be able to use script triggered startup actions such as moving a progress bar, you have to patch your runlevel scripts to call the "splash.sh" script.

      Download these utilities at



  2. The "splash" utility. The splash utility is a multifunction tool that allows you to:

    • attach pictures to an initrd.
    • attach a jpg picture including the bootsplash config header to an initrd with:
      splash -s -f \ /etc/bootsplash/themes/current/config/bootsplash-1024x768.cfg \ >> /boot/initrd
      You can add several pictures like this, if you intend to boot your machine with several resolutions.

    • use a new picture on the fly

    • show a new bootsplash graphics on the fly on the first console by using
      splash -s -u 0 \ /etc/bootsplash/themes/current/config/bootsplash-1024x768.cfg
      any other console can be used by specifying -u [console number] where the console number starts at 0 (i.e. by default you have 0-5)

    • trigger events during bootup

      we suggest that you add a function to your init scripts that is called every time an init script is started. This can either be done in the runlevel scripts themselves or by the script/program scheduling it (i.e. /etc/init.d/rc)

      function rc_splash()
      {
      test "$SPLASH" != "no" && test "$_rc_splash" -eq 1 && /sbin/splash "$1"
      progress=$(( $progress + 1 ))
      }
      when adding the rc_splash call to your runlevel script scheduler, do it
      about like this:
      for i in $runrc/S${rex}*; do
      [..]
      # send information to bootsplash handler.
      rc_splash "$i start"
      [..]
      done

      the splash program will look for the file
      /etc/bootsplash/themes/current/config/animations.cfg which looks like the following:

      [ .. ]
      fsck start:bootanim start fsck.mng
      fsck stop:bootanim stop
      [ .. ]

      so when %i is "fsck" and the runlevel script is executed during system start, the bootanim start fsck.mng

      Basically, it's a list of bootup hooks that are associated with a command to be executed when a certain service is started/stopped during boot/shutdown.

      The syntax is this:
      [service] [start|stop]:[command-to-execute]

      "Service" is almost always the name of an executed init script. There are some additional hooks for finetuning. See the SuSE 8.1 theme's config file "animations.cfg"


  3. The splash scripts


    • The splash.sh wrapper script, which:

      - paints a truetype rendered text during bootup and shutdown at predefined coordinates
      - moves a progress bar, if there is one, using the proc interface.
      - reads the config file /etc/bootsplash/themes/current/config/bootsplash-[X]x[Y].cfg

    • The bootanim wrapper script.
      This script starts/stops animations played with fbmngplay. It looks for these animations in /etc/bootsplash/themes/current/animations/ per default. It will likely be called from the file animations.cfg. When you want to play an animation when apache is started, you would write: apache start:bootanim start animation.mng To fade out an animation, run 'bootanim stop'. Bootanim can also play multiple animations in a row, each synchronized to a certain point in bootup. This can be used to keep the last picture of an animation visible after playing the animation. To achieve this, use 'bootanim start' with option -m and multiple mng files. To move on to the next animation, use 'bootanim next' later on. Before playing the next animation (esp. at the same position as before), you need to find a hook that can properly stop the boot animation (esp. when playing looped animations). It's also advised to have an entry in your config file that stops running animations as soon as the final system runlevel is reached: master:bootanim stop


  4. Progress bar handling in the init scripts.

    To have a progress bar during bootup you need the following


    • A theme that contains a progress bar. Look in the Theme section
      for information on how to add a progress bar and for example themes.

    • The above function rc_splash (or comparable functionality)

    • The splash.sh script (called from rc_splash as a wrapper to the splash utility)
      Additionally you need to make your runlevel script scheduler (i.e. /etc/init.d/rc) aware of the number of scripts to be executed in the current runlevel:

      #
      # initialize boosplash progressbar variables
      #
      runrc=/etc/init.d/rc${RUNLEVEL}.d
      prerc=/etc/init.d/rc${PREVLEVEL}.d

      SSC=($runrc/S*)
      case "$SSC" in
      *\*) sscripts=0 ;;
      *) sscripts=${#SSC[*]}
      esac
      export sscripts
      if test "$PREVLEVEL" != "N" ; then
      KSC=($prerc/K*)
      case "$KSC" in
      *\*) kscripts=0 ;;
      *) kscripts=${#KSC[*]}
      esac
      export kscripts
      fi

      if [ "$PREVLEVEL" == "N" -a "$RUNLEVEL" == "5" ]; then
      export progress=16
      sscripts=$(( $sscripts+15 ))
      else
      export progress=0
      fi

      To switch the bootsplash off when the final runlevel is reached you can add the following to the runlevel script scheduler at the according place:

      rc_splash "master"

      This will cause most themes to switch off the bootsplash screen.


  5. What distributions support this per default?

    Currently only SuSE Linux 8.2 supports all features of the bootsplash v3. Please note that SuSE Linux 8.2 holds the themes in /usr/share/splash/themes. It keeps a temporary copy of the currently used config files in /etc/bootsplash to be used when /usr is not available (i.e. on a different partition). Patches to runlevel scripts of all distributions are welcome and can be linked here, if desired. Contact

阅读(909) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~