80
SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

Embed Size (px)

Citation preview

Page 1: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

1

SKKU Embedded Software Lab.

Development Environment andPlatform Build

Page 2: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

2

SKKU Embedded Software Lab.

• Tizen Development Environment– Tizen Development Overview– Tizen Source Code Management– Installation

• Building Tizen Platform• Tizen Platform IDE• Appendices

– Trouble-shootings

Contents

Page 3: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

3

SKKU Embedded Software Lab.

A. Tizen Development OverviewB. Tizen Source Code Management

C. Installation

1. Tizen Development Environment

Page 4: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

4

SKKU Embedded Software Lab.

• Hundreds of packages– Tizen is composed of hundreds of packages.– Each package has its source code repository.– Git: Tizen source code is managed in distributed manner.

• Centralized Source Code Management– Tizen source code is reviewed and submitted in

centralized manner.– GBS(Git Build System): a tool for centralized source

code management– All the repositories are managed on Tizen servers; Gerrit

and OBS.

• Packaging and Making images– Packages are managed by RPM, images are made by MIC.

Tizen Development Overview

Page 5: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

5

SKKU Embedded Software Lab.

Tizen Development Workflow (1/3)

Page 6: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

6

SKKU Embedded Software Lab.

1. Local works by Developers1. Setting up Tizen development environment2. Cloning the source code3. Changing and verifying local source code through local

build

2. Review1. Submission: Developer submits patches to review

server for stakeholders to review2. Verification: Tizen backend service and reviewers

verify the patches through testing process and then vote based on the quality of the patches.

3. Approval and Merge: Maintainers approve the patches and then merge code changes to the review server’s repository.

Tizen Development Workflow (2/3)

Page 7: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

7

SKKU Embedded Software Lab.

3. Release– Tizen backend service activates pre-release and

normal release processes at the same time.1. Submission on OBS: Maintainers/Developers submit

packages to the OBS by using gbs submit command.2. Pre-release: Tizen images that incorporates specific

packages are created and submitted to release engineers to review.

3. Final review: Release engineers accept or reject submissions based on the quality of the packages. Accepted source code is merged into the OBS repository.

4. Release: the normal release process takes over and publishes repos together with Tizen images.

Tizen Development Workflow (3/3)

Page 8: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

8

SKKU Embedded Software Lab.

• A revision control and source management tool

• Features– Free and open source(GNU GPL v2)– Smaller and faster than other SCM tools– Distributed– Branching and merging– Data assurance– Staging area

• Git in Tizen– All source code repositories of Tizen packages are

managed by git.

SCM Tools (1/3): Git

Page 9: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

9

SKKU Embedded Software Lab.

• Repository management tool built on top of Git– Originally used in Android project– Used for managing many git repositories– Automate parts of development workflow

• Repo in Tizen– Tizen platform is composed of the hundreds of projects.– Each projects are managed as a git repository.– Repo is used for managing Tizen platform repositories in

batched manner.• ex. Cloning git repositories of entire Tizen platform packages

SCM Tools (2/3): Repo

Page 10: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

10

SKKU Embedded Software Lab.

• Git Build System• A developer command line tool that

supports Tizen package development• Functions

– Builds a repository or repositories and make package files(*.rpm)

– Generates tarballs based on Git repositories– Does local test buildings– Submits source code to OBS(Tizen’s main build service)

SCM Tools (3/3): GBS

Page 11: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

11

SKKU Embedded Software Lab.

• Gerrit (review.tizen.org)– A Web-based code review system

• OBS(Open Build System; build.tizen.org)– A distributed development platform that makes developers

to easily release open source software for various Linux distributions on different hardware architectures.

Centralized SCM System

Page 12: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

12

SKKU Embedded Software Lab.

• RPM(Red Hat Package Manager)– A tool to manage software packages

• build, install, query, verify, update and erase software packages

– RPM in Tizen• Each Tizen platform package is represented in *.rpm form and

managed by RPM.

• MIC(Moblin Image Creator)– A tool to create platform images to be flashed on target

device’s storage– Requires:

• Tizen platform packages (*.rpm)• Kickstart file: it defines how to make image of target device

– Output: platform images(system.img, userdata.img, ums.img)

Packaging Tools: RPM and MIC

Page 13: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

13

SKKU Embedded Software Lab.

A. Tizen Development OverviewB. Tizen Source Code Management

C. Installation

1. Tizen Development Environment

Page 14: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

14

SKKU Embedded Software Lab.

1. Git: manages source code versions2. GBS: builds source code of git repository

→ makes package file(RPM)3. Install package file on ODROID-U3

Tizen Source Code Workflow

Local PC

Working Directory

hello.c hello.h

(Local) Repository

