This is an old revision of the document!
A new enhanced bootsplash
Project description
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.
Approach to solving the problem
A bootsplash theme is a kernel module which implements these handler functions.
functions implemented in theme
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.
API for themes
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.
loader.rc
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 # ...
Integration with the existing grahpical bootloader
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"
Deliverables
- Implementation of a new bootsplash mechanism in the kernel
- Makefile and scripts for creating bootsplash themes
- Example themes
Milestones
| period | milestone | status |
|---|---|---|
| May 19 - May 25 | implement direct drawing | done |
| May 26 - June 8 | add changes to src/sys | done |
| June 9 - June 15 | write Makefile and scripts for creating themes | done |
| June 16 - June 22 | create and enjoy a flip book in bootsplash using direct drawing | done |
| June 23 - June 29 | work on unimplemented features (e.g. support RLE4) | in progress |
| June 28 | Mid-term evaluation deadline | |
| June 30 - July 20 | implement layered drawing | |
| July 21 - July 27 | support layered drawing in scripts for creating themes | |
| July 28 - 'pencils down' date | create themes and refactoring | |
| August 18 | End of coding (hard) | |
Test Plan
#1
- Write code in VM on VirtualBox
makeand copy generated kernel and modules to /boot- Launch .vdi of the VM with QEMU on host OS
- Check output and dmesg
#2
make buildinstallon a real machine.- boot it
- check output and dmesg