Creating Tizen IVI Images from Scratch in One Page

Introduction

This document provides information about how to create Tizen IVI images from scratch in the form of step-by-step instructions.

This document guides users to build latest Tizen IVI milestone release:

https://download.tizen.org/releases/milestone/tizen/ivi/tizen_20140422.1/

The following parts are covered:

  • Clone source code
  • Build all packages using GBS
  • Create images using MIC

Cloning Tizen Source

Ensure the following before getting started:

  • Gerrit account is available and ready for use.
  • ~/.ssh/config is correctly configured, as shown below:
Host review.tizen.org
Hostname review.tizen.org
Port 29418
User <INPUT_YOUR_USER>
# ProxyCommand connect -S <proxy:port> %h %p
 
Host tizen
Hostname review.tizen.org
Port 29418
User <INPUT_YOUR_USER>
# ProxyCommand connect -S <proxy:port> %h %p

For detailed instructions for account registration and configuration, refer to:

https://source.tizen.org/documentation/developer-guide/environment-setup

Assuming Tizen IVI source directory is ~/tizen_ivi_src, to clone the source code, execute the following commands:

$ mkdir ~/tizen_ivi_src & cd ~/tizen_ivi_src
$ repo init -u tizen:scm/manifest -b tizen -m ivi.xml
$ wget https://download.tizen.org/releases/milestone/tizen/ivi/tizen_20140422.1/builddata/manifest/tizen_20140422.1_ia32.xml -O .repo/manifests/ivi/projects.xml
$ sed -i '3,4d' .repo/manifests/ivi/projects.xml # remove duplicated <remote> and <default> lines
$ repo sync -j 32 # sync code

Latest build-config project of tizen_ivi branch has changed, which results in some package build failure, so please follow this command to use the correct version:

$ cd scm/meta/build-config && git checkout afede20b3af513e25eac44d725d19097ba8e541f && cd -

This is only valid for tizen_20140422.1 version, and latest tizen_ivi branch of build-config works fine for later new tizen IVI.

For information about other scenarios of cloning source code, refer to Section 2.2.2 of https://source.tizen.org/documentation/developer-guide/getting-started-guide/cloning-tizen-source

Building All Packages by Using GBS

Updating GBS config

Update ~/tizen_ivi_src/.gbs.conf to add remote repository:

[general]
tmpdir=/var/tmp/
profile = profile.tizen3.0_ivi
work_dir=.
 
[repo.tizen3.0_x86]
url=${work_dir}/pre-built/toolchain-x86/
 
# Newly added repo
[repo.tizen3.0_ivi]
url=https://download.tizen.org/releases/milestone/tizen/ivi/tizen_20140422.1
 
[profile.tizen3.0_ivi]
repos=repo.tizen3.0_x86, repo.tizen3.0_ivi
buildconf=${work_dir}/scm/meta/build-config/build.conf

For detailed information about .gbs.conf for other profiles, refer to Section 2.3 of https://source.tizen.org/documentation/developer-guide/getting-started-guide/building-packages-locally-gbs

Fixing Known Packaging Error

The following packages will not be built because of packaging issues that result in gbs export failure.

  • platform/upstream/qtchooser
  • platform/upstream/xkeyboard-config
  • platform/core/uifw/libhangul

All these packaging errors are caused by the update of upstream branch or/and upstream tag that cannot work with the commit ID in remote manifest, which results in gbs export failure with the following error message:

info: tracking branch: origin/upstream -> upstream
info: tracking branch: origin/pristine-tar -> pristine-tar
error: Invalid upstream treeish upstream/2.7
error: Generating upstream tarball and/or generating patches failed. GBS tried this as you have upstream branch in you git tree. Fix the problem by either:
1. Update your upstream branch and/or fix the spec file. Also, check the upstream tag format.
2. Remove or rename the upstream branch (change the package to native)
See https://source.tizen.org/documentation/reference/git-build-system/upstream-package for more details.
error: <gbs>Failed to export packaging files from git tree

Or like:

info: Generating patches from git (upstream/39..HEAD)
error: Start commit 'upstream/39' not an ancestor of end commit 'HEAD'
error: Generating upstream tarball and/or generating patches failed. GBS tried this as you have upstream branch in you git tree. Fix the problem by either:
1. Update your upstream branch and/or fix the spec file. Also, check the upstream tag format.
2. Remove or rename the upstream branch (change the package to native)
See https://source.tizen.org/documentation/reference/git-build-system/upstream-package for more details.
error: <gbs>Failed to export packaging files from git tree

To fix this error, just add a default .gbs.conf for this project, and generate tarball from HEAD.

$ cd ~/tizen_ivi_src/<path/to/package/dir>
$ echo -e "[general]\nupstream_branch=NONE" >.gbs.conf
$ git add .gbs.conf && git commit -m "don't use upstream branch"

Building All Packages

Once all Tizen source code is downloaded and gbs.conf is correctly configured, next step is to build all source by using GBS:

# For Devices image
$ nohup gbs build -A i586 --threads=4 --exclude=libtool,gettext,emulator-yagl >build.log 2>&1 &
# For emulator image
$ nohup gbs build -A i586 --threads=4 --exclude=libtool,gettext,mesa >build.log 2>&1 &
$ tail -f build.log

Note:

  1. libtool and gettext is for breaking dependency circles, because GBS does not support building multiple packages with circle dependency.
  2. Only one of emulator-yagl and mesa can be built. mesa is for device images, whereas emulator-yagl is for emulator images.

Once GBS build finishes, the summary report can be seen at build.log file, which is catched by using above commands. The following errors may occur:

  • Export error
  • Dependency missing error
  • Rpm build error

