diff options
-rw-r--r-- | core/modules/busybox/fbsplash-center.patch | 85 | ||||
-rw-r--r-- | core/modules/busybox/fbsplash-fillbg.patch | 50 | ||||
-rw-r--r-- | core/modules/busybox/module.build | 12 | ||||
-rw-r--r-- | core/modules/busybox/module.conf | 2 | ||||
-rwxr-xr-x | core/rootfs/rootfs-stage31/data/init | 43 |
5 files changed, 71 insertions, 121 deletions
diff --git a/core/modules/busybox/fbsplash-center.patch b/core/modules/busybox/fbsplash-center.patch deleted file mode 100644 index 748420fd..00000000 --- a/core/modules/busybox/fbsplash-center.patch +++ /dev/null @@ -1,85 +0,0 @@ -diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c -index 7b695b2..e3a55ca 100644 ---- a/miscutils/fbsplash.c -+++ b/miscutils/fbsplash.c -@@ -9,6 +9,7 @@ - * - put somewhere fbsplash.cfg file and an image in .ppm format. - * - run applet: $ setsid fbsplash [params] & - * -c: hide cursor -+ * -x: center image (if smaller than screen) - * -d /dev/fbN: framebuffer device (if not /dev/fb0) - * -s path_to_image_file (can be "-" for stdin) - * -i path_to_cfg_file -@@ -22,10 +23,11 @@ - */ - - //usage:#define fbsplash_trivial_usage --//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]" -+//usage: "-s IMGFILE [-c] [-x] [-d DEV] [-i INIFILE] [-f CMD]" - //usage:#define fbsplash_full_usage "\n\n" - //usage: " -s Image" - //usage: "\n -c Hide cursor" -+//usage: "\n -x Center image (if smaller than screen)" - //usage: "\n -d Framebuffer device (default /dev/fb0)" - //usage: "\n -i Config file (var=value):" - //usage: "\n BAR_LEFT,BAR_TOP,BAR_WIDTH,BAR_HEIGHT" -@@ -54,6 +56,7 @@ struct globals { - unsigned red_shift; - unsigned green_shift; - unsigned blue_shift; -+ bool bcenter_image; - }; - #define G (*ptr_to_globals) - #define INIT_G() do { \ -@@ -349,6 +352,8 @@ static void fb_drawimage(void) - char *read_ptr; - unsigned char *pixline; - unsigned i, j, width, height, line_size; -+ int xoffset = 0; -+ int yoffset = 0; - - if (LONE_DASH(G.image_filename)) { - theme_file = stdin; -@@ -396,6 +401,13 @@ static void fb_drawimage(void) - line_size = width*3; - pixline = xmalloc(line_size); - -+ if (G.bcenter_image) { -+ if (width < G.scr_var.xres) -+ xoffset = ((G.scr_var.xres - width) / 2) * G.bytes_per_pixel; -+ if (height < G.scr_var.yres) -+ yoffset = (G.scr_var.yres - height) / 2; -+ } -+ - if (width > G.scr_var.xres) - width = G.scr_var.xres; - if (height > G.scr_var.yres) -@@ -407,7 +419,7 @@ static void fb_drawimage(void) - if (fread(pixline, 1, line_size, theme_file) != line_size) - bb_error_msg_and_die("bad PPM file '%s'", G.image_filename); - pixel = pixline; -- src = G.addr + j * G.scr_fix.line_length; -+ src = G.addr + (j + yoffset) * G.scr_fix.line_length + xoffset; - for (i = 0; i < width; i++) { - unsigned thispix = fb_pixel_value(pixel[0], pixel[1], pixel[2]); - fb_write_pixel(src, thispix); -@@ -463,6 +475,7 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) - FILE *fp = fp; // for compiler - char *num_buf; - unsigned num; -+ unsigned optret; - bool bCursorOff; - - INIT_G(); -@@ -471,8 +484,10 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) - fb_device = "/dev/fb0"; - cfg_filename = NULL; - fifo_filename = NULL; -- bCursorOff = 1 & getopt32(argv, "cs:d:i:f:", -+ optret = getopt32(argv, "cxs:d:i:f:", - &G.image_filename, &fb_device, &cfg_filename, &fifo_filename); -+ bCursorOff = 1 & optret; -+ G.bcenter_image = 2 & optret; - - // parse configuration file - if (cfg_filename) diff --git a/core/modules/busybox/fbsplash-fillbg.patch b/core/modules/busybox/fbsplash-fillbg.patch index 51695ba7..8c8af905 100644 --- a/core/modules/busybox/fbsplash-fillbg.patch +++ b/core/modules/busybox/fbsplash-fillbg.patch @@ -1,30 +1,37 @@ diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c -index e3a55ca..daea60d 100644 +index 1419578..e920c06 100644 --- a/miscutils/fbsplash.c +++ b/miscutils/fbsplash.c -@@ -23,11 +23,12 @@ - */ +@@ -9,6 +9,7 @@ + * - put somewhere fbsplash.cfg file and an image in .ppm format. + * - run applet: $ setsid fbsplash [params] & + * -c: hide cursor ++ * -b: fill background with the color of top left pixel of image + * -d /dev/fbN: framebuffer device (if not /dev/fb0) + * -s path_to_image_file (can be "-" for stdin) + * -i path_to_cfg_file +@@ -47,10 +48,11 @@ + //kbuild:lib-$(CONFIG_FBSPLASH) += fbsplash.o //usage:#define fbsplash_trivial_usage --//usage: "-s IMGFILE [-c] [-x] [-d DEV] [-i INIFILE] [-f CMD]" -+//usage: "-s IMGFILE [-c] [-x] [-b] [-d DEV] [-i INIFILE] [-f CMD]" +-//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]" ++//usage: "-s IMGFILE [-c] [-b] [-d DEV] [-i INIFILE] [-f CMD]" //usage:#define fbsplash_full_usage "\n\n" //usage: " -s Image" //usage: "\n -c Hide cursor" - //usage: "\n -x Center image (if smaller than screen)" +//usage: "\n -b Fill background with color of top left pixel of image" //usage: "\n -d Framebuffer device (default /dev/fb0)" //usage: "\n -i Config file (var=value):" //usage: "\n BAR_LEFT,BAR_TOP,BAR_WIDTH,BAR_HEIGHT" -@@ -57,6 +58,7 @@ struct globals { +@@ -82,6 +84,7 @@ struct globals { + unsigned red_shift; unsigned green_shift; unsigned blue_shift; - bool bcenter_image; + bool bfill_background; }; #define G (*ptr_to_globals) #define INIT_G() do { \ -@@ -342,6 +344,23 @@ static void fb_drawprogressbar(unsigned percent) +@@ -369,6 +372,23 @@ static void fb_drawprogressbar(unsigned percent) G.nbar_colr, G.nbar_colg, G.nbar_colb); } @@ -48,27 +55,34 @@ index e3a55ca..daea60d 100644 /** * Draw image from PPM file -@@ -420,6 +439,10 @@ static void fb_drawimage(void) +@@ -440,6 +460,10 @@ static void fb_drawimage(void) bb_error_msg_and_die("bad PPM file '%s'", G.image_filename); pixel = pixline; - src = G.addr + (j + yoffset) * G.scr_fix.line_length + xoffset; + src = G.addr + (G.img_posy + j) * G.scr_fix.line_length + G.img_posx * G.bytes_per_pixel; + + if (G.bfill_background && j == 0) -+ fb_fillbackground(pixel, xoffset / G.bytes_per_pixel, yoffset, width, height); ++ fb_fillbackground(pixel, G.img_posx, G.img_posy, width, height); + for (i = 0; i < width; i++) { unsigned thispix = fb_pixel_value(pixel[0], pixel[1], pixel[2]); fb_write_pixel(src, thispix); -@@ -484,10 +507,11 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) +@@ -496,6 +520,7 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) + FILE *fp = fp; // for compiler + char *num_buf; + unsigned num; ++ unsigned optret; + bool bCursorOff; + + INIT_G(); +@@ -504,8 +529,10 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) fb_device = "/dev/fb0"; cfg_filename = NULL; fifo_filename = NULL; -- optret = getopt32(argv, "cxs:d:i:f:", -+ optret = getopt32(argv, "cxbs:d:i:f:", +- bCursorOff = 1 & getopt32(argv, "cs:d:i:f:", ++ optret = getopt32(argv, "cbs:d:i:f:", &G.image_filename, &fb_device, &cfg_filename, &fifo_filename); - bCursorOff = 1 & optret; - G.bcenter_image = 2 & optret; -+ G.bfill_background = 4 & optret; ++ bCursorOff = 1 & optret; ++ G.bfill_background = 2 & optret; // parse configuration file if (cfg_filename) diff --git a/core/modules/busybox/module.build b/core/modules/busybox/module.build index a6954efd..fe02a6f3 100644 --- a/core/modules/busybox/module.build +++ b/core/modules/busybox/module.build @@ -5,16 +5,14 @@ fetch_source() { git clone --depth 1 "${REQUIRED_GIT}" --branch "$REQUIRED_BRANCH" src || perror "Could not clone busybox git" fi cde src - # Patch image centering and background filling if not patched yet - if ! grep -q "bcenter_image" "miscutils/fbsplash.c"; then - git apply "${MODULE_DIR}/fbsplash-center.patch" || perror "Could not apply busybox patch for fbsplash image centering" - fi + # Patch background filling if not patched yet if ! grep -q "bfill_background" "miscutils/fbsplash.c"; then git apply "${MODULE_DIR}/fbsplash-fillbg.patch" || perror "Could not apply busybox patch for fbsplash background filling" fi - if ! grep -q 'suspend.*"no"' "util-linux/rtcwake.c"; then - git apply "${MODULE_DIR}/rtcwake-compat.patch" || perror "Could not apply busybox patch for rtcwake compat with util-linux" - fi + # TODO fix this patch + #if ! grep -q 'suspend.*"no"' "util-linux/rtcwake.c"; then + # git apply "${MODULE_DIR}/rtcwake-compat.patch" || perror "Could not apply busybox patch for rtcwake compat with util-linux" + #fi # make sure Makefile allows a preset CC if [ -n "$CC" ]; then sed -i -r 's/^CC\s*=\s*(\S)/CC ?= \1/' Makefile || perror "Could not patch Makefile" diff --git a/core/modules/busybox/module.conf b/core/modules/busybox/module.conf index cdd45a18..ac606abe 100644 --- a/core/modules/busybox/module.conf +++ b/core/modules/busybox/module.conf @@ -1,6 +1,6 @@ #!/bin/bash REQUIRED_GIT="git://git.busybox.net/busybox" -REQUIRED_BRANCH="1_25_1" +REQUIRED_BRANCH="1_32_0" REQUIRED_BINARIES="busybox" REQUIRED_DIRECTORIES=" /bin diff --git a/core/rootfs/rootfs-stage31/data/init b/core/rootfs/rootfs-stage31/data/init index 54102c8c..8d5baa0b 100755 --- a/core/rootfs/rootfs-stage31/data/init +++ b/core/rootfs/rootfs-stage31/data/init @@ -101,13 +101,38 @@ if [ "$SPLASH" -eq 1 ]; then MUTED_OUTPUT=1 clear echo -e "\033[?25l" >&4 - if [ -e "/etc/splash.ppm.gz" ]; then - fbsplash -x -b -s "/etc/splash.ppm.gz" || MUTED_OUTPUT= - elif [ -e "/etc/splash.ppm" ]; then - fbsplash -x -b -s "/etc/splash.ppm" || MUTED_OUTPUT= + screen_size="$(fbset | awk '$1 = /geometry/ {print $2" "$3}')" + screen_width="${screen_size%% *}" + screen_height="${screen_size#* }" + fbsplash_cfg="/etc/fbsplash.cfg" + fbsplash_ppm="/etc/splash.ppm.gz" + if [ -s "$fbsplash_ppm" ]; then + ppm_size="$(zcat "$fbsplash_ppm" | sed -n 2p)" else - echo "Splash screen requested, but not found in initramfs..." >&4 - MUTED_OUTPUT= + fbsplash_ppm="/etc/splash.ppm" + if [ -s "$fbsplash_ppm" ]; then + ppm_size="$(sed -n 2p "$fbsplash_ppm")" + else + echo "Splash screen requested, but not found in initramfs..." >&4 + MUTED_OUTPUT= + fi + fi + ppm_width="${ppm_size%% *}" + ppm_height="${ppm_size#* }" + ppm_height="${ppm_height%% *}" # make sure nothing weird is trailing + img_top="$(( ( screen_width - ppm_width ) / 2 ))" + img_left="$(( ( screen_height - ppm_height ) / 2 ))" + # just checking if nothing too weird is set + if [ -n "$img_left" ] && [ -n "$img_top" ] \ + && [ "$img_left" -ge 0 ] && [ "$img_left" -lt 8096 ] \ + && [ "$img_top" -ge 0 ] && [ "$img_top" -lt 8096 ]; then + printf "IMG_TOP=%d\nIMG_LEFT=%d\n" \ + "$img_top" "$img_left" + > "$fbsplash_cfg" + fbsplash -b -i "$fbsplash_cfg" -s "$fbsplash_ppm" || MUTED_OUTPUT= + else + # otherwise just use top left and be done with it + fbsplash -b -s "$fbsplash_ppm" || MUTED_OUTPUT= fi if [ -z "$MUTED_OUTPUT" ]; then exec 1>&4 2>&5 @@ -169,10 +194,8 @@ fi # Exam mode if [ -n "$SLX_EXAM" ]; then # Visual: Move splash screen to upper left corner - if [ -e "/etc/splash.ppm.gz" ]; then - fbsplash -b -s "/etc/splash.ppm.gz" & - elif [ -e "/etc/splash.ppm" ]; then - fbsplash -b -s "/etc/splash.ppm" & + if [ -s "$fbsplash_ppm" ]; then + fbsplash -b -s "$fbsplash_ppm" & fi fi |