Skip to content

Raspberry Sysroot Setup

Joakim L. Gilje edited this page Jan 6, 2016 · 1 revision

Extract contents from raspbian image

unzip 2015-05-05-raspbian-wheezy.zip
sudo losetup -P /dev/loop0 2015-05-05-raspbian-wheezy.img
sudo mount /dev/loop0p2 /mnt
mkdir sysroot
sudo rsync -a /mnt/ sysroot/
sudo umount /mnt
sudo losetup -d /dev/loop0

sudo apt-get install qemu-user-static # or equivalant on other non-debian distributions
sudo cp /usr/bin/qemu-arm-static sysroot/usr/bin
sudo mount -o bind /proc sysroot/proc
sudo mount -o bind /dev sysroot/dev
sudo mount -o bind /sys sysroot/sys
sudo sed -i "s/.*libcofi_rpi.so//" sysroot/etc/ld.so.preload
sudo chroot sysroot
apt-get update
apt-get dist-upgrade

apt-get install -y libssl-dev libvorbis-dev libasound2-dev
ln /usr/lib/arm-linux-gnueabihf/glib-2.0/include/glibconfig.h /usr/include/glib-2.0
exit
sudo umount sysroot/sys
sudo umount sysroot/dev
sudo umount sysroot/proc

Download and crosscompile Qt

wget http://download.qt.io/archive/qt/5.5/5.5.1/single/qt-everywhere-opensource-src-5.5.1.tar.xz
git clone [email protected]:raspberrypi/tools.git

tar xf qt-everywhere-opensource-src-5.5.1.tar.xz

export CROSS_COMPILE=`pwd`/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
export SYSROOT=`pwd`/sysroot

wget https://raw.githubusercontent.com/shahriman/cross-compile-tools/master/fixQualifiedLibraryPaths
chmod +x fixQualifiedLibraryPaths
./fixQualifiedLibraryPaths sysroot ${CROSS_COMPILE}gcc

cd qt-everywhere-opensource-src-5.5.1
./configure -prefix /opt/qt-5.5.1 -opensource -confirm-license -optimized-qmake \
 -opengl es2 \
 -device linux-rasp-pi-g++ \
 -device-option CROSS_COMPILE=$CROSS_COMPILE \
 -skip qtwebkit -skip qtscript \
 -nomake examples -nomake tests \
 -sysroot $SYSROOT

Download and compile GStreamer

I had to do this inside an emulated environment, as I never got the autotools from GStreamer to configure correctly for crosscompiling.

wget http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.6.1.tar.xz
wget http://gstreamer.freedesktop.org/src/orc/orc-0.4.24.tar.xz
wget http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-1.6.1.tar.xz
wget http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.6.1.tar.xz
wget http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.6.1.tar.xz
wget http://gstreamer.freedesktop.org/src/gst-omx/gst-omx-1.2.0.tar.xz

sudo mkdir sysroot/build
sudo tar xf gstreamer-1.6.1.tar.xz -C sysroot/build
sudo tar xf orc-0.4.24.tar.xz -C sysroot/build
sudo tar xf gst-plugins-base-1.6.1.tar.xz -C sysroot/build
sudo tar xf gst-plugins-good-1.6.1.tar.xz -C sysroot/build
sudo tar xf gst-plugins-bad-1.6.1.tar.xz -C sysroot/build
sudo tar xf gst-omx-1.2.0.tar.xz -C sysroot/build

sudo chroot sysroot

# dependencies for gstreamer
sudo apt-get install -y libglib2.0-dev
# dependencies for base
sudo apt-get install -y libasound2-dev libogg-dev libpango1.0-dev libtheora-dev libvorbis-dev
# dependencies for good
sudo apt-get install -y libpulse-dev libvpx-dev libflac-dev libshout3-dev libspeex-dev libsoup2.4-dev libgdk-pixbuf2.0-dev libjpeg8-dev
# dependencies for bad
sudo apt-get install -y libopus-dev libwebp-dev libfaad-dev

export PKG_CONFIG_PATH=/opt/gstreamer-1.6.1/lib/pkgconfig

cd /build/gstreamer-1.6.1
./configure --prefix=/opt/gstreamer-1.6.1 --disable-examples --disable-benchmarks --disable-tests
make && make install

cd /build/orc-0.4.24
./configure --prefix=/opt/gstreamer-1.6.1 --disable-examples --disable-benchmarks --disable-tests
make && make install

cd /build/gst-plugins-base-1.6.1
./configure --prefix=/opt/gstreamer-1.6.1 --disable-examples --disable-benchmarks --disable-tests
make && make install

cd /build/gst-plugins-good-1.6.1
./configure --prefix=/opt/gstreamer-1.6.1 --disable-examples --disable-benchmarks --disable-tests
make && make install

cd /build/gst-plugins-bad-1.6.1
LDFLAGS="-L/opt/vc/lib" CPPFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" \
./configure --prefix=/opt/gstreamer-1.6.1 --disable-examples --disable-benchmarks --disable-tests
make && make install

cd /build/gst-omx-1.2.0
LDFLAGS="-L/opt/vc/lib" CPPFLAGS="-I/opt/vc/include -I/opt/vc/include/IL -I/opt/vc/include/interface/vcos/pthreads" \
./configure --prefix=/opt/gstreamer-1.6.1 --with-omx-target=rpi --disable-examples --disable-benchmarks --disable-tests
make && make install

Finished! Sysroot should now be setup and ready for compiling disupurei!