Skip to main content

Sysadmin, interested in new technologies, communications, multimedia, accessibility, better Linux than Windows, better Android than IOS and similar.

pvagner

pvdeejay

mastodon.sk/@pvagner

Peter Vágner

with Irdeto / ICE card and this has started happenning randomly. There's a hack around at least. http://www.streamboard.tv/oscam/ticket/4487

Peter Vágner

How to hack #Kodi screen reader addon into #LibreElec image

4 min read

In order to make this really work I had to do a few edits to this article. Last change has been made at 29th of december 2016.
Today I was asked by one of the online friends how to make LibreElec htpc software include Kodi screen reader addon.
First we had some disscussion in the IRC channel on freenode. We have found out adding Kodi screen reader into the official image is not likely to happen. We are still free to make our blindness specific spin though.
There are several things to overcome.
Rebuilding the whole LibreELEC image is an overkill we just would like to inject our addon.
The addon has a feature that will not start when it's preinstalled into system wide kodi addons directory so we have to patch the addon with a dirty change until a better solution is found.
And this is updated proof of concept tweak how we can hack Kodi screen reader into image of Raspberry pi 2 / Raspberry pi 3 build of Libre Elec.


# Create an empty directory where we will do our job
mkdir /tmp/libreelec
cd /tmp/libreelec/
# download libreelec image. You can get the Kripton or more up to date version but pay extra attention in that case
wget "http://ftp.belnet.be/libreelec.tv/LibreELEC-RPi2.arm-7.0.2.img.gz"
# unpack the downloaded archive
gunzip LibreELEC-RPi2.arm-7.0.2.img.gz
# inspect what partitions the unpacked image has
fdisk -lu LibreELEC-RPi2.arm-7.0.2.img
# Note the sector size of the image is 512 bytes, first partition starts at sector 2048 thus we need to setup a loop device starting at offset 2048*512
sudo losetup -o 1048576 /dev/loop0 LibreELEC-RPi2.arm-7.0.2.img
# create a temporary folder where we'll mount the unpacked image
mkdir image
sudo mount /dev/loop0 image
# unpack squashfs image to a current directory (has to be executed as root to preserve file permissions and ownership)
sudo unsquashfs image/SYSTEM
# Download current Kodi screen reader addon from one of the kodi.tv addon repository mirrors
wget "http://ftp.halifax.rwth-aachen.de/xbmc/addons/krypton/service.xbmc.tts/service.xbmc.tts-1.0.6.zip"
# Change to the directory where you can unpack Kodi screen reader addon
cd squashfs-root/usr/share/kodi/addons/
# unzip the Kodi screen reader addon (do it as root to fit within the rest of the target system image)
sudo unzip ../../../../../service.xbmc.tts-1.0.6.zip
# Patch the addon not to disable it-self on first run when it detects it's preinstalled
sudo sed 's/return os\.path\.exists(preInstalledPath)/return False \.path\.exists(preInstalledPath)/g' service.xbmc.tts/lib/util.py 1<> service.xbmc.tts/lib/util.py
# change back to the original working directory
cd ../../../../..
# If you have image including Kodi Kripton or possibly newer version, uncomment the next line to add our addon into the addon-manifest.xml
sudo xmlstarlet ed -L --subnode "/addons" -t elem -n "addon" -v "service.xbmc.tts" squashfs-root/usr/share/kodi/system/addon-manifest.xml || : # ignore error
# Recreate the squashfs SYSTEM image (again it's important to do that as root)
sudo mksquashfs squashfs-root SYSTEM -b 131072 -comp lzo -no-xattrs
# Create a md5 sum for your new squashfs image
md5sum SYSTEM > SYSTEM.md5
# now if you like you can compare size and features of both the images.
ls -l SYSTEM
ls -l image/SYSTEM
unsquashfs -s SYSTEM
unsquashfs -s image/SYSTEM
# Finally move your newly created SYSTEM and SYSTEM.md5 files into the proper place
sudo mv SYSTEM* image/
# unmount the image as we are done tampering with it
sudo umount image
# If you like just check the image if it has been really modified recently
ls -l LibreELEC-RPi2.arm-7.0.2.img
# Compress the image inplace as much as gzip allows
gzip -9 LibreELEC-RPi2.arm-7.0.2.img
# Flash / upload file for a friend and clean up your self please