diff --git a/packages/addons/service/slice/changelog.txt b/packages/addons/service/slice/changelog.txt
new file mode 100644
index 0000000000..b8fc44b6fe
--- /dev/null
+++ b/packages/addons/service/slice/changelog.txt
@@ -0,0 +1,9 @@
+102
+- Fix rew pattern not working
+- Change logging to use LOGDEBUG
+
+101
+- Fix sleep.png so all LED's turn off
+
+100
+- Initial release
diff --git a/packages/addons/service/slice/icon/icon.png b/packages/addons/service/slice/icon/icon.png
new file mode 100644
index 0000000000..d669c45ed6
Binary files /dev/null and b/packages/addons/service/slice/icon/icon.png differ
diff --git a/packages/addons/service/slice/package.mk b/packages/addons/service/slice/package.mk
new file mode 100644
index 0000000000..0ff3cc5e25
--- /dev/null
+++ b/packages/addons/service/slice/package.mk
@@ -0,0 +1,47 @@
+################################################################################
+# This file is part of LibreELEC - https://libreelec.tv
+# Copyright (C) 2016-present Team LibreELEC
+#
+# LibreELEC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# LibreELEC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LibreELEC. If not, see .
+################################################################################
+
+PKG_NAME="slice"
+PKG_VERSION="0"
+PKG_REV="102"
+PKG_ARCH="any"
+PKG_LICENSE="GPL"
+PKG_SITE=""
+PKG_URL=""
+PKG_DEPENDS_TARGET="toolchain"
+PKG_SECTION="service"
+PKG_SHORTDESC="Controls the LED lights on the Slice box using Kodi actions"
+PKG_LONGDESC="Controls the LED lights on the Slice box using Kodi actions"
+PKG_AUTORECONF="no"
+
+PKG_IS_ADDON="yes"
+PKG_ADDON_NAME="Slice"
+PKG_ADDON_PROJECTS="Slice Slice3"
+PKG_ADDON_TYPE="xbmc.service"
+
+make_target() {
+ :
+}
+
+makeinstall_target() {
+ :
+}
+
+addon() {
+ :
+}
diff --git a/packages/addons/service/slice/source/default.py b/packages/addons/service/slice/source/default.py
new file mode 100644
index 0000000000..02a55c5b93
--- /dev/null
+++ b/packages/addons/service/slice/source/default.py
@@ -0,0 +1,249 @@
+################################################################################
+# This file is part of LibreELEC - https://libreelec.tv
+# Copyright (C) 2016-present Team LibreELEC
+#
+# LibreELEC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# LibreELEC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LibreELEC. If not, see .
+################################################################################
+
+from PIL import Image
+
+import os
+import threading
+import time
+import Queue
+import xbmc
+import xbmcaddon
+
+'''
+ffwd.png
+pause.png
+play.png
+quit.png
+rew.png
+shutdown.png
+skipf.png
+skipr.png
+sleep.png
+startup.png
+stop.png
+wake.png
+'''
+
+__addon__ = xbmcaddon.Addon()
+__path__ = __addon__.getAddonInfo('path')
+
+class PNGPatternPlayer(threading.Thread):
+
+ def __init__(self):
+ threading.Thread.__init__(self)
+ self.path = __path__ + "/resources/media/ledpatterns"
+ self.patterns = Queue.Queue()
+ self.responses = Queue.Queue()
+ self.stopped = False
+ self.memo = {}
+ self.start()
+
+ def setPath(self, path):
+ if self.path != path:
+ self.path = path
+ self.memo = {}
+
+ def clearPattern(self):
+ with open('/dev/ws2812', 'wb') as f:
+ 'write null multiple times as the LEDs can get locked up with fast operations'
+ for n in range(5):
+ f.write(bytearray(25))
+
+ def playPattern(self, file, delay):
+ xbmc.log('playing pattern: %s' % file, xbmc.LOGDEBUG)
+
+ 'get pixel data from a cache if available, otherwise load and calculate'
+ if file not in self.memo:
+ image = Image.open(file)
+ pixels = image.load()
+ width, height = image.size
+ data = []
+
+ for y in range(height):
+ x_pixels = []
+ for x in range(width):
+ pixel = []
+ r, g, b, a = pixels[x, y]
+ pixel.append(hex(r)[2:].zfill(2))
+ pixel.append(hex(g)[2:].zfill(2))
+ pixel.append(hex(b)[2:].zfill(2))
+ pixel.append(hex(a)[2:].zfill(2))
+ x_pixels.append(''.join(str(e) for e in pixel))
+ data.append(' '.join(str(e) for e in x_pixels))
+
+ self.memo[file] = data
+
+ for hexline in self.memo[file]:
+ if not self.stopped:
+ with open('/dev/ws2812', 'wb') as f:
+ f.write(bytearray.fromhex(hexline))
+ time.sleep(delay)
+ else:
+ break
+
+ def play(self, file, repeat=False, delay=0.030, wait=None):
+ self.stopped = True
+
+ if wait is not None:
+ # wait up to specified time if this pattern is to be processed synchronously
+ self.patterns.put((file, repeat, delay, True))
+ try:
+ result = self.responses.get(block=True, timeout=wait)
+ except Queue.Empty:
+ pass
+ else:
+ self.patterns.put((file, repeat, delay, False))
+
+ def stop(self, wait=None):
+ self.play(None, wait=wait)
+
+ def run(self):
+ repeat = False
+
+ while True:
+ try:
+ (file, repeat, delay, wait) = self.patterns.get(block=True, timeout=0 if repeat and not self.stopped else None)
+
+ self.stopped = False
+
+ if file is not None:
+ self.playPattern("%s/%s.png" % (self.path, file), delay)
+ else:
+ self.clearPattern()
+
+ if wait:
+ self.responses.put(True)
+
+ # Queue will be empty if we're repeating the last pattern and there is no new work
+ except Queue.Empty:
+ self.playPattern("%s/%s.png" % (self.path, file), delay)
+
+class SlicePlayer(xbmc.Player):
+
+ def __init__(self, *args, **kwargs):
+ xbmc.Player.__init__(self)
+
+ 'maps kodi player speed to delay in seconds'
+ self.speed_map = {-32: 0.015,
+ -16: 0.025,
+ -8: 0.030,
+ -4: 0.035,
+ -2: 0.040,
+ -1: 0.060,
+ 0: 0.000,
+ 1: 0.060,
+ 2: 0.040,
+ 4: 0.035,
+ 8: 0.030,
+ 16: 0.025,
+ 32: 0.015,
+ }
+
+ self.speed = 1
+ patterns.play('startup', False, 0.02)
+ xbmc.log('service.slice add-on started', xbmc.LOGNOTICE)
+
+ def onPlayBackEnded(self):
+ 'Will be called when Kodi stops playing a file'
+
+ patterns.play('stop')
+
+ def onPlayBackPaused(self):
+ 'Will be called when user pauses a playing file'
+
+ patterns.play('pause')
+
+ def onPlayBackResumed(self):
+ 'Will be called when user resumes a paused file'
+
+ patterns.play('play')
+
+ def onPlayBackSeek(self, iTime, seekOffset):
+ 'Will be called when user seeks to a time'
+
+ # todo: not working
+
+ xbmc.log('time offset: %d' % iTime, xbmc.LOGDEBUG)
+ xbmc.log('seek offset: %d' % seekOffset, xbmc.LOGDEBUG)
+
+ if seekOffset > 0:
+ patterns.play('skipf')
+ else:
+ patterns.play('skipr')
+
+ def onPlayBackSeekChapter(self, chapter):
+ 'Will be called when user performs a chapter seek'
+ pass
+
+ def onPlayBackSpeedChanged(self, speed):
+ 'Will be called when players speed changes. (eg. user FF/RW)'
+
+ xbmc.log('seek speed: %d' % speed, xbmc.LOGDEBUG)
+
+ self.speed = speed
+
+ if self.speed != 1:
+ if self.speed < 0:
+ patterns.play('rew', True, self.speed_map[self.speed])
+ elif self.speed > 0:
+ patterns.play('ffwd', True, self.speed_map[self.speed])
+ else:
+ patterns.stop()
+
+ def onPlayBackStarted(self):
+ 'Will be called when Kodi starts playing a file'
+
+ patterns.play('play')
+
+ def onPlayBackStopped(self):
+ 'Will be called when user stops Kodi playing a file'
+
+ patterns.play('stop')
+
+class SliceMonitor(xbmc.Monitor):
+
+ def __init__(self, *args, **kwargs):
+ xbmc.Monitor.__init__(self)
+
+ def onScreensaverActivated(self):
+ 'Will be called when screensaver kicks in'
+
+ patterns.play('sleep')
+
+ def onScreensaverDeactivated(self):
+ 'Will be called when screensaver goes off'
+
+ patterns.play('wake')
+
+ def onSettingsChanged(self):
+ 'Will be called when addon settings are changed'
+
+ # meh
+
+if (__name__ == "__main__"):
+ patterns = PNGPatternPlayer()
+ player = SlicePlayer()
+ monitor = SliceMonitor()
+
+ monitor.waitForAbort()
+ patterns.play('shutdown', wait=5.0)
+
+ del SliceMonitor
+ del SlicePlayer
+ del PNGPatternPlayer
diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/ffwd.png b/packages/addons/service/slice/source/resources/media/ledpatterns/ffwd.png
new file mode 100644
index 0000000000..5bee66fb5c
Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/ffwd.png differ
diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/pause.png b/packages/addons/service/slice/source/resources/media/ledpatterns/pause.png
new file mode 100644
index 0000000000..60a480f104
Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/pause.png differ
diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/play.png b/packages/addons/service/slice/source/resources/media/ledpatterns/play.png
new file mode 100644
index 0000000000..ae89019328
Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/play.png differ
diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/quit.png b/packages/addons/service/slice/source/resources/media/ledpatterns/quit.png
new file mode 100644
index 0000000000..667ada77e6
Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/quit.png differ
diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/rew.png b/packages/addons/service/slice/source/resources/media/ledpatterns/rew.png
new file mode 100644
index 0000000000..0420bee290
Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/rew.png differ
diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/shutdown.png b/packages/addons/service/slice/source/resources/media/ledpatterns/shutdown.png
new file mode 100644
index 0000000000..d4fde7ee7b
Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/shutdown.png differ
diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/skipf.png b/packages/addons/service/slice/source/resources/media/ledpatterns/skipf.png
new file mode 100644
index 0000000000..2018e325eb
Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/skipf.png differ
diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/skipr.png b/packages/addons/service/slice/source/resources/media/ledpatterns/skipr.png
new file mode 100644
index 0000000000..9292082b82
Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/skipr.png differ
diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/sleep.png b/packages/addons/service/slice/source/resources/media/ledpatterns/sleep.png
new file mode 100644
index 0000000000..d4a6af639d
Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/sleep.png differ
diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/startup.png b/packages/addons/service/slice/source/resources/media/ledpatterns/startup.png
new file mode 100644
index 0000000000..282954b4a8
Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/startup.png differ
diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/stop.png b/packages/addons/service/slice/source/resources/media/ledpatterns/stop.png
new file mode 100644
index 0000000000..e02589b813
Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/stop.png differ
diff --git a/packages/addons/service/slice/source/resources/media/ledpatterns/wake.png b/packages/addons/service/slice/source/resources/media/ledpatterns/wake.png
new file mode 100644
index 0000000000..31944073b0
Binary files /dev/null and b/packages/addons/service/slice/source/resources/media/ledpatterns/wake.png differ
diff --git a/packages/linux-drivers/slice-drivers/package.mk b/packages/linux-drivers/slice-drivers/package.mk
new file mode 100644
index 0000000000..5c9e366231
--- /dev/null
+++ b/packages/linux-drivers/slice-drivers/package.mk
@@ -0,0 +1,45 @@
+################################################################################
+# This file is part of LibreELEC - https://libreelec.tv
+# Copyright (C) 2016-present Team LibreELEC
+#
+# LibreELEC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# LibreELEC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LibreELEC. If not, see .
+################################################################################
+
+PKG_NAME="slice-drivers"
+PKG_VERSION="d02f3e7"
+PKG_ARCH="arm"
+PKG_LICENSE="GPL"
+PKG_SITE="https://github.com/LibreELEC/slice-drivers"
+PKG_URL="https://github.com/LibreELEC/slice-drivers/archive/$PKG_VERSION.tar.gz"
+PKG_DEPENDS_TARGET="toolchain linux"
+PKG_NEED_UNPACK="$LINUX_DEPENDS"
+PKG_SECTION="driver"
+PKG_SHORTDESC="linux kernel modules for the Slice box"
+PKG_LONGDESC="linux kernel modules for the Slice box"
+
+PKG_IS_ADDON="no"
+PKG_AUTORECONF="no"
+
+pre_make_target() {
+ unset LDFLAGS
+}
+
+make_target() {
+ make KDIR=$(kernel_path)
+}
+
+makeinstall_target() {
+ mkdir -p $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME
+ cp *.ko $INSTALL/usr/lib/modules/$(get_module_dir)/$PKG_NAME
+}
diff --git a/packages/linux-firmware/slice-firmware/package.mk b/packages/linux-firmware/slice-firmware/package.mk
new file mode 100644
index 0000000000..b602eefe75
--- /dev/null
+++ b/packages/linux-firmware/slice-firmware/package.mk
@@ -0,0 +1,44 @@
+################################################################################
+# This file is part of LibreELEC - https://libreelec.tv
+# Copyright (C) 2016-present Team LibreELEC
+#
+# LibreELEC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# LibreELEC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LibreELEC. If not, see .
+################################################################################
+
+PKG_NAME="slice-firmware"
+PKG_VERSION="0f463cc"
+PKG_ARCH="arm"
+PKG_LICENSE="GPL"
+PKG_SITE="https://github.com/FiveNinjas/slice-firmware"
+PKG_URL="https://github.com/libreelec/slice-firmware/archive/$PKG_VERSION.tar.gz"
+PKG_DEPENDS_TARGET="toolchain dtc"
+PKG_SECTION="linux-firmware"
+PKG_SHORTDESC="BCM270x firmware related stuff for Slice"
+PKG_LONGDESC="BCM270x firmware related stuff for Slice"
+
+PKG_IS_ADDON="no"
+PKG_AUTORECONF="no"
+
+make_target() {
+ if [ "$PROJECT" = "Slice3" ]; then
+ $(kernel_path)/scripts/dtc/dtc -O dtb -I dts -o dt-blob.bin slice3-dt-blob.dts
+ elif [ "$PROJECT" = "Slice" ]; then
+ $(kernel_path)/scripts/dtc/dtc -O dtb -I dts -o dt-blob.bin slice-dt-blob.dts
+ fi
+}
+
+makeinstall_target() {
+ mkdir -p $INSTALL/usr/share/bootloader/
+ cp -a $PKG_BUILD/dt-blob.bin $INSTALL/usr/share/bootloader/
+}
diff --git a/packages/linux/package.mk b/packages/linux/package.mk
index 609149c294..42032e84fc 100644
--- a/packages/linux/package.mk
+++ b/packages/linux/package.mk
@@ -135,6 +135,16 @@ post_patch() {
sed -i -e "s|^CONFIG_ISCSI_IBFT_FIND=.*$|# CONFIG_ISCSI_IBFT_FIND is not set|" $PKG_BUILD/.config
sed -i -e "s|^CONFIG_ISCSI_IBFT=.*$|# CONFIG_ISCSI_IBFT is not set|" $PKG_BUILD/.config
fi
+
+ # install extra dts files
+ for f in $PROJECT_DIR/$PROJECT/config/*-overlay.dts; do
+ [ -f "$f" ] && cp -v $f $PKG_BUILD/arch/$TARGET_KERNEL_ARCH/boot/dts/overlays || true
+ done
+ if [ -n "$DEVICE" ]; then
+ for f in $PROJECT_DIR/$PROJECT/devices/$DEVICE/config/*-overlay.dts; do
+ [ -f "$f" ] && cp -v $f $PKG_BUILD/arch/$TARGET_KERNEL_ARCH/boot/dts/overlays || true
+ done
+ fi
}
makeinstall_host() {
diff --git a/packages/mediacenter/kodi/package.mk b/packages/mediacenter/kodi/package.mk
index 192f7a31ad..edfea75cd2 100644
--- a/packages/mediacenter/kodi/package.mk
+++ b/packages/mediacenter/kodi/package.mk
@@ -188,6 +188,10 @@ else
KODI_ARCH="-DWITH_ARCH=$TARGET_ARCH"
fi
+if [ "$PROJECT" = "Slice" -o "$PROJECT" = "Slice3" ]; then
+ PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET led_tools"
+fi
+
if [ ! "$KODIPLAYER_DRIVER" = default ]; then
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $KODIPLAYER_DRIVER"
if [ "$KODIPLAYER_DRIVER" = bcm2835-driver ]; then
@@ -333,6 +337,9 @@ post_makeinstall_target() {
xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "os.openelec.tv" $ADDON_MANIFEST
xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "repository.libreelec.tv" $ADDON_MANIFEST
xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "service.libreelec.settings" $ADDON_MANIFEST
+ if [ "$PROJECT" = "Slice" -o "$PROJECT" = "Slice3" ]; then
+ xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "service.slice" $ADDON_MANIFEST
+ fi
# more binaddons cross compile badness meh
sed -e "s:INCLUDE_DIR /usr/include/kodi:INCLUDE_DIR $SYSROOT_PREFIX/usr/include/kodi:g" \
diff --git a/packages/tools/bcm2835-bootloader/package.mk b/packages/tools/bcm2835-bootloader/package.mk
index d9615ccc71..49c28979d3 100644
--- a/packages/tools/bcm2835-bootloader/package.mk
+++ b/packages/tools/bcm2835-bootloader/package.mk
@@ -31,10 +31,7 @@ PKG_IS_ADDON="no"
PKG_AUTORECONF="no"
make_target() {
- if [ -f $DISTRO_DIR/$DISTRO/config/dt-blob.dts ]; then
- echo Compiling device tree blob
- $(kernel_path)/scripts/dtc/dtc -O dtb -o dt-blob.bin $DISTRO_DIR/$DISTRO/config/dt-blob.dts
- fi
+ :
}
makeinstall_target() {
@@ -43,17 +40,24 @@ makeinstall_target() {
cp -PRv bootcode.bin $INSTALL/usr/share/bootloader
cp -PRv fixup_x.dat $INSTALL/usr/share/bootloader/fixup.dat
cp -PRv start_x.elf $INSTALL/usr/share/bootloader/start.elf
- [ -f dt-blob.bin ] && cp -PRv dt-blob.bin $INSTALL/usr/share/bootloader/dt-blob.bin
cp -PRv $PKG_DIR/scripts/update.sh $INSTALL/usr/share/bootloader
- if [ -f $DISTRO_DIR/$DISTRO/config/distroconfig.txt ]; then
+ if [ -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/config/distroconfig.txt ]; then
+ cp -PRv $PROJECT_DIR/$PROJECT/devices/$DEVICE/config/distroconfig.txt $INSTALL/usr/share/bootloader
+ elif [ -f $PROJECT_DIR/$PROJECT/config/distroconfig.txt ]; then
+ cp -PRv $PROJECT_DIR/$PROJECT/config/distroconfig.txt $INSTALL/usr/share/bootloader
+ elif [ -f $DISTRO_DIR/$DISTRO/config/distroconfig.txt ]; then
cp -PRv $DISTRO_DIR/$DISTRO/config/distroconfig.txt $INSTALL/usr/share/bootloader
else
cp -PRv $PKG_DIR/files/3rdparty/bootloader/distroconfig.txt $INSTALL/usr/share/bootloader
fi
- if [ -f $DISTRO_DIR/$DISTRO/config/config.txt ]; then
+ if [ -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/config/config.txt ]; then
+ cp -PRv $PROJECT_DIR/$PROJECT/devices/$DEVICE/config/config.txt $INSTALL/usr/share/bootloader
+ elif [ -f $PROJECT_DIR/$PROJECT/config/config.txt ]; then
+ cp -PRv $PROJECT_DIR/$PROJECT/config/config.txt $INSTALL/usr/share/bootloader
+ elif [ -f $DISTRO_DIR/$DISTRO/config/config.txt ]; then
cp -PRv $DISTRO_DIR/$DISTRO/config/config.txt $INSTALL/usr/share/bootloader
else
cp -PRv $PKG_DIR/files/3rdparty/bootloader/config.txt $INSTALL/usr/share/bootloader
diff --git a/packages/tools/bcm2835-bootloader/release b/packages/tools/bcm2835-bootloader/release
index 577d4b473b..f48d63f226 100755
--- a/packages/tools/bcm2835-bootloader/release
+++ b/packages/tools/bcm2835-bootloader/release
@@ -25,7 +25,7 @@ mkdir -p $RELEASE_DIR/3rdparty/bootloader
cp -PR $BUILD/bcm2835-bootloader-*/bootcode.bin $RELEASE_DIR/3rdparty/bootloader/
cp -PR $BUILD/bcm2835-bootloader-*/fixup_x.dat $RELEASE_DIR/3rdparty/bootloader/fixup.dat
cp -PR $BUILD/bcm2835-bootloader-*/start_x.elf $RELEASE_DIR/3rdparty/bootloader/start.elf
- [ -f $BUILD/bcm2835-bootloader-*/dt-blob.bin ] && cp -PR $BUILD/bcm2835-bootloader-*/dt-blob.bin $RELEASE_DIR/3rdparty/bootloader/
+ [ -f $BUILD/slice-firmware-*/dt-blob.bin ] && cp -PR $BUILD/slice-firmware-*/dt-blob.bin $RELEASE_DIR/3rdparty/bootloader/
cp -PR $INSTALL/usr/share/bootloader/*.dtb $RELEASE_DIR/3rdparty/bootloader/
cp -PR $INSTALL/usr/share/bootloader/overlays $RELEASE_DIR/3rdparty/bootloader/
cp -PR $INSTALL/usr/share/bootloader/config.txt $RELEASE_DIR/3rdparty/bootloader/
diff --git a/packages/tools/led_tools/package.mk b/packages/tools/led_tools/package.mk
new file mode 100644
index 0000000000..b6750e6e0d
--- /dev/null
+++ b/packages/tools/led_tools/package.mk
@@ -0,0 +1,44 @@
+###############################################################################
+# This file is part of LibreELEC - https://LibreELEC.tv
+# Copyright (C) 2014 Gordon Hollingworth (gordon@fiveninjas.com)
+#
+# LibreELEC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# LibreELEC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LibreELEC. If not, see .
+################################################################################
+
+PKG_NAME="led_tools"
+PKG_VERSION="0.1"
+PKG_REV="1"
+PKG_ARCH="any"
+PKG_LICENSE="GPL"
+PKG_SITE="http://www.fiveninjas.com"
+PKG_URL="http://updates.fiveninjas.com/src/$PKG_NAME-$PKG_VERSION.tar.gz"
+PKG_DEPENDS_TARGET="toolchain zlib libpng slice-addon"
+PKG_DEPENDS_HOST="toolchain"
+PKG_SECTION="tools"
+PKG_SHORTDESC="led_tools"
+PKG_LONGDESC="LED tools, these are a set of tools to control the LEDs on Slice"
+
+PKG_IS_ADDON="no"
+PKG_AUTORECONF="no"
+
+make_target() {
+ make CC="$CC" \
+ CFLAGS="$CFLAGS" \
+ LDFLAGS="$LDFLAGS"
+}
+
+makeinstall_target() {
+ mkdir -p $INSTALL/usr/bin
+ cp led_png $INSTALL/usr/bin
+}
diff --git a/packages/tools/slice-addon/package.mk b/packages/tools/slice-addon/package.mk
new file mode 100644
index 0000000000..237acd7f6c
--- /dev/null
+++ b/packages/tools/slice-addon/package.mk
@@ -0,0 +1,43 @@
+################################################################################
+# This file is part of LibreELEC - https://libreelec.tv
+# Copyright (C) 2016-present Team LibreELEC
+#
+# LibreELEC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# LibreELEC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LibreELEC. If not, see .
+################################################################################
+
+PKG_NAME="slice-addon"
+PKG_VERSION="1.0"
+PKG_REV="101"
+PKG_ARCH="any"
+PKG_LICENSE="GPL"
+PKG_SITE=""
+PKG_URL=""
+PKG_DEPENDS_TARGET=""
+PKG_SHORTDESC="Controls the LED lights on the Slice box using Kodi actions"
+PKG_LONGDESC="Controls the LED lights on the Slice box using Kodi actions"
+PKG_AUTORECONF="no"
+
+PKG_IS_ADDON="no"
+
+make_target() {
+(
+ cd $ROOT
+ scripts/create_addon slice
+)
+}
+
+makeinstall_target() {
+ mkdir -p $INSTALL/usr/share/kodi/addons
+ cp -R $BUILD/$ADDONS/slice/service.slice $INSTALL/usr/share/kodi/addons
+}
diff --git a/projects/RPi/linux/linux.arm.conf b/projects/RPi/linux/linux.arm.conf
index c3ab9f4c7a..8c1b666cae 100644
--- a/projects/RPi/linux/linux.arm.conf
+++ b/projects/RPi/linux/linux.arm.conf
@@ -2846,7 +2846,7 @@ CONFIG_SND_SOC_ADAU7002=m
# CONFIG_SND_SOC_CS42L52 is not set
# CONFIG_SND_SOC_CS42L56 is not set
# CONFIG_SND_SOC_CS42L73 is not set
-# CONFIG_SND_SOC_CS4265 is not set
+CONFIG_SND_SOC_CS4265=m
# CONFIG_SND_SOC_CS4270 is not set
# CONFIG_SND_SOC_CS4271_I2C is not set
# CONFIG_SND_SOC_CS4271_SPI is not set
diff --git a/projects/RPi2/linux/linux.arm.conf b/projects/RPi2/linux/linux.arm.conf
index 8cc691ae8b..356a29d284 100644
--- a/projects/RPi2/linux/linux.arm.conf
+++ b/projects/RPi2/linux/linux.arm.conf
@@ -2939,7 +2939,7 @@ CONFIG_SND_SOC_ADAU7002=m
# CONFIG_SND_SOC_CS42L52 is not set
# CONFIG_SND_SOC_CS42L56 is not set
# CONFIG_SND_SOC_CS42L73 is not set
-# CONFIG_SND_SOC_CS4265 is not set
+CONFIG_SND_SOC_CS4265=m
# CONFIG_SND_SOC_CS4270 is not set
# CONFIG_SND_SOC_CS4271_I2C is not set
# CONFIG_SND_SOC_CS4271_SPI is not set
diff --git a/projects/Slice/config/distroconfig.txt b/projects/Slice/config/distroconfig.txt
new file mode 100644
index 0000000000..6473369b91
--- /dev/null
+++ b/projects/Slice/config/distroconfig.txt
@@ -0,0 +1,23 @@
+################################################################################
+# This file is part of LibreELEC - http://www.libreelec.tv
+# Copyright (C) 2016 Team LibreELEC
+#
+# LibreELEC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# LibreELEC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LibreELEC. If not, see .
+################################################################################
+
+# WARNING: DO NOT EDIT THIS FILE - IT WILL BE OVERWRITTEN WHEN UPGRADING!
+
+dtoverlay=slice
+dtoverlay=ws2812
+dtoverlay=mmc
diff --git a/projects/Slice/config/slice-overlay.dts b/projects/Slice/config/slice-overlay.dts
new file mode 100644
index 0000000000..7f0a4d2f3b
--- /dev/null
+++ b/projects/Slice/config/slice-overlay.dts
@@ -0,0 +1,172 @@
+// Definitions for Slice hardware
+/dts-v1/;
+/plugin/;
+
+#include "dt-bindings/clock/bcm2835.h"
+
+/ {
+ compatible = "brcm,bcm2708";
+
+ //
+ // Set up GPIOs:
+ // I2C1 on GPIO44,45
+ // LIRC input/output on GPIO4 and 37 (NB GPIO4 NC on Slice)
+ // I2S on GPIO28-31
+ //
+ fragment@0 {
+ target = <&gpio>;
+ __overlay__ {
+ i2c1_pins: i2c1 {
+ brcm,pins = <44 45>;
+ brcm,function = <6>; /* alt2 */
+ };
+ lirc_pins: lirc_pins {
+ brcm,pins = <4 37>; //
+ brcm,function = <1 0>; // out in
+ brcm,pull = <0 1>; // off down
+ };
+ i2s_pins: i2s {
+ brcm,pins = <28 29 30 31>;
+ brcm,function = <6>; /* alt2 */
+ };
+ ws2812_pins: ws2812 {
+ brcm,pins = <40>;
+ brcm,function = <4>; /* alt0 */
+ };
+ };
+ };
+
+ //
+ // I2C at 100KHz
+ //
+ fragment@1 {
+ target = <&i2c1>;
+ __overlay__ {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c1_pins>;
+ clock-frequency = <100000>;
+ };
+ };
+
+ //
+ // Add devices to I2C1 Bus:
+ // PCF8523 RTC device
+ // CS4265 Audio CODEC
+ //
+ fragment@2 {
+ target = <&i2c1>;
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "okay";
+ pcf8523@68 {
+ compatible = "nxp,pcf8523";
+ reg = <0x68>;
+ nxp,xtalcap-7pf; /* set crystal load to 7pf */
+ status = "okay";
+ };
+ cs4265@4e {
+ #sound-dai-cells = <0>;
+ compatible = "cirrus,cs4265";
+ reg = <0x4e>;
+ cs4265-reset-gpios = <&gpio 33 0>; /* AUD_RST_N on GPIO33 */
+ cirrus,no-s16le; /* remove S16LE support to workaround I2S controller issue */
+ status = "okay";
+ };
+ };
+ };
+
+ //
+ // LIRC
+ //
+ fragment@3 {
+ target-path = "/";
+ __overlay__ {
+ lirc_rpi: lirc_rpi {
+ compatible = "rpi,lirc-rpi";
+ pinctrl-names = "default";
+ pinctrl-0 = <&lirc_pins>;
+ status = "okay";
+
+ // Override autodetection of IR receiver circuit
+ // (0 = active high, 1 = active low, -1 = no override )
+ rpi,sense = <0xffffffff>;
+
+ // Software carrier
+ // (0 = off, 1 = on)
+ rpi,softcarrier = <1>;
+
+ // Invert output
+ // (0 = off, 1 = on)
+ rpi,invert = <0>;
+
+ // Enable debugging messages
+ // (0 = off, 1 = on)
+ rpi,debug = <0>;
+ };
+ };
+ };
+
+ //
+ // Audio driver
+ //
+ fragment@4 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ target = <&sound>;
+ __overlay__ {
+ compatible = "fiveninjas,slice";
+ clocks = <&cprman BCM2835_CLOCK_GP0>;
+ clock-names = "gp0";
+ pinctrl-names = "default";
+ i2s-controller = <&i2s>;
+ status = "okay";
+ };
+ };
+
+ //
+ // Enable I2S
+ //
+ fragment@5 {
+ target = <&i2s>;
+ __overlay__ {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2s_pins>;
+ brcm,enable-mmap;
+ status = "okay";
+ };
+ };
+
+ //
+ // WS2812B LEDs driver
+ //
+ fragment@6 {
+ target = <&soc>;
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ws2812: ws2812 {
+ compatible = "rpi,ws2812";
+ pinctrl-names = "default";
+ pinctrl-0 = <&ws2812_pins>;
+ reg = <0x7e20c000 0x100>; /* PWM */
+ dmas = <&dma 5>;
+ dma-names = "pwm_dma";
+ led-en-gpios = <&gpio 43 0>;
+ rpi,invert = <1>;
+ rpi,num_leds = <25>;
+ status = "okay";
+ };
+ };
+ };
+
+ //
+ // Disable standard audio
+ //
+ fragment@7 {
+ target = <&audio>;
+ __overlay__ {
+ status = "disabled";
+ };
+ };
+};
diff --git a/projects/Slice/config/ws2812-overlay.dts b/projects/Slice/config/ws2812-overlay.dts
new file mode 100644
index 0000000000..38ac74dffa
--- /dev/null
+++ b/projects/Slice/config/ws2812-overlay.dts
@@ -0,0 +1,33 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "brcm,bcm2708";
+
+ fragment@0 {
+ target = <&soc>;
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ ws2812: ws2812 {
+ compatible = "rpi,ws2812";
+ reg = <0x7e20c000 0x100>; /* PWM */
+ dmas = <&dma 5>;
+ dma-names = "pwm_dma";
+ led-en-gpios = <&gpio 43 0>;
+
+ rpi,invert = <1>;
+ rpi,num_leds = <25>;
+
+ status = "okay";
+
+ };
+ };
+ };
+
+ __overrides__ {
+ invert = <&ws2812>,"rpi,invert:0";
+ num_leds = <&ws2812>,"rpi,num_leds:0";
+ };
+};
diff --git a/projects/Slice/filesystem/usr/config/autostart.sh b/projects/Slice/filesystem/usr/config/autostart.sh
new file mode 100644
index 0000000000..0b6166972b
--- /dev/null
+++ b/projects/Slice/filesystem/usr/config/autostart.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+hdparm -S60 /dev/sda
diff --git a/projects/Slice/filesystem/usr/config/shutdown.sh b/projects/Slice/filesystem/usr/config/shutdown.sh
new file mode 100644
index 0000000000..2c597f1186
--- /dev/null
+++ b/projects/Slice/filesystem/usr/config/shutdown.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+LEDDIR="/usr/share/kodi/addons/service.slice/resources/media/ledpatterns"
+
+case "$1" in
+ halt)
+ hdparm -y /dev/sda
+ led_png $LEDDIR/shutdown.png
+ ;;
+ poweroff)
+ hdparm -y /dev/sda
+ led_png $LEDDIR/shutdown.png
+ ;;
+ reboot)
+ led_png $LEDDIR/shutdown.png
+ ;;
+ *)
+ ;;
+esac
diff --git a/projects/Slice/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Slice/filesystem/usr/lib/systemd/system/serial-console.service
new file mode 100644
index 0000000000..196e8c4a97
--- /dev/null
+++ b/projects/Slice/filesystem/usr/lib/systemd/system/serial-console.service
@@ -0,0 +1,23 @@
+[Unit]
+Description=Debug Shell on /dev/console
+DefaultDependencies=no
+ConditionKernelCommandLine=console
+
+[Service]
+WorkingDirectory=/storage
+Environment="ENV=/etc/profile"
+ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"'
+ExecStart=/bin/sh
+Restart=always
+RestartSec=0
+StandardInput=tty
+TTYPath=/dev/console
+TTYReset=yes
+TTYVHangup=yes
+KillMode=process
+IgnoreSIGPIPE=no
+# bash ignores SIGTERM
+KillSignal=SIGHUP
+
+[Install]
+WantedBy=sysinit.target
diff --git a/projects/Slice/filesystem/usr/share/alsa/cards/snd_slice.conf b/projects/Slice/filesystem/usr/share/alsa/cards/snd_slice.conf
new file mode 100644
index 0000000000..298f43d8e7
--- /dev/null
+++ b/projects/Slice/filesystem/usr/share/alsa/cards/snd_slice.conf
@@ -0,0 +1,25 @@
+
+
+snd_slice.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+}
diff --git a/projects/Slice/initramfs/platform_init b/projects/Slice/initramfs/platform_init
new file mode 100755
index 0000000000..e3e2e7d50a
--- /dev/null
+++ b/projects/Slice/initramfs/platform_init
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+################################################################################
+# This file is part of OpenELEC - http://www.openelec.tv
+# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv)
+#
+# OpenELEC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# OpenELEC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with OpenELEC. If not, see .
+################################################################################
+
+# Enable io_is_busy for improved sdhost performance - essentially, equivalent of force_turbo=1 but for mmc
+echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
+
+# Configure frequency scaling properties - should improve performance a little (turbo, in most cases)
+echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
+echo 100000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
diff --git a/projects/Slice/kodi/advancedsettings.xml b/projects/Slice/kodi/advancedsettings.xml
new file mode 100644
index 0000000000..00ed0dda87
--- /dev/null
+++ b/projects/Slice/kodi/advancedsettings.xml
@@ -0,0 +1,12 @@
+
+
+ false
+ 1
+
+ 720
+ 540
+
+
+ 30
+
+
diff --git a/projects/Slice/linux b/projects/Slice/linux
new file mode 120000
index 0000000000..588bc44b88
--- /dev/null
+++ b/projects/Slice/linux
@@ -0,0 +1 @@
+../RPi/linux
\ No newline at end of file
diff --git a/projects/Slice/options b/projects/Slice/options
new file mode 100644
index 0000000000..645e538609
--- /dev/null
+++ b/projects/Slice/options
@@ -0,0 +1,143 @@
+################################################################################
+# setup system defaults
+################################################################################
+
+ # The TARGET_CPU variable controls which processor should be targeted for
+ # generated code.
+ case $TARGET_ARCH in
+ arm)
+ # TARGET_CPU:
+ # arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm7m arm7d
+ # arm7dm arm7di arm7dmi arm70 arm700 arm700i arm710 arm710c
+ # arm7100 arm720 arm7500 arm7500fe arm7tdmi arm7tdmi-s arm710t
+ # arm720t arm740t strongarm strongarm110 strongarm1100
+ # strongarm1110 arm8 arm810 arm9 arm9e arm920 arm920t arm922t
+ # arm946e-s arm966e-s arm968e-s arm926ej-s arm940t arm9tdmi
+ # arm10tdmi arm1020t arm1026ej-s arm10e arm1020e arm1022e
+ # arm1136j-s arm1136jf-s mpcore mpcorenovfp arm1156t2-s
+ # arm1176jz-s arm1176jzf-s cortex-a8 cortex-a9 cortex-r4
+ # cortex-r4f cortex-m3 cortex-m1 xscale iwmmxt iwmmxt2 ep9312.
+ TARGET_CPU="arm1176jzf-s"
+
+ # TARGET_FLOAT:
+ # Specifies which floating-point ABI to use. Permissible values are:
+ # soft softfp hard
+ TARGET_FLOAT="hard"
+
+ # TARGET_FPU:
+ # This specifies what floating point hardware (or hardware emulation) is
+ # available on the target. Permissible names are:
+ # fpa fpe2 fpe3 maverick vfp vfpv3 vfpv3-fp16 vfpv3-d16 vfpv3-d16-fp16
+ # vfpv3xd vfpv3xd-fp16 neon neon-fp16 vfpv4 vfpv4-d16 fpv4-sp-d16
+ # neon-vfpv4.
+ TARGET_FPU="vfp"
+ ;;
+ esac
+
+ # Bootloader to use (syslinux / u-boot / bcm2835-bootloader)
+ BOOTLOADER="bcm2835-bootloader"
+
+ # u-boot version to use (default)
+ UBOOT_VERSION="default"
+
+ # Configuration for u-boot
+ UBOOT_CONFIG=""
+
+ # Target Configfile for u-boot
+ UBOOT_CONFIGFILE=""
+
+ # Kernel target
+ KERNEL_TARGET="zImage"
+
+ # Kernel extra targets to build
+ KERNEL_UBOOT_EXTRA_TARGET=""
+
+ # Additional kernel make parameters (for example to specify the u-boot loadaddress)
+ KERNEL_MAKE_EXTRACMD="dtbs overlays/slice.dtbo overlays/ws2812.dtbo"
+
+ # Kernel to use. values can be:
+ # default: default mainline kernel
+ LINUX="default-rpi"
+
+ # NOOBS supported hex versions (legacy)
+ NOOBS_HEX="2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,19,0092,0093"
+
+ # NOOBS supported model versions
+ NOOBS_SUPPORTED_MODELS='"Pi Model","Pi Compute Module","Pi Zero"'
+
+################################################################################
+# setup build defaults
+################################################################################
+
+ # Project CFLAGS
+ PROJECT_CFLAGS=""
+
+ # SquashFS compression method (gzip / lzo / xz)
+ SQUASHFS_COMPRESSION="lzo"
+
+
+################################################################################
+# setup project defaults
+################################################################################
+
+ # build and install ALSA Audio support (yes / no)
+ ALSA_SUPPORT="yes"
+
+ # OpenGL(X) implementation to use (no / mesa)
+ OPENGL="no"
+
+ # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q)
+ OPENGLES="bcm2835-driver"
+
+ # include uvesafb support (yes / no)
+ UVESAFB_SUPPORT="no"
+
+ # Displayserver to use (x11 / no)
+ DISPLAYSERVER="no"
+
+ # Windowmanager to use (ratpoison / fluxbox / none)
+ WINDOWMANAGER="none"
+
+ # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia)
+ # Space separated list is supported,
+ # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia"
+ GRAPHIC_DRIVERS=""
+
+ # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap)
+ KODIPLAYER_DRIVER="bcm2835-driver"
+
+ # Modules to install in initramfs for early boot
+ INITRAMFS_MODULES=""
+
+ # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware)
+ # Space separated list is supported,
+ # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware"
+ FIRMWARE="misc-firmware wlan-firmware dvb-firmware brcmfmac_sdio-firmware-rpi slice-firmware"
+
+ # build and install ATV IR remote support (yes / no)
+ ATVCLIENT_SUPPORT="no"
+
+ # build with swap support (yes / no)
+ SWAP_SUPPORT="yes"
+
+ # swap support enabled per default (yes / no)
+ SWAP_ENABLED_DEFAULT="no"
+
+ # swapfile size if SWAP_SUPPORT=yes in MB
+ SWAPFILESIZE="128"
+
+ # build with installer (yes / no)
+ INSTALLER_SUPPORT="no"
+
+ # build debug with valgrind (yes / no)
+ # Not available for armv6. Increases image size significantly
+ VALGRIND="no"
+
+ # kernel image name
+ KERNEL_NAME="kernel.img"
+
+ # additional drivers to install:
+ # for a list of additinoal drivers see packages/linux-drivers
+ # Space separated list is supported,
+ # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2"
+ ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS media_build rpi-cirrus-config slice-drivers"
diff --git a/projects/Slice/patches/kodi/kodi-000-revert-pr11222.patch b/projects/Slice/patches/kodi/kodi-000-revert-pr11222.patch
new file mode 100644
index 0000000000..491bc0b868
--- /dev/null
+++ b/projects/Slice/patches/kodi/kodi-000-revert-pr11222.patch
@@ -0,0 +1,102 @@
+From 073c2c6a118a03b70a29fd302e48f1f75bc7e5bc Mon Sep 17 00:00:00 2001
+From: MilhouseVH
+Date: Wed, 24 May 2017 19:17:24 +0100
+Subject: [PATCH] Revert "PR11222"
+
+This reverts commit 6cc9ab253753aeb62b01d3e654bbfa77a7f22a42.
+---
+ .../resource.language.en_gb/resources/strings.po | 15 --------------
+ system/peripherals.xml | 4 +---
+ xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 23 +++++++---------------
+ 3 files changed, 8 insertions(+), 34 deletions(-)
+
+diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
+index 6443f3d..e0060d1 100644
+--- a/addons/resource.language.en_gb/resources/strings.po
++++ b/addons/resource.language.en_gb/resources/strings.po
+@@ -19745,18 +19745,3 @@ msgstr ""
+ msgctxt "#39010"
+ msgid "Select sort method"
+ msgstr ""
+-
+-#: system/peripherals.xml
+-msgctxt "#38050"
+-msgid "Remote button press delay before repeating (ms)"
+-msgstr ""
+-
+-#: system/peripherals.xml
+-msgctxt "#38051"
+-msgid "Remote button press repeat rate (ms)"
+-msgstr ""
+-
+-#: system/peripherals.xml
+-msgctxt "#38052"
+-msgid "Remote button press release time (ms)"
+-msgstr ""
+diff --git a/system/peripherals.xml b/system/peripherals.xml
+index 02b1a9e..d5704b2 100644
+--- a/system/peripherals.xml
++++ b/system/peripherals.xml
+@@ -31,9 +31,7 @@
+
+
+
+-
+-
+-
++
+
+
+
+diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
+index d04a632..d032ffd 100644
+--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
+@@ -803,10 +803,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key)
+ CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration);
+
+ CSingleLock lock(m_critSection);
+- // avoid the queue getting too long
+- if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5)
+- return;
+- if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0)
++ if (key.iDuration > 0)
+ {
+ if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0)
+ {
+@@ -1299,15 +1296,6 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu
+ m_configuration.bActivateSource = config.bActivateSource;
+ bChanged |= SetSetting("activate_source", m_configuration.bActivateSource == 1);
+
+- m_configuration.iDoubleTapTimeoutMs = config.iDoubleTapTimeoutMs;
+- bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeoutMs);
+-
+- m_configuration.iButtonRepeatRateMs = config.iButtonRepeatRateMs;
+- bChanged |= SetSetting("button_repeat_rate_ms", (int)m_configuration.iButtonRepeatRateMs);
+-
+- m_configuration.iButtonReleaseDelayMs = config.iButtonReleaseDelayMs;
+- bChanged |= SetSetting("button_release_delay_ms", (int)m_configuration.iButtonReleaseDelayMs);
+-
+ m_configuration.bPowerOffOnStandby = config.bPowerOffOnStandby;
+
+ m_configuration.iFirmwareVersion = config.iFirmwareVersion;
+@@ -1403,10 +1391,13 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void)
+ m_configuration.bPowerOffOnStandby = iStandbyAction == LOCALISED_ID_SUSPEND ? 1 : 0;
+ m_bShutdownOnStandby = iStandbyAction == LOCALISED_ID_POWEROFF;
+
+- // double tap prevention timeout in ms
++#if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD)
++ // double tap prevention timeout in ms. libCEC uses 50ms units for this in 2.2.0, so divide by 50
++ m_configuration.iDoubleTapTimeout50Ms = GetSettingInt("double_tap_timeout_ms") / 50;
++#else
++ // backwards compatibility. will be removed once the next major release of libCEC is out
+ m_configuration.iDoubleTapTimeoutMs = GetSettingInt("double_tap_timeout_ms");
+- m_configuration.iButtonRepeatRateMs = GetSettingInt("button_repeat_rate_ms");
+- m_configuration.iButtonReleaseDelayMs = GetSettingInt("button_release_delay_ms");
++#endif
+
+ if (GetSettingBool("pause_playback_on_deactivate"))
+ {
+--
+2.7.4
+
diff --git a/projects/Slice/patches/kodi/kodi-001-backport.patch b/projects/Slice/patches/kodi/kodi-001-backport.patch
new file mode 120000
index 0000000000..d83be26793
--- /dev/null
+++ b/projects/Slice/patches/kodi/kodi-001-backport.patch
@@ -0,0 +1 @@
+../../../RPi/patches/kodi/kodi-001-backport.patch
\ No newline at end of file
diff --git a/projects/Slice/patches/kodi/kodi-004-keyboard.patch b/projects/Slice/patches/kodi/kodi-004-keyboard.patch
new file mode 100644
index 0000000000..d5434ebf74
--- /dev/null
+++ b/projects/Slice/patches/kodi/kodi-004-keyboard.patch
@@ -0,0 +1,45 @@
+--- a/system/keymaps/keyboard.xml 2016-09-17 16:35:20.000000000 +0100
++++ b/system/keymaps/keyboard.xml 2016-10-01 19:31:07.928719606 +0100
+@@ -56,7 +56,7 @@
+
+ ContextMenu
+ Menu
+- Pause
++ PlayPause
+ Stop
+ SkipNext
+ SkipPrevious
+@@ -321,8 +321,8 @@
+ NextSubtitle
+ StepBack
+ StepForward
+- ChapterOrBigStepForward
+- ChapterOrBigStepBack
++ VolumeUp
++ VolumeDown
+ AudioNextLanguage
+ NextSubtitle
+ AudioDelay
+@@ -425,8 +425,8 @@
+ StepForward
+ Rewind
+ FastForward
+- SkipNext
+- SkipPrevious
++ VolumeUp
++ VolumeDown
+ PlayerProcessInfo
+ LockPreset
+ FullScreen
+@@ -632,8 +632,8 @@
+
+ StepBack
+ StepForward
+- Up
+- Down
++ VolumeUp
++ VolumeDown
+ OSD
+ OSD
+ ActivateWindow(PVROSDChannels)
+
diff --git a/projects/Slice/patches/kodi/kodi-999.99-sysinfo-battery.patch b/projects/Slice/patches/kodi/kodi-999.99-sysinfo-battery.patch
new file mode 100644
index 0000000000..cd4d881ee9
--- /dev/null
+++ b/projects/Slice/patches/kodi/kodi-999.99-sysinfo-battery.patch
@@ -0,0 +1,10 @@
+--- a/xbmc/windows/GUIWindowSystemInfo.cpp 2013-02-21 22:09:04.765734381 +0400
++++ b/xbmc/windows/GUIWindowSystemInfo.cpp 2013-02-22 16:12:57.942164800 +0400
+@@ -100,7 +100,6 @@
+ #endif
+ SetControlLabel(i++, "%s: %s", 12390, SYSTEM_UPTIME);
+ SetControlLabel(i++, "%s: %s", 12394, SYSTEM_TOTALUPTIME);
+- SetControlLabel(i++, "%s: %s", 12395, SYSTEM_BATTERY_LEVEL);
+ }
+ else if (m_section == CONTROL_BT_STORAGE)
+ {
diff --git a/projects/Slice/patches/linux/linux-01-RPi_support.patch b/projects/Slice/patches/linux/linux-01-RPi_support.patch
new file mode 120000
index 0000000000..1642b276b2
--- /dev/null
+++ b/projects/Slice/patches/linux/linux-01-RPi_support.patch
@@ -0,0 +1 @@
+../../../RPi/patches/linux/linux-01-RPi_support.patch
\ No newline at end of file
diff --git a/projects/Slice/patches/linux/linux-04-rtc-pcf8523-c.patch b/projects/Slice/patches/linux/linux-04-rtc-pcf8523-c.patch
new file mode 100644
index 0000000000..da7593ed7e
--- /dev/null
+++ b/projects/Slice/patches/linux/linux-04-rtc-pcf8523-c.patch
@@ -0,0 +1,17 @@
+--- a/drivers/rtc/rtc-pcf8523.c 2016-10-01 10:16:30.259771931 +0100
++++ b/drivers/rtc/rtc-pcf8523.c 2016-10-01 10:21:29.762638800 +0100
+@@ -291,7 +291,13 @@ static int pcf8523_probe(struct i2c_clie
+ if (!pcf)
+ return -ENOMEM;
+
+- err = pcf8523_select_capacitance(client, true);
++ if (of_property_read_bool(client->dev.of_node, "nxp,xtalcap-7pf")) {
++ printk(KERN_ERR "PCF8523 - set 7pF crystal load");
++ err = pcf8523_select_capacitance(client, false);
++ } else {
++ printk(KERN_ERR "PCF8523 - set 12pF crystal load");
++ err = pcf8523_select_capacitance(client, true);
++ }
+ if (err < 0)
+ return err;
+
diff --git a/projects/Slice/patches/linux/linux-05-cs4265-c.patch b/projects/Slice/patches/linux/linux-05-cs4265-c.patch
new file mode 100644
index 0000000000..a3487ac222
--- /dev/null
+++ b/projects/Slice/patches/linux/linux-05-cs4265-c.patch
@@ -0,0 +1,45 @@
+--- linux-4.4-rc7-old/sound/soc/codecs/cs4265.c 2016-01-13 20:56:05.637652775 +0000
++++ linux-4.4-rc7/sound/soc/codecs/cs4265.c 2016-01-17 11:21:16.977652775 +0000
+@@ -157,7 +157,7 @@
+ SOC_SINGLE("Validity Bit Control Switch", CS4265_SPDIF_CTL2,
+ 3, 1, 0),
+ SOC_ENUM("SPDIF Mono/Stereo", spdif_mono_stereo_enum),
+- SOC_SINGLE("MMTLR Data Switch", 0,
++ SOC_SINGLE("MMTLR Data Switch", CS4265_SPDIF_CTL2,
+ 1, 1, 0),
+ SOC_ENUM("Mono Channel Select", spdif_mono_select_enum),
+ SND_SOC_BYTES("C Data Buffer", CS4265_C_DATA_BUFF, 24),
+@@ -199,8 +199,6 @@
+ SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_AIF_IN("DIN2", NULL, 0,
+ SND_SOC_NOPM, 0, 0),
+- SND_SOC_DAPM_AIF_IN("TXIN", NULL, 0,
+- CS4265_SPDIF_CTL2, 5, 1),
+
+ SND_SOC_DAPM_OUTPUT("LINEOUTL"),
+ SND_SOC_DAPM_OUTPUT("LINEOUTR"),
+@@ -384,7 +382,6 @@
+ static int cs4265_digital_mute(struct snd_soc_dai *dai, int mute)
+ {
+ struct snd_soc_codec *codec = dai->codec;
+-
+ if (mute) {
+ snd_soc_update_bits(codec, CS4265_DAC_CTL,
+ CS4265_DAC_CTL_MUTE,
+@@ -410,7 +407,7 @@
+ struct snd_soc_codec *codec = dai->codec;
+ struct cs4265_private *cs4265 = snd_soc_codec_get_drvdata(codec);
+ int index;
+-
++printk(KERN_ERR "cs4265_pcm_hw_params: format = 0x%x, width = %d\n", cs4265->format, params_width(params));
+ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
+ ((cs4265->format & SND_SOC_DAIFMT_FORMAT_MASK)
+ == SND_SOC_DAIFMT_RIGHT_J))
+@@ -469,6 +466,7 @@
+ static int cs4265_set_bias_level(struct snd_soc_codec *codec,
+ enum snd_soc_bias_level level)
+ {
++printk(KERN_ERR "set_bias_level %d\n", level);
+ switch (level) {
+ case SND_SOC_BIAS_ON:
+ break;
diff --git a/projects/Slice3/config/distroconfig.txt b/projects/Slice3/config/distroconfig.txt
new file mode 100644
index 0000000000..6473369b91
--- /dev/null
+++ b/projects/Slice3/config/distroconfig.txt
@@ -0,0 +1,23 @@
+################################################################################
+# This file is part of LibreELEC - http://www.libreelec.tv
+# Copyright (C) 2016 Team LibreELEC
+#
+# LibreELEC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# LibreELEC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LibreELEC. If not, see .
+################################################################################
+
+# WARNING: DO NOT EDIT THIS FILE - IT WILL BE OVERWRITTEN WHEN UPGRADING!
+
+dtoverlay=slice
+dtoverlay=ws2812
+dtoverlay=mmc
diff --git a/projects/Slice3/config/slice-overlay.dts b/projects/Slice3/config/slice-overlay.dts
new file mode 100644
index 0000000000..7f0a4d2f3b
--- /dev/null
+++ b/projects/Slice3/config/slice-overlay.dts
@@ -0,0 +1,172 @@
+// Definitions for Slice hardware
+/dts-v1/;
+/plugin/;
+
+#include "dt-bindings/clock/bcm2835.h"
+
+/ {
+ compatible = "brcm,bcm2708";
+
+ //
+ // Set up GPIOs:
+ // I2C1 on GPIO44,45
+ // LIRC input/output on GPIO4 and 37 (NB GPIO4 NC on Slice)
+ // I2S on GPIO28-31
+ //
+ fragment@0 {
+ target = <&gpio>;
+ __overlay__ {
+ i2c1_pins: i2c1 {
+ brcm,pins = <44 45>;
+ brcm,function = <6>; /* alt2 */
+ };
+ lirc_pins: lirc_pins {
+ brcm,pins = <4 37>; //
+ brcm,function = <1 0>; // out in
+ brcm,pull = <0 1>; // off down
+ };
+ i2s_pins: i2s {
+ brcm,pins = <28 29 30 31>;
+ brcm,function = <6>; /* alt2 */
+ };
+ ws2812_pins: ws2812 {
+ brcm,pins = <40>;
+ brcm,function = <4>; /* alt0 */
+ };
+ };
+ };
+
+ //
+ // I2C at 100KHz
+ //
+ fragment@1 {
+ target = <&i2c1>;
+ __overlay__ {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c1_pins>;
+ clock-frequency = <100000>;
+ };
+ };
+
+ //
+ // Add devices to I2C1 Bus:
+ // PCF8523 RTC device
+ // CS4265 Audio CODEC
+ //
+ fragment@2 {
+ target = <&i2c1>;
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "okay";
+ pcf8523@68 {
+ compatible = "nxp,pcf8523";
+ reg = <0x68>;
+ nxp,xtalcap-7pf; /* set crystal load to 7pf */
+ status = "okay";
+ };
+ cs4265@4e {
+ #sound-dai-cells = <0>;
+ compatible = "cirrus,cs4265";
+ reg = <0x4e>;
+ cs4265-reset-gpios = <&gpio 33 0>; /* AUD_RST_N on GPIO33 */
+ cirrus,no-s16le; /* remove S16LE support to workaround I2S controller issue */
+ status = "okay";
+ };
+ };
+ };
+
+ //
+ // LIRC
+ //
+ fragment@3 {
+ target-path = "/";
+ __overlay__ {
+ lirc_rpi: lirc_rpi {
+ compatible = "rpi,lirc-rpi";
+ pinctrl-names = "default";
+ pinctrl-0 = <&lirc_pins>;
+ status = "okay";
+
+ // Override autodetection of IR receiver circuit
+ // (0 = active high, 1 = active low, -1 = no override )
+ rpi,sense = <0xffffffff>;
+
+ // Software carrier
+ // (0 = off, 1 = on)
+ rpi,softcarrier = <1>;
+
+ // Invert output
+ // (0 = off, 1 = on)
+ rpi,invert = <0>;
+
+ // Enable debugging messages
+ // (0 = off, 1 = on)
+ rpi,debug = <0>;
+ };
+ };
+ };
+
+ //
+ // Audio driver
+ //
+ fragment@4 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ target = <&sound>;
+ __overlay__ {
+ compatible = "fiveninjas,slice";
+ clocks = <&cprman BCM2835_CLOCK_GP0>;
+ clock-names = "gp0";
+ pinctrl-names = "default";
+ i2s-controller = <&i2s>;
+ status = "okay";
+ };
+ };
+
+ //
+ // Enable I2S
+ //
+ fragment@5 {
+ target = <&i2s>;
+ __overlay__ {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2s_pins>;
+ brcm,enable-mmap;
+ status = "okay";
+ };
+ };
+
+ //
+ // WS2812B LEDs driver
+ //
+ fragment@6 {
+ target = <&soc>;
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ws2812: ws2812 {
+ compatible = "rpi,ws2812";
+ pinctrl-names = "default";
+ pinctrl-0 = <&ws2812_pins>;
+ reg = <0x7e20c000 0x100>; /* PWM */
+ dmas = <&dma 5>;
+ dma-names = "pwm_dma";
+ led-en-gpios = <&gpio 43 0>;
+ rpi,invert = <1>;
+ rpi,num_leds = <25>;
+ status = "okay";
+ };
+ };
+ };
+
+ //
+ // Disable standard audio
+ //
+ fragment@7 {
+ target = <&audio>;
+ __overlay__ {
+ status = "disabled";
+ };
+ };
+};
diff --git a/projects/Slice3/config/ws2812-overlay.dts b/projects/Slice3/config/ws2812-overlay.dts
new file mode 100644
index 0000000000..38ac74dffa
--- /dev/null
+++ b/projects/Slice3/config/ws2812-overlay.dts
@@ -0,0 +1,33 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "brcm,bcm2708";
+
+ fragment@0 {
+ target = <&soc>;
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ ws2812: ws2812 {
+ compatible = "rpi,ws2812";
+ reg = <0x7e20c000 0x100>; /* PWM */
+ dmas = <&dma 5>;
+ dma-names = "pwm_dma";
+ led-en-gpios = <&gpio 43 0>;
+
+ rpi,invert = <1>;
+ rpi,num_leds = <25>;
+
+ status = "okay";
+
+ };
+ };
+ };
+
+ __overrides__ {
+ invert = <&ws2812>,"rpi,invert:0";
+ num_leds = <&ws2812>,"rpi,num_leds:0";
+ };
+};
diff --git a/projects/Slice3/filesystem/usr/config/autostart.sh b/projects/Slice3/filesystem/usr/config/autostart.sh
new file mode 100644
index 0000000000..0b6166972b
--- /dev/null
+++ b/projects/Slice3/filesystem/usr/config/autostart.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+hdparm -S60 /dev/sda
diff --git a/projects/Slice3/filesystem/usr/config/shutdown.sh b/projects/Slice3/filesystem/usr/config/shutdown.sh
new file mode 100644
index 0000000000..2c597f1186
--- /dev/null
+++ b/projects/Slice3/filesystem/usr/config/shutdown.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+LEDDIR="/usr/share/kodi/addons/service.slice/resources/media/ledpatterns"
+
+case "$1" in
+ halt)
+ hdparm -y /dev/sda
+ led_png $LEDDIR/shutdown.png
+ ;;
+ poweroff)
+ hdparm -y /dev/sda
+ led_png $LEDDIR/shutdown.png
+ ;;
+ reboot)
+ led_png $LEDDIR/shutdown.png
+ ;;
+ *)
+ ;;
+esac
diff --git a/projects/Slice3/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Slice3/filesystem/usr/lib/systemd/system/serial-console.service
new file mode 100644
index 0000000000..196e8c4a97
--- /dev/null
+++ b/projects/Slice3/filesystem/usr/lib/systemd/system/serial-console.service
@@ -0,0 +1,23 @@
+[Unit]
+Description=Debug Shell on /dev/console
+DefaultDependencies=no
+ConditionKernelCommandLine=console
+
+[Service]
+WorkingDirectory=/storage
+Environment="ENV=/etc/profile"
+ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"'
+ExecStart=/bin/sh
+Restart=always
+RestartSec=0
+StandardInput=tty
+TTYPath=/dev/console
+TTYReset=yes
+TTYVHangup=yes
+KillMode=process
+IgnoreSIGPIPE=no
+# bash ignores SIGTERM
+KillSignal=SIGHUP
+
+[Install]
+WantedBy=sysinit.target
diff --git a/projects/Slice3/filesystem/usr/share/alsa/cards/snd_slice.conf b/projects/Slice3/filesystem/usr/share/alsa/cards/snd_slice.conf
new file mode 100644
index 0000000000..298f43d8e7
--- /dev/null
+++ b/projects/Slice3/filesystem/usr/share/alsa/cards/snd_slice.conf
@@ -0,0 +1,25 @@
+
+
+snd_slice.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+}
diff --git a/projects/Slice3/initramfs/platform_init b/projects/Slice3/initramfs/platform_init
new file mode 100755
index 0000000000..e3e2e7d50a
--- /dev/null
+++ b/projects/Slice3/initramfs/platform_init
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+################################################################################
+# This file is part of OpenELEC - http://www.openelec.tv
+# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv)
+#
+# OpenELEC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# OpenELEC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with OpenELEC. If not, see .
+################################################################################
+
+# Enable io_is_busy for improved sdhost performance - essentially, equivalent of force_turbo=1 but for mmc
+echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
+
+# Configure frequency scaling properties - should improve performance a little (turbo, in most cases)
+echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
+echo 100000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
diff --git a/projects/Slice3/kodi/advancedsettings.xml b/projects/Slice3/kodi/advancedsettings.xml
new file mode 100644
index 0000000000..00ed0dda87
--- /dev/null
+++ b/projects/Slice3/kodi/advancedsettings.xml
@@ -0,0 +1,12 @@
+
+
+ false
+ 1
+
+ 720
+ 540
+
+
+ 30
+
+
diff --git a/projects/Slice3/linux b/projects/Slice3/linux
new file mode 120000
index 0000000000..e48fcfd9f8
--- /dev/null
+++ b/projects/Slice3/linux
@@ -0,0 +1 @@
+../RPi2/linux
\ No newline at end of file
diff --git a/projects/Slice3/options b/projects/Slice3/options
new file mode 100644
index 0000000000..fc543279b1
--- /dev/null
+++ b/projects/Slice3/options
@@ -0,0 +1,139 @@
+################################################################################
+# setup system defaults
+################################################################################
+
+ # The TARGET_CPU variable controls which processor should be targeted for
+ # generated code.
+ case $TARGET_ARCH in
+ arm)
+ # TARGET_CPU:
+ # arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm7m arm7d
+ # arm7dm arm7di arm7dmi arm70 arm700 arm700i arm710 arm710c
+ # arm7100 arm720 arm7500 arm7500fe arm7tdmi arm7tdmi-s arm710t
+ # arm720t arm740t strongarm strongarm110 strongarm1100
+ # strongarm1110 arm8 arm810 arm9 arm9e arm920 arm920t arm922t
+ # arm946e-s arm966e-s arm968e-s arm926ej-s arm940t arm9tdmi
+ # arm10tdmi arm1020t arm1026ej-s arm10e arm1020e arm1022e
+ # arm1136j-s arm1136jf-s mpcore mpcorenovfp arm1156t2-s
+ # arm1176jz-s arm1176jzf-s cortex-a8 cortex-a9 cortex-r4
+ # cortex-r4f cortex-m3 cortex-m1 xscale iwmmxt iwmmxt2 ep9312.
+ TARGET_CPU="cortex-a7"
+
+ # TARGET_FLOAT:
+ # Specifies which floating-point ABI to use. Permissible values are:
+ # soft softfp hard
+ TARGET_FLOAT="hard"
+
+ # TARGET_FPU:
+ # This specifies what floating point hardware (or hardware emulation) is
+ # available on the target. Permissible names are:
+ # fpa fpe2 fpe3 maverick vfp vfpv3 vfpv3-fp16 vfpv3-d16 vfpv3-d16-fp16
+ # vfpv3xd vfpv3xd-fp16 neon neon-fp16 vfpv4 vfpv4-d16 fpv4-sp-d16
+ # neon-vfpv4.
+ TARGET_FPU="neon-vfpv4"
+ ;;
+ esac
+
+ # Bootloader to use (syslinux / u-boot / bcm2835-bootloader)
+ BOOTLOADER="bcm2835-bootloader"
+
+ # u-boot version to use (default)
+ UBOOT_VERSION="default"
+
+ # Configuration for u-boot
+ UBOOT_CONFIG=""
+
+ # Target Configfile for u-boot
+ UBOOT_CONFIGFILE=""
+
+ # Kernel target
+ KERNEL_TARGET="zImage"
+
+ # Kernel extra targets to build
+ KERNEL_UBOOT_EXTRA_TARGET=""
+
+ # Additional kernel make parameters (for example to specify the u-boot loadaddress)
+ KERNEL_MAKE_EXTRACMD="dtbs overlays/slice.dtbo overlays/ws2812.dtbo"
+
+ # Kernel to use. values can be:
+ # default: default mainline kernel
+ LINUX="default-rpi"
+
+ # NOOBS supported hex versions (legacy)
+ NOOBS_HEX="1040,1041,2082"
+
+ # NOOBS supported model versions
+ NOOBS_SUPPORTED_MODELS='"Pi 2","Pi 3"'
+
+################################################################################
+# setup build defaults
+################################################################################
+
+ # Project CFLAGS
+ PROJECT_CFLAGS=""
+
+ # SquashFS compression method (gzip / lzo / xz)
+ SQUASHFS_COMPRESSION="lzo"
+
+
+################################################################################
+# setup project defaults
+################################################################################
+
+ # build and install ALSA Audio support (yes / no)
+ ALSA_SUPPORT="yes"
+
+ # OpenGL(X) implementation to use (no / mesa)
+ OPENGL="no"
+
+ # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q)
+ OPENGLES="bcm2835-driver"
+
+ # include uvesafb support (yes / no)
+ UVESAFB_SUPPORT="no"
+
+ # Displayserver to use (x11 / no)
+ DISPLAYSERVER="no"
+
+ # Windowmanager to use (ratpoison / fluxbox / none)
+ WINDOWMANAGER="none"
+
+ # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia)
+ # Space separated list is supported,
+ # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia"
+ GRAPHIC_DRIVERS=""
+
+ # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap)
+ KODIPLAYER_DRIVER="bcm2835-driver"
+
+ # Modules to install in initramfs for early boot
+ INITRAMFS_MODULES=""
+
+ # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware)
+ # Space separated list is supported,
+ # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware"
+ FIRMWARE="misc-firmware wlan-firmware dvb-firmware brcmfmac_sdio-firmware-rpi slice-firmware"
+
+ # build and install ATV IR remote support (yes / no)
+ ATVCLIENT_SUPPORT="no"
+
+ # build with swap support (yes / no)
+ SWAP_SUPPORT="yes"
+
+ # swap support enabled per default (yes / no)
+ SWAP_ENABLED_DEFAULT="no"
+
+ # swapfile size if SWAP_SUPPORT=yes in MB
+ SWAPFILESIZE="128"
+
+ # build with installer (yes / no)
+ INSTALLER_SUPPORT="no"
+
+ # kernel image name
+ KERNEL_NAME="kernel.img"
+
+ # additional drivers to install:
+ # for a list of additinoal drivers see packages/linux-drivers
+ # Space separated list is supported,
+ # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2"
+ ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS media_build rpi-cirrus-config slice-drivers"
diff --git a/projects/Slice3/patches/kodi/kodi-000-revert-pr11222.patch b/projects/Slice3/patches/kodi/kodi-000-revert-pr11222.patch
new file mode 100644
index 0000000000..491bc0b868
--- /dev/null
+++ b/projects/Slice3/patches/kodi/kodi-000-revert-pr11222.patch
@@ -0,0 +1,102 @@
+From 073c2c6a118a03b70a29fd302e48f1f75bc7e5bc Mon Sep 17 00:00:00 2001
+From: MilhouseVH
+Date: Wed, 24 May 2017 19:17:24 +0100
+Subject: [PATCH] Revert "PR11222"
+
+This reverts commit 6cc9ab253753aeb62b01d3e654bbfa77a7f22a42.
+---
+ .../resource.language.en_gb/resources/strings.po | 15 --------------
+ system/peripherals.xml | 4 +---
+ xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 23 +++++++---------------
+ 3 files changed, 8 insertions(+), 34 deletions(-)
+
+diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
+index 6443f3d..e0060d1 100644
+--- a/addons/resource.language.en_gb/resources/strings.po
++++ b/addons/resource.language.en_gb/resources/strings.po
+@@ -19745,18 +19745,3 @@ msgstr ""
+ msgctxt "#39010"
+ msgid "Select sort method"
+ msgstr ""
+-
+-#: system/peripherals.xml
+-msgctxt "#38050"
+-msgid "Remote button press delay before repeating (ms)"
+-msgstr ""
+-
+-#: system/peripherals.xml
+-msgctxt "#38051"
+-msgid "Remote button press repeat rate (ms)"
+-msgstr ""
+-
+-#: system/peripherals.xml
+-msgctxt "#38052"
+-msgid "Remote button press release time (ms)"
+-msgstr ""
+diff --git a/system/peripherals.xml b/system/peripherals.xml
+index 02b1a9e..d5704b2 100644
+--- a/system/peripherals.xml
++++ b/system/peripherals.xml
+@@ -31,9 +31,7 @@
+
+
+
+-
+-
+-
++
+
+
+
+diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
+index d04a632..d032ffd 100644
+--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
+@@ -803,10 +803,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key)
+ CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration);
+
+ CSingleLock lock(m_critSection);
+- // avoid the queue getting too long
+- if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5)
+- return;
+- if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0)
++ if (key.iDuration > 0)
+ {
+ if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0)
+ {
+@@ -1299,15 +1296,6 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu
+ m_configuration.bActivateSource = config.bActivateSource;
+ bChanged |= SetSetting("activate_source", m_configuration.bActivateSource == 1);
+
+- m_configuration.iDoubleTapTimeoutMs = config.iDoubleTapTimeoutMs;
+- bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeoutMs);
+-
+- m_configuration.iButtonRepeatRateMs = config.iButtonRepeatRateMs;
+- bChanged |= SetSetting("button_repeat_rate_ms", (int)m_configuration.iButtonRepeatRateMs);
+-
+- m_configuration.iButtonReleaseDelayMs = config.iButtonReleaseDelayMs;
+- bChanged |= SetSetting("button_release_delay_ms", (int)m_configuration.iButtonReleaseDelayMs);
+-
+ m_configuration.bPowerOffOnStandby = config.bPowerOffOnStandby;
+
+ m_configuration.iFirmwareVersion = config.iFirmwareVersion;
+@@ -1403,10 +1391,13 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void)
+ m_configuration.bPowerOffOnStandby = iStandbyAction == LOCALISED_ID_SUSPEND ? 1 : 0;
+ m_bShutdownOnStandby = iStandbyAction == LOCALISED_ID_POWEROFF;
+
+- // double tap prevention timeout in ms
++#if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD)
++ // double tap prevention timeout in ms. libCEC uses 50ms units for this in 2.2.0, so divide by 50
++ m_configuration.iDoubleTapTimeout50Ms = GetSettingInt("double_tap_timeout_ms") / 50;
++#else
++ // backwards compatibility. will be removed once the next major release of libCEC is out
+ m_configuration.iDoubleTapTimeoutMs = GetSettingInt("double_tap_timeout_ms");
+- m_configuration.iButtonRepeatRateMs = GetSettingInt("button_repeat_rate_ms");
+- m_configuration.iButtonReleaseDelayMs = GetSettingInt("button_release_delay_ms");
++#endif
+
+ if (GetSettingBool("pause_playback_on_deactivate"))
+ {
+--
+2.7.4
+
diff --git a/projects/Slice3/patches/kodi/kodi-001-backport.patch b/projects/Slice3/patches/kodi/kodi-001-backport.patch
new file mode 120000
index 0000000000..7a787944f5
--- /dev/null
+++ b/projects/Slice3/patches/kodi/kodi-001-backport.patch
@@ -0,0 +1 @@
+../../../RPi2/patches/kodi/kodi-001-backport.patch
\ No newline at end of file
diff --git a/projects/Slice3/patches/kodi/kodi-004-keyboard.patch b/projects/Slice3/patches/kodi/kodi-004-keyboard.patch
new file mode 100644
index 0000000000..d5434ebf74
--- /dev/null
+++ b/projects/Slice3/patches/kodi/kodi-004-keyboard.patch
@@ -0,0 +1,45 @@
+--- a/system/keymaps/keyboard.xml 2016-09-17 16:35:20.000000000 +0100
++++ b/system/keymaps/keyboard.xml 2016-10-01 19:31:07.928719606 +0100
+@@ -56,7 +56,7 @@
+
+ ContextMenu
+ Menu
+- Pause
++ PlayPause
+ Stop
+ SkipNext
+ SkipPrevious
+@@ -321,8 +321,8 @@
+ NextSubtitle
+ StepBack
+ StepForward
+- ChapterOrBigStepForward
+- ChapterOrBigStepBack
++ VolumeUp
++ VolumeDown
+ AudioNextLanguage
+ NextSubtitle
+ AudioDelay
+@@ -425,8 +425,8 @@
+ StepForward
+ Rewind
+ FastForward
+- SkipNext
+- SkipPrevious
++ VolumeUp
++ VolumeDown
+ PlayerProcessInfo
+ LockPreset
+ FullScreen
+@@ -632,8 +632,8 @@
+
+ StepBack
+ StepForward
+- Up
+- Down
++ VolumeUp
++ VolumeDown
+ OSD
+ OSD
+ ActivateWindow(PVROSDChannels)
+
diff --git a/projects/Slice3/patches/kodi/kodi-999.99-sysinfo-battery.patch b/projects/Slice3/patches/kodi/kodi-999.99-sysinfo-battery.patch
new file mode 100644
index 0000000000..cd4d881ee9
--- /dev/null
+++ b/projects/Slice3/patches/kodi/kodi-999.99-sysinfo-battery.patch
@@ -0,0 +1,10 @@
+--- a/xbmc/windows/GUIWindowSystemInfo.cpp 2013-02-21 22:09:04.765734381 +0400
++++ b/xbmc/windows/GUIWindowSystemInfo.cpp 2013-02-22 16:12:57.942164800 +0400
+@@ -100,7 +100,6 @@
+ #endif
+ SetControlLabel(i++, "%s: %s", 12390, SYSTEM_UPTIME);
+ SetControlLabel(i++, "%s: %s", 12394, SYSTEM_TOTALUPTIME);
+- SetControlLabel(i++, "%s: %s", 12395, SYSTEM_BATTERY_LEVEL);
+ }
+ else if (m_section == CONTROL_BT_STORAGE)
+ {
diff --git a/projects/Slice3/patches/linux/linux-01-RPi_support.patch b/projects/Slice3/patches/linux/linux-01-RPi_support.patch
new file mode 120000
index 0000000000..b6884c169a
--- /dev/null
+++ b/projects/Slice3/patches/linux/linux-01-RPi_support.patch
@@ -0,0 +1 @@
+../../../RPi2/patches/linux/linux-01-RPi_support.patch
\ No newline at end of file
diff --git a/projects/Slice3/patches/linux/linux-04-rtc-pcf8523-c.patch b/projects/Slice3/patches/linux/linux-04-rtc-pcf8523-c.patch
new file mode 100644
index 0000000000..da7593ed7e
--- /dev/null
+++ b/projects/Slice3/patches/linux/linux-04-rtc-pcf8523-c.patch
@@ -0,0 +1,17 @@
+--- a/drivers/rtc/rtc-pcf8523.c 2016-10-01 10:16:30.259771931 +0100
++++ b/drivers/rtc/rtc-pcf8523.c 2016-10-01 10:21:29.762638800 +0100
+@@ -291,7 +291,13 @@ static int pcf8523_probe(struct i2c_clie
+ if (!pcf)
+ return -ENOMEM;
+
+- err = pcf8523_select_capacitance(client, true);
++ if (of_property_read_bool(client->dev.of_node, "nxp,xtalcap-7pf")) {
++ printk(KERN_ERR "PCF8523 - set 7pF crystal load");
++ err = pcf8523_select_capacitance(client, false);
++ } else {
++ printk(KERN_ERR "PCF8523 - set 12pF crystal load");
++ err = pcf8523_select_capacitance(client, true);
++ }
+ if (err < 0)
+ return err;
+
diff --git a/projects/Slice3/patches/linux/linux-05-cs4265-c.patch b/projects/Slice3/patches/linux/linux-05-cs4265-c.patch
new file mode 100644
index 0000000000..a3487ac222
--- /dev/null
+++ b/projects/Slice3/patches/linux/linux-05-cs4265-c.patch
@@ -0,0 +1,45 @@
+--- linux-4.4-rc7-old/sound/soc/codecs/cs4265.c 2016-01-13 20:56:05.637652775 +0000
++++ linux-4.4-rc7/sound/soc/codecs/cs4265.c 2016-01-17 11:21:16.977652775 +0000
+@@ -157,7 +157,7 @@
+ SOC_SINGLE("Validity Bit Control Switch", CS4265_SPDIF_CTL2,
+ 3, 1, 0),
+ SOC_ENUM("SPDIF Mono/Stereo", spdif_mono_stereo_enum),
+- SOC_SINGLE("MMTLR Data Switch", 0,
++ SOC_SINGLE("MMTLR Data Switch", CS4265_SPDIF_CTL2,
+ 1, 1, 0),
+ SOC_ENUM("Mono Channel Select", spdif_mono_select_enum),
+ SND_SOC_BYTES("C Data Buffer", CS4265_C_DATA_BUFF, 24),
+@@ -199,8 +199,6 @@
+ SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_AIF_IN("DIN2", NULL, 0,
+ SND_SOC_NOPM, 0, 0),
+- SND_SOC_DAPM_AIF_IN("TXIN", NULL, 0,
+- CS4265_SPDIF_CTL2, 5, 1),
+
+ SND_SOC_DAPM_OUTPUT("LINEOUTL"),
+ SND_SOC_DAPM_OUTPUT("LINEOUTR"),
+@@ -384,7 +382,6 @@
+ static int cs4265_digital_mute(struct snd_soc_dai *dai, int mute)
+ {
+ struct snd_soc_codec *codec = dai->codec;
+-
+ if (mute) {
+ snd_soc_update_bits(codec, CS4265_DAC_CTL,
+ CS4265_DAC_CTL_MUTE,
+@@ -410,7 +407,7 @@
+ struct snd_soc_codec *codec = dai->codec;
+ struct cs4265_private *cs4265 = snd_soc_codec_get_drvdata(codec);
+ int index;
+-
++printk(KERN_ERR "cs4265_pcm_hw_params: format = 0x%x, width = %d\n", cs4265->format, params_width(params));
+ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
+ ((cs4265->format & SND_SOC_DAIFMT_FORMAT_MASK)
+ == SND_SOC_DAIFMT_RIGHT_J))
+@@ -469,6 +466,7 @@
+ static int cs4265_set_bias_level(struct snd_soc_codec *codec,
+ enum snd_soc_bias_level level)
+ {
++printk(KERN_ERR "set_bias_level %d\n", level);
+ switch (level) {
+ case SND_SOC_BIAS_ON:
+ break;