Staging Area

Ver.1hello.h

Ver.2hello.c hello.h

Github Server (Remote)

(Remote) Repository

Ver.1hello.h

Ver.2hello.c hello.h

Pull

Push

Commit

Add

gbs build Package file (rpm)

Install

ODROID-U3

Page 15: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

15

SKKU Embedded Software Lab.

• Working directory– Source code in work– “add” command: adds

files/directories to staging area

• Staging area(index)– Source code to be committed– “commit” command: makes a

new version in repository

• Repository(HEAD)– Source code already committed– Files or directories are stored as

content-addressable objects identifiable by hash value.

Git: Key Concepts

Working Directory

hello.c hello.h

(Local) Repository

Staging Area

Ver.1hello.h

Ver.2hello.c hello.h

Commit

Add

Page 16: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

16

SKKU Embedded Software Lab.

• Add a source code, ‘hello.cpp’1. Add hello.c to staging area

1. $ git add hello.c

2. Make a new version1. $ git commit -m “commit message”

• Add all of the source code1. Add all of the source code

1. $ git add --all

2. Make a new version1. $ git commit -m “commit message”

• Display staging area’s status1. $ git status

Version Management (1/2)

Working Directory

hello.c hello.h

(Local) Repository

Staging Area

Ver.1hello.h

Ver.2hello.c hello.h

Commit

Add

Page 17: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

17

SKKU Embedded Software Lab.

• Display the commit log1. $ git log– Each commit’s hash value, author

information, date, message

Version Management (2/2)

commit 783c82ff64eda9f03401834de906eca77d01f691Author: Gyeonghwan Hong <[email protected]>Date: Mon Sep 22 10:37:44 2014 +0900 2nd version commit: hello.c is added

commit 712943bb31bf85430e1a027abe197e5b88a26110Author: Gyeonghwan Hong <[email protected]>Date: Thu Aug 28 12:08:17 2014 +0900 1st version commit: hello.h is added

• Return to a previous version1. git checkout <commit’s hash

value>

Working Directory

hello.c hello.h

(Local) Repository

Staging Area

Ver.1hello.h

Ver.2hello.c hello.h

Commit

Add

– ex. git checkout 712943bb31bf85430e1a027abe197e5b88a26110

Page 18: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

18

SKKU Embedded Software Lab.

• “Commit”– Make a new version on local repository

• “Push”– Upload commits in local repository to remote repository

Local & Remote Repository (1/2)

• “Pull”– Download commits

in remote repository to local repository

Local PC

Working Directory

hello.c hello.h

(Local) Repository

Staging Area

Ver.1hello.h

Ver.2hello.c hello.h

Github Server (Remote)

(Remote) Repository

Ver.1hello.h

Ver.2hello.c hello.h

Pull

Push

Commit

Add

Page 19: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

19

SKKU Embedded Software Lab.

• Upload to remote repository1. $ git push <remote name> <remote branch>– ex. $ git push origin master

Local & Remote Repository (2/2)

Local PC

Working Directory

hello.c hello.h

(Local) Repository

Staging Area

Ver.1hello.h

Ver.2hello.c hello.h

Github Server (Remote)

(Remote) Repository

Ver.1hello.h

Ver.2hello.c hello.h

Pull

Push

Commit

Add

• Download from remote repository1. $ git pull

Page 20: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

20

SKKU Embedded Software Lab.

• Check the branch list of local repository1. $ git branch --list

• Check the branch list of remote repository1. $ git branch --remote

Branch Management (1/3)

* master feature_x

• Move to another branch1. $ git checkout <branch name>– ex. $ git checkout feature_x

Page 21: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

21

SKKU Embedded Software Lab.

• Develop a new feature by making a new branch

1.Make a new branch ‘feature_x’1. $ git branch feature_x2. $ git checkout feature_x

2.Edit and commit source code3.Merge ‘feature_x’ branch to original branch

1. $ git checkout master2. $ git merge feature_x

Branch Management (2/3)

Page 22: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

22

SKKU Embedded Software Lab.

• Conflict– When merging feature_y branch to master branch, ‘hello.h’

in version 2-x and 2-y have different changes each other.– This situation is called as ‘conflict’.– The conflict should be resolved by ‘conflict resolution’

process.1. $ git mergetool• http://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-

and-Merging

Branch Management (3/3)

Page 23: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

23

SKKU Embedded Software Lab.

A. Tizen Development OverviewB. Tizen Source Code Management

C. Installation

1. Tizen Development Environment

Page 24: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

24

SKKU Embedded Software Lab.

Tizen Dev. Environment Install (1/11)

1. Git: Install and Configuration1. Install a git package.

1. $ sudo apt-get install git

