Cross compile rsync for OpenELEC

In earlier releases of OpenELEC support for rsync was included. At some point it was moved to the unofficial addon repository. Unfortunately it looks like the unofficial addon repo has been abandoned. OpenElec 8 has been out for a year and there is still no unofficial addon support for it. I would assume that there won’t be any support for it in the future either.

I run OpenELEC on a RaspberryPi and really needed rsync support for it.

To get it working I cross compiled rsync for armv7 on my regular Linux machine and then copied the binary to my OpenElec box. I figured this might be handy for someone running into the same issue. This workflow is specific for ARM.

Fetch and unpack the rsync sources:

# wget https://download.samba.org/pub/rsync/src/rsync-3.1.3.tar.gz
# tar -xzvf rsync-3.1.3.tar.gz 
# cd rsync-3.1.3

I installed the ARM GNU Compiler Collection. I’m on Arch and the package is in the AUR:

aur/arm-linux-gnueabihf-gcc

Initially I had installed:

community/aarch64-linux-gnu-gcc

This only works for ARMv8 though. If you wan’t to compile for a RaspberryPIv3 this might be the way to go as this is available as pre-compiled binary while you have to compile the ARM GNU Compiler Collection which took several hours on my machine.

Next generate the Makefile:

# ./configure --disable-acl-support --disable-xattr-support --with-included-popt

Then edit the Makefile and replace:

CC=gcc   
CC=arm-linux-gnueabihf-gcc -march=armv7

If you want to compile for a different architecture or use another compiler adjust accordingly. To see the architecture you want to compile against, run this on your OpenElec box

# uname -a
Linux Projector 4.9.30 #1 SMP Mon May 29 09:51:09 CEST 2017 armv7l GNU/Linux

Next compile rsync:

# make

Once its done you can check if it compiled for the correct architecture with:

# file rsync
rsync: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=5129f7b08ff6d57de2e32b7e43de782a887aa06f, with debug_info, not stripped

Then create the directory structure and copy over the binary to the OpenElec box:

# mkdir -p /storage/.kodi/addons/network.backup.rsync/bin

...

#  scp ./rsync openelecbox:/storage/.kodi/addons/network.backup.rsync/bin/

I then use rsync like this to sync data to the OpenElec box:

# rsync --bwlimit=1000 --progress -av --delete -e ssh --rsync-path=/storage/.kodi/addons/network.backup.rs
ync/bin/rsync /mnt/usb/backup/musi/ root@openelecbox:/var/media/sda2-ata-WDC_WD7500BPKT-0/music/

I'm available for contracting work. Check out my LinkedIn profile and my portfolio page for an overview of my skills and experience. If you are interested in working with me please use the contact form to get in touch.

Cross compile rsync for OpenELEC

Leave a Reply

Your email address will not be published. Required fields are marked *