add splash support #13

Open
wants to merge 3 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+210 −3
Split
View
@@ -27,6 +27,15 @@ https://bugs.launchpad.net/snap-pi3/+filebug
We use Launchpad to track issues as this allows us to coordinate multiple
projects better than what is available with Github issues.
+## Branding
+
+This gadget snap comes with a boot splash, to change the logo you can add a new png file to
+the psplash subdirectory of this tree, adjust the "SPLASH=" option in psplash/config to
+point to this file and rebuild the gadget.
+
+To turn off the splash screen completely please edit config/cmdline.txt and remove
+the "splash" and the "vt.handoff=2" keywords from the default kernel commandline.
+
## Building
To build the gadget snap locally on an armhf system please use `snapcraft`.
View
@@ -1 +1 @@
-dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty0 elevator=deadline rng_core.default_quality=700
+dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty0 elevator=deadline rng_core.default_quality=700 vt.handoff=2 quiet splash
View
@@ -56,4 +56,4 @@ device_tree_address=0x02000000
core_freq=250
enable_uart=1
-dtoverlay=vc4-kms-v3d
+#dtoverlay=vc4-kms-v3d
View
@@ -0,0 +1,2 @@
+SPLASH="core_black-orange_st_hex.png"
+FONT="/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+# TTF to font.h generator
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: $0 SOME_FONT.ttf"
+ exit 1
+fi
+
+otf2bdf -p 22 -r 75 -v $1 -o font.bdf
+bdftobogl font.bdf > font.h
+rm font.bdf
+sed -i 's/#include "bogl\.h"/#include "psplash\.h"/g' font.h
+sed -i 's/struct bogl_font font_font/PSplashFont font/g' font.h
@@ -0,0 +1,8 @@
+/scripts/init-top/all_generic_ide "$@"
+[ -e /conf/param.conf ] && . /conf/param.conf
+/scripts/init-top/blacklist "$@"
+[ -e /conf/param.conf ] && . /conf/param.conf
+/scripts/init-top/udev "$@"
+[ -e /conf/param.conf ] && . /conf/param.conf
+/scripts/init-top/psplash "$@"
+[ -e /conf/param.conf ] && . /conf/param.conf
@@ -0,0 +1,23 @@
+#!/bin/sh -e
+
+PREREQS=""
+
+prereqs() { echo "$PREREQS"; }
+
+case "$1" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+for x in $(cat /proc/cmdline); do
+ case ${x} in
+ splash)
+ /bin/psplash &
+ ;;
+ *)
+ ;;
+ esac
+done
+
View
@@ -0,0 +1,105 @@
+diff --git a/Makefile.am b/Makefile.am
+index a14152a..3c168c3 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -5,7 +5,7 @@ AM_CFLAGS = $(GCC_FLAGS) -D_GNU_SOURCE
+ psplash_SOURCES = psplash.c psplash.h psplash-fb.c psplash-fb.h \
+ psplash-console.c psplash-console.h \
+ psplash-colors.h psplash-config.h \
+- psplash-poky-img.h psplash-bar-img.h radeon-font.h
++ psplash-core-img.h psplash-bar-img.h font.h
+
+ psplash_write_SOURCES = psplash-write.c psplash.h
+
+diff --git a/make-image-header.sh b/make-image-header.sh
+index d7cf67c..01750dd 100755
+--- a/make-image-header.sh
++++ b/make-image-header.sh
+@@ -3,8 +3,9 @@
+ set -e
+
+ imageh=`basename $1 .png`-img.h
++if [ -n "$3" ]; then
++ imageh="${3}-img.h"
++fi
+ name="${2}_IMG"
+ gdk-pixbuf-csource --macros $1 > $imageh.tmp
+ sed -e "s/MY_PIXBUF/${name}/g" -e "s/guint8/uint8/g" $imageh.tmp > $imageh && rm $imageh.tmp
+-
+-
+diff --git a/psplash-bar-img.h b/psplash-bar-img.h
+index c1c7626..c672894 100644
+--- a/psplash-bar-img.h
++++ b/psplash-bar-img.h
+@@ -1,8 +1,8 @@
+ /* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
+
+ #define BAR_IMG_ROWSTRIDE (920)
+-#define BAR_IMG_WIDTH (230)
+-#define BAR_IMG_HEIGHT (28)
++#define BAR_IMG_WIDTH (0)
++#define BAR_IMG_HEIGHT (0)
+ #define BAR_IMG_BYTES_PER_PIXEL (4) /* 3:RGB, 4:RGBA */
+ #define BAR_IMG_RLE_PIXEL_DATA ((uint8*) \
+ "\203\354\354\341\377\4\326\326\315\377\236\236\233\377\200\200\201\377" \
+diff --git a/psplash.c b/psplash.c
+index 992e199..f518278 100644
+--- a/psplash.c
++++ b/psplash.c
+@@ -21,9 +21,9 @@
+ #include "psplash.h"
+ #include "psplash-config.h"
+ #include "psplash-colors.h"
+-#include "psplash-poky-img.h"
++#include "psplash-core-img.h"
+ #include "psplash-bar-img.h"
+-#include "radeon-font.h"
++#include "font.h"
+
+ #define SPLIT_LINE_POS(fb) \
+ ( (fb)->height \
+@@ -45,7 +45,7 @@ psplash_draw_msg (PSplashFB *fb, const char *msg)
+ {
+ int w, h;
+
+- psplash_fb_text_size (&w, &h, &radeon_font, msg);
++ psplash_fb_text_size (&w, &h, &font, msg);
+
+ DBG("displaying '%s' %ix%i\n", msg, w, h);
+
+@@ -62,7 +62,7 @@ psplash_draw_msg (PSplashFB *fb, const char *msg)
+ (fb->width-w)/2,
+ SPLIT_LINE_POS(fb) - h,
+ PSPLASH_TEXT_COLOR,
+- &radeon_font,
++ &font,
+ msg);
+ }
+
+@@ -280,18 +280,18 @@ main (int argc, char** argv)
+
+ /* Draw the Poky logo */
+ psplash_fb_draw_image (fb,
+- (fb->width - POKY_IMG_WIDTH)/2,
++ (fb->width - CORE_IMG_WIDTH)/2,
+ #if PSPLASH_IMG_FULLSCREEN
+- (fb->height - POKY_IMG_HEIGHT)/2,
++ (fb->height - CORE_IMG_HEIGHT)/2,
+ #else
+ (fb->height * PSPLASH_IMG_SPLIT_NUMERATOR
+- / PSPLASH_IMG_SPLIT_DENOMINATOR - POKY_IMG_HEIGHT)/2,
++ / PSPLASH_IMG_SPLIT_DENOMINATOR - CORE_IMG_HEIGHT)/2,
+ #endif
+- POKY_IMG_WIDTH,
+- POKY_IMG_HEIGHT,
+- POKY_IMG_BYTES_PER_PIXEL,
+- POKY_IMG_ROWSTRIDE,
+- POKY_IMG_RLE_PIXEL_DATA);
++ CORE_IMG_WIDTH,
++ CORE_IMG_HEIGHT,
++ CORE_IMG_BYTES_PER_PIXEL,
++ CORE_IMG_ROWSTRIDE,
++ CORE_IMG_RLE_PIXEL_DATA);
+
+ /* Draw progress bar border */
+ psplash_fb_draw_image (fb,
View
@@ -77,6 +77,50 @@ parts:
- dctrl-tools
- sed
- wget
+ psplash:
+ source: git://git.yoctoproject.org/psplash
+ plugin: make
+ prepare: |
+ export TREE="../../../psplash"
+ . ${TREE}/config
+ if ! $(echo "$FONT"|grep -q ^/); then \
+ FONT="${TREE}/${FONT}"; \
+ fi
+ if ! $(echo "$SPLASH"|grep -q ^/); then \
+ SPLASH="${TREE}/${SPLASH}"; \
+ fi
+ git apply ${TREE}/psplash.patch
+ ${TREE}/font-gen.sh "$FONT"
+ ./make-image-header.sh "$SPLASH" CORE psplash-core
+ aclocal
+ autoreconf --install
+ if [ "$(arch)" = "x86_64" ]; then \
+ if [ ! -x /usr/bin/arm-linux-gnueabihf-gcc ]; then \
+ echo "ERROR: You are cross building this snap, please install gcc-arm-linux-gnueabihf"
+ exit 1; \
+ fi
+ ./configure --host=arm-linux CC=/usr/bin/arm-linux-gnueabihf-gcc; \
+ else \
+ ./configure; \
+ fi
+ install: |
+ rm -rf $SNAPCRAFT_PART_INSTALL/usr
+ cp -a ../../../psplash/initrd .
+ mkdir -p initrd/bin
+ cp psplash initrd/bin
+ mkdir -p $SNAPCRAFT_PART_INSTALL/boot-assets
+ cd initrd && find . | cpio --quiet -o -H newc| lzma >>$SNAPCRAFT_PART_INSTALL/boot-assets/psplash.img
+ build-packages:
+ - libgdk-pixbuf2.0-dev
+ - automake
+ - autoconf
+ - gcc
+ - otf2bdf
+ - libbogl-dev
+ - ttf-ubuntu-font-family
+ - cpio
+ - findutils
+ - xz-utils
slots:
bcm-gpio-0:
View
@@ -30,14 +30,16 @@ kernel_file=kernel.img
loadaddr=0x00200000
loadbootenv=echo LOADBOOTENV; load ${devtype} ${devnum} ${loadaddr} ${bootenv}
loadfdt=fdt addr 0x02000000; fdt get value args /chosen bootargs
-loadfiles=run loadkernel; run loadinitrd; run loadfdt
+loadfiles=run loadkernel; run loadinitrd; run loadpsplash; run loadfdt
loadinitrd=load ${target} ${devnumber}:${partition} ${initrd_addr} ${snap_kernel}/${initrd_file}; setenv initrd_size ${filesize}
loadkernel=load ${target} ${devnumber}:${partition} ${loadaddr} ${snap_kernel}/${kernel_file}
+loadpsplash=if test -e mmc ${mmcdev}:${mmcpart} ${psplash_file}; then setexpr psplash_addr ${initrd_addr} + ${initrd_size}; load mmc ${mmcdev}:${mmcpart} ${psplash_addr} ${psplash_file}; setenv psplash_size ${filesize}; setexpr initrd_size ${initrd_size} + ${psplash_size}; fi
dev_boot=if ${target} dev ${devnum}; then setenv devtype ${target}; if run loadbootenv; then echo Loaded environment from ${bootenv}; run importbootenv; fi; if test -n "$uenvcmd"; then echo Running uenvcmd ...; run uenvcmd; fi; run scan_dev_for_boot_part; fi
allargs=setenv bootargs "${args} root=${devroot}"
devnumber=0
partition=1
mmcrootfstype=ext4
+psplash_file=psplash.img
pxefile_addr_r=0x00100000
ramdisk_addr_r=0x02100000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done