Skip to content

Instantly share code, notes, and snippets.

@hlev
Created November 13, 2018 23:51
Show Gist options
  • Save hlev/0539b061e77b5bb56f4d0e74f73cda1c to your computer and use it in GitHub Desktop.
Save hlev/0539b061e77b5bb56f4d0e74f73cda1c to your computer and use it in GitHub Desktop.
Toldotechnik PoC - Build and run recent WPEWebkit buildroot with deprecated WPELauncher
diff --git a/configs/toldotechnik_rpi3_wpe_defconfig b/configs/toldotechnik_rpi3_wpe_defconfig
new file mode 100644
index 0000000000..aca9484334
--- /dev/null
+++ b/configs/toldotechnik_rpi3_wpe_defconfig
@@ -0,0 +1,81 @@
+BR2_arm=y
+BR2_cortex_a7=y
+BR2_ARM_FPU_NEON_VFPV4=y
+BR2_ARM_INSTRUCTIONS_THUMB2=y
+BR2_CCACHE=y
+BR2_OPTIMIZE_2=y
+BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+BR2_PACKAGE_HOST_GDB=y
+BR2_TARGET_GENERIC_CABUNDLE=y
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
+BR2_TARGET_GENERIC_ROOT_PASSWD="root"
+# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
+BR2_SYSTEM_DHCP="eth0"
+BR2_ROOTFS_POST_BUILD_SCRIPT="$(TOPDIR)/custom/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="$(TOPDIR)/custom/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="--disable-mmc-overlay --fix-alsa --add-pi3-miniuart-bt-overlay --rpi-wifi --tvmode-720 --overclock-pi3 --silent"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/raspberrypi/linux.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="be97febf4aa42b1d019ad24e7948739da8557f66"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/raspberrypi/rpi23-linux-4.9.config"
+BR2_LINUX_KERNEL_LZ4=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2710-rpi-3-b bcm2710-rpi-3-b-plus bcm2710-rpi-cm3"
+BR2_PACKAGE_BUSYBOX_SMP=y
+BR2_PACKAGE_GSTREAMER1=y
+BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_APP=y
+BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_VIDEOCONVERT=y
+BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_GIO=y
+BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_OPUS=y
+BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_AUDIOFX=y
+BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_AUDIOPARSERS=y
+BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_AUTODETECT=y
+BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_DEINTERLACE=y
+BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_ICYDEMUX=y
+BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_ID3DEMUX=y
+BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_INTERLEAVE=y
+BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_MATROSKA=y
+BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_SOUPHTTPSRC=y
+BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_MPEGTSDEMUX=y
+BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_VIDEOPARSERS=y
+BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_DASH=y
+BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_FAAD=y
+BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS=y
+BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_OPUS=y
+BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_SMOOTHSTREAMING=y
+BR2_PACKAGE_GST1_PLUGINS_UGLY=y
+BR2_PACKAGE_GST1_PLUGINS_UGLY_PLUGIN_MPG123=y
+BR2_PACKAGE_GST_OMX=y
+BR2_PACKAGE_NINJA=y
+BR2_PACKAGE_BITSTREAM_VERA=y
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
+BR2_PACKAGE_RPI_FIRMWARE=y
+BR2_PACKAGE_RPI_WIFI_FIRMWARE=y
+# BR2_PACKAGE_EUDEV_ENABLE_HWDB is not set
+BR2_PACKAGE_RPI_USERLAND=y
+BR2_PACKAGE_WEBP=y
+BR2_PACKAGE_WPEWEBKIT=y
+# BR2_PACKAGE_WPEWEBKIT_USE_ENCRYPTED_MEDIA is not set
+BR2_PACKAGE_WPELAUNCHER=y
+BR2_PACKAGE_ORC=y
+BR2_PACKAGE_ICU_USE_ICUDATA=y
+BR2_PACKAGE_SHARED_MIME_INFO=y
+BR2_PACKAGE_DROPBEAR=y
+BR2_PACKAGE_GESFTPSERVER=y
+BR2_PACKAGE_WPA_SUPPLICANT=y
+BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=y
+BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN=y
+BR2_PACKAGE_WPA_SUPPLICANT_EAP=y
+BR2_PACKAGE_WPA_SUPPLICANT_HOTSPOT=y
+BR2_PACKAGE_WPA_SUPPLICANT_WPS=y
+BR2_TARGET_ROOTFS_INITRAMFS=y
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENEXT2FS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
diff --git a/custom/0100-port-wpelauncher-from-stable.patch b/custom/0100-port-wpelauncher-from-stable.patch
new file mode 100644
index 0000000000..063cb6830b
--- /dev/null
+++ b/custom/0100-port-wpelauncher-from-stable.patch
@@ -0,0 +1,194 @@
+diff --git a/package/wpe/Config.in b/package/wpe/Config.in
+index c5a84398ab..356fb2b017 100644
+--- a/package/wpe/Config.in
++++ b/package/wpe/Config.in
+@@ -7,4 +7,5 @@ source "package/wpe/wpewebkit/Config.in"
+ if BR2_PACKAGE_WPEWEBKIT
+ source "package/wpe/wpebackend/Config.in"
+ source "package/wpe/wpebackend-rdk/Config.in"
++source "package/wpe/wpelauncher/Config.in"
+ endif
+diff --git a/package/wpe/wpelauncher/Config.in b/package/wpe/wpelauncher/Config.in
+new file mode 100644
+index 0000000000..974345b520
+--- /dev/null
++++ b/package/wpe/wpelauncher/Config.in
+@@ -0,0 +1,5 @@
++config BR2_PACKAGE_WPELAUNCHER
++ bool "wpelauncher"
++ depends on BR2_PACKAGE_WPEWEBKIT
++ help
++ WPE WebKit launcher app (will be deprecated soon).
+diff --git a/package/wpe/wpelauncher/S90wpe b/package/wpe/wpelauncher/S90wpe
+new file mode 100644
+index 0000000000..dd83fb8a0c
+--- /dev/null
++++ b/package/wpe/wpelauncher/S90wpe
+@@ -0,0 +1,46 @@
++#!/bin/sh
++
++WPE_URL_FILE="/boot/wpe.txt"
++
++start() {
++ echo -n "Starting WPE: "
++ if [ -e "$WPE_URL_FILE" ]; then
++ URL=`head -1 $WPE_URL_FILE`
++ if [ -n "$URL" ]; then
++ /usr/bin/wpe --loop $URL &> /dev/null &
++ echo "OK"
++ else
++ echo "NO URL"
++ fi
++ else
++ echo "NO FILE"
++ fi
++}
++
++stop() {
++ echo -n "Stopping WPE: "
++ killall wpe WPELauncher WPEWebProcess WPENetworkProcess &> /dev/null
++ echo "OK"
++}
++
++restart() {
++ stop
++ start
++}
++
++case "$1" in
++ start)
++ start
++ ;;
++ stop)
++ stop
++ ;;
++ restart|reload)
++ restart
++ ;;
++ *)
++ echo "Usage: $0 {start|stop|restart}"
++ exit 1
++esac
++
++exit $?
+diff --git a/package/wpe/wpelauncher/wpe b/package/wpe/wpelauncher/wpe
+new file mode 100644
+index 0000000000..c4f9cc7c72
+--- /dev/null
++++ b/package/wpe/wpelauncher/wpe
+@@ -0,0 +1,58 @@
++#!/bin/sh
++
++# Enable cookie persistent storage
++export WPE_SHELL_COOKIE_STORAGE=1
++
++# FIXME: gst-gl's dispmanx backend is messing up with our compositor
++# when it creates its initial 16x16px surface.
++export GST_GL_WINDOW=dummy
++
++# Use cairo noaa compositor
++export CAIRO_GL_COMPOSITOR=noaa
++
++# WebInspector
++export WEBKIT_INSPECTOR_SERVER=0.0.0.0:9998
++
++# FPS
++#export WPE_THREADED_COMPOSITOR_FPS=1
++
++# RPI mouse support
++#export WPE_BCMRPI_CURSOR=1
++
++# RPI touch support
++#export WPE_BCMRPI_TOUCH=1
++
++WPE_UPDATE="/usr/bin/wpe-update"
++if [ -e "$WPE_UPDATE" ];
++then
++ WPE_UPDATE_RESULT=$($WPE_UPDATE)
++fi
++
++#export TZ=$(wget -qO- http://jsonip.metrological.com/ | sed -e 's/^.*"tz":"\([^"]*\)".*$/\1/')
++
++WPE_CONF_FILE="/boot/wpe.conf"
++WPE_CONFIG=""
++if [ -e "$WPE_CONF_FILE" ];
++then
++ WPE_CONFIG=$(grep -v '^#' $WPE_CONF_FILE | tr -d "\r" | tr "\n" " " | tr -s " ")
++fi
++
++# Core dumps
++#echo 1 > /proc/sys/kernel/core_uses_pid
++#echo 2 > /proc/sys/fs/suid_dumpable
++#echo "/root/cores/core-pid_%p--process%E" > /proc/sys/kernel/core_pattern
++#mkdir -p /root/cores
++#ulimit -c unlimited
++
++# The PREFIX env var can be useful when debugging athol/WPELauncher with gdbserver.
++if [ "$1" = "--loop" ];
++then
++ export HOME=/root
++ mkdir -p $HOME
++ while true;
++ do
++ cd /root && eval "$WPE_CONFIG $PREFIX WPELauncher \"$2\""
++ done
++else
++ cd /root && eval "$WPE_CONFIG $PREFIX WPELauncher \"$1\""
++fi
+diff --git a/package/wpe/wpelauncher/wpe.conf b/package/wpe/wpelauncher/wpe.conf
+new file mode 100644
+index 0000000000..61eee54771
+--- /dev/null
++++ b/package/wpe/wpelauncher/wpe.conf
+@@ -0,0 +1,11 @@
++# WebInspector
++WEBKIT_INSPECTOR_SERVER=0.0.0.0:9998
++
++# FPS
++WPE_THREADED_COMPOSITOR_FPS=1
++
++# RPI mouse support
++#WPE_BCMRPI_CURSOR=1
++
++# Timezone
++#TZ=CET-1CEST,M3.5.0,M10.5.0/3
+diff --git a/package/wpe/wpelauncher/wpe.txt b/package/wpe/wpelauncher/wpe.txt
+new file mode 100644
+index 0000000000..234eeefe9b
+--- /dev/null
++++ b/package/wpe/wpelauncher/wpe.txt
+@@ -0,0 +1 @@
++http://youtube.com/tv
+diff --git a/package/wpe/wpelauncher/wpelauncher.mk b/package/wpe/wpelauncher/wpelauncher.mk
+new file mode 100644
+index 0000000000..49b2de7e0a
+--- /dev/null
++++ b/package/wpe/wpelauncher/wpelauncher.mk
+@@ -0,0 +1,27 @@
++###############################################################################
++#
++# WPELauncher
++#
++################################################################################
++
++WPELAUNCHER_VERSION = 371d4b0bcd96723d1d8383317c365f0935be3023
++WPELAUNCHER_SITE = $(call github,WebPlatformForEmbedded,WPEWebKitLauncher,$(WPELAUNCHER_VERSION))
++
++WPELAUNCHER_DEPENDENCIES = wpewebkit
++
++define WPELAUNCHER_BINS
++ $(INSTALL) -D -m 0644 package/wpe/wpelauncher/wpe.{txt,conf} $(BINARIES_DIR)/
++ $(INSTALL) -D -m 0755 package/wpe/wpelauncher/wpe $(TARGET_DIR)/usr/bin
++endef
++
++define WPELAUNCHER_AUTOSTART
++ $(INSTALL) -D -m 0755 package/wpe/wpelauncher/S90wpe $(TARGET_DIR)/etc/init.d
++endef
++
++WPELAUNCHER_POST_INSTALL_TARGET_HOOKS += WPELAUNCHER_BINS
++
++ifeq ($(BR2_PACKAGE_PLUGIN_WEBKITBROWSER),)
++WPELAUNCHER_POST_INSTALL_TARGET_HOOKS += WPELAUNCHER_AUTOSTART
++endif
++
++$(eval $(cmake-package))
diff --git a/custom/genimage.cfg b/custom/genimage.cfg
new file mode 100644
index 0000000000..e701756de7
--- /dev/null
+++ b/custom/genimage.cfg
@@ -0,0 +1,42 @@
+image boot.vfat {
+ vfat {
+ files = {
+ "bcm2710-rpi-3-b.dtb",
+ "rpi-firmware/bootcode.bin",
+ "rpi-firmware/cmdline.txt",
+ "rpi-firmware/config.txt",
+ "rpi-firmware/fixup.dat",
+ "rpi-firmware/start.elf",
+ "rpi-firmware/overlays",
+ "zImage",
+ "wpe.txt"
+ }
+ }
+ size = 100M
+}
+
+image data.ext4 {
+ name = "data"
+ ext4 {
+ label = "data"
+ }
+ size = 900M
+ mountpoint = "/"
+}
+
+image sdcard.img {
+ hdimage {
+ }
+
+ partition boot {
+ partition-type = 0xC
+ bootable = "true"
+ image = "boot.vfat"
+ }
+
+ partition data {
+ partition-type = 0x83
+ image = "data.ext4"
+ }
+}
+
diff --git a/custom/post-build.sh b/custom/post-build.sh
new file mode 100755
index 0000000000..e6899c05b4
--- /dev/null
+++ b/custom/post-build.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -u
+set -e
+
+echo "Post-build: processing $@"
+env
+
+BOARD_DIR="$(dirname $0)"
+
+# Add Gstreamer software based AC3 Decoder
+if [ -f "${BOARD_DIR}/libgstfluac3dec.so" ]; then
+ mkdir -p "${TARGET_DIR}/usr/lib/gstreamer-1.0/"
+ cp -pf "${BOARD_DIR}/libgstfluac3dec.so" "${TARGET_DIR}/usr/lib/gstreamer-1.0/"
+fi
+
+# Copy splash screen
+
+# Create datapartition/ directory in the output dir, so data.ext4 can be generated from it
+if [ ! -d ${BINARIES_DIR}/datapartition ]; then
+ mkdir "${BINARIES_DIR}/datapartition"
+ touch "${BINARIES_DIR}/datapartition/example_empty_file"
+fi
+
diff --git a/custom/post-image.sh b/custom/post-image.sh
new file mode 100755
index 0000000000..10889991b8
--- /dev/null
+++ b/custom/post-image.sh
@@ -0,0 +1,199 @@
+#!/bin/sh
+
+CUSTOM_BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${CUSTOM_BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+DATAPART_DIR="${BINARIES_DIR}/datapartition"
+
+echo "Post-image: processing $@"
+
+# Override cmdline.txt
+cat << __EOF__ > "${BINARIES_DIR}/rpi-firmware/cmdline.txt"
+console=ttyAMA0,115200 ipv6.disable=1 consoleblank=0 vt.global_cursor_default=0 ignore_loglevel
+__EOF__
+
+for i in "$@"
+do
+case "$i" in
+ --disable-mmc-overlay)
+ # Disable the mmc overlay
+ if ! grep -qE '^#dtoverlay=mmc' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Commenting out MMC overlay in config.txt."
+ sed -i 's/dtoverlay=mmc/#dtoverlay=mmc/' "${BINARIES_DIR}/rpi-firmware/config.txt"
+ fi
+ ;;
+ --fix-alsa)
+ if ! grep -qE '^dtparam=audio' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding 'dtparam=audio=on' to config.txt."
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Fix ALSA
+dtparam=audio=on
+__EOF__
+ fi
+ ;;
+ --add-pi3-miniuart-bt-overlay)
+ if [ "x${BLUETOOTH}" = "x" ]; then
+ if ! grep -qE '^dtoverlay=pi3-miniuart-bt' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding 'dtoverlay=pi3-miniuart-bt' to config.txt (fixes ttyAMA0 serial console)."
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Fixes rpi3 ttyAMA0 serial console
+dtoverlay=pi3-miniuart-bt
+__EOF__
+ fi
+ fi
+ ;;
+ --tvmode-720)
+ if ! grep -qE '^hdmi_mode=4' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding 'tvmode=720' to config.txt."
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Force 720p
+hdmi_group=1
+hdmi_mode=4
+__EOF__
+ fi
+ ;;
+ --tvmode-1080)
+ if ! grep -qE '^hdmi_mode=16' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding 'tvmode=1080' to config.txt."
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Force 1080p
+hdmi_group=1
+hdmi_mode=16
+__EOF__
+ fi
+ ;;
+ --tvmode-dvi)
+ if ! grep -qE '^hdmi_drive=2' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding 'tvmode=dvi' to config.txt."
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Force dvi output
+hdmi_drive=2
+__EOF__
+ fi
+ ;;
+ --silent)
+ if ! grep -qE '^disable_splash=1' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding 'silent=1' to config.txt."
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Silent
+disable_splash=1
+boot_delay=0
+__EOF__
+ fi
+ ;;
+ --i2c)
+ if ! grep -qE '^dtparam=i2c_arm=on' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding 'i2c' functionality to config.txt."
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Enable i2c functionality
+dtparam=i2c_arm=on,i2c_arm_baudrate=400000
+dtparam=i2c1=on,i2c1_baudrate=50000
+__EOF__
+ fi
+ ;;
+ --spi)
+ if ! grep -qE '^dtparam=spi=on' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding 'spi' functionality to config.txt."
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Enable spi functionality
+dtparam=spi=on
+__EOF__
+ fi
+ ;;
+ --1w)
+ if ! grep -qE '^dtoverlay=w1-gpio' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding '1w' functionality to config.txt."
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Enable 1Wire functionality
+dtoverlay=w1-gpio,gpiopin=7
+__EOF__
+ fi
+ ;;
+ --lirc)
+ if ! grep -qE '^dtoverlay=lirc-rpi' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding 'lirc' functionality to config.txt."
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Enable 1Wire functionality
+dtoverlay=lirc-rpi,gpio_in_pin=23,gpio_out_pin=22
+__EOF__
+ fi
+ ;;
+ --touchscreen)
+ if ! grep -qE '^dtoverlay=ads7846' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding 'ads7846' functionality to config.txt."
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Enable ADS7846 Touchscreen
+dtoverlay=ads7846,cs=0,penirq=25,penirq_pull=2,speed=10000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=199,xmax=3999,ymin=199,ymax=3999
+__EOF__
+ fi
+ ;;
+ --rpi-wifi*)
+ if ! grep -qE '^dtoverlay=sdtweak' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding 'rpi wifi' functionality to config.txt."
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Enable overlay for wifi functionality
+dtoverlay=sdtweak,overclock_50=80
+__EOF__
+ fi
+ if grep -qE '^dtoverlay=mmc' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Removing overlay for mmc due to wifi compatibilityin config.txt."
+ cat "${BINARIES_DIR}/rpi-firmware/config.txt" | sed '/^# Enable mmc by default/,+2d' > "${BINARIES_DIR}/rpi-firmware/config_.txt"
+ rm "${BINARIES_DIR}/rpi-firmware/config.txt"
+ mv "${BINARIES_DIR}/rpi-firmware/config_.txt" "${BINARIES_DIR}/rpi-firmware/config.txt"
+ fi
+ ;;
+ --overclock*)
+ if ! grep -qE '^arm_freq=' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+ echo "Adding 'overclock' to config.txt."
+ # Commenting out sdram_freq overclock, because some Pis may be sensitive to it
+ cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+
+# Overclock
+[pi0]
+[pi0w]
+[pi1]
+[pi2]
+arm_freq=1000
+gpu_freq=500
+#sdram_freq=500
+over_voltage=6
+[pi3]
+arm_freq=1350
+gpu_freq=500
+#sdram_freq=500
+over_voltage=5
+[pi3+]
+arm_freq=1500
+gpu_freq=500
+#sdram_freq=560
+over_voltage=5
+[all]
+avoid_warnings=1
+__EOF__
+ fi
+ ;;
+esac
+done
+
+echo "Generating SD image"
+rm -rf "${GENIMAGE_TMP}"
+genimage \
+ --rootpath "${DATAPART_DIR}" \
+ --tmppath "${GENIMAGE_TMP}" \
+ --inputpath "${BINARIES_DIR}" \
+ --outputpath "${BINARIES_DIR}" \
+ --config "${GENIMAGE_CFG}"
+
+exit $?
diff --git a/custom/toldotechnik_rpi3_wpe_defconfig b/custom/toldotechnik_rpi3_wpe_defconfig
new file mode 120000
index 0000000000..f5f0406b3b
--- /dev/null
+++ b/custom/toldotechnik_rpi3_wpe_defconfig
@@ -0,0 +1 @@
+../configs/toldotechnik_rpi3_wpe_defconfig
\ No newline at end of file
diff --git a/package/wpe/Config.in b/package/wpe/Config.in
index c5a84398ab..356fb2b017 100644
--- a/package/wpe/Config.in
+++ b/package/wpe/Config.in
@@ -7,4 +7,5 @@ source "package/wpe/wpewebkit/Config.in"
if BR2_PACKAGE_WPEWEBKIT
source "package/wpe/wpebackend/Config.in"
source "package/wpe/wpebackend-rdk/Config.in"
+source "package/wpe/wpelauncher/Config.in"
endif
diff --git a/package/wpe/wpelauncher/Config.in b/package/wpe/wpelauncher/Config.in
new file mode 100644
index 0000000000..974345b520
--- /dev/null
+++ b/package/wpe/wpelauncher/Config.in
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_WPELAUNCHER
+ bool "wpelauncher"
+ depends on BR2_PACKAGE_WPEWEBKIT
+ help
+ WPE WebKit launcher app (will be deprecated soon).
diff --git a/package/wpe/wpelauncher/S90wpe b/package/wpe/wpelauncher/S90wpe
new file mode 100644
index 0000000000..dd83fb8a0c
--- /dev/null
+++ b/package/wpe/wpelauncher/S90wpe
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+WPE_URL_FILE="/boot/wpe.txt"
+
+start() {
+ echo -n "Starting WPE: "
+ if [ -e "$WPE_URL_FILE" ]; then
+ URL=`head -1 $WPE_URL_FILE`
+ if [ -n "$URL" ]; then
+ /usr/bin/wpe --loop $URL &> /dev/null &
+ echo "OK"
+ else
+ echo "NO URL"
+ fi
+ else
+ echo "NO FILE"
+ fi
+}
+
+stop() {
+ echo -n "Stopping WPE: "
+ killall wpe WPELauncher WPEWebProcess WPENetworkProcess &> /dev/null
+ echo "OK"
+}
+
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart|reload)
+ restart
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+esac
+
+exit $?
diff --git a/package/wpe/wpelauncher/wpe b/package/wpe/wpelauncher/wpe
new file mode 100644
index 0000000000..c4f9cc7c72
--- /dev/null
+++ b/package/wpe/wpelauncher/wpe
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# Enable cookie persistent storage
+export WPE_SHELL_COOKIE_STORAGE=1
+
+# FIXME: gst-gl's dispmanx backend is messing up with our compositor
+# when it creates its initial 16x16px surface.
+export GST_GL_WINDOW=dummy
+
+# Use cairo noaa compositor
+export CAIRO_GL_COMPOSITOR=noaa
+
+# WebInspector
+export WEBKIT_INSPECTOR_SERVER=0.0.0.0:9998
+
+# FPS
+#export WPE_THREADED_COMPOSITOR_FPS=1
+
+# RPI mouse support
+#export WPE_BCMRPI_CURSOR=1
+
+# RPI touch support
+#export WPE_BCMRPI_TOUCH=1
+
+WPE_UPDATE="/usr/bin/wpe-update"
+if [ -e "$WPE_UPDATE" ];
+then
+ WPE_UPDATE_RESULT=$($WPE_UPDATE)
+fi
+
+#export TZ=$(wget -qO- http://jsonip.metrological.com/ | sed -e 's/^.*"tz":"\([^"]*\)".*$/\1/')
+
+WPE_CONF_FILE="/boot/wpe.conf"
+WPE_CONFIG=""
+if [ -e "$WPE_CONF_FILE" ];
+then
+ WPE_CONFIG=$(grep -v '^#' $WPE_CONF_FILE | tr -d "\r" | tr "\n" " " | tr -s " ")
+fi
+
+# Core dumps
+#echo 1 > /proc/sys/kernel/core_uses_pid
+#echo 2 > /proc/sys/fs/suid_dumpable
+#echo "/root/cores/core-pid_%p--process%E" > /proc/sys/kernel/core_pattern
+#mkdir -p /root/cores
+#ulimit -c unlimited
+
+# The PREFIX env var can be useful when debugging athol/WPELauncher with gdbserver.
+if [ "$1" = "--loop" ];
+then
+ export HOME=/root
+ mkdir -p $HOME
+ while true;
+ do
+ cd /root && eval "$WPE_CONFIG $PREFIX WPELauncher \"$2\""
+ done
+else
+ cd /root && eval "$WPE_CONFIG $PREFIX WPELauncher \"$1\""
+fi
diff --git a/package/wpe/wpelauncher/wpe.conf b/package/wpe/wpelauncher/wpe.conf
new file mode 100644
index 0000000000..61eee54771
--- /dev/null
+++ b/package/wpe/wpelauncher/wpe.conf
@@ -0,0 +1,11 @@
+# WebInspector
+WEBKIT_INSPECTOR_SERVER=0.0.0.0:9998
+
+# FPS
+WPE_THREADED_COMPOSITOR_FPS=1
+
+# RPI mouse support
+#WPE_BCMRPI_CURSOR=1
+
+# Timezone
+#TZ=CET-1CEST,M3.5.0,M10.5.0/3
diff --git a/package/wpe/wpelauncher/wpe.txt b/package/wpe/wpelauncher/wpe.txt
new file mode 100644
index 0000000000..234eeefe9b
--- /dev/null
+++ b/package/wpe/wpelauncher/wpe.txt
@@ -0,0 +1 @@
+http://youtube.com/tv
diff --git a/package/wpe/wpelauncher/wpelauncher.mk b/package/wpe/wpelauncher/wpelauncher.mk
new file mode 100644
index 0000000000..49b2de7e0a
--- /dev/null
+++ b/package/wpe/wpelauncher/wpelauncher.mk
@@ -0,0 +1,27 @@
+###############################################################################
+#
+# WPELauncher
+#
+################################################################################
+
+WPELAUNCHER_VERSION = 371d4b0bcd96723d1d8383317c365f0935be3023
+WPELAUNCHER_SITE = $(call github,WebPlatformForEmbedded,WPEWebKitLauncher,$(WPELAUNCHER_VERSION))
+
+WPELAUNCHER_DEPENDENCIES = wpewebkit
+
+define WPELAUNCHER_BINS
+ $(INSTALL) -D -m 0644 package/wpe/wpelauncher/wpe.{txt,conf} $(BINARIES_DIR)/
+ $(INSTALL) -D -m 0755 package/wpe/wpelauncher/wpe $(TARGET_DIR)/usr/bin
+endef
+
+define WPELAUNCHER_AUTOSTART
+ $(INSTALL) -D -m 0755 package/wpe/wpelauncher/S90wpe $(TARGET_DIR)/etc/init.d
+endef
+
+WPELAUNCHER_POST_INSTALL_TARGET_HOOKS += WPELAUNCHER_BINS
+
+ifeq ($(BR2_PACKAGE_PLUGIN_WEBKITBROWSER),)
+WPELAUNCHER_POST_INSTALL_TARGET_HOOKS += WPELAUNCHER_AUTOSTART
+endif
+
+$(eval $(cmake-package))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment