tizen project guideline · 1. clone existing tizen repository – if you have already a repository,...
TRANSCRIPT
SKKU Embedded Software Lab.
47
1
SKKU Embedded Software Lab.
Tizen Project Guideline
SKKU Embedded Software Lab.
47
2
SKKU Embedded Software Lab.
• Assume that you have done flashing Tizen images.
1. Preparation
– Install Tizen Development Environments
2. Github
1. Sign in Github
2. Make an Organization and a Repository
3. Upload Initial Source Code
3. Tizen Source Code Workflow
1. Version & Branch Management
2. Package Build
3. Package Install
Tizen Project Process
SKKU Embedded Software Lab.
47
3
SKKU Embedded Software Lab.
• Install Tizen Development Environments
1. Preparation
SKKU Embedded Software Lab.
47
4
SKKU Embedded Software Lab.
• Source Code Management(SCM) Tools
– Git, Repo, Gerrit
• Build Tool
– GBS(Git Build System)
• Packaging Tools
– MIC, RPM
Tizen Development Environment
Tizen Servers ODROID-U3Host PC
Kernel Image
Make & Flash Images
Build
Kernel Source Code
Platform Source Code
Object File
Packages Platform ImagesClone Source Code
Kernel Source Code
Platform Source Code
(Git, Repo, Gerrit) (GBS) (MIC, RPM)
SKKU Embedded Software Lab.
47
5
SKKU Embedded Software Lab.
Tizen Dev. Environment Install (1/11)
1. Git: Install and Configuration
1. 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]
SKKU Embedded Software Lab.
47
6
SKKU Embedded Software Lab.
Tizen Dev. Environment Install (2/11)
PATH=~/bin:${PATH}
~/.bashrc
2. Repo: Install and Configuration
1. Download repo.
1. $ sudo apt-get install curl
2. $ mkdir -p ~/bin
3. $ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
4. $ chmod +x ~/bin/repo
2. Add repo‟s path to the basic path list.
1. Edit ~/.bashrc
1. $ gedit ~/.bashrc
2. After adding below code to the last line, restart your shell.
SKKU Embedded Software Lab.
47
7
SKKU Embedded Software Lab.
3. GBS, MIC: Install
1. Add Tizen development tool repository to APT repository list.
1. $ sudo gedit /etc/apt/sources.list
2. Add below code
1. 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
3. $ sudo apt-get update
2. Install packages of GBS, MIC.
1. sudo apt-get install gbs mic
SKKU Embedded Software Lab.
47
8
SKKU Embedded Software Lab.
• You should have an access right to review server for accessing Tizen source code.
4. Register a Tizen developer ID
1. Go to developer.tizen.org/ko.
Tizen Dev. Environment Install (4/11)
2. You can log in Tizen review server (review.tizen.org).
SKKU Embedded Software Lab.
47
9
SKKU Embedded Software Lab.
5. Review Server: Configuration
1. $ 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
SKKU Embedded Software Lab.
47
10
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
SKKU Embedded Software Lab.
47
11
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.
SKKU Embedded Software Lab.
47
12
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‟
SKKU Embedded Software Lab.
47
13
SKKU Embedded Software Lab.
5. Review Server: Configuration (Cont‟d)
7. Test ssh server connection
1. $ ssh tizen
2. $ ssh review.tizen.org
• If the connection is successful, below message will be displayed.
Tizen Dev. Environment Install (9/11)
SKKU Embedded Software Lab.
47
14
SKKU Embedded Software Lab.
• Tizen source code is built by pre-built toolchains.
6. Clone Pre-built Toolchain Packages
1. Clone ARM toolchain
1. $ git clone ssh://[email protected]:29418/pre-built/toolchain-arm pre-built/toolchain-arm
2. $ cd pre-built/toolchain-arm
3. $ git checkout origin/tizen_2.2
4. $ cd -
2. Clone x86 toolchain
1. $ git clone ssh://[email protected]:29418/ pre-built/toolchain-x86 pre-built/toolchain-x86
2. $ git pre-built/toolchain-x86
3. $ git checkout origin/tizen_2.2
4. $ cd -
Tizen Dev. Environment Install (10/11)
SKKU Embedded Software Lab.
47
15
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.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
SKKU Embedded Software Lab.
47
16
SKKU Embedded Software Lab.
1. Sign in Github
2. Make a New Organization and Repository
3. Upload Initial Source Code
2. Github
SKKU Embedded Software Lab.
47
17
SKKU Embedded Software Lab.
1. Go to http://www.github.com and Sign in.
Sign in Github
SKKU Embedded Software Lab.
47
18
SKKU Embedded Software Lab.
Create an Organization on Github (1/3)
• Create one organization by a team on Github.
1. Press “+” button → Click “New organization”.
SKKU Embedded Software Lab.
47
19
SKKU Embedded Software Lab.
Create an Organization on Github (2/3)
2. Input organization name and billing email address.
– Billing email: In the case of private repository, bill will be sent to the address. It will not used in the case of open source repository.
3. Click “Create organization” button.
SKKU Embedded Software Lab.
47
20
SKKU Embedded Software Lab.
Create an Organization on Github (3/3)
4. Register IDs of team members.
5. Click “Finish” button.
SKKU Embedded Software Lab.
47
21
SKKU Embedded Software Lab.
Create a Repository on Gitbub (1/2)
• Make a repository belonged to organization
1. Press “+” button → Click “New repository” of „this organization‟.
SKKU Embedded Software Lab.
47
22
SKKU Embedded Software Lab.
2. Input Repository name and specific information.
Create a Repository on Gitbub (2/2)
SKKU Embedded Software Lab.
47
23
SKKU Embedded Software Lab.
• Initial source code should be uploaded.
• Case 1. Make a New Git Repository
– In case that there are no contents at all.
– In case that there is no “.git” directory in working directory.
• Case 2. Use a Existing Git Repository
– In case that there is “.git” directory in working directory.
– In case that you modify existing Tizen platform source code.
Upload Initial Source Code (1/7)
SKKU Embedded Software Lab.
47
24
SKKU Embedded Software Lab.
Case 1. Make a New Git Repository
1. Make a new Git repository
1. Move to working directory.
2. $ git init
2. Do initial commit
1. $ touch README.md
2. $ git add README.md
3. $ git commit -m “initial commit”
Upload Initial Source Code (2/7)
SKKU Embedded Software Lab.
47
25
SKKU Embedded Software Lab.
Case 1. Make a New Git Repository
3. Register Github server‟s address
3. $ git remote add origin https://github.com/organization/project-name.git
• ex. $ git remote add origin https://github.com/SKKU-ESLAB-Tizen/remote-key-framework-service.git
4. Upload code to Git repository
1. $ git push origin master
– „master‟ branch in local repository is uploaded to „master‟ branch in remote repository.
5. Result
– A new repository with only README.md will be created.
Upload Initial Source Code (3/7)
SKKU Embedded Software Lab.
47
26
SKKU Embedded Software Lab.
Case 2. Use a Existing Git Repository
1. Clone existing Tizen repository
– If you have already a repository, skip this process.
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.
Upload Initial Source Code (4/7)
4. Clone the repository
1. $ git clone ssh://[email protected]:29418/project-name
SKKU Embedded Software Lab.
47
27
SKKU Embedded Software Lab.
Upload Initial Source Code (5/7)
Case 2. Use a Existing Git Repository
1. Clone existing Tizen repository (Cont‟d)
– Tizen package repository has several branches by release version.
5. Check branches
1. $ 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
6. Change branch to target release version
1. $ git checkout <target branch>
– ex. git checkout origin/tizen_2.2
SKKU Embedded Software Lab.
47
28
SKKU Embedded Software Lab.
Case 2. Use a Existing Git Repository
2. Register Github server‟s address
1. Move to working directory.
2. $ git remote add origin https://github.com/organization/project-name.git
• ex. $ git remote add origin https://github.com/SKKU-ESLAB-Tizen/remote-key-framework-service.git
3. Upload to Git repository
1. $ git push origin master
• „master‟ branch in local repository will be uploaded to „master‟ branch in remote repository.
Upload Initial Source Code (6/7)
SKKU Embedded Software Lab.
47
29
SKKU Embedded Software Lab.
Case 2. Use a Existing Git Repository
4. Result
– Existing Git repository is uploaded to Github repository.
– Existing commit log, branch information are preserved.
Upload Initial Source Code (7/7)
SKKU Embedded Software Lab.
47
30
SKKU Embedded Software Lab.
1. Run following command
1. $ git clone https://github.com/organization/project-name.git
– ex. $ git clone https://github.com/SKKU-ESLAB-Tizen/remote-key-framework-service.git
Clone Github Repository
SKKU Embedded Software Lab.
47
31
SKKU Embedded Software Lab.
1. Version & Branch Management
2. Package Build
3. Package Install
3. Repository Management and Package Build/Install
SKKU Embedded Software Lab.
47
32
SKKU Embedded Software Lab.
1. Git: manages source code versions
2. 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.1
hello.h
Ver.2
hello.c hello.h
Github Server (Remote)
(Remote) Repository
Ver.1
hello.h
Ver.2
hello.c hello.h
Pull
Push
Commit
Add
gbs build Package file
(rpm)
Install
ODROID-U3
SKKU Embedded Software Lab.
47
33
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.1
hello.h
Ver.2
hello.c hello.h
Commit
Add
SKKU Embedded Software Lab.
47
34
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 version
1. $ git commit -m “commit message”
• Add all of the source code
1. Add all of the source code
1. $ git add --all
2. Make a new version
1. $ git commit -m “commit message”
• Display staging area‟s status
1. $ git status
Version Management (1/2)
Working Directory
hello.c hello.h
(Local) Repository
Staging Area
Ver.1
hello.h
Ver.2
hello.c hello.h
Commit
Add
SKKU Embedded Software Lab.
47
35
SKKU Embedded Software Lab.
• Display the commit log
1. $ git log
– Each commit‟s hash value, author information, date, message
Version Management (2/2)
commit 783c82ff64eda9f03401834de906eca77d01f691 Author: Gyeonghwan Hong <[email protected]> Date: Mon Sep 22 10:37:44 2014 +0900 2nd version commit: hello.c is added commit 712943bb31bf85430e1a027abe197e5b88a26110 Author: Gyeonghwan Hong <[email protected]> Date: Thu Aug 28 12:08:17 2014 +0900 1st version commit: hello.h is added
• Return to a previous version 1. git checkout <commit’s hash value>
Working Directory
hello.c hello.h
(Local) Repository
Staging Area
Ver.1
hello.h
Ver.2
hello.c hello.h
Commit
Add
– ex. git checkout 712943bb31bf85430e1a027abe197e5b88a26110
SKKU Embedded Software Lab.
47
36
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.1
hello.h
Ver.2
hello.c hello.h
Github Server (Remote)
(Remote) Repository
Ver.1
hello.h
Ver.2
hello.c hello.h
Pull
Push
Commit
Add
SKKU Embedded Software Lab.
47
37
SKKU Embedded Software Lab.
• Upload to remote repository
1. $ 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.1
hello.h
Ver.2
hello.c hello.h
Github Server (Remote)
(Remote) Repository
Ver.1
hello.h
Ver.2
hello.c hello.h
Pull
Push
Commit
Add
• Download from remote repository
1. $ git pull
SKKU Embedded Software Lab.
47
38
SKKU Embedded Software Lab.
• Check the branch list of local repository
1. $ git branch --list
• Check the branch list of remote repository
1. $ git branch --remote
Branch Management (1/3)
* master feature_x
• Move to another branch 1. $ git checkout <branch name>
– ex. $ git checkout feature_x
SKKU Embedded Software Lab.
47
39
SKKU Embedded Software Lab.
• Develop a new feature by making a new branch
1. Make a new branch „feature_x‟
1. $ git branch feature_x
2. $ git checkout feature_x
2. Edit and commit source code
3. Merge „feature_x‟ branch to original branch
1. $ git checkout master
2. $ git merge feature_x
Branch Management (2/3)
SKKU Embedded Software Lab.
47
40
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)
SKKU Embedded Software Lab.
47
41
SKKU Embedded Software Lab.
• Tizen project repository requires following files
– Red files are files 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>, …
SKKU Embedded Software Lab.
47
42
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
SKKU Embedded Software Lab.
47
43
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.1
hello.h
Ver.2
hello.c hello.h
Commit
Add
gbs build Package file
(rpm)
SKKU Embedded Software Lab.
47
44
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.1
hello.h
Ver.2
hello.c hello.h
Commit
Add
gbs build Package file
(rpm)
SKKU Embedded Software Lab.
47
45
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)
SKKU Embedded Software Lab.
47
46
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.1
hello.h
Ver.2
hello.c hello.h
Commit
Add
gbs build Package file
(rpm)
Package file
(rpm)gbs build
--include-all
Install
Install
ODROID-U3
SKKU Embedded Software Lab.
47
47
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 mode 1. $ sdb root on
3. Send package file to target board through SDB 1. $ sdb push package_name-version.arch.rpm /
4. Install the package 1. $ sdb shell rpm -ivh --nodeps --force package_name-
version.arch.rpm
5. Reboot your target board 1. $ adb shell sync; sdb shell reboot -f
How to Install Tizen Package (2/2)