2. Configure user information of git.• This information will be used for committer information.1. $ git config --global user.name “Your name”2. $ git config --global user.email email@address• ex.

– $ git config --global user.name “Gyeonghwan Hong”– $ git config --global user.email [email protected]

Page 25: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

25

SKKU Embedded Software Lab.

Tizen Dev. Environment Install (2/11)

PATH=~/bin:${PATH}

~/.bashrc

~/.bashrc

2. Repo: Install and Configuration1. Download repo.

1.$ sudo apt-get install curl2.$ mkdir -p ~/bin3.$ curl http://commondatastorage.googleapis.com/git-repo-

downloads/repo > ~/bin/repo4.$ chmod +x ~/bin/repo

2. Add repo’s path to the basic path list.1.Edit ~/.bashrc

1. $ gedit ~/.bashrc2. After adding below code to the last line, restart your shell.

Page 26: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

26

SKKU Embedded Software Lab.

3. GBS, MIC: Install1. Add Tizen development tool repository to APT repository

list.1. $ sudo gedit /etc/apt/sources.list

2. Add below code1. XX : Ubuntu’s major version (ex. 12, 13, 14)2. YY : Ubuntu’s minor version (ex. 04, 10)

Tizen Dev. Environment Install (3/11)

deb http://download.tizen.org/tools/latest-release/Ubuntu_XX.YY /

/etc/apt/sources.list

/etc/apt/sources.list

3. $ sudo apt-get update

2. Install packages of GBS, MIC.1. sudo apt-get install gbs mic

Page 27: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

27

SKKU Embedded Software Lab.

• You should have an access right to review server for accessing Tizen source code.

4. Register a Tizen developer ID1. Go to developer.tizen.org/ko.

Tizen Dev. Environment Install (4/11)

2. You can log in Tizen review server (review.tizen.org).

Page 28: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

28

SKKU Embedded Software Lab.

5. Review Server: Configuration1. $ gedit ~/.ssh/config– Enter your username.

Tizen Dev. Environment Install (5/11)

Host tizen Hostname review.tizen.org IdentityFile ~/.ssh/id_rsa User username Port 29418

Host review.tizen.org Hostname review.tizen.org IdentityFile ~/.ssh/id_rsa User username Port 29418

~/.ssh/config~/.ssh/config

Page 29: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

29

SKKU Embedded Software Lab.

5. Review Server: Configuration (Cont’d)2. Run “ssh-keygen” on a shell.

1. $ ssh-keygen

Tizen Dev. Environment Install (6/11)

– Press enter about every question for using default values.

– In result, id_rsa, id_rsa.pub files will be created.» id_rsa: private key» id_rsa.pub: public key

Page 30: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

30

SKKU Embedded Software Lab.

5. Review Server: Configuration (Cont’d)3. After log in review.tizen.org, go to ‘settings’ menu.

Tizen Dev. Environment Install (7/11)

4. Enter into “SSH Public Keys” menu → Press “Add Key …” button.

Page 31: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

31

SKKU Embedded Software Lab.

5. Review Server: Configuration (Cont’d)5. Display the contents of public key file.

5. $ cat ~/.ssh/id_rsa.pub

6. Copy the displayed text to below text box.

Tizen Dev. Environment Install (8/11)

Contents of ‘~/.ssh/id_rsa.pub’

Page 32: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

32

SKKU Embedded Software Lab.

5. Review Server: Configuration (Cont’d)7. Test ssh server connection

1. $ ssh tizen2. $ ssh review.tizen.org• If the connection is successful, below message will be

displayed.

Tizen Dev. Environment Install (9/11)

Page 33: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

33

SKKU Embedded Software Lab.

• Tizen source code is built by pre-built toolchains.

6.Clone Pre-built Toolchain Packages1. Clone ARM toolchain

1. $ git clone ssh://[email protected]:29418/pre-built/toolchain-arm pre-built/toolchain-arm

2. $ cd pre-built/toolchain-arm3. $ git checkout origin/tizen_2.24. $ cd -

2. Clone x86 toolchain1. $ git clone ssh://[email protected]:29418/

pre-built/toolchain-x86 pre-built/toolchain-x862. $ git pre-built/toolchain-x863. $ git checkout origin/tizen_2.24. $ cd -

Tizen Dev. Environment Install (10/11)

Page 34: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

34

SKKU Embedded Software Lab.

7. Make a GBS configuration file (~/.gbs.conf)– Without this file, Tizen source code cannot be built.1. $ gedit ~/.gbs.conf

Tizen Dev. Environment Install (11/11)

[general]tmpdir=/var/tmp/profile=profile.tizen2.2work_dir=/home/user

