790 likes | 802 Views
Learn about managing Tizen source code, building Tizen platform, and the development workflow. Explore Git, GBS, RPM, and MIC tools for efficient Tizen development.
E N D
Contents • Tizen Development Environment • Tizen Development Overview • Tizen Source Code Management • Installation • Building Tizen Platform • Tizen Platform IDE • Appendices • Trouble-shootings
1. Tizen Development Environment Tizen Development Overview Tizen Source Code Management Installation
Tizen Development Overview • 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 Workflow (2/3) • Local works by Developers • Setting up Tizen development environment • Cloning the source code • Changing and verifying local source code through local build • Review • Submission: Developer submits patches to review server for stakeholders to review • Verification: Tizen backend service and reviewers verify the patches through testing process and then vote based on the quality of the patches. • Approval and Merge: Maintainers approve the patches and then merge code changes to the review server’s repository.
Tizen Development Workflow (3/3) • Release • Tizen backend service activates pre-release and normal release processes at the same time. • Submission on OBS: Maintainers/Developers submit packages to the OBS by using gbs submit command. • Pre-release: Tizen images that incorporates specific packages are created and submitted to release engineers to review. • Final review: Release engineers accept or reject submissions based on the quality of the packages. Accepted source code is merged into the OBS repository. • Release: the normal release process takes over and publishes repos together with Tizen images.
SCM Tools (1/3): Git • 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 (2/3): Repo • 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 (3/3): GBS • 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)
Centralized SCM System • 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.
Packaging Tools: RPM and MIC • 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)
1. Tizen Development Environment Tizen Development Overview Tizen Source Code Management Installation
Tizen Source Code Workflow • Git: manages source code versions • GBS: builds source code of git repository → makes package file(RPM) • Install package file on ODROID-U3
Git: Key Concepts • 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.
Version Management (1/2) • Add a source code, ‘hello.cpp’ • Add hello.c to staging area • $ git add hello.c • Make a new version • $ git commit -m “commit message” • Add all of the source code • Add all of the source code • $ git add --all • Make a new version • $ git commit -m “commit message” • Display staging area’s status • $ git status
Version Management (2/2) • Display the commit log • $ git log • Each commit’s hash value, author information, date, message commit 783c82ff64eda9f03401834de906eca77d01f691 Author: Gyeonghwan Hong <redcarrottt@gmail.com> Date: Mon Sep 22 10:37:44 2014 +0900 2nd version commit: hello.c is added commit 712943bb31bf85430e1a027abe197e5b88a26110 Author: Gyeonghwan Hong <redcarrottt@gmail.com> Date: Thu Aug 28 12:08:17 2014 +0900 1st version commit: hello.h is added • Return to a previous version • git checkout <commit’s hash value> • ex. git checkout 712943bb31bf85430e1a027abe197e5b88a26110
Local & Remote Repository (1/2) • “Commit” • Make a new version on local repository • “Push” • Upload commits in local repository to remote repository • “Pull” • Download commits in remote repository to local repository
Local & Remote Repository (2/2) • Upload to remote repository • $ git push <remote name> <remote branch> • ex. $ git push origin master • Download from remote repository • $ git pull
Branch Management (1/3) • Check the branch list of localrepository • $ git branch --list • Check the branch list of remote repository • $ git branch --remote * master feature_x • Move to another branch • $ git checkout <branch name> • ex. $ git checkout feature_x
Branch Management (2/3) • Develop a new feature by making a new branch • Make a new branch ‘feature_x’ • $ git branch feature_x • $ git checkout feature_x • Edit and commit source code • Merge ‘feature_x’ branch to original branch • $ git checkout master • $ git merge feature_x
Branch Management (3/3) • 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. • $ git mergetool • http://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging
1. Tizen Development Environment Tizen Development Overview Tizen Source Code Management Installation
Tizen Dev. Environment Install (1/11) • Git: Install and Configuration • Install a git package. • $ sudo apt-get install git • Configure user information of git. • This information will be used for committer information. • $ git config --global user.name “Your name” • $ git config --global user.email email@address • ex. • $ git config --global user.name “Gyeonghwan Hong” • $ git config --global user.email redcarrottt@gmail.com
Tizen Dev. Environment Install (2/11) • Repo: Install and Configuration • Download repo. • $ sudo apt-get install curl • $ mkdir -p ~/bin • $ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo • $ chmod +x ~/bin/repo • Add repo’s path to the basic path list. • Edit ~/.bashrc • $ gedit ~/.bashrc • After adding below code to the last line, restart your shell. ~/.bashrc PATH=~/bin:${PATH}
Tizen Dev. Environment Install (3/11) /etc/apt/sources.list • GBS, MIC: Install • Add Tizen development tool repository to APT repository list. • $ sudo gedit /etc/apt/sources.list • Add below code • XX: Ubuntu’s major version (ex. 12, 13, 14) • YY: Ubuntu’s minor version(ex. 04, 10) deb http://download.tizen.org/tools/latest-release/Ubuntu_XX.YY / • $ sudo apt-get update • Install packages of GBS, MIC. • sudo apt-get install gbs mic
Tizen Dev. Environment Install (4/11) • You should have an access right to review server for accessing Tizen source code. • Register a Tizen developer ID • Go to developer.tizen.org/ko. • You can log in Tizen review server (review.tizen.org).
Tizen Dev. Environment Install (5/11) • Review Server: Configuration • $ gedit ~/.ssh/config • Enter your username. 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
Tizen Dev. Environment Install (6/11) • Review Server: Configuration (Cont’d) • Run “ssh-keygen” on a shell. • $ ssh-keygen • 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
Tizen Dev. Environment Install (7/11) • Review Server: Configuration (Cont’d) • After log in review.tizen.org, go to ‘settings’ menu. • Enter into “SSH Public Keys” menu →Press “Add Key …” button.
Tizen Dev. Environment Install (8/11) • Review Server: Configuration (Cont’d) • Display the contents of public key file. • $ cat ~/.ssh/id_rsa.pub • Copy the displayed text to below text box. Contents of ‘~/.ssh/id_rsa.pub’
Tizen Dev. Environment Install (9/11) • Review Server: Configuration (Cont’d) • Test ssh server connection • $ ssh tizen • $ ssh review.tizen.org • If the connection is successful, below message will be displayed.
Tizen Dev. Environment Install (10/11) • Tizen source code is built by pre-built toolchains. • Clone Pre-built Toolchain Packages • Clone ARM toolchain • $ git clone ssh://user@review.tizen.org:29418/pre-built/toolchain-arm pre-built/toolchain-arm • $ cd pre-built/toolchain-arm • $ git checkout origin/tizen_2.2 • $ cd - • Clone x86 toolchain • $ git clone ssh://user@review.tizen.org:29418/ pre-built/toolchain-x86 pre-built/toolchain-x86 • $ git pre-built/toolchain-x86 • $ git checkout origin/tizen_2.2 • $ cd -
Tizen Dev. Environment Install (11/11) • Make a GBS configuration file (~/.gbs.conf) • Without this file, Tizen source code cannot be built. • $ gedit ~/.gbs.conf [general] tmpdir=/var/tmp/ profile=profile.tizen2.2 work_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
How to Build and Apply Tizen Package • 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.
Building Single Tizen Package • Build time and package size are minimized.
Building Tizen Platform • Build time is too long and the size of packages is too large.
Required Files in Repository (1/2) • Tizen projectrepository requires following files • Red files are required at least. • 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>, …
Required Files in Repository (2/2) • ex. Remote Key Framework Service Project(Link) • 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
How to Clone Existing Repository (1/2) • Log in Tizen review server (review.tizen.org) • Enter into “Projects” → “List” • 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. • Clone the repository • $ git clone ssh://user@review.tizen.org:29418/project-name
How to Clone Existing Repository (2/2) • Tizen package repository has several branches by release version. • Check branches • $ git branch --remote • ex. origin/1.0_post origin/2.0alpha origin/HEAD -> origin/master origin/master origin/tizen_2.0 origin/tizen_2.1 origin/tizen_2.2 origin/tizen_2.3 • Change branch to target release version • $ git checkout <target branch> • ex. git checkout origin/tizen_2.2
How to Build Single Tizen Package (1/3) • Build the most recent version in Git repository • In default, GBS builds the source code of most recent version. • Move to the directory of repository. • $ gbs build -A armv7l • -A <architecture type>: x86, armv7l
How to Build Single Tizen Package (2/3) • Build the working directory • Use it in the case of building the source code in work. • Move to the directory of repository. • $ gbs build -A armv7l --include-all • --include-all: option for building working directory
How to Build Single Tizen Package (3/3) • 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 Install Tizen Package (1/2) • 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 (2/2) • Connect to ODROID-U3via USB • How to check connection: $ sdb devices • Caution: If you are using VMWare, check the connection of ‘removable device’ • Enter to SDB root mode • $ sdb root on • Send package file to target board through SDB • $ sdb push package_name-version.arch.rpm / • Install the package • $ sdb shell rpm -ivh --nodeps --force package_name-version.arch.rpm • Reboot your target board • $ adb shell sync; sdb shell reboot -f
Overview on Building Tizen Platform • Requirements • Total source code of Tizen • Profile for ODROID-U3 • Kickstart filefor 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