During our experimental build, the build error of the following three packages is caused by missing dependencies:

=== the following packages failed to build due to missing build dependencies (3) ===
cross-i386-gcc48-icecream-backend:
nothing provides cross-i386-binutils
gcc48-testresults:
nothing provides fastjar
nothing provides dejagnu
libgcj48:
nothing provides fastjar

The above error can be ignored, as these three packages still have not been built in the build system and do not affect final image creation. libffi48 build error issue can also be ignored for the same reason.

The building of some packages may fail with the error log below:

[ 0s] Memory limit set to 21760284KB
[ 0s] Using BUILD_ROOT=/home/<User>/tizen_IVI_BUILD_ROOT/local/BUILD-ROOTS/scratch.i586.0
[ 0s] Using BUILD_ARCH=i686:i586:i486:i386:noarch
[ 0s] processing specfile /home/<User>/tizen_IVI_BUILD_ROOT/local/sources/tizen3.0_ivi/unifdef-2.8-1/unifdef.spec ...
[ 0s] init_buildsystem --configdir /usr/lib/build/configs --cachedir /home/<User>/tizen_IVI_BUILD_ROOT/local/cache --repository /home/<User>/tizen_IVI_BUILD_ROOT/local/repos/tizen3.0_ivi/i586/RPMS --repository /home/<User>/tizen/pre-built/toolchain-x86/ --repository http://linux-ftp.bj.intel.com/pub/mirrors/tizen/releases/milestone/tizen/ivi/tizen_20140422.1/repos/ivi/ia32/packages --repository http://linux-ftp.bj.intel.com/pub/mirrors/tizen/releases/milestone/tizen/ivi/tizen_20140422.1/repos/emul/ia32/packages /home/<User>/tizen_IVI_BUILD_ROOT/local/sources/tizen3.0_ivi/unifdef-2.8-1/unifdef.spec ...
[ 0s] initializing /home/<User>/tizen_IVI_BUILD_ROOT/local/BUILD-ROOTS/scratch.i586.0/.srcfiles.cache ...
[ 0s] /usr/lib/build/createrpmdeps /home/<User>/tizen_IVI_BUILD_ROOT/local/repos/tizen3.0_ivi/i586/RPMS
[ 0s] /usr/lib/build/createrepomddeps /home/<User>/tizen/pre-built/toolchain-x86/
[ 0s] /usr/lib/build/createrepomddeps --cachedir=/home/<User>/tizen_IVI_BUILD_ROOT/local/cache http://download.tizen.org/releases/milestone/tizen/ivi/tizen_20140422.1/repos/ivi/ia32/packages
[ 1s] Couldn't open /home/<User>/tizen_IVI_BUILD_ROOT/local/cache/338f7aa828eb615f0dfd4593f33ae5f2/repodata/repomd.xml:
[ 1s] No such file or directory at /usr/lib/build/createrepomddeps line 436

This is a known issue caused by network error, which can be fixed by rebuilding by using GBS with the same command.

Creating Images by Using MIC

This section describes how to download and configure ks files,which then will be used to create images with MIC.

For more detailed information, refer to:
https://source.tizen.org/documentation/developer-guide/getting-started-guide/creating-tizen-images-mic

Downloading ks Files

Download specific ks files from: http://download.tizen.org/releases/milestone/tizen/ivi/tizen_20140422.1/builddata/image-configs/

$ wget http://download.tizen.org/releases/milestone/tizen/ivi/tizen_20140422.1/builddata/image-configs/ivi-release-mbr-i586.ks -O ~/tizen_ivi_src/ivi-release-mbr-i586.ks

Updating ks Files

Update ks files based on the following diff content:

-repo --name=ivi --baseurl=http://download.tizen.org/snapshots/tizen/ivi/ivi-release/@BUILD_ID@/repos/ivi/ia32/packages/
+repo --name=ivi --baseurl=http://download.tizen.org/releases/milestone/tizen/ivi/tizen_20140422.1/repos/ivi/ia32/packages/
+repo --name=local --baseurl=file:///home/<user>/GBS-ROOT/local/repos/tizen3.0_ivi/i586 --priority=1
+repo --name=local-toolchain --baseurl=file:///home/<user>/tizen_ivi_src/pre-built/toolchain-x86/ --priority=2

Creating Tizen Images

To create Tizen images, execute the following commands:

$ cd ~/tizen_ivi_src/
$ rm /var/tmp/mic/cache/packages/ivi/ -rf
$ time sudo mic cr auto ivi-release-mbr-i586.ks –tmpfs
...
INFO: The new image can be found here:
/home/<User>/tizen_ivi_src/mic-output/ivi-release-mbr-i586-201405141920-sdb.bmap
/home/<User>/tizen_ivi_src/mic-output/ivi-release-mbr-i586-201405141920-sdb.raw.bz2
/home/<User>/tizen_ivi_src/mic-output/ivi-release-mbr-i586-201405141920.xml
/home/<User>/tizen_ivi_src/mic-output/ivi-release-mbr-i586-201405141920-vmlinuz-3.13.3-3-x86-ivi
INFO: Finished.
real 3m21.476s
user 2m57.236s
sys 0m7.864s

Next step is to check whether all packages for image creation are from local repo, which can be done by checking MIC's cache dir:

$ find /var/tmp/mic/cache/packages/ivi/
/var/tmp/mic/cache/packages/ivi/
/var/tmp/mic/cache/packages/ivi/libmm-player-0.2.19-12.4.i686.rpm
/var/tmp/mic/cache/packages/ivi/libhangul-0.1.0-12.1.i686.rpm

In above case, two packages are downloaded from remote repository caused by local build error.

Till now, image creation has been done.