Tizen on RPi2: Now Supporting 3D Acceleration

This article is part of a series on Tizen on the Raspberry Pi 2.

In Bringing Tizen to a Raspberry PI 2 Near You… I described the work we completed to port Tizen to Raspberry Pi 2 (RPi2). Since then, the Samsung Open Source Group has worked hard to add support for 3D acceleration.

UPDATES:

  • Added the -dev images, as they’re now supported.
  • Added bitbake command for building the crosswalk-dev image
  • Added command line for ddrescue
  • The Kernel was updated to Vanilla Tizen Kernel 4.4

This is an update to our original guide that describes how to build a custom Tizen image for the RPi2, and it now includes instructions to enable 3D acceleration. This is based mostly on work completed by our own Derek Foreman. Please note that this uses a driver that is still under development (VC4), written by Eric Anholt from Broadcom, so we don’t recommend its use in production situations.

If you don’t want to wait through the build process (it can take a few hours or more), you can download the latest version of this image here. Once it has downloaded, you can skip to the section titled “Use the Image.”

Step-By-Step Process for Building a Tizen Image for the RPi2

BEFORE STARTING: As a Yocto build needs to download lots of packages and git trees, you should ensure that your firewall policy allows  ftp, http, https and git protocols, otherwise the build may fail. If git:// is blocked, the recipes can be modified to use http – details are beyond the scope of this blog, see the Yocto bitbake documentation.

1) Create a Local Copy of tizen-distro

The first step is to clone the Tizen distro tree. We actually use an alternate version of the already existing tizen.org tizen-distro tree.

Our variant has some patches on the top of the tree that allows building Tizen for ARM CPUs. It also disables the usage of the Open Source mesa/gallium 3D driver, since the Broadcom GPU used on Raspberry PI2 is not currently supported by this open source driver. The plan is to rework these patches to submit them to Tizen upstream, without breaking anything for x86.

To create the clone, do the following from any terminal window:

git clone git://git.s-osg.org/tizen-distro.git
cd tizen-distro
git checkout 3d_accel_vc4

2) Add Raspberry PI 2 BSP Meta Repository

Yocto works with several layers of software. The BSP (Board Supported Package) layer provides support for the board, and writing a BSP can consume a lot of time. Fortunately, there’s already a Yocto BSP for Raspbery PI 2, and the only extra requirement is to adjust the BSP to work with Tizen. Again, we opted to create a fork of the tree, to avoid interfering with other distros supported by this BSP, but the plan is to rework these patches in order to submit them to Yocto upstream in a way that would not affect builds for other distros.

The steps to create the clone are (starting in the tizen-distro directory created above):

git clone git://git.s-osg.org/meta-raspberrypi.git
cd meta-raspberrypi
git checkout 3d_accel_vc4
cd ..

3) Initialize the Environment to Prepare for Build

Now that we have a copy of both the Tizen and BSP Yocto bits, we need to set up the build environment in order to use bitbake. It should be noted that some packages may need to be installed, depending on the distribution you’re using on the build machine. The Yocto builder (bitbake) requires Python 2.7.3 or greater. So, we don’t recommend using an LTS distro for the build, as it may have packages that are too old. Here, we used Fedora 21, as it provides recent packages while being stable enough for desktop needs.

The command to initialize the build environment is:

source ./tizen-common-init-build-env build

4) Modify Config Files to Point to Build for Raspberry PI2

The Tizen build is controlled by configuration files. Assuming Tizen was installed at ~/tizen-distro the previous steps would have changed the working directory to the new build directory. So, the current directory should be ~/tizen-distro/build and the configuration files are in the ./conf directory.

From the build directory, you’ll need to edit the conf/local.conf with your favorite editor. You should comment out any existing line that starts with “MACHINE”, and add the line bellow:

MACHINE ??= "raspberrypi2"

This will tell bitbake that it should compile for the Raspberry PI 2 board.

Now, we need to add the BSP meta-raspberrypi layer to the conf/bblayers.conf file, at both BBLAYERS and BBLAYERS_NON_REMOVABLE. Again, use your favorite editor.