[repo.tizen2.2]url=http://download.tizen.org/releases/2.2/tizen-2.2/[repo.tizen2.2_arm]url=${work_dir}/pre-built/toolchain-arm/[repo.tizen2.2_x86]url=${work_dir}/pre-built/toolchain-x86/

[profile.tizen2.2]repos=repo.tizen2.2_arm, repo.tizen2.2_x86, repo.tizen2.2

Page 35: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

35

SKKU Embedded Software Lab.

2. Building Single Tizen Package

Page 36: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

36

SKKU Embedded Software Lab.

Tizen Build Process

Page 37: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

37

SKKU Embedded Software Lab.

• Building Single Tizen Package– Maintain source code of single package.– If other packages are required in build phase, download

them from Tizen download server.– There are two ways to apply single package.

• Installing the package on target board in force• Making and flashing Tizen platform images

– Build time and package size are minimized.

• Building Tizen Platform– Maintain total source code of Tizen platform.– Build time is too long and the size of packages is too

large.

How to Build and Apply Tizen Package

Page 38: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

38

SKKU Embedded Software Lab.

• Build time and package size are minimized.

Building Single Tizen Package

Page 39: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

39

SKKU Embedded Software Lab.

• Build time is too long and the size of packages is too large.

Building Tizen Platform

Page 40: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

40

SKKU Embedded Software Lab.

• Tizen project repository requires following files– Red files are required at least.

Required Files in Repository (1/2)

• AUTHORS: Author list• LICENSE: License information• CMakeLists.txt: cmake configuration file about this directory’s

build• <project-name>.manifest: SMACK manifest file• packaging• <project-name>.manifest: SMACK manifest file• <project-name>.spec: RPM package specification file• <sub-directory 1>• CMakeLists.txt• include

• Header files• src

• Source code files• <sub-directory 2>, <sub-directory 3>, …

Page 41: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

41

SKKU Embedded Software Lab.

• ex. Remote Key Framework Service Project (Link)

Required Files in Repository (2/2)

• AUTHORS: Author list• LICENSE: License information• CMakeLists.txt: cmake configuration file about this directory’s

build• remote-key-framework.manifest: SMACK manifest file• packaging

• remote-key-framework.manifest: SMACK manifest file• remote-key-framework.spec: RPM package specification

file• remote-key-framework.service: systemd service

configuration file• server

• CMakeLists.txt• include

• common.h: Common header file• src

• main.cpp: Main source code• common.cpp: Source code of dlog connector

Page 42: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

42

SKKU Embedded Software Lab.

1. Log in Tizen review server (review.tizen.org)2. Enter into “Projects” → “List”3. Find a repository that you want to clone

– Be careful: Packages in Tizen 2.2 and 3.0 are managed in different way, so multiple packages will be displayed on the result.

How to Clone Existing Repository (1/2)

4. Clone the repository1. $ git clone

ssh://[email protected]:29418/project-name

Page 43: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

43

SKKU Embedded Software Lab.

How to Clone Existing Repository (2/2)

• Tizen package repository has several branches by release version.

5.Check branches1. $ git branch --remote

• ex. origin/1.0_postorigin/2.0alphaorigin/HEAD -> origin/masterorigin/masterorigin/tizen_2.0origin/tizen_2.1origin/tizen_2.2origin/tizen_2.3

6. Change branch to target release version1. $ git checkout <target branch>

• ex. git checkout origin/tizen_2.2

Page 44: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

44

SKKU Embedded Software Lab.

• Build the most recent version in Git repository– In default, GBS builds the source code of most recent version.1. Move to the directory of repository.2. $ gbs build -A armv7l– -A <architecture type>: x86, armv7l

How to Build Single Tizen Package (1/3)

Local PC

Working Directory

hello.c hello.h

(Local) Repository

Staging Area

Ver.1hello.h

Ver.2hello.c hello.h

Commit

Add

gbs build Package file (rpm)

Page 45: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

45

SKKU Embedded Software Lab.

• Build the working directory– Use it in the case of building the source code in work.1. Move to the directory of repository.2. $ gbs build -A armv7l --include-all– --include-all: option for building working directory

How to Build Single Tizen Package (2/3)

Local PC

Working Directory

hello.c hello.h

(Local) Repository

Staging Area

Ver.1hello.h

Ver.2hello.c hello.h

Commit

Add

gbs build Package file (rpm)

Page 46: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

46

SKKU Embedded Software Lab.

• Other GBS Options– --threads <# of threads>: the number of build threads– --clean: initializes the GBS build root– --exclude=<packages>: the list of packages to be

excluded

• Build Result– Name: package_name-version.arch.rpm

• ex. remote-key-framework-1.2.1.armv7l.rpm

– Located in: ~/GBS-ROOT/local/repos/tizen2.2/armv7l/RPMS/

