Build Tizen with Yocto Project

From Tizen Wiki
(Redirected from Build Tizen with Yocto)
Jump to: navigation, search

The purpose of this page is to explain, step by step, how to create your own Tizen Common or IVI image with Yocto Project.


Build a Tizen on Yocto Project image

At the moment there is a known bug building Tizen on hosts with gcc 5 (for example Ubuntu 15.10). Please use gcc 4.9. If you are Ubuntu 15.10 user, you can build Tizen in LXC container with Ubuntu 14.04.

Package requirements

A few packages are needed on your build machine in order to create an image with Yocto Project:

  • Debian/Ubuntu
   sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential \
   chrpath libsdl1.2-dev xterm libattr1-dev binutils-gold quilt cpio libwayland-dev ccache
  • Fedora
   sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch diffutils diffstat git \
   cpp gcc gcc-c++ glibc-devel texinfo chrpath ccache perl-Data-Dumper perl-Text-ParseWords \
   perl-Thread-Queue perl-XML-Parser SDL-devel xterm libattr-devel gettext-devel which wayland-devel

Note: also needs the equivalent of binutils-gold.

Note: Currently, it is not possible to use Fedora 22 or other distribtions where the compiler is gcc 5.x, as several packages don't compile. The serious issue is that there are some expectations in the tizen code about the compiler behavior of inlines which were never guaranteed, but always used to work. There are also some packages which would be easy to fix, as the work is already done in upstreams OpenEmbebdded/Yocto (ncurses, binutils, localedef) - this should be pulled in.

  • OpenSuse
   sudo zypper install python gcc gcc-c++ git chrpath make wget python-xml diffstat texinfo python-curses \
   patch libSDL-devel xterm libattr-devel binutils-gold
  • CentOS
   sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch diffutils diffstat git \
   cpp gcc gcc-c++ glibc-devel texinfo chrpath SDL-devel xterm libattr-devel

Note: also needs the equivalent of binutils-gold.

The Yocto Project Quick Start will help you to configure your host.