After the changes, the file contents should look like the one below, with your home directory instead of /home/mchehab:

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "5"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  /home/mchehab/tizen-distro/meta \
  /home/mchehab/tizen-distro/meta-raspberrypi \
  /home/mchehab/tizen-distro/meta-openembedded/meta-oe \
  /home/mchehab/tizen-distro/meta-openembedded/meta-multimedia \
  /home/mchehab/tizen-distro/meta-openembedded/meta-ruby \
  /home/mchehab/tizen-distro/meta-openembedded/meta-systemd \
  /home/mchehab/tizen-distro/meta-openembedded/meta-gnome \
  /home/mchehab/tizen-distro/meta-tizen/meta-tizen-adaptation/meta \
  /home/mchehab/tizen-distro/meta-tizen/meta-tizen-adaptation/meta-oe \
  /home/mchehab/tizen-distro/meta-tizen/meta-tizen-common-base \
  /home/mchehab/tizen-distro/meta-tizen/meta-tizen-common-share \
  /home/mchehab/tizen-distro/meta-tizen/meta-tizen-common-devtools \
  /home/mchehab/tizen-distro/meta-tizen/meta-tizen-common-demo \
"

BBLAYERS_NON_REMOVABLE ?= " \
  /home/mchehab/tizen-distro/meta \
  /home/mchehab/tizen-distro/meta-raspberrypi \
  /home/mchehab/tizen-distro/meta-openembedded/meta-oe \
  /home/mchehab/tizen-distro/meta-openembedded/meta-multimedia \
  /home/mchehab/tizen-distro/meta-openembedded/meta-ruby \
  /home/mchehab/tizen-distro/meta-openembedded/meta-systemd \
  /home/mchehab/tizen-distro/meta-openembedded/meta-gnome \
  /home/mchehab/tizen-distro/meta-tizen/meta-tizen-adaptation-oe-core \
  /home/mchehab/tizen-distro/meta-tizen/meta-tizen-adaptation-meta-oe \
  /home/mchehab/tizen-distro/meta-tizen/meta-tizen-common-base \
"

Notice the new entry for “~/tizen-distro/meta-raspberrypi \” in each of the sections.

5) Start Building

Now that everything is set, it is time to start the build. This is the step that will take a considerable amount of time, and will require a good Internet connection because it will download thousands of packages and/or clone upstream git trees for several packages.

Do this by running the bitbake command to generate an image. Currently, the following images are supported:

Image name Details
rpi-hwup-image Raspberry PI2 minimal image plus gstreamer
tizen-common-core-image-minimal Tizen common core image with the bare minimum Tizen packages
tizen-core-image-minimal Tizen minimal image – has application launchers for test apps
tizen-common-core-image-crosswalk Tizen image with crosswalk HTML application runtime
tizen-core-image-minimal-dev Same as tizen-core-image-minimal plus some additional development packages
tizen-common-core-image-crosswalk-dev Same as tizen-common-core-image-crosswalk plus some additional development packages

NOTE: Those images are the minimal images. They can incremented by adding more packages at the bitbake recipe. For example, if you want to add gstreamer to tizen-core-image-minimal, you could edit ./meta-tizen/meta-tizen-common-base/recipes-image/images/tizen-core-image-minimal.bb and add there the following lines:

CORE_IMAGE_BASE_INSTALL += "gstreamer1.0-meta-base"
CORE_IMAGE_BASE_INSTALL += "gstreamer1.0-meta-audio"
CORE_IMAGE_BASE_INSTALL += "gstreamer1.0-meta-video"
CORE_IMAGE_BASE_INSTALL += "gstreamer1.0-meta-debug"
CORE_IMAGE_BASE_INSTALL += "gstreamer1.0-plugins-good-meta"
CORE_IMAGE_BASE_INSTALL += "gstreamer1.0-plugins-base-meta"
CORE_IMAGE_BASE_INSTALL += "gstreamer1.0-plugins-ugly-meta"
CORE_IMAGE_BASE_INSTALL += "gstreamer1.0-plugins-bad-meta"
CORE_IMAGE_BASE_INSTALL += "gstreamer1.0-libav"

So, for example, in order to build the most complete image, you can run the command:

