640 likes | 668 Views
Development Environment and Tizen v2.3 Platform Build. Contents. Tizen v2.3 Development Environment Tizen v2.3 Development Overview Installation Tizen Source Code Management Building Total Tizen v2.3 Platform Projects Building a Tizen v2.3 Platform Project Making Tizen v2.3 Platform Image.
E N D
Contents • Tizen v2.3 Development Environment • Tizen v2.3 Development Overview • Installation • Tizen Source Code Management • Building Total Tizen v2.3 Platform Projects • Building a Tizen v2.3 Platform Project • Making Tizen v2.3 Platform Image
1. Tizen v2.3 Development Environment Tizen v2.3 Development Overview Installation Tizen v2.3 Source Code Management
Tizen v2.3 Development Overview (1/2) • Hundreds of 'Open Source' Projects • Source code repository • Each project has its source code repository. • Developers can clone, edit and build its source code. • Git: source code management tool
Tizen v2.3 Development Overview (2/2) • Centralized Source Code Management • Tizen source code is reviewed and submitted on centralized review server. • http://review.tizen.org • GBS(Git Build System): a tool for centralized source code management • All the repositories are managed on Tizen servers; Gerrit and OBS.
Tizen v2.3 Development Workflow (1/3) • From local coding to final release
Tizen v2.3 Development Workflow (2/3) • Local works by Developers • It will be covered in “Section 1-C. Tizen Source Code Management”. • Setting up Tizen development environment • Cloning the source code • Changing and verifying local source code through local build • Submit & 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 v2.3 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 v2.3 Development Environment Tizen v2.3 Development Overview Installation Tizen v2.3 Source Code Management
Tizen v2.3 Dev. Environment Install (1/10) • We will cover an environment based on Ubuntu. • 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 v2.3 Dev. Environment Install (2/10) • 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 v2.3 Dev. Environment Install (3/10) /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 • Check your Ubuntu version. • $ cat /etc/issue deb http://download.tizen.org/tools/pre-release/Ubuntu_13.10 / • $ sudo apt-get update • Install packages of GBS, MIC. • $ sudo apt-get install gbs mic
Tizen v2.3 Dev. Environment Install (4/10) • 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 v2.3 Dev. Environment Install (5/10) • Review Server: Configuration • $ gedit ~/.ssh/config • Enter your Gerrit ID. Host tizen Hostname review.tizen.org IdentityFile ~/.ssh/id_rsa User GerritID Port 29418 Host review.tizen.org Hostname review.tizen.org IdentityFile ~/.ssh/id_rsa User GerritID Port 29418 ~/.ssh/config
Tizen v2.3 Dev. Environment Install (6/10) • Review Server: Configuration (Cont’d) • Run “ssh-keygen” on a shell. • $ ssh-keygen • Press just enter about every question for using default values. • Finally, id_rsa, id_rsa.pub files will be created. • id_rsa: private key • id_rsa.pub: public key
Tizen v2.3 Dev. Environment Install (7/10) • 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 v2.3 Dev. Environment Install (8/10) • 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 v2.3 Dev. Environment Install (9/10) • 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 v2.3 Dev. Environment Install (10/10) • Make a GBS configuration file (~/.gbs.conf) • Without this file, Tizen source code cannot be built. • $ gedit ~/.gbs.conf • Check whether repo.tizen2.3 is vaild or not. Repository’s URL can be changed if new version of Tizen is released. [general] tmpdir=/var/tmp/ profile=profile.tizen2.3 [repo.tizen2.3] url=http://download.tizen.org/releases/2.3/2.3-mobile/tizen-2.3-mobile_20150311.3/repos/target/packages [profile.tizen2.3] repos=repo.tizen2.3
1. Tizen v2.3 Development Environment Tizen v2.3 Development Overview Installation Tizen v2.3 Source Code Management
Tizen v2.3 Local Work Flow • All Process before submission • Git: manages source code versions • GBS: builds source code of git repository → makes package file(RPM) • Install package file on target board
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(SHA-1).
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. Return to “1st version commit”$ 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 <remote name> <remote branch> • ex. $ git pull origin master
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 • You should commit all the local change before checkout. If not, it makes an error. • If you want to checkout without making a new commit, use flag “-f”. • $ git checkout -f <branch name>
Branch Management (2/3) • Develop a new feature by making a new branch • Make a new branch ‘feature_x’ • $ git branch feature_x • Checkout to the new branch • $ git branch feature_x • Edit and commit source code • Merge the ‘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
Cloning Total Source Code of Tizen • Make and move to Tizen source code directory • $ mkdir tizen-platform; cd tizen-platform • Set the path of download server. • $ repo init -u https://github.com/SKKU-ESLAB-Tizen/tizen-manifest-2.3-mobile • Clone source code(Using 8 threads) • $ repo sync -j8
Edit GBS Configuration • No download server URL in GBSconfiguration file. • $ gedit ~/tizen-platform/.gbs.conf [general] tmpdir=/var/tmp/ profile=profile.tizen2.3 work_dir=/home/user [repo.tizen2.3.mobile] url=http://download.tizen.org/releases/2.3/2.3-mobile/tizen-2.3-mobile_20150206.1/repos/target/packages [profile.tizen2.3] repos=repo.tizen2.3.mobile
Building Total Platform Packages • Make a build script (build.sh) • $ gedit build.sh ~/tizen-platform/build.sh #!/bin/bash # The list of packages to be excluded, # in order to prevent package dependency problem and reduce build time. export 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,web-ui-fw,python-doc,rpm,perl“ gbs build -A armv7l --threads=8 --clean-once --include-all --exclude=${skip_pkgs} • $ sudochmod +x build.sh • Run the build script • $ ./build.sh
Tizen v2.3 Platform Project Build Process (1/2) • Assume that Tizen v2.3 is running on target board • Example: build and install package A
Tizen v2.3 Platform Project Build Process (2/2) • Clone the Source Code of a Tizen Project • Download source code of a Tizen project from Tizen review server. • Build the Tizen Project • Build the source code of the project with GBS, and make package files(*.rpm). • Install the Packages • Install the package files(*.rpm) to the target board with SDB.
Required Files in Repository (1/2) • Tizen v2.3 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
Clone the Source Code of Tizen v2.3 Project (1/2) • Log in Tizen review server (review.tizen.org) • Enter into “Projects” → “List” • Find a repository that you want to clone • Caution: Packages in Tizen 2.3 and 3.0 are managed in different way, so multiple packages will be displayed on the result. • Clone the repository • $ git clone ssh://username@review.tizen.org:29418/project-name
Clone the Source Code of Tizen v2.3 Project (2/2) • Tizenproject source code 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.3
Build the Tizen v2.3 Project (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>: i586, x86_64, armv7l
Build the Tizen v2.3 Project (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
Build the Tizen v2.3 Project (3/3) • GBS downloads dependent packages from Tizen download server on demand. • ex. wrt(Web Runtime) package depends on ewebkit2(WebKitEFL) package, so ewebkit2 is downloaded when building wrt. • 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(Package Files; *.rpm) • The name of package file is dependent on the project’s RPM spec. • Typically package file is named as ‘package_name-version.arch.rpm’. • ex. remote-key-framework-1.2.1.armv7l.rpm • Located in: ~/GBS-ROOT/local/repos/tizen2.3/armv7l/RPMS/
Install the Packages (1/2) • Install package files(*.rpm) on target board • Send package files to target board through SDB • Install the packages by RPM tool
Install the Packages (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 file> / • Install the package • $ sdb shell rpm -ivh --nodeps --force <package file> • Reboot your target board • $ sdb shell sync; sdb shell reboot -f