Build tested with:

  • Ubuntu 12.04 + ln updated (available version doesn't support option "--relative")
  • Ubuntu 14.04
  • Ubuntu 15.04
  • OpenSuse 12.3
  • OpenSuse 13.1
  • OpenSuse 13.2

Download Tizen distribution

You can find the Tizen-Distro here

If you want to fetch anonymously:

git clone git://review.tizen.org/scm/bb/tizen-distro

When building an IVI image, use rev_ivi_2015_02_04 (see release notes below). The last tested revision of Tizen-Distro for Tizen Common is the tizen_3.0.2015.q1_common. Since then, the "tizen-ivi" branch has been updated to follow the code and configuration of the Tizen IVI 3.0 release.

The full development history of the meta-tizen layer since rev_0.9 can be found in the "tizen-merged" branch, which (in contrast to the "tizen" branch there) contains all the intermediate commits required to get to a working build. The "tizen" branch itself only contains patches which do not break building it. It avoids merging because that does not work well with copying patches into tizen-distro.

Create your build directory

Recently, the build of tizen IVI and tizen Common has been splitted into two different branches.

For Tizen Common

Upstream

The upstream development is in Git branch tizen.

cd tizen-distro
git checkout tizen
build_directory_name=build-common
source ./tizen-common-init-build-env $build_directory_name

Tizen Common Q4 2014

cd tizen-distro
git checkout rev_0.9
build_directory_name=build-common
source ./tizen-common-init-build-env $build_directory_name

Tizen Common Q1 2015

cd tizen-distro
git checkout tizen_3.0.2015.q1_common
build_directory_name=build-common
source ./tizen-common-init-build-env $build_directory_name

Tizen Common Q2 2015

This snapshot was released supporting a GBS build, but the Yocto recipes are not ready yet - stay tuned.

For Tizen IVI

cd tizen-distro
git checkout rev_ivi_2015_02_04
build_directory_name=build-modello
source ./tizen-ivi-init-build-env $build_directory_name
  • If you wan to use the latest source code of Yocto recipes for Tizen IVI instead of the milestone for February 2015 please execute:
    git checkout tizen-ivi

Please read carefully the instructions provided by bitbake.

Local configuration

In the file conf/local.conf, select the MACHINE you want to build a Tizen image for. Basically for 64 bits build you should set the MACHINE to "genericx86-64". For a 32 bits build, you should set it to "genericx86".

64 bits build:

MACHINE ??= "genericx86-64"

32 bits build:

MACHINE ??= "genericx86"

Build an image

For Tizen Common

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

For Tizen IVI

bitbake tizen-ivi-Modello-image

The generated image can be found in tmp-glibc/deploy/images/${MACHINE}

Boot the created image

Bootable USB

Tizen Common Release Q1 2015

An image hdddirect is available in tmp-glibc/deploy/images/${MACHINE}
This image has 2 partitions. one FAT for grub-efi and one ext3 for the rootfs.
This image can be directly flash on USB stick.
Select your USB drive for example sdx then flash the image.

sudo dd_rescue tizen-common-core-image-crosswalk-dev-genericx86-64.hdddirect /dev/sdx

Tizen Common Release Q4 2015 and Tizen IVI

Those images don't have a raw image but a rootfs and a kernel.
From those you can easily boot Tizen on Yocto Project Images either by creating a bootable USB or directly by installing it on a hard drive (dual boot).

Both solutions are explained in is section.

  • Required files

Note:

  • That those images can be quite old, it is preferable to use your own images if you want to get the latest features.

Tizen Common

tizen-common-core-image-minimal-dev.ext3 (Download here)
bzImage (Download here)

Tizen IVI Modello
WARNING: Modello doesn't automatically start during the first boot BTY-51,please right click and refresh or reboot

tizen-ivi-core-image-minimal.ext3 (Download here)
bzImage (Download here)

Tizen IVI Ico
WARNING:Tizen IVI Ico is currently broken BTY-49

  • Required tool
fdisk
mkfs
grub2
  • The Tizen Common image is created as root
  • The Tizen Common image is tested on Lenovo x230 Tablet
  • Select your USB or hard drive device:
USB_DISK="sdz"
USB_DISKID="${USB_DISK}1"
  • Create rootfs partition.
fdisk /dev/"${USB_DISK}"

Press 'p' to display the partition table and 'd' to delete the previous partition(s).
Press 'n' then 'p' and '1' to create a single partition and use the default values for the size.
Don't forget to mark it as bootable by pressing 'a' and the partition number '1'.
Press 'w' to save and quit.

You should see very similar output :

fdisk -l /dev/"${USB_DISK}"
Disk /dev/sdz: 8004 MB, 8004304896 bytes
142 heads, 18 sectors/track, 6116 cylinders, total 15633408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x206c1007
  Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048     5633407     2815680   83  Linux
  • Format you partition
mkfs.ext3 /dev/"${USB_DISKID}"
  • Mount your key
mkdir -p /mnt/"${USB_DISKID}"
mount /dev/"${USB_DISKID}" /mnt/"${USB_DISKID}"
  • Mount your EXT3 Tizen source
mkdir -p /mnt/YoctoTizen_EXT3
mount tizen-common-core-image-minimal-dev.ext3 /mnt/YoctoTizen_EXT3

(Please adapt the image name to your needs.)

  • Copy the rootfs files
cp -a /mnt/YoctoTizen_EXT3/* /mnt/"${USB_DISKID}"
  • Copy the kernel file
mkdir -p /mnt/"${USB_DISKID}"/boot
cp -a bzImage /mnt/"${USB_DISKID}"/boot
  • Create grub files
grub2-install --recheck --root-directory=/mnt/"${USB_DISKID}" /dev/"${USB_DISK}"

On Debian and OpenSUSE the grub v2 install command is called just "grub-install".

  • Create your grub config file
mkdir -p /mnt/"${USB_DISKID}"/boot/grub2/
cat > /mnt/"${USB_DISKID}"/boot/grub2/grub.cfg <<EOF
set default="0"
set timeout="30"
menuentry 'Yocto Tizen Common' {
     insmod part_msdos
     insmod ext2
     set root='(hd0,msdos1)'
     linux /boot/bzImage root=/dev/sdb1 init=/lib/systemd/systemd rw rootwait
}
EOF

Note:

  • That you may have to modify the last line, especially the root parameter.
  • On Debian, use /boot/grub instead of /boot/grub2. Otherwise grub only presents a command prompt.
  • Clean the kitchen
sync
umount /mnt/"${USB_DISKID}"
umount /mnt/YoctoTizen_EXT3
rm -fr /mnt/"${USB_DISKID}"
rm -fr /mnt/YoctoTizen_EXT3
  • Enjoy your meal :)

Dual boot

A very convenient way to test images is to setup a test machine with dual boot, the process to setup such a configuration is explained here

Release Notes

rev_ivi_2015_02_04

This release corresponds to Tizen IVI 3.0.

Like all "Tizen on Yocto" builds so far, it contains recipes from OpenEmbedded (sometimes adapted to Tizen) and recipes (partly) derived from Tizen .spec files, partly manually adapted. Therefore it is not absolutely identical to Tizen, although the source of the Tizen recipes is the Tizen IVI 3.0.

Tested configurations:

  • MinnowboardMax, with meta-intel layer, MACHINE=genericx86-64: tizen-ivi-Modello-image-dev and tizen-ivi-Modello-image boot to Modello; tizen-ivi-core-image boots into Weston and weston-terminal works. tizen-ivi-Modello-image-dev was tested based on a clean rebuild of the final tizen-distro, the others with incremental, slightly earlier builds.

Known runtime issues:

  • The ICO home screen images do not build because ICO packages no longer compile successfully. They were not working earlier either (BTY-49).
  • When using a Modello image, the first boot (and only that) needs to install the Modello applications. Sometimes, in particular (only?) on -dev images, that first boot fails to bring up Modello. When stuck on a bluish or black screen, reboot (BTY-51). It should work from then on. During each first boot while installing Modello apps, pkginfo segfaults once, but that does not seem to have any visible effect.
  • "su - app" does not change the Smack label of the process to "User". Beware when editing files in that state, they will not be usable by "normal" app processes. Add "session required pam_smack.so" at the bottom of /etc/pam.d/su to change this. Original Tizen does not have that either - perhaps it is less important (but still needed?) because /etc/pam.d/login includes pam_smack.so (missing in "Tizen on Yocto") and thus already the root process runs as "User".
  • On MinnowboardMAX with no Ethernet plugged in, booting is stuck for a while waiting for the systemd hostname service.

Known compile issues:

  • bashisms in recipes derived from .spec files. If you are on a distro with /bin/sh linking to dash instead of bash, replace /bin/sh with /bin/bash in tizen-distro/bitbake/lib/bb/build.py.
  • Some recipes have additional, unwanted host dependencies:
    • rpm-native needs the "autopoint" command installed on the host on some systems (BTY-101). Install "autopoint" or "gettext-devel", depending on what provides /usr/bin/autopoint.
    • swig needs pcre-config from libpcre-devel installed but does not use it (potential fix posted to oe-core mailing list, see "swig + pcre-config").
  • When doing incremental builds, it can happen that do_package_rpm fails because rpmbuild was passed a --buildroot "package" directory which did not exist. A "bitbake -c cleansstate" of the affected recipe works around the issue.
  • When something fails to compile, try to continue building the rest with "bitbake -k", then "bitbake -c clean" or even "bitbake -c cleansstate" the failing recipe and restart the image building. Due to missing dependency declarations in some converted recipes the build is not perfectly deterministic. This shows up as, for example, "QA Issue: sphinxbase rdepends on libsndfile1, but it isn't a build dependency? [build-deps]".
  • Something in the meta-tizen layers breaks grub or gummiboot as EFI boot loader. They build, but then hang before showing the boot menu. This prevents using the tizen-distro/contrib/mkefidisk.sh script without further changes; to work around the issue, use the script, then mount the boot partition and replace EFI/BOOT/boot*.efi with the corresponding file built in a bitbake build config without the meta-tizen layers ("bitbake grub-efi").
  • systemd configure/build fails on systems with too old coreutils (configure: error: *** ln doesn't support --relative ***). Copy poky's systemd_216.bb do_configure_prepend() content in systemd.inc for tizen-distro.
  • OpenCV 3.0 configure issue related to ippicv .tgz hash mismatch can be workarounded by adding -DWITH_IPP=OFF in opencv_3.0.bb

First steps:

  • Modello images bring up the normal Modello UI.
  • The "core" images boot into the Weston shell. Use the shell icon on the top left to spawn a Weston terminal.
  • -dev images contain debug information and tools. They enable login as root (no password) via openssh and serial console (if configured in the grub config with a line like "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1", see http://0pointer.de/blog/projects/serial-console.html). In this revision they no longer contain development packages because that would just have bloated the images.
  • All images have a "genivi" user which owns the display and an "app" user which connects to that shared display and runs the actual applications.