$ bitbake tizen-common-core-image-crosswalk-dev

If everything goes well with bitbake, the images will be located in the tmp-glibc/deploy/images/raspberrypi2 directory, and will look like the ones below:

$ ls tmp-glibc/deploy/images/raspberrypi2/
bcm2835-bootfiles
Image
Image--4.1.0+git07009cab090ade3dd180e8a55d590b1a00072eed-r0-bcm2708-rpi-b-20150710122011.dtb
Image--4.1.0+git07009cab090ade3dd180e8a55d590b1a00072eed-r0-bcm2708-rpi-b-plus-20150710122011.dtb
Image--4.1.0+git07009cab090ade3dd180e8a55d590b1a00072eed-r0-bcm2709-rpi-2-b-20150710122011.dtb
Image--4.1.0+git07009cab090ade3dd180e8a55d590b1a00072eed-r0-raspberrypi2-20150710122011.bin
Image-bcm2708-rpi-b.dtb
Image-bcm2708-rpi-b-plus.dtb
Image-bcm2709-rpi-2-b.dtb
Image-raspberrypi2.bin
modules--4.1.0+git07009cab090ade3dd180e8a55d590b1a00072eed-r0-raspberrypi2-20150710122011.tgz
modules-raspberrypi2.tgz
README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
rpi-hwup-image-raspberrypi2-20150710132847.rootfs.ext3
rpi-hwup-image-raspberrypi2-20150710132847.rootfs.manifest
rpi-hwup-image-raspberrypi2-20150710132847.rootfs.rpi-sdimg
rpi-hwup-image-raspberrypi2-20150710132847.rootfs.tar.bz2
rpi-hwup-image-raspberrypi2.ext3
rpi-hwup-image-raspberrypi2.manifest
rpi-hwup-image-raspberrypi2.rpi-sdimg
rpi-hwup-image-raspberrypi2.tar.bz2

Use the Image

Be careful at this point, because the steps below should be run as root, and will rewrite a disk image. If you do something wrong at this point, you may end by damaging what’s stored on your disks! Let’s assume that the SD card will be mapped as /dev/sdc. Replace /dev/sdc with the device where your SD card is stored. To find out where your device is mapped, you can run the command:

$ df -aTh

WARNING: In the next section, be sure to change any instance of /dev/sdc to your specific disk that it is mapped. Otherwise you may damage your system!

1) Fill the SD Card With the Image

Insert an SD card into your computer using an SD->USB adapter and check if it was mapped at /dev/sdc.

The current image size is about 620 MB. Be sure to have an SD card big enough to fit the size of the generated image.

Now, write the image with the following command:

# dd if=tmp-glibc/deploy/images/raspberrypi2/tizen-common-core-image-crosswalk-dev-raspberrypi2.rpi-sdimg of=/dev/sdc bs=256M; sync
3+1 records in
3+1 records out
935329792 bytes (935 MB) copied, 91.798 s, 6.7 MB/s

NOTE: the actual image size may vary, as we add more packages to the build image.

Please notice that the above is for the rpi-hwup-image. If the selected bitbake target is different, you need to change the above accordingly.

You may, instead use ddrescue:

# ddrescue tmp-glibc/deploy/images/raspberrypi2/tizen-common-core-image-crosswalk-dev-raspberrypi2.rpi-sdimg /dev/sdc -Df
GNU ddrescue 1.20
Press Ctrl-C to interrupt
rescued:   935329 kB,   errsize:         0 B,    current rate:   4325 kB/s
   ipos:   935264 kB,    errors:         0,      average rate:  11991 kB/s
   opos:   935264 kB,  run time:      1m 18s,  remaining time:         n/a
time since last successful read:          0s
Finished                                     

The image is now created and you can use it to boot into Tizen.

NOTE: The root password used on this image will be “root”.

Get Involved

Now, You’re ready to use Tizen on your Raspberry PI 2 with 3D acceleration. Please notice that this uses a WIP GPU driver. So, I don’t recommend using it in production. If you want to learn more or get involved, you can join us in the Tizen IRC chatroom, or subscribe to the Tizen Community mailing list. Lastly, you can also stay tuned to this blog to catch more articles about building things on Tizen and Raspberry Pi. Have fun!

