This is an old revision of the document!


A new enhanced bootsplash

I propose a new bootsplash mechanism. Currently, we can enable bootsplash by adding few options such as splash_bmp_load to /boot/loader.conf but it only displays an image file so I cannot reassure that the system works well. Therefore, I want to develop a new bootsplash mechanism which enables enhancements of attractiveness, such as progress bar. I think this will greatly improve user experience. I’m planning to implement this using src/sys/dev/fb, SYSINIT and kernel module system.

A bootsplash theme is a kernel module which implements these handler functions.

void theme_early_init(int screen_size_y, int screen_size_x)

Draw image before kernel thread mechanism is activated. It is called before copyright printed.

void theme_init(void)

Add a kernel thread to update screen periodically if needed. It is called after kernel thread mechanism is activated.

void theme_kmsg(const char *msg)

Print a message if needed. msg is a kernel messsage. It is called each lines of kernel messages.

void theme_update(int percentage

Advance the position of progress bar if needed. It is called before each SYSINIT element initialization.

void theme_uninit(void)

It is called after almost booted.

The bootsplash system holds a array of struct bsplash_layer below. Themes receives pointers of them by bsplash_new_*_layer*() and manipulate variables.

struct bsplash_layer{
  void* data;             /* The pointer to content of a file/text. */
  int screen_y, screen_x; /* Position on screen. */
  int image_y, image_x;   /* Stating on the image.     It is unused in text layers. */
  int height;             /* The height of this layer. It is unused in text layers. */
  int width;              /* The width of this layer.  It is unused in text layers. */
  int visibility;         /* 0: visible, 1: hidden */
  int z-index;            /* The stack order of layers. A layer with the greater value is drawn above layers with lesser value. */
};
  • void bsplash_drawImage(const char *filename): Draw image (.pcx or .bmp) in the screen. It determines file type by the extension.
  • struct bsplash_layer *bsplash_new_image_layer(const char *filename): Create a layer with a image (.pcx or .bmp) file. I want to support .png files with libpng.
  • struct bsplash_layer *bsplash_new_text_layer(const char *text): Create a layer with a text.
  • void bsplash_draw_layers(): Draw layers.
  • void bsplash_go_text_mode(): Go back into text mode.

Load splash images by /boot/splash/splash.4th (auto generated)

# loader.rc
include /boot/splash/splash.4th
 
# splash.4th
load -t splash_image /boot/splash/image_1.bmp
load -t splash_image /boot/splash/image_2.bmp
 
# ...

I'll develop a theme which can parse an extended configuration file based on https://wiki.freebsd.org/OliverFromme/BootLoader. It makes creating bootsplash theme more easier. The extended theme.conf looks like this:

theme_background="/boot/themes/default/biglogo.pcx"
theme_font="/boot/themes/default/default.font"
theme_bgcolor="0 0 0"           # black
theme_fgcolor="255 255 255"     # white
theme_options_xy="64 10"
theme_actions_xy="64 82"
 
# ***** extended configuration are as follows *****
extended_theme_enable="YES" # it enables configurations below
 
#
#  Bootsplash system loads files specified in `theme_progress_images' to 
#  draw a progress bar.
#
#  `%' will be replaced with 10,20,30,...,100. You have to prepare 
#  progress_bar10.pcx, progress_bar20.pcx, ..., progress_bar100.pcx in 
#  /boot/themes/default.
#
theme_progress_bar_enable="YES"
theme_progress_bar_images="/boot/themes/default/progress_bar%.pcx"
theme_progress_bar_xy="150 300"
 
#
#  Bootsplash system loads files speicifed in `theme_boot_animation_images' 
#  to render a animation on boot.
#
#  `%' will be replaced with 1,2,3,...,100.
#  You have to prepare animation1.pcx at least in /boot/themes/default.
#
theme_boot_animation_enable="YES"
theme_boot_animation_images="/boot/themes/default/animation%.pcx"
theme_boot_animation_xy="150 100"
theme_boot_animation_fps="15"
theme_boot_animation_repeat="YES"
 
# Bootsplash system updates it per lines.
theme_boot_kmsg_enable="YES"
theme_boot_kmsg_xy = "150 400"
  • Implementation of a new bootsplash mechanism in the kernel
  • Makefile and scripts for creating bootsplash themes
  • Example themes
  • May 19: Start of coding
  • May 19 - May 25: implement direct drawing (only draw an image file at once just like splash_bmp_load, but it enables rendering multiple image files)
  • May 26 - June 8: add changes to src/sys
  • June 9 - June 15: write Makefile and scripts for creating themes
  • June 16 - June 22: create and enjoy a flip book in bootsplash using direct drawing
  • July 27: Mid-term evaluations deadline
  • June 23 - June 29: print characters in a framebuffer
  • June 30 - July 20: implement layered drawing (draw stacked images and text at once)
  • July 21 - July 27: support layered drawing in scripts for creating themes
  • July 28 - 'pencils down' date: create themes
  • August 11: End of coding (soft)
  • August 18: End of coding (hard)
  • Write code in VM on VirtualBox
  • make and copy generated kernel and modules to /boot
  • Launch .vdi of the VM with QEMU on host OS
  • Check output and dmesg
  • make buildinstall on a real machine.
  • boot it
  • check output and dmesg
  • summerofcode2014/bootsplash.1399776163.txt.gz
  • Last modified: 2014/05/11 02:42
  • by SeiyaNuta