2015-01-21 12:57:28 +01:00
|
|
|
ON TARGET
|
2013-10-17 09:43:10 +02:00
|
|
|
--------------
|
2014-12-20 20:51:17 +01:00
|
|
|
sudo apt-get install libQt4-dev libusb-1.0-0-dev python-dev rsync
|
2013-10-17 09:43:10 +02:00
|
|
|
|
|
|
|
ON HOST
|
|
|
|
---------
|
2015-01-21 12:57:28 +01:00
|
|
|
export TARGET_IP=192.168.1.17
|
|
|
|
export TARGET_USER=pi
|
|
|
|
|
2013-10-17 09:43:10 +02:00
|
|
|
export RASCROSS_DIR="$HOME/raspberrypi"
|
2015-01-21 12:57:28 +01:00
|
|
|
export ROOTFS_DIR="RASCROSS_DIR/rootfs"
|
2013-10-17 09:43:10 +02:00
|
|
|
export HYPERION_DIR="$HOME/hyperion"
|
2015-01-21 12:57:28 +01:00
|
|
|
export TOOLCHAIN_FILE="$HYPERION_DIR/Toolchain-RaspberryPi.cmake"
|
|
|
|
|
|
|
|
export NATIVE_BUILD_DIR="$HYPERION_DIR/build"
|
|
|
|
export TARGET_BUILD_DIR=HYPERION_DIR="$HYPERION_DIR/build-rpi"
|
2013-10-17 09:43:10 +02:00
|
|
|
|
2014-12-20 20:51:17 +01:00
|
|
|
# install required packages
|
|
|
|
sudo apt-get install git rsync cmake build-essential libQt4-dev libusb-1.0-0-dev python-dev
|
2013-10-17 09:43:10 +02:00
|
|
|
sudo apt-get install git rsync cmake ia32-libs protobuf-compiler
|
2015-01-05 14:38:00 +01:00
|
|
|
|
2015-01-05 14:35:24 +01:00
|
|
|
# On newer version of Ubuntu (and maybe other distros) the ia32-libs is not available, the following
|
|
|
|
# install solved this for me (TODO: verify what is really required)
|
|
|
|
sudo apt-get install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386
|
2013-10-17 09:43:10 +02:00
|
|
|
|
2015-01-21 12:57:28 +01:00
|
|
|
# create the rootfs by copying it from an target
|
|
|
|
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
|
|
|
|
2014-12-20 20:51:17 +01:00
|
|
|
# get the raspberry pi firmware and add it to the rootfs
|
2013-10-17 09:43:10 +02:00
|
|
|
git clone 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
|
|
|
|
2014-12-20 20:51:17 +01:00
|
|
|
# get the compile tools
|
|
|
|
git clone 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 ######
|
|
|
|
|
2014-12-20 20:51:17 +01:00
|
|
|
# get the Hyperion sources
|
|
|
|
git clone --recursive https://github.com/tvdzwan/hyperion.git "$HYPERION_DIR"
|
2013-10-17 09:43:10 +02:00
|
|
|
|
2015-01-16 09:10:23 +01:00
|
|
|
# if you forget the --resursive in above statement or you are updating an existing clone you need
|
|
|
|
# to clone the protobuf submodule by runnning the follwing two statements:
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
|
2014-12-20 20:51:17 +01:00
|
|
|
# do a native build (to build the protobuf 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
|
2014-12-20 20:51:17 +01:00
|
|
|
# specify the protoc export file to import the protobuf 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
|
|
|
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
These instructions are based on the guide given by:
|
|
|
|
http://airwiki.ws.dei.polimi.it/index.php/Cross-compiling_for_the_RaspberryPi
|