2016-03-13 02:27:12 +01:00
|
|
|
#!/bin/bash
|
2016-08-20 16:37:45 +02:00
|
|
|
#Updated: 18 August 2016, by brindosch
|
2016-03-13 02:27:12 +01:00
|
|
|
#Just use a clean Ubunut 14.04 and run this script
|
|
|
|
##############
|
|
|
|
#ON TARGET
|
|
|
|
#--------------
|
2016-08-20 16:37:45 +02:00
|
|
|
#sudo apt-get install qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev python-dev rsync
|
2016-03-13 02:27:12 +01:00
|
|
|
#############
|
|
|
|
|
|
|
|
#ON HOST
|
|
|
|
#---------
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get upgrade
|
|
|
|
#TO-DO verify what is really required
|
2019-01-06 19:49:56 +01:00
|
|
|
#blacklist: lib32z1 lib32ncurses5 lib32bz2-1.0 zlib1g-dev
|
2016-08-20 16:37:45 +02:00
|
|
|
sudo apt-get -qq -y install git rsync cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev
|
2016-03-13 02:27:12 +01:00
|
|
|
|
|
|
|
echo 'PATH=$PATH:$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin' >> .bashrc
|
|
|
|
#---------
|
|
|
|
|
|
|
|
|
|
|
|
export TARGET_IP=192.168.0.103
|
2015-01-21 12:57:28 +01:00
|
|
|
export TARGET_USER=pi
|
|
|
|
|
2013-10-17 09:43:10 +02:00
|
|
|
export RASCROSS_DIR="$HOME/raspberrypi"
|
2016-03-13 02:27:12 +01:00
|
|
|
export ROOTFS_DIR="$RASCROSS_DIR/rootfs"
|
2013-10-17 09:43:10 +02:00
|
|
|
export HYPERION_DIR="$HOME/hyperion"
|
2016-03-13 02:27:12 +01:00
|
|
|
#export IMX6_DIR="$HOME/hummingboard"
|
2015-01-21 12:57:28 +01:00
|
|
|
export TOOLCHAIN_FILE="$HYPERION_DIR/Toolchain-RaspberryPi.cmake"
|
|
|
|
|
|
|
|
export NATIVE_BUILD_DIR="$HYPERION_DIR/build"
|
2016-03-13 02:27:12 +01:00
|
|
|
export TARGET_BUILD_DIR="$HYPERION_DIR/build-rpi"
|
2013-10-17 09:43:10 +02:00
|
|
|
|
2015-01-21 12:57:28 +01:00
|
|
|
mkdir -p "$ROOTFS_DIR"
|
|
|
|
rsync -rl --delete-after --copy-unsafe-links $TARGET_USER@$TARGET_IP:/{lib,usr} "$ROOTFS_DIR"
|
|
|
|
|
|
|
|
######## RPi specific #########
|
2013-10-17 09:43:10 +02:00
|
|
|
|
2016-03-13 02:27:12 +01:00
|
|
|
mkdir -p "$RASCROSS_DIR/firmware"
|
2016-08-20 16:37:45 +02:00
|
|
|
git clone --depth 1 https://github.com/raspberrypi/firmware.git "$RASCROSS_DIR/firmware"
|
2015-01-21 12:57:28 +01:00
|
|
|
ln -s "$RASCROSS_DIR/firmware/hardfp/opt" "$ROOTFS_DIR/opt"
|
2013-08-01 09:39:23 +02:00
|
|
|
|
2016-08-20 16:37:45 +02:00
|
|
|
git clone --depth 1 git://github.com/raspberrypi/tools.git "$RASCROSS_DIR/tools"
|
2013-10-17 09:43:10 +02:00
|
|
|
|
2015-01-21 12:57:28 +01:00
|
|
|
##### End of RPi specific ######
|
|
|
|
|
2016-03-13 02:27:12 +01:00
|
|
|
######## NOT TESTED ONLY INFOs #########
|
|
|
|
######## IMX6 specific #########
|
|
|
|
#export IMX6_DIR="$HOME/hummingboard"
|
|
|
|
#mkdir -p "$IMX6_Dir"
|
|
|
|
#cd "$IMX6_Dir"
|
|
|
|
#wget https://launchpad.net/linaro-toolchain-binaries/trunk/2013.10/+download/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.bz2
|
|
|
|
#tar -xvjf gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.bz2
|
|
|
|
#cd
|
|
|
|
##### End of IMX6 specific ######
|
|
|
|
######## NOT TESTED #########
|
|
|
|
|
2014-12-20 20:51:17 +01:00
|
|
|
# get the Hyperion sources
|
2016-08-20 16:37:45 +02:00
|
|
|
git clone --recursive https://github.com/hyperion-project/hyperion.ng.git "$HYPERION_DIR"
|
2013-10-17 09:43:10 +02:00
|
|
|
|
2019-01-06 19:49:56 +01:00
|
|
|
# do a native build (to build the flatbuffers compiler for the native platform)
|
2015-01-21 12:57:28 +01:00
|
|
|
mkdir -p "$NATIVE_BUILD_DIR"
|
|
|
|
cmake -DENABLE_DISPMANX=OFF --build "$NATIVE_BUILD_DIR" "$HYPERION_DIR"
|
2013-10-17 09:43:10 +02:00
|
|
|
|
2015-01-21 12:57:28 +01:00
|
|
|
# do the cross build
|
2019-01-06 19:49:56 +01:00
|
|
|
# specify the protoc export file to import the flatbuffers compiler from the native build
|
2015-01-21 12:57:28 +01:00
|
|
|
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"
|
2013-10-17 09:43:10 +02:00
|
|
|
|
2016-03-13 02:27:12 +01:00
|
|
|
#compile
|
|
|
|
cd "$HYPERION_DIR/bin"
|
|
|
|
chmod +x *
|
|
|
|
cp "$HYPERION_DIR/bin/create_all_releases.sh" "$HYPERION_DIR"
|
|
|
|
cd "$HYPERION_DIR"
|
|
|
|
./create_all_releases.sh
|
|
|
|
|
|
|
|
######END
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
#These instructions are based on tvdzwan and on the guide given by:
|
|
|
|
#http://airwiki.ws.dei.polimi.it/index.php/Cross-compiling_for_the_RaspberryPi
|