How to Build Single Tizen Package (3/3)

Page 47: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

47

SKKU Embedded Software Lab.

• Install package files(*.rpm) on target board– Send package files to target board through SDB– Install the packages by RPM tool

How to Install Tizen Package (1/2)

Local PC

Working Directory

hello.c hello.h

(Local) Repository

Staging Area

Ver.1hello.h

Ver.2hello.c hello.h

Commit

Add

gbs build Package file (rpm)

Package file (rpm)gbs build

--include-all

Install

Install

ODROID-U3

Page 48: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

48

SKKU Embedded Software Lab.

1. Connect to ODROID-U3 via USB– How to check connection: $ sdb devices– Caution: If you are using VMWare, check the connection

of ‘removable device’

2. Enter to SDB root mode1. $ sdb root on

3. Send package file to target board through SDB1. $ sdb push package_name-version.arch.rpm /

4. Install the package1. $ sdb shell rpm -ivh --nodeps --force package_name-

version.arch.rpm

5. Reboot your target board1. $ adb shell sync; sdb shell reboot -f

How to Install Tizen Package (2/2)

Page 49: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

49

SKKU Embedded Software Lab.

4. Building Tizen Platform

Page 50: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

50

SKKU Embedded Software Lab.

• Requirements– Total source code of Tizen– Profile for ODROID-U3– Kickstart file for ODROID-U3– Package group pattern for ODROID-U3

• Entire Process– Cloning total Tizen platform source code– Setting up for target board

• Profile• Kickstart file• Package group pattern

– Building– Making Images

Overview on Building Tizen Platform

Page 51: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

51

SKKU Embedded Software Lab.

• Total source code contains below directories. (Tizen 2.2)– adaptation– apps– external– framework– kernel– meta– mic-output– pkgs– pre-built– profile– scm– sdk– toolchains– tools

Total Source Code of Tizen

Page 52: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

52

SKKU Embedded Software Lab.

• A file that defines characteristics by target device– Basic features: Model name, platform version, processor name– Processor: CPU architecture, FPU type, Graphics acceleration– Network: Wifi, Telephony, VoIP, Bluetooth, GPS, WPS, Push– Peripheral devices: Camera, FM Radio, Keyboard, Microphone,

Multi-point touch, Screen, Sensors, USB, Vision– Other features: Database encryption, OpenGL configuration,

Shell, Speech, OSP-compatible

• Different profile is required by target board.– Official target of Tizen 2.2: RD-210, RD-PQ, Emulator– ODROID-U3 is not supported officially → New profile is required

• Refer to https://www.tizen.org/feature

Profile

Page 53: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

53

SKKU Embedded Software Lab.

• Components– LICENSE.APLv2: Apache License v2– NOTICE.APLv2– model-config.manifest: Manifest file required for RPM

• http://wiki.tizen.org/wiki/Security/Application_installation_and_Manifest

– model-config.xml• ODROID-U3 Profile

– packaging/model-config-odroid-u3.spec• RPM package specification

ODROID-U3 Profile

Page 54: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

54

SKKU Embedded Software Lab.

ODROID-U3 Profile: Structure

<?xml version="1.0" encoding="UTF-8" standalone="no"?><model-config version="2.2.0" model="ODROID-U3-REF"> <platform> <!-- Model Name, Platform Name/Version, Processor Name --> <key name="tizen.org/system/model_name" type="string">ODROID-U3</key> <key name="tizen.org/system/platform.name" type="string">Tizen</key> <key name="tizen.org/feature/platform.version" type="string">2.2</key> <key name="tizen.org/system/platform.processor" type="string">exynos4412</key>

<!-- Specification of Features --> <key name="tizen.org/feature/camera" type="bool">false</key> <key name="tizen.org/feature/camera.back" type="bool">false</key>( 중략 ) </platform> <custom> </custom></model-config>

~/tizen-platform/profile/mobile/model/config-odroid-u3/

model-config.xml

~/tizen-platform/profile/mobile/model/config-odroid-u3/

model-config.xml

Page 55: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

55

SKKU Embedded Software Lab.

• A file that defines how to make image of target device

• Structure– Default locale, keyboard language, timezone– Partition configurations, root user, default user to login– Repository path

• Path of repository that contains Tizen packages

– Required package groups• List of package groups to be included in image

– Required pre-packages• List of packages to be included in image

– Postscript• Script that configures the initial condition of image

Kickstart File

Page 56: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

56

SKKU Embedded Software Lab.

Kickstart File: Structure (1/4)

#Default locale, keyboard language, and timezonelang en_US.UTF-8keyboard ustimezone --utc America/Los_Angeles

