diff --git a/CrossCompileHowto.txt b/CrossCompileHowto.txt index 1f793b6f..97e9db7c 100644 --- a/CrossCompileHowto.txt +++ b/CrossCompileHowto.txt @@ -55,6 +55,9 @@ cmake -DENABLE_DISPMANX=OFF --build "$NATIVE_BUILD_DIR" "$HYPERION_DIR" mkdir -p "$TARGET_BUILD_DIR" cmake -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" -DIMPORT_PROTOC=$NATIVE_BUILD_DIR/protoc_export.cmake --build "$TARGET_BUILD_DIR" "$HYPERION_DIR" +# For hummingboard (imx6) the following package is required +sudo apt-get install lib32z1 + ------------------------------------------------------------------------------ These instructions are based on the guide given by: http://airwiki.ws.dei.polimi.it/index.php/Cross-compiling_for_the_RaspberryPi diff --git a/Toolchain-imx6.cmake b/Toolchain-imx6.cmake new file mode 100644 index 00000000..6ca757a7 --- /dev/null +++ b/Toolchain-imx6.cmake @@ -0,0 +1,22 @@ +SET(CUBIXCROSS_DIR $ENV{HOME}/hummingboard) + +SET(CMAKE_SYSTEM_NAME Linux) +SET(CMAKE_SYSTEM_VERSION 1) + +# specify the cross compiler +SET(CMAKE_C_COMPILER ${CUBIXCROSS_DIR}/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-gcc) +SET(CMAKE_CXX_COMPILER ${CUBIXCROSS_DIR}/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-g++) +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=vfpv3 -mfloat-abi=softfp") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=vfpv3 -mfloat-abi=softfp") + +# where is the target environment +SET(CMAKE_FIND_ROOT_PATH ${CUBIXCROSS_DIR}/rootfs) + +# search for programs in the build host directories +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + +# for libraries and headers in the target directories +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +include_directories(${CMAKE_FIND_ROOT_PATH}/usr/include) diff --git a/Toolchain-RaspberryPi.cmake b/Toolchain-rpi.cmake similarity index 100% rename from Toolchain-RaspberryPi.cmake rename to Toolchain-rpi.cmake diff --git a/Toolchain-x32.cmake b/Toolchain-x32.cmake new file mode 100644 index 00000000..2304edc6 --- /dev/null +++ b/Toolchain-x32.cmake @@ -0,0 +1,12 @@ +# toolchain file for building a 32bit version on a 64bit host + +# use it like this: +# cmake -DCMAKE_TOOLCHAIN_FILE=Toolchain-x32.cmake + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR "i686") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "c++ flags") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" CACHE STRING "c flags") + diff --git a/bin/create_all_releases.sh b/bin/create_all_releases.sh new file mode 100644 index 00000000..c284f207 --- /dev/null +++ b/bin/create_all_releases.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# Create the x64 build +mkdir build-x64 +cd build-x64 +cmake -DENABLE_DISPMANX=OFF -DENABLE_X11=ON .. +make -j 4 +cd .. + +# Create the x32 build +mkdir build-x32 +cd build-x32 +cmake -DIMPORT_PROTOC=../build-x64/protoc_export.cmake -DENABLE_DISPMANX=OFF -DENABLE_X11=ON .. +make -j 4 +cd .. + +# Create the RPI build +mkdir build-rpi +cd build-rpi +cmake -DCMAKE_TOOLCHAIN_FILE="../Toolchain-rpi.cmake" -DIMPORT_PROTOC=../build-x64/protoc_export.cmake .. +make -j 4 +cd .. + +# Create the WETEK build +mkdir build-wetek +cd build-wetek +cmake -DCMAKE_TOOLCHAIN_FILE="../Toolchain-rpi.cmake" -DIMPORT_PROTOC=../build-x64/protoc_export.cmake -DENABLE_DISPMANX=OFF -DENABLE_FB=ON -DENABLE_AMLOGIC=ON .. +make -j 4 +cd .. + +# Create the IMX6 build +mkdir build-imx6 +cd build-imx6 +cmake -DCMAKE_TOOLCHAIN_FILE="../Toolchain-imx6.cmake" -DIMPORT_PROTOC=../build-x64/protoc_export.cmake -DENABLE_DISPMANX=OFF -DENABLE_FB=ON .. +make -j 4 +cd .. + +bin/create_release.sh . x64 +bin/create_release.sh . x32 +bin/create_release.sh . rpi +bin/create_release.sh . wetek +bin/create_release.sh . imx6 + diff --git a/bin/create_oe_depedencies.sh b/bin/create_oe_depedencies.sh new file mode 100644 index 00000000..288c5ee9 --- /dev/null +++ b/bin/create_oe_depedencies.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +RPI_ROOTFS=/home/tvdzwan/hummingboard/rootfs +IMX6_ROOTFS=/home/tvdzwan/hummingboard/rootfs +outfile=hyperion.deps.openelec-imx6.tar.gz + +tar --create --verbose --gzip --absolute-names --show-transformed-names --dereference \ + --file "$outfile" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libaudio.so.2" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libffi.so.6" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libICE.so.6" \ + "$IMX6_ROOTFS/lib/arm-linux-gnueabihf/libpcre.so.3" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libpng12.so.0" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libQtCore.so.4" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libQtGui.so.4" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libQtNetwork.so.4" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libSM.so.6" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libX11.so.6" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libXau.so.6" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libxcb.so.1" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libXdmcp.so.6" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libXext.so.6" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libXrender.so.1" \ + "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libXt.so.6" \ + "./hyperiond.sh" \ + "./hyperion-remote.sh" + diff --git a/bin/create_release.sh b/bin/create_release.sh new file mode 100644 index 00000000..625ff0e1 --- /dev/null +++ b/bin/create_release.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +if [ "$#" -ne 2 ] || ! [ -d "$1" ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +repodir="$1" +buildid="$2" +builddir=$repodir/build-$buildid +echo build directory = $builddir +echo repository root dirrectory = $repodir +if ! [ -d "$builddir" ]; then + echo "Could not find build director" + exit 1 +fi + +outfile="$repodir/deploy/hyperion_$buildid.tar.gz" +echo create $outfile + +tar --create --verbose --gzip --absolute-names --show-transformed-names --ignore-failed-read\ + --file "$outfile" \ + --transform "s:$builddir/bin/:hyperion/bin/:" \ + --transform "s:$repodir/effects/:hyperion/effects/:" \ + --transform "s:$repodir/config/:hyperion/config/:" \ + --transform "s:$repodir/bin/hyperion.init.sh:hyperion/init.d/hyperion.init.sh:" \ + --transform "s://:/:g" \ + "$builddir/bin/hyperiond" \ + "$builddir/bin/hyperion-remote" \ + "$builddir/bin/hyperion-v4l2" \ + "$builddir/bin/dispmanx2png" \ + "$repodir/effects/"* \ + "$repodir/bin/hyperion.init.sh" \ + "$repodir/config/hyperion.config.json" + diff --git a/deploy/hyperion-remote.sh b/deploy/hyperion-remote.sh new file mode 100644 index 00000000..b9a58d14 --- /dev/null +++ b/deploy/hyperion-remote.sh @@ -0,0 +1,2 @@ +#!/bin/sh +LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/storage/hyperion/bin /storage/hyperion/bin/hyperion-remote "$@" diff --git a/deploy/hyperion.deps.openelec-imx6.tar.gz.REMOVED.git-id b/deploy/hyperion.deps.openelec-imx6.tar.gz.REMOVED.git-id new file mode 100644 index 00000000..bebbc1ba --- /dev/null +++ b/deploy/hyperion.deps.openelec-imx6.tar.gz.REMOVED.git-id @@ -0,0 +1 @@ +198ac3d44bac13ba993069454397ad8c201d37b9 \ No newline at end of file diff --git a/deploy/hyperion_imx6.tar.gz.REMOVED.git-id b/deploy/hyperion_imx6.tar.gz.REMOVED.git-id index e8868c08..1243e5d8 100644 --- a/deploy/hyperion_imx6.tar.gz.REMOVED.git-id +++ b/deploy/hyperion_imx6.tar.gz.REMOVED.git-id @@ -1 +1 @@ -8708dec3801868f8710e06bd9186fc520f7e639f \ No newline at end of file +9a4c5499f7191aad3e23e0e3be806861a3ec1c02 \ No newline at end of file diff --git a/deploy/hyperion_rpi.tar.gz.REMOVED.git-id b/deploy/hyperion_rpi.tar.gz.REMOVED.git-id new file mode 100644 index 00000000..a429abf8 --- /dev/null +++ b/deploy/hyperion_rpi.tar.gz.REMOVED.git-id @@ -0,0 +1 @@ +3a346e54f8958f87ae7f4e8804f6afdec33aa9fc \ No newline at end of file diff --git a/deploy/hyperion_wetek.tar.gz.REMOVED.git-id b/deploy/hyperion_wetek.tar.gz.REMOVED.git-id new file mode 100644 index 00000000..e38beaa9 --- /dev/null +++ b/deploy/hyperion_wetek.tar.gz.REMOVED.git-id @@ -0,0 +1 @@ +05227980ea998eeeecda03cefe090b5f55ff8ee0 \ No newline at end of file diff --git a/deploy/hyperion_x32.tar.gz.REMOVED.git-id b/deploy/hyperion_x32.tar.gz.REMOVED.git-id new file mode 100644 index 00000000..c189c367 --- /dev/null +++ b/deploy/hyperion_x32.tar.gz.REMOVED.git-id @@ -0,0 +1 @@ +f3e3f4a3a8e52e4bfaf9a0337cb364da841e150b \ No newline at end of file diff --git a/deploy/hyperion_x64.tar.gz.REMOVED.git-id b/deploy/hyperion_x64.tar.gz.REMOVED.git-id new file mode 100644 index 00000000..ca1bf5dd --- /dev/null +++ b/deploy/hyperion_x64.tar.gz.REMOVED.git-id @@ -0,0 +1 @@ +9342bb64479ea4d5554f301b905a0a830e330635 \ No newline at end of file diff --git a/deploy/hyperiond.sh b/deploy/hyperiond.sh new file mode 100644 index 00000000..ea9909db --- /dev/null +++ b/deploy/hyperiond.sh @@ -0,0 +1,2 @@ +#!/bin/sh +LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/storage/hyperion/bin /storage/hyperion/bin/hyperiond "$@" diff --git a/deploy/update_hyperion.sh b/deploy/update_hyperion.sh new file mode 100644 index 00000000..2a310f51 --- /dev/null +++ b/deploy/update_hyperion.sh @@ -0,0 +1,114 @@ +#!/bin/sh + +# Script for downloading and installing the latest Hyperion release + +# Make sure /sbin is on the path (for service to find sub scripts) +PATH="/sbin:$PATH" + +# Find out if we are on OpenElec +OS_OPENELEC=`cat /etc/issue | grep -m 1 OpenELEC | wc -l` + +# Find out if its an imx6 device +CPU_RPI=`cat /proc/cpuinfo | grep RPI | wc -l` +CPU_IMX6=`cat /proc/cpuinfo | grep i.MX6 | wc -l` +CPU_WETEK=`cat /proc/cpyinfo | grep wetek | wc -l` +CPU_X64=`uname -m | grep x86_64 | wc -l` +CPU_X32=`uname -m | grep x86_32 | wc -l` +# Check that we have a known configuration +if [ $CPU_RPI -ne 1 ] & [ $CPU_IMX6 -ne 1 ] & [ $CPU_WETEK -ne 1 ] & [ $CPU_X64 -ne 1 ] & [ $CPU_X32 -ne 1 ]; then + echo 'CPU information does not match any known releases' + exit +fi + +# check which init script we should use +USE_INITCTL=`which /sbin/initctl | wc -l` +USE_SERVICE=`which /usr/sbin/service | wc -l` + +# Make sure that the boblight daemon is no longer running +BOBLIGHT_PROCNR=$(pidof boblightd | wc -l) +if [ $BOBLIGHT_PROCNR -eq 1 ]; then + echo 'Found running instance of boblight. Please stop boblight via XBMC menu before installing hyperion' + exit +fi + +# Stop hyperion daemon if it is running +# Start the hyperion daemon +if [ $USE_INITCTL -eq 1 ]; then + /sbin/initctl stop hyperion +elif [ $USE_SERVICE -eq 1 ]; then + /usr/sbin/service hyperion stop +fi + +# Select the appropriate release +HYPERION_ADDRESS=https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy +if [ $CPU_RPI -eq 1 ]; then + HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi.tar.gz + OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz +elif [ $CPU_IMX6 -eq 1 ]; then + HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_imx6.tar.gz + OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-imx6.tar.gz +elif [ $CPU_WETEK -eq 1 ]; then + HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_wetek.tar.gz + OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz +elif [ $CPU_X64 -eq 1 ]; then + HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_x64.tar.gz + OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-x64.tar.gz +elif [ $CPU_X32 -eq 1 ]; then + HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_x32.tar.gz + OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-x32.tar.gz +else + echo "Target platform unknown" + exit +fi + +# Get and extract the Hyperion binaries and effects +echo 'Downloading hyperion' +if [ $OS_OPENELEC -eq 1 ]; then + # OpenELEC has a readonly file system. Use alternative location + curl -L --get $HYPERION_RELEASE | tar -C /storage -xz + curl -L --get $OE_DEPENDECIES | tar -C /storage/hyperion/bin -xz + + # modify the default config to have a correct effect path + sed -i 's:/opt:/storage:g' /storage/hyperion/config/hyperion.config.json + + # /storage/.config is available as samba share. A symbolic link would not be working + false | cp -i /storage/hyperion/config/hyperion.config.json /storage/.config/hyperion.config.json 2>/dev/null +else + wget $HYPERION_RELEASE -O - | tar -C /opt -xz + + # create links to the binaries + ln -fs /opt/hyperion/bin/hyperiond /usr/bin/hyperiond + ln -fs /opt/hyperion/bin/hyperion-remote /usr/bin/hyperion-remote + ln -fs /opt/hyperion/bin/hyperion-v4l2 /usr/bin/hyperion-v4l2 + +# Copy a link to the hyperion configuration file to /etc + ln -s /opt/hyperion/config/hyperion.config.json /etc/hyperion.config.json +fi + +# Copy the service control configuration to /etc/int +if [ $USE_INITCTL -eq 1 ]; then + echo 'Installing initctl script' + wget -N https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/ + initctl reload-configuration +elif [ $USE_SERVICE -eq 1 ]; then + echo 'Installing startup script in init.d' + # place startup script in init.d and add it to upstart + ln -fs /opt/hyperion/init.d/hyperion.init.sh /etc/init.d/hyperion + chmod +x /etc/init.d/hyperion + update-rc.d hyperion defaults 98 02 +elif [ $IS_OPENELEC -eq 1 ]; then + # only add to start script if hyperion is not present yet + if [ `cat /storage/.config/autostart.sh 2>/dev/null | grep hyperiond | wc -l` -eq 0 ]; then + echo 'Adding Hyperion to autostart script' + echo "/storage/hyperion/bin/hyperiond.sh /storage/.config/hyperion.config.json > /dev/null 2>&1 &" >> /storage/.config/autostart.sh + chmod +x /storage/.config/autostart.sh + fi +fi + +# Start the hyperion daemon +if [ $USE_INITCTL -eq 1 ]; then + /sbin/initctl start hyperion +elif [ $USE_SERVICE -eq 1 ]; then + /usr/sbin/service hyperion start +fi +