The Mer Wiki now uses your Mer user account and password (create account on https://bugs.merproject.org/)
Community Workspace/RaspberryPi
(typofix) |
|||
(35 intermediate revisions by 7 users not shown) | |||
Line 3: | Line 3: | ||
This page details the steps required to bring up a development environment which can be used to create a basic Mer image. | This page details the steps required to bring up a development environment which can be used to create a basic Mer image. | ||
− | The hardware | + | The hardware adaptation is maintained in the project [https://build.merproject.org/package/show?package=kernel-adaptation-rpi&project=home%3Avgrade%3ARaspberryPi https://build.merproject.org/package/show?package=kernel-adaptation-rpi&project=home%3Avgrade%3ARaspberryPi] |
− | === | + | === Working === |
− | * Boot | + | |
+ | * Boot with 128M/128M memory split (128M for the ARM, 128M for the GPU) | ||
* Wired networking | * 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) | ||
+ | * Accelerated Qt 5.0 | ||
+ | * 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 X.Org | ||
− | |||
− | |||
− | |||
− | |||
* Qt 4.8 | * Qt 4.8 | ||
== Install Mer SDK == | == Install Mer SDK == | ||
− | Using the instructions at | + | Using the instructions at https://wiki.merproject.org/wiki/Nemo/OBS#Getting_started_with_the_build_system setup your host system |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
== Building a Mer Core Image == | == Building a Mer Core Image == | ||
− | Here we use the | + | Here we use the https://wiki.merproject.org/wiki/Platform_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 | Get kickstart file | ||
− | curl -k -O https://github.com/snowcap-electronics/kickstarts | + | curl -k -O https://raw.github.com/snowcap-electronics/kickstarts/master/rpi/mer-rpi.ks |
+ | |||
+ | More recent Qt5 version | ||
+ | |||
+ | curl -k -O https://wiki.merproject.org/images/a/ac/Mer-qt5-rpi.ks | ||
To work around a mic issue zypper in the following package to the SDK | To work around a mic issue zypper in the following package to the SDK | ||
Line 43: | Line 45: | ||
Use the mic tool to create the image using the kickstart file | Use the mic tool to create the image using the kickstart file | ||
+ | export PATH=/sbin:$PATH # Else you'll get "Error <creator>: Command 'modprobe' is not available." | ||
sudo mic create raw mer-rpi.ks -o . --pkgmgr=yum --arch=armv6l | sudo mic create raw mer-rpi.ks -o . --pkgmgr=yum --arch=armv6l | ||
Line 49: | Line 52: | ||
dd of=/dev/sdX if=mer-rpi-mmcblk0p.raw bs=4M | dd of=/dev/sdX if=mer-rpi-mmcblk0p.raw bs=4M | ||
− | Place in RaspberryPi and boot. | + | 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 [https://github.com/raspberrypi/firmware/tree/master/opt/vc/src/hello_pi 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 = | = Maintainers = | ||
Line 62: | Line 122: | ||
* vgrade | * vgrade | ||
* zuh | * zuh | ||
+ | |||
+ | = For maintainers = | ||
+ | |||
+ | == Qt5 Platform Plugin == | ||
+ | |||
+ | I've spent sometime this weekend setting up a package to hopefully build a Qt Platform Plugin which will mean we don't need to rebuild the whole of Qt5 with the RPi mkspec. | ||
+ | |||
+ | With lots of help from Stskeeps I've done the following :- | ||
+ | |||
+ | I linkpac'd qtbase to a new project at | ||
+ | |||
+ | https://build.pub.meego.com/package/files?package=qtplatformplugin-rpi&project=home%3Avgrade%3AraspPiQt5Plugin | ||
+ | |||
+ | and created a new spec file based on the qtwaylandplugin with the aim of just doing a qmake/make in the src/plugins/platforms directory utilising qeglfshooks_pi.cpp. Added the rpi-gfx package to provide EGL/GLES and bcm/vcos bits. | ||
+ | |||
+ | https://build.pub.meego.com/package/live_build_log?arch=armv7el&package=qtplatformplugin-rpi&project=home%3Avgrade%3AraspPiQt5Plugin&repository=Mer_Core_armv6l | ||
+ | |||
+ | I used the package-config files from rpi-gfx package (thanks kulve) and added qeglfshooks_pi.cpp to the .pro file | ||
+ | |||
+ | Current status is looking good. | ||
+ | |||
+ | http://www.youtube.com/watch?v=ZwJB-hJE5YA | ||
+ | |||
+ | http://www.youtube.com/watch?v=k4yrJiDH2LI | ||
+ | |||
+ | http://www.youtube.com/watch?v=bmfbeOaIeQs | ||
+ | |||
+ | Image here http://dl.dropbox.com/u/5715485/rasp-pi/pi-qt5-plugin.img.gz | ||
+ | |||
+ | ctrl alt F2 | ||
+ | login root/rootme | ||
+ | |||
+ | init 3 to stop uxlaunch trying to spawn X | ||
+ | |||
+ | in particle, minimer, qt-cinematic dirs | ||
+ | |||
+ | qmlscene -platform eglfsrpi *.qml | ||
+ | |||
+ | Catch me (vgrade) on #mer if you want to get involved. | ||
+ | |||
+ | == qt5 qml-compositor and qtwayland-rpi == | ||
+ | |||
+ | [[File:Example.jpg|200px|thumb]] | ||
+ | |||
+ | See packages at https://build.pub.meego.com/project/show?project=home%3Astskeeps%3Aqtwayland-rpi | ||
+ | |||
+ | Instructions | ||
+ | |||
+ | Install eglfs-rpi plugin | ||
+ | |||
+ | [16:23] <@Stskeeps> vgrade: http://repo.pub.meego.com/home:/stskeeps:/qtwayland-rpi/Mer_Core_armv6l/ | ||
+ | [16:23] <@Stskeeps> add that repo | ||
+ | [16:23] <@Stskeeps> and install: | ||
+ | [16:24] <@Stskeeps> qt5-qtwayland-rpi , qt5-qtwayland-rpi-examples | ||
+ | [16:26] <@Stskeeps> and go for /usr/lib/qt5/examples/qtwayland/qml-compositor/ | ||
+ | [16:26] <@Stskeeps> and ./qml-compositor -platform eglfsrpi & | ||
+ | [16:26] <@Stskeeps> do this over ssh, btw | ||
+ | [16:26] <@Stskeeps> and then try qmlscene -platform wayland | ||
+ | |||
+ | == maze compositor == | ||
+ | |||
+ | clone https://github.com/capisce/mazecompositor | ||
+ | qmake | ||
+ | make | ||
+ | |||
+ | cd makecompositor | ||
+ | ./mazecompositor -platform eglfsrpi | ||
+ | |||
+ | cd minimer | ||
+ | qmlscene -platform wayland main.qml | ||
+ | |||
+ | http://www.youtube.com/watch?v=t_0XEUD36jY | ||
+ | |||
+ | == 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 === | ||
+ | |||
+ | * Branched from Mer Core | ||
+ | * gst-plugins-base upgraded to 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 |
Latest revision as of 23:46, 16 February 2014
Contents |
[edit] 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 adaptation is maintained in the project https://build.merproject.org/package/show?package=kernel-adaptation-rpi&project=home%3Avgrade%3ARaspberryPi
[edit] 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)
- Accelerated Qt 5.0
- OpenMax IL decode/render (not X.Org integrated)
[edit] Not working
- HW accelerated Gstreamer video render
- HW accelerated GStreamer video encode
- HW accelerated Gstreamer audio decode/encode
- Accelerated X.Org
- Qt 4.8
[edit] Install Mer SDK
Using the instructions at https://wiki.merproject.org/wiki/Nemo/OBS#Getting_started_with_the_build_system setup your host system
[edit] Building a Mer Core Image
Here we use the https://wiki.merproject.org/wiki/Platform_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://raw.github.com/snowcap-electronics/kickstarts/master/rpi/mer-rpi.ks
More recent Qt5 version
curl -k -O https://wiki.merproject.org/images/a/ac/Mer-qt5-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
export PATH=/sbin:$PATH # Else you'll get "Error <creator>: Command 'modprobe' is not available." 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.
[edit] 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.
[edit] 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
[edit] 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?)
[edit] Maintainers
For questions, suggestions and contributions you can ping the following persons in #mer @ Freenode
- cristi
- kulve
- vgrade
- zuh
[edit] For maintainers
[edit] Qt5 Platform Plugin
I've spent sometime this weekend setting up a package to hopefully build a Qt Platform Plugin which will mean we don't need to rebuild the whole of Qt5 with the RPi mkspec.
With lots of help from Stskeeps I've done the following :-
I linkpac'd qtbase to a new project at
and created a new spec file based on the qtwaylandplugin with the aim of just doing a qmake/make in the src/plugins/platforms directory utilising qeglfshooks_pi.cpp. Added the rpi-gfx package to provide EGL/GLES and bcm/vcos bits.
https://build.pub.meego.com/package/live_build_log?arch=armv7el&package=qtplatformplugin-rpi&project=home%3Avgrade%3AraspPiQt5Plugin&repository=Mer_Core_armv6l
I used the package-config files from rpi-gfx package (thanks kulve) and added qeglfshooks_pi.cpp to the .pro file
Current status is looking good.
http://www.youtube.com/watch?v=ZwJB-hJE5YA
http://www.youtube.com/watch?v=k4yrJiDH2LI
http://www.youtube.com/watch?v=bmfbeOaIeQs
Image here http://dl.dropbox.com/u/5715485/rasp-pi/pi-qt5-plugin.img.gz
ctrl alt F2 login root/rootme
init 3 to stop uxlaunch trying to spawn X
in particle, minimer, qt-cinematic dirs
qmlscene -platform eglfsrpi *.qml
Catch me (vgrade) on #mer if you want to get involved.
[edit] qt5 qml-compositor and qtwayland-rpi
See packages at https://build.pub.meego.com/project/show?project=home%3Astskeeps%3Aqtwayland-rpi
Instructions
Install eglfs-rpi plugin
[16:23] <@Stskeeps> vgrade: http://repo.pub.meego.com/home:/stskeeps:/qtwayland-rpi/Mer_Core_armv6l/ [16:23] <@Stskeeps> add that repo [16:23] <@Stskeeps> and install: [16:24] <@Stskeeps> qt5-qtwayland-rpi , qt5-qtwayland-rpi-examples [16:26] <@Stskeeps> and go for /usr/lib/qt5/examples/qtwayland/qml-compositor/ [16:26] <@Stskeeps> and ./qml-compositor -platform eglfsrpi & [16:26] <@Stskeeps> do this over ssh, btw [16:26] <@Stskeeps> and then try qmlscene -platform wayland
[edit] maze compositor
clone https://github.com/capisce/mazecompositor qmake make
cd makecompositor ./mazecompositor -platform eglfsrpi cd minimer qmlscene -platform wayland main.qml
http://www.youtube.com/watch?v=t_0XEUD36jY
[edit] Wiki page TODO
- Add: QtCreator Instructions
[edit] Updating packages
[edit] bootloader-rpi
git clone https://github.com/raspberrypi/firmware.git rm firmware/boot/kernel* tar zcf firmware-boot-<git sha>.tgz firmware/boot
[edit] gfx-rpi
git clone https://github.com/raspberrypi/firmware.git tar zcf firmware-opt-<git sha>.tgz firmware/hardfp/opt/vc/ firmware/opt/vc/
[edit] 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
[edit] gst-plugins-bad-free, gst-plugins-base
- Branched from Mer Core
- gst-plugins-base upgraded to 0.10.36
- Added --with-audioresample-format=float for ARMv6 in gst-plugins-base.spec
[edit] kernel-adaptation-rpi
- Download latest .tar.gz from https://github.com/raspberrypi/linux (branch rpi-3.2.27)
[edit] mkimage-rpi
git clone https://github.com/raspberrypi/tools.git tar zcf tools-mkimage-<git sha>.tar.gz tools/mkimage