#Partition configurations# ROOT fs partitionpart / --size=3000 --ondisk mmcblk0p --fstype=ext4 --label=platform# DATA partitionpart /opt/ --size=3000 --ondisk mmcblk0p --fstype=ext4 --label=data# UMS partitionpart /opt/usr/ --size=3000 --ondisk mmcblk0p --fstype=ext4 --label=ums

#Root user and default user to loginrootpw tizen bootloader --timeout=0 --append="rootdelay=5" desktop --autologinuser=root user --name root --groups audio,video --password '‘(Continued)

~/tizen-platform/ODROID-U3.ks

~/tizen-platform/ODROID-U3.ks

Page 57: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

57

SKKU Embedded Software Lab.

Kickstart File: Structure (2/4)

(Continued)# Modify the local path as your environment.repo --name=local --baseurl=file:///home/user/GBS-ROOT/local/repos/tizen2.2/armv7l/ --priority=1repo --name=Tizen-main --baseurl=https://download.tizen.org/snapshots/2.2/common/latest/repos/tizen-main/armv7l/packages/ --save --ssl_verify=no --priority=99repo --name=Tizen-base --baseurl=https://download.tizen.org/snapshots/2.2/common/latest/repos/tizen-base/armv7l/packages/ --ssl_verify=no --priority=99(Continued)

~/tizen-platform/ODROID-U3.ks

~/tizen-platform/ODROID-U3.ks

• Repository path– Path of repository that contains Tizen packages– Multiple path: local path, download server …– Priority is tunable.

Page 58: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

58

SKKU Embedded Software Lab.

Kickstart File: Structure (3/4)

(Continued)%packages@common@apps-common@apps-core@osp@target-common@target-odroid-u3%end

~/tizen-platform/ODROID-U3.ks

~/tizen-platform/ODROID-U3.ks

%prepackageseglibcsystemdbusyboxlibacllibcapdbus-libslibgcclibudevlibattrdefault-files-tizenopenssl

libprivilege-controllibprivilege-control-confsecurity-serverlibdloglibsecurity-server-clientsqlitetzdata-slpvconftizen-coreutilsrpm-security-plugin%end(Continued)

• Required package groups– List of package groups to be included in image

• Pre-required packages– List of package groups to be included in image

Page 59: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

59

SKKU Embedded Software Lab.

• Postscript– Script that configures the initial condition of image

Kickstart File: Structure (4/4)

