summaryrefslogtreecommitdiffstats
path: root/remote/modules/busybox
diff options
context:
space:
mode:
authorSimon Rettberg2014-01-30 18:06:29 +0100
committerSimon Rettberg2014-01-30 18:06:29 +0100
commitc889d7d9df3a348dfc54e2f73aadf98ca6e025dc (patch)
treed0589c1701366e4278fea322d1c75362aa7fc59a /remote/modules/busybox
parent[rfs-s31] forgot * to allow many whitespaces (diff)
downloadtm-scripts-c889d7d9df3a348dfc54e2f73aadf98ca6e025dc.tar.gz
tm-scripts-c889d7d9df3a348dfc54e2f73aadf98ca6e025dc.tar.xz
tm-scripts-c889d7d9df3a348dfc54e2f73aadf98ca6e025dc.zip
[busybox] Add patch for centering the image displayed with fbsplash
Diffstat (limited to 'remote/modules/busybox')
-rw-r--r--remote/modules/busybox/busybox.build4
-rw-r--r--remote/modules/busybox/fbsplash-center.patch83
2 files changed, 87 insertions, 0 deletions
diff --git a/remote/modules/busybox/busybox.build b/remote/modules/busybox/busybox.build
index adb3db86..727a334c 100644
--- a/remote/modules/busybox/busybox.build
+++ b/remote/modules/busybox/busybox.build
@@ -3,6 +3,10 @@ fetch_source() {
git clone "${REQUIRED_GIT}" src || perror "Could not clone busybox git"
cd src || perror "Could not cd to src"
git checkout "$REQUIRED_BRANCH" || perror "Could not checkout requested branch"
+ # Patch image centering 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
cd .. || perror "cd .. failed"
}
diff --git a/remote/modules/busybox/fbsplash-center.patch b/remote/modules/busybox/fbsplash-center.patch
new file mode 100644
index 00000000..7e54a183
--- /dev/null
+++ b/remote/modules/busybox/fbsplash-center.patch
@@ -0,0 +1,83 @@
+diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
+index 12a77b7..cae392c 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,11 @@ static void fb_drawimage(void)
+ line_size = width*3;
+ pixline = xmalloc(line_size);
+
++ if (G.bcenter_image) {
++ xoffset = ((G.scr_var.xres - width) * G.bytes_per_pixel) / 2;
++ 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 +417,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 +473,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 +482,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)