Raspberry Pi is a trademark of the Raspberry Pi Foundation

Author: Mauro Carvalho Chehab

Mauro is the maintainer of the Linux kernel media and EDAC subsystems and Tizen on Yocto. He's also a major contributor to the Reliability Availability and Serviceability (RAS) subsystems.

15 thoughts on “Tizen on RPi2: Now Supporting 3D Acceleration”

  1. Problem build this project to Raspberry Pi 2:

    LOG:

    arm-oe-linux-gnueabi-gcc -march=armv7-a -marm -mthumb-interwork -mfloat-abi=hard -mfpu=neon-vfpv4 -mtune=cortex-a7 –sysroot=/media/paulz/data/yocto/tizen-distro/build/tmp-glibc/sysroots/raspberrypi2 -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I../src/lib/efl -I../src/lib/efl -DPACKAGE_BIN_DIR=\”/usr/bin\” -DPACKAGE_LIB_DIR=\”/usr/lib\” -DPACKAGE_DATA_DIR=\”/usr/share/efreet\” -DPACKAGE_BUILD_DIR=\”/media/paulz/data/yocto/tizen-distro/build/tmp-glibc/work/cortexa7t2hf-vfp-vfpv4-neon-oe-linux-gnueabi/efl/1.12.2-r0/git\” -DDATA_DIR=\”/usr/share\” -DLOCALE_DIR=\”/usr/share/locale\” -Wall -Wextra -Wpointer-arith -Wno-missing-field-initializers -fvisibility=hidden -fdata-sections -ffunction-sections -I../src/lib/efreet -I../src/lib/efreet -I../src/bindings/efreet -I../src/bindings/efreet -I../src/lib/eina -I../src/lib/eina -I../src/lib/eo -I../src/lib/eo -I../src/lib/eldbus -I../src/lib/eldbus -I../src/lib/ecore_file -I../src/lib/ecore_file -I../src/lib/ecore -I../src/lib/ecore -I../src/lib/eet -I../src/lib/eet -DEFL_EFREET_BUILD=1 -O2 -pipe -g -feliminate-unused-debug-types -DMESA_EGL_NO_X11_HEADERS -c -o tests/efreet/compare/tests_efreet_compare_efreet_menu_alloc-efreet_menu_alloc.o `test -f ‘tests/efreet/compare/efreet_menu_alloc.c’ || echo ‘./’`tests/efreet/compare/efreet_menu_alloc.c
    | make[4]: *** No rule to make target ‘lib/ecore_audio/ecore_audio.eo.hh’, needed by ‘all-am’. Stop.
    | make[4]: *** Waiting for unfinished jobs….
    | Makefile:31903: recipe for target ‘all-recursive’ failed
    | make[3]: *** [all-recursive] Error 1
    | Makefile:11563: recipe for target ‘all’ failed
    | make[2]: *** [all] Error 2
    | Makefile:2254: recipe for target ‘all-recursive’ failed
    | make[1]: *** [all-recursive] Error 1
    | Makefile:1484: recipe for target ‘all’ failed
    | make: *** [all] Error 2
    | ERROR: oe_runmake failed
    | WARNING: exit code 1 from a shell command.
    | ERROR: Function failed: do_compile (log file is located at /media/paulz/data/yocto/tizen-distro/build/tmp-glibc/work/cortexa7t2hf-vfp-vfpv4-neon-oe-linux-gnueabi/efl/1.12.2-r0/temp/log.do_compile.10450)
    ERROR: Task 3730 (/media/paulz/data/yocto/tizen-distro/meta-tizen/meta-tizen-common-share/recipes-efl/efl/efl_git.bb, do_compile) failed with exit code ‘1’
    Waiting for 2 running tasks to finish:
    0: linux-raspberrypi-4.1.0+git07009cab090ade3dd180e8a55d590b1a00072eed-r0 do_compile (pid 20506)

    1. There are a number of packages that should be installed at the host for tizen to build. Those vary depending on the distribution you’re using. Take a look at the Tizen wiki for more about that: https://wiki.tizen.org/wiki/Build_Tizen_with_Yocto_Project. Also, sometimes I experience random build errors. Calling bitbake again or cleaning the caches usally fixes. In order to cleanup the caches, you can do:
      bitbake -c clean [package]
      you may also remove everything under build/tmp-glibc, build/ccache and/or build/sstate-cache.

  2. The build is failing also with the following error:
    | configure: exit 1
    | ERROR: oe_runconf failed
    | WARNING: /home/anathoo/projects/tizen/tizen-distro/build/tmp-glibc/work/cortexa7t2hf-vfp-vfpv4-neon-oe-linux-gnueabi/pam/1.1.6-r0/temp/run.do_compile.10754:1 exit 1 from
    | exit 1
    | ERROR: Function failed: do_compile (log file is located at /home/anathoo/projects/tizen/tizen-distro/build/tmp-glibc/work/cortexa7t2hf-vfp-vfpv4-neon-oe-linux-gnueabi/pam/1.1.6-r0/temp/log.do_compile.10754)
    ERROR: Task 413 (/home/anathoo/projects/tizen/tizen-distro/meta-tizen/meta-tizen-common-base/recipes-extended/pam/pam_git.bb, do_compile) failed with exit code ‘1’
    Waiting for 0 running tasks to finish:
    NOTE: Tasks Summary: Attempted 509 tasks of which 16 didn’t need to be rerun and 1 failed.
    Waiting for 0 running tasks to finish:

    ============
    Some package error also during configure:
    ============
    checking for LIBSMACK… no
    configure: error: Package requirements (libsmack) were not met:

    No package ‘libsmack’ found

    1. There are a number of packages that should be installed at the host for tizen to build. Those vary depending on the distribution you’re using. Take a look at the Tizen wiki for more about that: https://wiki.tizen.org/wiki/Build_Tizen_with_Yocto_Project.
      I suspect, however, that, for some reason, it failed to download some package from review.tizen.org. Try to run bitbake again and check at the warnings if it was able to download everything or if there are some warnings that some package(s) weren’t downloaded.

      1. Hi,

        I managed to build the image, by doing a cleansstate and forcing bitbake to rebuild the problem component. I was able to build both the bare rpi image and the crosswalk image.

        However the crosswalk image does not seem to work after following the instruction to flash the SD card. My rpi keeps rebooting after a very brief flash on the screen. And the serial interface does not seem to work either, so I don’t have a way to see what’s going on.

  3. The raspberry pi keeps rebooting before it has finished the boot process.

    I was able to capture a video of the screen flashing for a split second and it show the following errors on the display during the boot process:

    display-manager.service changed failed -> start
    double free or corruption (fprev): 0x017219b0 *****

    The double free is causing WATCHDOG timer to trigger and the rpi is rebooting.

    Amir.

  4. I’m trying to build an image on Ubuntu 14.04 (64 bit) following this guide, but it seems that there’s some complications trying to get the pam compiled. I noticed on the older guide that they had a section mentioning a workaround for pam. I tried pulling “origin/tizen-debianhost” but during the auto-merging, two conflicts came up (efl.inc and weston.inc).

    Kinda stuck now; anyone else have success building on Ubuntu 14.04? Is there some trick to getting pam? Any hints would be greatly appreciated.

  5. I’m getting a connection refused on the “git clone git://git.s-osg.org/tizen-distro.git” step – is the git server down? Are there any mirrors?

    1. just to clarify – the machine at git.s-osg.org is clearly up, but it’s refusing connections on port 9418 (I’m getting a RST/ACK packet back). Neither http nor https work either…one possible hint is that DNS is actually aliasing git.s-osg.org to lists.s-osg.org

  6. Hello,

    Can I build Tizen with IVI profile?

    Could you please help to confirm?

    Thank you very much with best regards,
    Chi

  7. Thanks for your contribution.
    I installed the image successfully on raspbery pi 2.
    But except the wayland-terminator and gst-launch, I can’t run any app on raspberry pi.
    Does any one run the app successfully?

  8. ok downloaded the latest image and now how to burn it on the SD card? Is the format similar to images provided by raspberry for their OSes?

    I am on Windows machine

Comments are closed.