(Continued)%postecho 'kickstart post script start'if [ -d /etc/init.d ]; then cp /etc/init.d/* /etc/rc.d/init.d/ -rdffirm -rf /etc/init.d*ln -sf /etc/rc.d/init.d /etc/init.d

rm -rf /etc/localtime ln -sf /opt/etc/localtime /etc/localtime ( 중략 )%end

~/tizen-platform/ODROID-U3.ks

~/tizen-platform/ODROID-U3.ks

Page 60: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

60

SKKU Embedded Software Lab.

• Package Group Pattern– Tizen packages are grouped by their common objectives.– When MIC makes Tizen image, it loads packages in the

unit of package group.

ODROID-U3 Package Group Pattern (1/3)

Description: Packages for ODROID-U3 targetName: target-odroid-u3Packages:- alsa-scenario-scn-data-0-wm1811- bluetooth-firmware-bcm-e4412- charging-animation- device-manager-plugin-exynos- gst-plugins-e4x12- gst-plugins-fimcconvert- libomxil-e4x12(Continued)

~/tizen-platform/meta/package-groups/patterns/target-odroid-u3.xml

~/tizen-platform/meta/package-groups/patterns/target-odroid-u3.xml

Page 61: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

61

SKKU Embedded Software Lab.

ODROID-U3 Package Group Pattern (2/3)

(Continued)- libtbm-exynos4412- mfc-firmware-e4412- mmfw-sysconf-cleansdk-e4x12- model-config-odroid-u3- my-account- nfc-plugin-65nxp- nfc-plugin-nxp- opengl-es-virtual-drv- org.tizen.mobileprint- powertop- print-service- print-driver-data- pygobject- rfkill- sensor-plugins- system-plugin-slp- systemd-console-ttySAC2- tel-plugin-imc- tel-plugin-imcmodem- xorg-x11-drv-exynos- xorg-x11-misc-exynosSummary: Packages for ODROID-U3

ODROID-U3 profile package

Page 62: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

62

SKKU Embedded Software Lab.

1.Make and move to Tizen source code directory1. $ mkdir tizen-platform; cd tizen-platform

2.Set the path of download server.1. $ repo init -u

ssh://<Username>@review.tizen.org:29418/scm/manifest -b <Branch-name>

ex. $ repo init -u ssh://[email protected]:29418/scm/manifest -b tizen_2.2

3.Clone source code (Using 8 threads)1. $ repo sync -j8

Cloning Total Source Code of Tizen

Page 63: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

63

SKKU Embedded Software Lab.

1. Move to Tizen source code directory1. $ cd ~/tizen-platform

2. Clone ODROID-U3 profile package1. cd ~/tizen-platform2. git clone https://github.com/SKKU-ESLAB-Tizen/tizen-

profile-odroid-u3.git profile/mobile/model/config-odroid-u3

3. Copy ODROID-U3 kickstart file1. cp profile/mobile/model/config-odroid-u3/ODROID-U3.ks

~/tizen-platform

4. Copy ODROID-U3 package group file1. cp profile/mobile/model/config-odroid-u3/target-odroid-

u3.yaml ~/tizen-platform/meta/package-groups/patterns/2. cd ~/tizen-platform/meta/package-groups/3. git add .4. git commit -m “ODROID-U3 package group is added”

Setting up for Target Board (1/2)

Page 64: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

64

SKKU Embedded Software Lab.

5. Modify Repo Manifest File:1. $ cd ~/tizen-platform2. gedit ./.repo/manifests/profile-projects.xml

1. Add following red line.

Setting up for Target Board (2/2)

<?xml version="1.0" encoding="UTF-8"?><manifest> <project name="profile/mobile/model/config-emulator" path="profile/mobile/model/config-emulator" groups="profile"/> <project name="profile/mobile/model/config-rd-210" path="profile/mobile/model/config-rd-210" groups="profile"/> <project name="profile/mobile/model/config-rd-pq" path="profile/mobile/model/config-rd-pq" groups="profile"/> <project name="profile/mobile/model/config-odroid-u3" path="profile/mobile/model/config-odroid-u3" groups="profile" /></manifest>

Page 65: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

65

SKKU Embedded Software Lab.

1. Make a build script (build.sh)1. $ gedit build.sh

Building Total Platform Packages

#!/bin/bash# The list of packages to be excluded,# in order to prevent package dependency problem and reduce build time.skip_pkgs="bash,bzip2-libs,c-ares,cmake,coreutils,diffutils,eglibc,elfutils-libelf,elfutils-libs,elfutils,fdupes,file,findutils,gawk,gmp,libacl,libattr,libcap,libcurl,libfile,libgcc,liblua,libstdc++,make,mpc,mpfr,ncurses-libs,nodejs,nspr,nss-softokn-freebl,nss,openssl,patch,popt,rpm-libs,rpm-build,sed,sqlite,tar,xz-libs,binutils,gcc,filesystem,aul,libmm-sound,libtool,syspopup,notification,libva,libzypp-bindings,rpm"

gbs build -A armv7l --threads=2 --exclude=${skip_pkgs}

~/tizen-platform/build.sh

~/tizen-platform/build.sh

2. $ sudo chmod +x build.sh

2. Run the build script1. $ ./build.sh

Page 66: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

66

SKKU Embedded Software Lab.

• MIC makes images using Tizen packages.

Making Tizen Images (1/2)

– MIC downloads packages from download server, which do not exist in local repository.

• Requirements– Tizen packages

• in local• in download

server

– Kickstart file

Page 67: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

67

SKKU Embedded Software Lab.

1. Making Tizen Images1. $ cd ~/tizen-platform2. $ gbs createimage --ks-file=ODROID-U3.ks --tmpfs

• --ks-file=<path>: the path of kickstart file• --tmpfs: accelerates making image process through ramdisk

2. Results: <TIZEN-ROOT>/mic-output– RD-PQ-YYYYMMDDhhmm.tar.gz: Platform images

• platform.img, ums.img, data.img

– RD-PQ-YYYYMMDDhhmm.packages: List of packages included

– RD-PQ-YYYYMMDDhhmm.xml: Partition information– manifest.json: Manifest file

Making Tizen Images (2/2)

Page 68: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

68

SKKU Embedded Software Lab.

• Platform IDE provides the following advantages:– Download source code from git repository and

contribute changes– Create platform projects and commit changes and push

to git repository– Easily build platform module– Run and debug the platform module– Easily manage packages

Tizen Platform IDE

Page 69: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

69

SKKU Embedded Software Lab.

• Tizen Platform IDE is included in Tizen SDK.1. ./tizen-sdk-ubuntu32-v2.2.71.bin

Tizen Platform IDE: Install

2. Check below options.• Platform development• SDK development

Tools• Platform Rootstrap

Page 70: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

70

SKKU Embedded Software Lab.

• Set the Review Server’s Address– For accessing Tizen review server, you should set the

review server’s address.1. “Window Preferences Tizen SDK Platform Site

Configuration”2. “Add Configuration”3. Input the review server’s information as below figure.4. Press “OK”

Tizen Platform IDE: Git Configuration

Page 71: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

71

SKKU Embedded Software Lab.

• “File New Project Tizen Tizen Platform Project”– Choose one of the git repositories in Tizen review server.

Cloning Existing Tizen Repository

Page 72: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

72

SKKU Embedded Software Lab.

• SSL certification error is often occurred. In this case, follow below process.– $ wget

https://java-use-examples.googlecode.com/svn/trunk/src/com/aw/ad/util/InstallCert.java

– $ javac InstallCert.java– $ java InstallCert review.tizen.org

• Enter when ‘Enter certificate to add to trusted keystore or 'q' to quit: [1]’

– Copy jssecacerts into• /usr/lib/jvm/java-7-oracle/jre/lib/security/cacerts

– Click update again in site configuration then success

SSL Ceritification Error

Page 73: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

73

SKKU Embedded Software Lab.

Tizen IDE Platform Perspective

Page 74: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

74

SKKU Embedded Software Lab.

• Git Repository Checkout– Window Show View Others Git

Git Repositories– Create new branch (Checkout from

remote branch)• Branch Local Switch To New

Branch• Choose refs/remotes/origin/tizen_2.2• Finish

Checkout Repository

Page 75: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

75

SKKU Embedded Software Lab.

• Build Package– Choose target device from rootstrap view– Choose project and Build package

Building Tizen Platform Project

Page 76: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

76

SKKU Embedded Software Lab.

Appendix: Git and Repo Cheatsheet (1/2)

• Android developing document:• https://source.android.com/source/developing.html

Page 77: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

77

SKKU Embedded Software Lab.

Appendix: Git and Repo Cheatsheet (2/2)

Page 78: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

78

SKKU Embedded Software Lab.

• Problem– GBS can run on only English Ubuntu.– If you use Ubuntu in other language, GBS could not be

work.

• Solution– Run below commands before run GBS.

Appendix: Locale error in build phase

$ export LANGUAGE=en_US.UTF-8$ export LANG=en_US.UTF-8$ export LC_ALL=en_US.UTF-8$ locale-gen en_US.UTF-8$ dpkg-reconfigure locales

Page 79: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

79

SKKU Embedded Software Lab.

• When build error is occured, refer to the error log.

Appendix: GBS Trouble-shooting (1/2)

info: *** Build Status Summary ***=== the following packages failed to build due to rpmbuild issue (1) ===xf86-video-exynos: /home/user/GBS-ROOT/local/repos/tizen2.2/armv7l/logs/fail/xf86-video-exynos-1.0.0-1/log.txt

ExampleExample

[ 139s] error: db4 error(-30971) from dbenv->open: DB_VERSION_MISMATCH: Database environment version mismatch [ 139s] error: cannot open Packages index using db4 - (-30971)[ 139s] error: cannot open Packages database in /var/lib/rpm[ 139s] error: db4 error(-30971) from dbenv->open: DB_VERSION_MISMATCH: Database environment version mismatch [ 139s] error: cannot open Packages database in /var/lib/rpm

/home/user/GBS-ROOT/local/repos/tizen2.2/armv7l/

logs/fail/xf86-video-exynos-1.0.0-1/log.txt

/home/user/GBS-ROOT/local/repos/tizen2.2/armv7l/

logs/fail/xf86-video-exynos-1.0.0-1/log.txt

• You can find the problem on the error log.

Page 80: SKKU Embedded Software Lab. 75 1 SKKU Embedded Software Lab. Development Environment and Platform Build

SKKU Embedded Software Lab.

75

80

SKKU Embedded Software Lab.

• RPM DB4 error

Appendix: GBS Trouble-shooting (2/2)

[ 139s] error: db4 error(-30971) from dbenv->open: DB_VERSION_MISMATCH: Database environment version mismatch [ 139s] error: cannot open Packages index using db4 - (-30971)[ 139s] error: cannot open Packages database in /var/lib/rpm[ 139s] error: db4 error(-30971) from dbenv->open: DB_VERSION_MISMATCH: Database environment version mismatch [ 139s] error: cannot open Packages database in /var/lib/rpm

/home/user/GBS-ROOT/local/repos/tizen2.2/armv7l/

logs/fail/xf86-video-exynos-1.0.0-1/log.txt

/home/user/GBS-ROOT/local/repos/tizen2.2/armv7l/

logs/fail/xf86-video-exynos-1.0.0-1/log.txt

– Problem: temporary files in BUILD-ROOT are in conflict each other.

– Solution: Add ‘--clean’ flag on GBS.

gbs build -A armv7l --include-all --cleanbuild.shbuild.sh