summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2014-07-05 12:46:55 +0200
committerSimon Rettberg2014-07-05 12:46:55 +0200
commit1859078155bd8637e703b24e2ed7e22b69e1aff3 (patch)
treec25c9a56f1422db6257d0118b2f246edc15fead8
parent[useradd.inc] Fix add_user in case the user and their group exists and the gr... (diff)
downloadtm-scripts-1859078155bd8637e703b24e2ed7e22b69e1aff3.tar.gz
tm-scripts-1859078155bd8637e703b24e2ed7e22b69e1aff3.tar.xz
tm-scripts-1859078155bd8637e703b24e2ed7e22b69e1aff3.zip
[busybox] Add patch for background filling
-rw-r--r--remote/modules/busybox/fbsplash-fillbg.patch74
-rw-r--r--remote/modules/busybox/module.build5
2 files changed, 78 insertions, 1 deletions
diff --git a/remote/modules/busybox/fbsplash-fillbg.patch b/remote/modules/busybox/fbsplash-fillbg.patch
new file mode 100644
index 00000000..f4ee0f73
--- /dev/null
+++ b/remote/modules/busybox/fbsplash-fillbg.patch
@@ -0,0 +1,74 @@
+diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
+index 2201108..2195bcc 100644
+--- a/miscutils/fbsplash.c
++++ b/miscutils/fbsplash.c
+@@ -23,11 +23,12 @@
+ */
+
+ //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:#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 {
+ 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)
+ G.nbar_colr, G.nbar_colg, G.nbar_colb);
+ }
+
++/**
++ * Fill screen around image with given color
++ */
++static void fb_fillbackground(unsigned char* pixel, const int xoffset, const int yoffset, const int width, const int height)
++{
++ int i, j;
++ unsigned thispix = fb_pixel_value(pixel[0], pixel[1], pixel[2]);
++
++ for (j = 0; j < G.scr_var.yres; j++) {
++ unsigned char *src = G.addr + j * G.scr_fix.line_length;
++
++ for (i = 0; i < G.scr_var.xres; i++) {
++ if ((j < yoffset || j >= yoffset + height) || (i < xoffset || i >= xoffset + width))
++ fb_write_pixel(src + i * G.bytes_per_pixel, thispix);
++ }
++ }
++}
+
+ /**
+ * Draw image from PPM file
+@@ -418,6 +437,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;
++
++ if (G.bfill_background && j == 0)
++ fb_fillbackground(pixel, xoffset / G.bytes_per_pixel, yoffset, width, height);
++
+ for (i = 0; i < width; i++) {
+ unsigned thispix = fb_pixel_value(pixel[0], pixel[1], pixel[2]);
+ fb_write_pixel(src, thispix);
+@@ -482,10 +505,11 @@ 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:",
+ &G.image_filename, &fb_device, &cfg_filename, &fifo_filename);
+ bCursorOff = 1 & optret;
+ G.bcenter_image = 2 & optret;
++ G.bfill_background = 4 & optret;
+
+ // parse configuration file
+ if (cfg_filename)
diff --git a/remote/modules/busybox/module.build b/remote/modules/busybox/module.build
index 135ba8a1..73936e49 100644
--- a/remote/modules/busybox/module.build
+++ b/remote/modules/busybox/module.build
@@ -2,10 +2,13 @@
fetch_source() {
git clone --depth 1 "${REQUIRED_GIT}" --branch "$REQUIRED_BRANCH" src || perror "Could not clone busybox git"
cd src || perror "Could not cd to src"
- # Patch image centering if not patched yet
+ # Patch image centering and background filling if not patched yet
if ! grep -q "bcenter_image" "miscutils/fbsplash.c"; then
git apply "../fbsplash-center.patch" || perror "Could not apply busybox patch for fbsplash image centering"
fi
+ if ! grep -q "bfill_background" "miscutils/fbsplash.c"; then
+ git apply "../fbsplash-fillbg.patch" || perror "Could not apply busybox patch for fbsplash background filling"
+ fi
cd .. || perror "cd .. failed"
}