socsvn commit: r271117 - in soc2014/seiya/bootsplash: etc sys/dev/fb
seiya at FreeBSD.org
seiya at FreeBSD.org
Sat Jul 19 07:23:16 UTC 2014
Author: seiya
Date: Sat Jul 19 07:23:14 2014
New Revision: 271117
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=271117
Log:
support a progress bar
Modified:
soc2014/seiya/bootsplash/etc/rc
soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c
Modified: soc2014/seiya/bootsplash/etc/rc
==============================================================================
--- soc2014/seiya/bootsplash/etc/rc Sat Jul 19 06:27:24 2014 (r271116)
+++ soc2014/seiya/bootsplash/etc/rc Sat Jul 19 07:23:14 2014 (r271117)
@@ -124,7 +124,18 @@
fi
files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* ${local_rc} 2>/dev/null`
+files_num=`echo "$files" | wc -l`
+files_num_per_10=`expr $files_num / 10` # FIXME
+i=0
+BOOT_PROGRESS=0
for _rc_elem in ${files}; do
+ i=`expr $i + 1`
+ if [ $files_num_per_10 -eq $i ]; then
+ BOOT_PROGRESS=`expr $BOOT_PROGRESS + 10`
+ kenv BOOT_PROGRESS=$BOOT_PROGRESS > /dev/null
+ i=0
+ fi
+
case "$_rc_elem_done" in
*" $_rc_elem "*) continue ;;
esac
Modified: soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c
==============================================================================
--- soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c Sat Jul 19 06:27:24 2014 (r271116)
+++ soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c Sat Jul 19 07:23:14 2014 (r271117)
@@ -59,7 +59,14 @@
static int animation_x = -1;
static int animation_width = -1;
static int animation_height = -1;
-static int animation_enabled = 1;
+static int animation_enabled = 1; // 1:enabled, 0:disabled
+static int progress_bar_y_origin = -1;
+static int progress_bar_y = -1;
+static int progress_bar_x = -1;
+static int progress_bar_width = -1;
+static int progress_bar_height = -1;
+static int progress_bar_enabled = 1; // 1:enabled, 0:disabled
+
int
bsplash_early_init(video_adapter_t *_adp)
@@ -141,6 +148,56 @@
}
freeenv(s);
+ // load "bsplash_progress_bar_y_origin"
+ if ((s = getenv("bsplash_progress_bar_y_origin")) == NULL) {
+ if (bootverbose)
+ printf("bsplash: cannot load \"bsplash_progress_bar_y_origin\"\n");
+ progress_bar_enabled = 0;
+ } else {
+ progress_bar_y_origin = strtol(s, NULL, 10);
+ }
+ freeenv(s);
+
+ // load "bsplash_progress_bar_y"
+ if ((s = getenv("bsplash_progress_bar_y")) == NULL) {
+ if (bootverbose)
+ printf("bsplash: cannot load \"bsplash_progress_bar_y\"\n");
+ progress_bar_enabled = 0;
+ } else {
+ progress_bar_y = strtol(s, NULL, 10);
+ }
+ freeenv(s);
+
+ // load "bsplash_progress_bar_x"
+ if ((s = getenv("bsplash_progress_bar_x")) == NULL) {
+ if (bootverbose)
+ printf("bsplash: cannot load \"bsplash_progress_bar_x\"\n");
+ progress_bar_enabled = 0;
+ } else {
+ progress_bar_x = strtol(s, NULL, 10);
+ }
+ freeenv(s);
+
+ // load "bsplash_progress_bar_height"
+ if ((s = getenv("bsplash_progress_bar_height")) == NULL) {
+ if (bootverbose)
+ printf("bsplash: cannot load \"bsplash_progress_bar_height\"\n");
+ progress_bar_enabled = 0;
+ } else {
+ progress_bar_height = strtol(s, NULL, 10);
+ }
+ freeenv(s);
+
+ // load "bsplash_progress_bar_width"
+ if ((s = getenv("bsplash_progress_bar_width")) == NULL) {
+ if (bootverbose)
+ printf("bsplash: cannot load \"bsplash_progress_bar_width\"\n");
+ progress_bar_enabled = 0;
+ } else {
+ progress_bar_width = strtol(s, NULL, 10);
+ }
+ freeenv(s);
+
/*
* for debugging
*/
@@ -155,6 +212,13 @@
animation_y_origin,
animation_height,
animation_width);
+ printf("bsplash: progress bar is %s (y,x)=(%d,%d), img_y=%d, height=%d, width=%d\n",
+ (progress_bar_enabled)? "enabled" : "disabled",
+ progress_bar_y,
+ progress_bar_x,
+ progress_bar_y_origin,
+ progress_bar_height,
+ progress_bar_width);
}
/*
@@ -223,8 +287,11 @@
freeenv(s);
}
- // boot takes too long
- if (progress >= 100 || count > 50 /* FXIME */){
+ // update the progress bar
+ draw_bmp(progress_bar_y_origin + ((progress / 10) * progress_bar_height),
+ progress_bar_y, progress_bar_x, progress_bar_width, progress_bar_height);
+
+ if (progress >= 100 /* boot has finished */ || count > 50 /* FIX<E */){
/* terminate boot splash */
vidd_set_mode(adp, M_TEXT_80x25);
kthread_exit();
More information about the svn-soc-all
mailing list