The Mer Wiki now uses your Mer user account and password (create account on https://bugs.merproject.org/)
Community Workspace/RaspberryPi
Contents |
Mer on Raspberry Pi
This page details the steps required to bring up a development environment which can be used to create a basic Mer image.
The hardware adatation is maintained in the project CE:Adaptation:RaspberryPi
Working
- Boot with 128M/128M memory split (128M for the ARM, 128M for the GPU)
- Wired networking
- Gstreamer HW accelerated decode using gst-omx
- Audio output through HDMI/audio jack(at least after manual modprobe snd-bcm2835)
- OpenGL ES 2 (not X.Org integrated)
- OpenMax IL decode/render (not X.Org integrated)
Not working
- HW accelerated Gstreamer video render
- HW accelerated GStreamer video encode
- HW accelerated Gstreamer audio decode/encode
- Accelerated X.Org
- Accelerated Qt
- Qt 5.0
- Qt 4.8
Install Mer SDK
Using the instructions at http://wiki.merproject.org/wiki/Platform_SDK#Mer_platform_SDK install Mer SDK on your host Linux system. The SDK has been designed to not rely on the host system so you can use your favourite distro.
Get an account on the community OBS server, ping lbt on #mer freenode IRC channel.
edit .oscrc to set server to api.pub.meego.com and set user and password
To test the installation follow the instructions for building the SDK image.
Building a Mer Core Image
Here we use the SDK to build an image which can be written to an sdcard which will include bootloader, kernel and a base filesystem which boots X and starts qmlviewer.
Get kickstart file
curl -k -O https://github.com/snowcap-electronics/kickstarts/raw/master/rpi/mer-rpi.ks
To work around a mic issue zypper in the following package to the SDK
sudo zypper in syslinux-extlinux
Use the mic tool to create the image using the kickstart file
sudo mic create raw mer-rpi.ks -o . --pkgmgr=yum --arch=armv6l
Once the image has been produced write to your sdcard (you may need to use sudo below if groups are not properly set):
dd of=/dev/sdX if=mer-rpi-mmcblk0p.raw bs=4M
Place in RaspberryPi and boot.
Host SDK Development using SB2
Cross-compiling on the host SDK (as opposed to compiling natively on device) is possible by creating a target (an unpacked rootfs) and using sb2 to "emulate" the ARM device.
Step-by-step Setup
Step one is to create the target rootfs. This can be done with mic using the same kickstart file used to create the image:
sudo mic create fs mer-rpi.ks -o /path/to/target --arch=armv6l
This will create a /path/to/target/mer-rpi directory with a rootfs that contains all the default packages from that ks.
Step two is changing the permissions so we can write anywhere on the rootfs:
sudo chown -R $USER.mer mer-rpi
Step three is initializing the sb2 target (yes, a lot of options there):
cd mer-rpi sb2-init -A armv6l -M armv6l -d -L --sysroot=/ -C --sysroot=/ -c /usr/bin/qemu-arm-dynamic -m sdk-build -n -N -t / mer-rpi /opt/cross/bin/armv6l-meego-linux-gnueabi-gcc
There will be errors from sb2-init (concerning ld and host-gcc), but it should be safe to ignore them.
Step four is to fix a quirk about /var/run in the target being a symlink, sb2 doesn't like this:
rm var/run mkdir var/run
Step five is to rebuild and refresh the packaging system so we can install devel packages:
sb2 -m sdk-install -R rpm --rebuilddb sb2 -t mer-rpi -m sdk-install -R zypper ref
Building RPi Examples
As an example of how to use sb2 to build, we shall build the RPi examples. (TBD: sane way to get them)
First off, we know beforehand that we will need the rpi graphics and freetype devel packages installed to compile the examples. Usually the exact dependencies are either in the README or INSTALL of the project or (sadly often) found out by building and failing. We also need make and gcc in the target to compile.
To install, we will use sb2 in sdk-install mode and also request to fake that we are root user (as we did in setup too). This will enable us to write to the rootfs, normally it is considered read-only, and trick the tools to think we have super powers:
sb2 -m sdk-install -R zypper install gcc make gfx-rpi-devel gfx-rpi-libEGL-devel gfx-rpi-libGLESv2-devel gfx-rpi-libOMXIL-devel freetype-devel
NOTE: sometimes it's necessary to be on the top directory of the target to successfully run commands in the sdk-install mode. If a command fails mysteriously, try that first.
Next we create a symbolic link from /usr (where the libs should be) to mer-pi/opt/vc (where the libs are in RPi "official" images). This way we avoid changing the include paths in the project (which would be a valid fix as well):
ln -s /usr opt/vc
Then we simply go to the hello_pi directory and invoke the build script (which just goes through the example directories calling make in them) through sb2:
sb2 ./rebuild.sh
If everything is set up right, you should in a moment have cross-compiled binaries to copy to your device.
NOTE: couple of examples (hello_audio & hello_video) need -lpthread to be added to their LDFLAGS to link succesfully, due to the ilclient helper lib requiring it.
The same principle works for most other projects as well, just install the dependencies and run the build commands through sb2.
(TBD: how to install non-packaged dependencies?)
Maintainers
For questions, suggestions and contributions you can ping the following persons in #mer @ Freenode
- cristi
- kulve
- vgrade
- zuh
For maintainers
Wiki page TODO
- Add: QtCreator Instructions
Updating packages
bootloader-rpi
git clone https://github.com/raspberrypi/firmware.git rm firmware/boot/kernel* tar zcf firmware-boot-<git sha>.tgz firmware/boot
gfx-rpi
git clone https://github.com/raspberrypi/firmware.git tar zcf firmware-opt-<git sha>.tgz firmware/hardfp/opt/vc/ firmware/opt/vc/
gst-omx-rpi
git clone git://anongit.freedesktop.org/gstreamer/gst-omx cd gst-omx git checkout -b raspberry remotes/origin/raspberry ./autogen.sh && make dist mv gst-omx-0.10.0.1.tar.gz gst-omx-raspberry-0.10.0.1-<git sha>.tar.gz
gst-plugins-bad-free, gst-plugins-base, gstreamer
- Branched from Mer Core
- gst-plugins-base upgraded to 0.10.36 (gstreamer was already 0.10.36)
- Added --with-audioresample-format=float for ARMv6 in gst-plugins-base.spec
kernel-adaptation-rpi
- Download latest .tar.gz from https://github.com/raspberrypi/linux (branch rpi-3.2.27)
mkimage-rpi
git clone https://github.com/raspberrypi/tools.git tar zcf tools-mkimage-<git sha>.tar.gz tools/mkimage