tizen platform practice part 3....
TRANSCRIPT
SKKU Embedded Software Lab.
85
2
SKKU Embedded Software Lab.
• Part 1. Overview– Tizen Platform & Kernel Overview
– Development System Overview
– Appendix: Tizen Source Code Management
• Part 2. Setting– Tizen Development System Setting
– Tizen SD-card Setting
• Part 3. Project– Building a Tizen Platform Project
– Example Tizen Projects
– Remote Key Framework
– Appendix: Hello Tizen Service
– Appendix: Tizen Project FAQ
Contents
SKKU Embedded Software Lab.
85
3
SKKU Embedded Software Lab.
Part 3-A. Building a Tizen Platform Project
SKKU Embedded Software Lab.
85
4
SKKU Embedded Software Lab.
• Assume that Tizen is running on target board
• Example: build and install package A
Tizen Platform Project Build Process (1/2)
SKKU Embedded Software Lab.
85
5
SKKU Embedded Software Lab.
1. Clone the Source Code of a Tizen Project
– Download source code of a Tizen project from Tizen review server.
2. Build the Tizen Project
– Build the source code of the project with GBS, and make package files(*.rpm).
3. Install the Packages
– Install the package files(*.rpm) to the target board with SDB.
Tizen Platform Project Build Process (2/2)
SKKU Embedded Software Lab.
85
6
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>, …
SKKU Embedded Software Lab.
85
7
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.
85
8
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
– Caution: Packages in Tizen 2.3 and 3.0 are managed in different way, so multiple packages will be displayed on the result.
4. Clone the repository
1. $ git clone ssh://[email protected]:29418/project-name
Clone the Source Code of Tizen Project (1/2)
SKKU Embedded Software Lab.
85
9
SKKU Embedded Software Lab.
Clone the Source Code of Tizen Project (2/2)
• Tizen project source code has several branches by release version.
5. Check branches
1. $ 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 version
1. $ git checkout <target branch>
• ex. git checkout origin/tizen_2.3
SKKU Embedded Software Lab.
85
10
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>: i586, x86_64, armv7l
Build the Tizen Project (1/3)
SKKU Embedded Software Lab.
85
11
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
Build the Tizen Project (2/3)
SKKU Embedded Software Lab.
85
12
SKKU Embedded Software Lab.
• GBS downloads dependent packages from Tizendownload 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/
Build the Tizen Project (3/3)
SKKU Embedded Software Lab.
85
13
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
Install the Packages (1/2)
SKKU Embedded Software Lab.
85
14
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 file> /
4. Install the package1. $ sdb shell rpm -ivh --nodeps --force <package file>
5. Reboot your target board1. $ sdb shell sync; sdb shell reboot -f
Install the Packages (2/2)
SKKU Embedded Software Lab.
85
15
SKKU Embedded Software Lab.
Part 3-B. Example Tizen Projects
More Projects: https://wiki.tizen.org/wiki/Tizen_Lecture_Materials/Sungkyunkwan_University_2014
SKKU Embedded Software Lab.
85
16
SKKU Embedded Software Lab.
Project 1: Remote Sensor Framework
• Remote Sensor Virtualization
– Remote sensor를 internal sensor로 가상화
– Sensor Framework 수정 (Tizen 2.2)
– Sensor 플러그인과 sensor 서버 사이에 middle layer 생성
– Need to understand sensor framework
Github repository: https://github.com/sensor-virtualization
SKKU Embedded Software Lab.
85
17
SKKU Embedded Software Lab.
Project 2: Remote Camera Framework
• Remote Camera Virtualization
– Remote camera를 가상화
– Remote camera를 연결하고 제어하는 API 제공
– App에서는 remote camera data(사진)를 파일 형태로 read 가능.
– Need to understand multimedia framework
Github repository: https://github.com/SKKU-Tizen-Remote-Camera
SKKU Embedded Software Lab.
85
18
SKKU Embedded Software Lab.
Project 3: App Relay
• Seamless Cross-device Application
– Application의 작업을 seamless 하게 전달 가능한 service 구현
– Music player application 수정
• 음악 재생 작업을 옮길 수 있는 seamless music player application 구현
– Need to understand network framework
Github repository: https://github.com/hj7jeon/app-relay-framework.git
SKKU Embedded Software Lab.
85
19
SKKU Embedded Software Lab.
Project 4: App Prefetch
• Prefetch application data for fast application launch
– Profiling system calls in VFS
– Register profile results at App Info. DB
– AUL daemon prefetches data
– Need to understand application framework
19
SKKU Embedded Software Lab.
85
20
SKKU Embedded Software Lab.
Project 5: Chameleon Display
• Change the display color according to the weather condition
– Get temperature and humidity information from Oduino device
• Develop sensor plug-in for Oduino humidity and temperature sensor
– Adjust display color
– Need to understand on UI & graphics framework
20
SKKU Embedded Software Lab.
85
21
SKKU Embedded Software Lab.
Project 6: Battery Usage Info.
• Tizen has no service on Per-app battery usage information
– Profile runtime, CPU time and I/O time (storage, network)
– Service daemon collects power consumption information from system server, devman(device manager) and power manager
– Need to understand the interface between platform and kernel (device manager service, HAL, etc.)
21
SKKU Embedded Software Lab.
85
23
SKKU Embedded Software Lab.
1. Install Tizen development environment.
– Already covered in 1st day
1. Install git, repo, gbs and mic.
2. Register Tizen developer ID.
3. Do review server configuration.
4. Make GBS configuration file. (~/.gbs.conf)
2. Kernel source code
– Required for building virtual key kernel module
3. Resolve troubles of Tizen on ODROID-U3.
– Already covered in last week
Prerequisites
SKKU Embedded Software Lab.
85
24
SKKU Embedded Software Lab.
• No home key, back key and menu key in ODROID-U3 & ODROID-VU.
Motivation
?
SKKU Embedded Software Lab.
85
25
SKKU Embedded Software Lab.
• A framework to control Tizen device through remote Android smartphones.
Concept
SKKU Embedded Software Lab.
85
26
SKKU Embedded Software Lab.
• Wireless connection between Android device andTizen device
– Bluetooth and RFCOMM protocols
– Bluetooth frameworks in Tizen and Android
• Virtual key input event on Tizen device
– Virtual input device driver is required
• Background process
– Register a Tizen service on Systemd
Requirements
SKKU Embedded Software Lab.
85
27
SKKU Embedded Software Lab.
ODROID-U3 (Tizen)
Kernel
Framework
Android Phone
Client Application
Server Service
Message
Bluetooth/RFCOMM
Virtual Input Device Driver
Applications
X11 & EFLFramework
Kernelevdev
• Virtual Input Device Driver (Kernel Module)
– If a command come from service, it creates an input event.
• Server Service (Tizen Framework Service)
– Connection with Android device via Bluetooth
• Client (Android Application)
– UI and connection with Tizen device via Bluetooth
Design
SKKU Embedded Software Lab.
85
28
SKKU Embedded Software Lab.
1. Download Source Code
– 아래 사이트에 들어가서 “Download ZIP”으로 소스 코드 다운로드 VM으로 복사 압축 풀기
1. https://github.com/SKKU-ESLAB-Tizen/virtual_inputdevice
2. https://github.com/SKKU-ESLAB-Tizen/remote-key-framework-service
3. https://github.com/SKKU-ESLAB-Tizen/remote-key-framework-client
Download Source Code
SKKU Embedded Software Lab.
85
29
SKKU Embedded Software Lab.
• Host driver
– Connected to evdev(event device driver)
– In this project, make a new host driver for making virtual key events.
• evdev
– Sends events to udev
• udev
– Sends device events to xinput
• xinput (in X server)
– Sends events to X clients
Virtual Input Device Driver
SKKU Embedded Software Lab.
85
30
SKKU Embedded Software Lab.
• Receive commands from Server Service
• Make key input events via evdev
• Those events will be delivered to apps.
– virtual input device driver → evdev → xinput(in X server) → EFL→ Application
Virtual Input Device Driver
ODROID-U3 (Tizen)
Kernel
Framework
Android Phone
Client Application
Server Service
Message
Bluetooth/RFCOMM
Virtual Input Device Driver
Applications
X11 & EFLFramework
Kernelevdev
SKKU Embedded Software Lab.
85
31
SKKU Embedded Software Lab.
1. Initialize device driver
– homekey_init()
– Register input device on evdev
– sysfs에 entry 등록
• (/sys/bus/platform/devices/homekey/coordinates)
2. Handling sysfs entry events
– Server service가 sysfs entry file에 대한 write command 수행
– sysfs entry file에 대한 write command가 device driver의homekey_click() 함수 호출
Virtual Input Device Driver: Order
SKKU Embedded Software Lab.
85
32
SKKU Embedded Software Lab.
• Source Code 원본 위치– https://github.com/SKKU-ESLAB-Tizen/virtual_inputdevice
• Source Code Files
Virtual Input Device Driver
• virtual_homekey.c• Main source code
• load-virtual-homekey.service• Systemd service description file
• Makefile• Makefile for building kernel module
• build.sh• Build Script
• Xmodmap• Xinput keymap file
SKKU Embedded Software Lab.
85
33
SKKU Embedded Software Lab.
• Edit virtual_homekey.c
– $ cd virtual_inputdevice
– $ gedit virtual_homekey.c
Virtual Input Device Driver
• static ssize_t homekey_click()• Make an input event
• static struct attribute *homekey_attrs[]• sysfs attribute entry
(/sys/bus/platform/devices/homekey/coordinates)• static struct attribute_group homekey_attr_group
• sysfs group entry(/sys/bus/platform/devices/homekey/)
• static int __init homekey_init()• Initialize device driver
• static void __exit homekey_exit()• Unregister the input device and remove sysfs entry
SKKU Embedded Software Lab.
85
34
SKKU Embedded Software Lab.
• homekey_init()
– Initialize device driver
virtual_homekey.c
Register a platform device
Register a sysfs entry
Allocate an input device data structure
Set an keymap entry
Register an input device to evdev
SKKU Embedded Software Lab.
85
35
SKKU Embedded Software Lab.
• “coordinate” entry file
– registered on sysfs
– calls homekey_click() function
virtual_homekey.c
/sys/bus/platform/devices/homekey/coordinates
/sys/bus/platform/devices/homekey
SKKU Embedded Software Lab.
85
36
SKKU Embedded Software Lab.
• homekey_click()
– Make and synchronize an input event
– 남는 keycode 값을 담은 input event을 발생시킴
• KEY_XFER, KEY_PROG1, KEY_PROG2
virtual_homekey.c
Make an virtual input event
Synchronize the input event
SKKU Embedded Software Lab.
85
37
SKKU Embedded Software Lab.
• homekey_exit()
– Unregister the input device and remove sysfs entry
virtual_homekey.c
Unregister the input device from evdev
Unregister the platform device
Remove the homekey entry from sysfs
• Set module init & exit functions
SKKU Embedded Software Lab.
85
38
SKKU Embedded Software Lab.
• Makefile
Virtual Input Device Driver
Cross compiler path
Kernel path
• Build– Input cross compiler & kernel path
– $ ./build.sh
Build kernel module
SKKU Embedded Software Lab.
85
39
SKKU Embedded Software Lab.
• Install
– At first, connect your ODROID target to host PC.
– Ensure SDB connection
• $ sdb devices
– Turn on root mode
• $ sdb root on
– Push kernel module & service file
• $ sdb push virtual_homekey.ko /data/
• $ sdb push load-virtual-homekey.service /usr/lib/systemd/system
Virtual Input Device Driver
SKKU Embedded Software Lab.
85
40
SKKU Embedded Software Lab.
• Install (Cont’d)
– Make ‘load-virtual-homekey’ service run on boot
• $ sdb shell ln -s /usr/lib/systemd/system/load-virtual-homekey.service /usr/lib/systemd/system/graphical.target.wants/
– Reboot ODROID target
• $ sync
• $ reboot -f
Virtual Input Device Driver
SKKU Embedded Software Lab.
85
41
SKKU Embedded Software Lab.
• Xmodmap
– Kernel input event X input event map 설정하는 유틸리티
– Virtual input event와 Tizen의 home, back, menu key와 연결 시 필요
– Tizen의 “x11-xserver-utils” 프로젝트에 포함되어 있으나, 2.3부터는 기본적으로 빌드되지 않도록 바뀜
1. x11-xserver-utils 다운로드1. $ git clone
https://review.tizen.org/git/framework/uifw/xorg/util/x11-xserver-utils
Xmodmap (1/5)
SKKU Embedded Software Lab.
85
42
SKKU Embedded Software Lab.
2. Xmodmap를 빌드 대상에 포함하도록 변경1. $ cd x11-xserver-utils
2. $ vi packaging/xorg-x11-xserver-utils.spec
• 빨간색 글씨 부분 추가
Xmodmap (2/5)
# Line 45%define DEF_SUBDIRS xkill xrandr xrdb xset xmodmap
# Line 139%{_libdir}/systemd/user/core-efl.target.wants/xrdb.service%{_bindir}/xmodmap
SKKU Embedded Software Lab.
85
43
SKKU Embedded Software Lab.
3. 빌드 및 설치1. $ gbs build -A armv7l --include-all
2. $ cd ~/GBS-ROOT/local/repos/tizen2.3/armv7l/RPMS/
3. $ sdb push xorg-x11-server-utils-7.5.1-12.armv7l.rpm /
4. $ sdb shell rpm -ivh --nodeps --force /xorg-x11-server-utils-7.5.1-12.armv7l.rpm
Xmodmap (3/5)
SKKU Embedded Software Lab.
85
44
SKKU Embedded Software Lab.
• Configuration file
– Virtual input event와 Tizen의 home, back, menu key와 연결
– KEY_XFER(=155) → home key(XF86Send)
– KEY_PROG1(=156) → back key(XF86Phone)
– KEY_PROG2 (=157)→ menu key(XF86Stop)
Xmodmap (4/5)
SKKU Embedded Software Lab.
85
45
SKKU Embedded Software Lab.
4. Install configuration file
1. $ sdb root on
2. $ sdb push ./Xmodmap /etc/X11/Xmodmap
3. $ sdb shell sync
5. Reboot target device
1. $ sdb reboot -f
Xmodmap (5/5)
SKKU Embedded Software Lab.
85
46
SKKU Embedded Software Lab.
• SDB 내에서 아래 명령을 실행하면 키 동작이 일어남– Menu key
• $ echo 1 > /sys/bus/platform/devices/homekey/coordinates
– Home key
• $ echo 11 > /sys/bus/platform/devices/homekey/coordinates
– Back key
• $ echo 111 > /sys/bus/platform/devices/homekey/coordinates
Virtual Key Event Test
SKKU Embedded Software Lab.
85
47
SKKU Embedded Software Lab.
• Source Code 원본 위치– https://github.com/SKKU-ESLAB-Tizen/remote-key-framework-
service
• Source Code Files
Server Service
• CMakeLists.txt: cmake configuration file about this directory’s build• packaging
• remote-key-framework.spec: RPM package specification file• remote-key-framework.service: systemd service description file
• server• CMakeLists.txt: cmake configuration file about this directory’s build• include• src
• main.cpp: Main source code
SKKU Embedded Software Lab.
85
48
SKKU Embedded Software Lab.
• Android phone의 client app으로부터 Bluetooth 메시지 전송 받음– Bluetooth 연결 유지 역할도 담당해야 함
• Virtual input device driver의 sysfs entry file에 명령을 내림
Server Service
ODROID-U3 (Tizen)
Kernel
Framework
Android Phone
Client Application
Server Service
Message
Bluetooth/RFCOMM
Virtual Input Device Driver
Applications
X11 & EFLFramework
Kernelevdev
SKKU Embedded Software Lab.
85
49
SKKU Embedded Software Lab.
1. Initialization
– rkf_initialize_bluetooth()
– Bluetooth 장치를 초기화하고 event handler 설정
2. Listening Connection
– rkf_listen_connection() & rkf_finalize_bluetooth()
– target device가 Bluetooth로 연결되기를 기다림
3. Handling Bluetooth Events
– Glib main loop이 동작하며 Bluetooth event 받음
– Received data event, Socket connection status changed event, Bluetooth State changed event, …
Server Service: 작동 순서
SKKU Embedded Software Lab.
85
50
SKKU Embedded Software Lab.
• server/src/main.cpp
– Main source code of the service
– Glib event loop handles Bluetooth events
Server Service
• rkf_initialize_bluetooth()• Initialize Bluetooth adapter and set event handlers
• rkf_finalize_bluetooth_socket() & rkf_finalize_bluetooth()• Cleanup Bluetooth connection
• rkf_listen_connection()• Wait until target device is connected through Bluetooth
• Handles Bluetooth events• rkf_received_data_cb()• rkf_socket_connection_state_changed_cb()• rkf_state_changed_cb()• timeout_func_cb()
• main()• Main function, calls initialization routine and event loop
SKKU Embedded Software Lab.
85
51
SKKU Embedded Software Lab.
• main()
– Calls initialization routine and event loop
server/src/main.cpp
Initialize glib main loop
Initialize Bluetooth adapter and set event handlers
Wait until target device is connected through Bluetooth
After connection is done, enter the Glib main loop.It will receive and handle Bluetooth events
Cleanup Bluetooth connection
SKKU Embedded Software Lab.
85
52
SKKU Embedded Software Lab.
• rkf_initialize_bluetooth()
– Initialize Bluetooth adapter and set event handlers
server/src/main.cpp
Initialize Bluetooth adapter
Get Bluetooth adapter state
Ensure Bluetooth device is enabled
If Bluetooth device is disabled, issue ‘enable Bluetooth command’.Then, wait until Bluetooth is enabled or timeout is expired.
SKKU Embedded Software Lab.
85
53
SKKU Embedded Software Lab.
• rkf_initialize_bluetooth() (Cont’d)
– Initialize Bluetooth adapter and set event handlers
server/src/main.cpp
Set Bluetooth device visible always by other Bluetooth devices
SKKU Embedded Software Lab.
85
54
SKKU Embedded Software Lab.
• rkf_initialize_bluetooth() (Cont’d)
– Initialize Bluetooth adapter and set event handlers
server/src/main.cpp
Create Bluetooth/RFCOMM socket and get its file descriptor
Register Bluetooth event handlers• Connection state changed event• Socket data received event
SKKU Embedded Software Lab.
85
55
SKKU Embedded Software Lab.
• rkf_listen_connection()
– Wait until target device is connected through Bluetooth
server/src/main.cpp
SKKU Embedded Software Lab.
85
56
SKKU Embedded Software Lab.
• rkf_received_data_cb()
– Handler of ‘socket data received event’
– Received message: menu, home, back
– Make an input event by sysfs entry
• /sys/bus/platform/devices/homekey/coordinates
server/src/main.cpp
SKKU Embedded Software Lab.
85
57
SKKU Embedded Software Lab.
• rkf_connection_state_changed_cb()
– Handler of Bluetooth connection state changed event
– If Bluetooth connection is disconnected, it exits Glib main loop
server/src/main.cpp
SKKU Embedded Software Lab.
85
58
SKKU Embedded Software Lab.
• rkf_state_changed_cb()
– Handler of Bluetooth adapter state changed event
– This handler is registered only if Bluetooth adapter is disabled.
– If Bluetooth adapter becomes enabled, stop waiting this event anymore.
server/src/main.cpp
SKKU Embedded Software Lab.
85
59
SKKU Embedded Software Lab.
• rkf_finalize_bluetooth_socket() & rkf_finalize_bluetooth()
– Cleanup Bluetooth socket and adapter
server/src/main.cpp
SKKU Embedded Software Lab.
85
60
SKKU Embedded Software Lab.
• Build Requisites
– packaging/remote-key-framework.spec
– CMakeLists.txt
– packaging/CMakeLists.txt
• Build Order
1. gbs build: build and make rpm package as specified in *.spec
2. cmake: make ‘Makefile’ as specified in CMakeLists.txt
3. make: build project as specified in Makefile
Server Service
SKKU Embedded Software Lab.
85
61
SKKU Embedded Software Lab.
• Systemd service description file
– Basic descriptions of the package
– List of required packages
packaging/remote-key-framework.spec
SKKU Embedded Software Lab.
85
62
SKKU Embedded Software Lab.
• Systemd service description file (Cont’d)
– When ‘gbs build’ command is issued, %prep, %build, %install, %post scripts will run in order
packaging/remote-key-framework.spec
SKKU Embedded Software Lab.
85
63
SKKU Embedded Software Lab.
• Systemd service description file (Cont’d)
– RPM package includes file list in %files
• Service binary file
– /usr/bin/rkf_server
• Systemd service description files
– /usr/lib/systemd/system/remote-key-framework.service
– /usr/lib/systemd/system/graphical.target.wants/remote-key-framework.service
• License description file
– /usr/share/license/remote-key-framework
packaging/remote-key-framework.spec
SKKU Embedded Software Lab.
85
64
SKKU Embedded Software Lab.
• CMakeLists.txt
– Cmake configuration file about root directory’s build
– Set sub-directories to be built
– Environment value will be used by CMakeLists.txt in sub-directory.
• PREFIX, EXEC_PREFIX, LIBDIR, INCLUDEDIR, …
Server Service
SKKU Embedded Software Lab.
85
65
SKKU Embedded Software Lab.
• server/CMakeLists.txt
– Cmake configuration file about this directory’s build
Server Service
List of Packages to be used by linker
Set compiler flags for additional packages
Set directories of headers to be included
Set source codes
Set loader flags
Set compiler flags and make binary
SKKU Embedded Software Lab.
85
66
SKKU Embedded Software Lab.
• packaging/remote-key-framework.service
– Systemd service description file
Server Service
After: units that should run before this service
Command to be executed
Restart if the service is terminated in 1 second
This unit will be executed at graphical.target stage in boot time
SKKU Embedded Software Lab.
85
67
SKKU Embedded Software Lab.
• Github에서 zip으로 다운로드했기 때문에, gitrepository를 먼저 초기화해야 함1. $ git init
2. $ git add --all
3. $ git commit -m “Initial commit”
Server Service: Build 사전 작업
SKKU Embedded Software Lab.
85
68
SKKU Embedded Software Lab.
• Build
– *.spec file is required for gbs build
– Build the working directory
• $ gbs build -A armv7l --include-all
– Build the most recent version in Git repository
• $ gbs build -A armv7l
Server Service: Build
SKKU Embedded Software Lab.
85
69
SKKU Embedded Software Lab.
• Install the package
– Package files are located in:~/GBS-ROOT/local/repos/tizen2.3/armv7l/RPMS/
– Send package files to target board through SDB
– Install the packages by RPM tool
Server Service: Install
SKKU Embedded Software Lab.
85
70
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$ sdb root on
3. Send package file to target board through SDB$ cd ~/GBS-ROOT/local/repos/tizen2.3/armv7l/RPMS/
$ sdb push remote-key-framework-1.2.1.armv7l.rpm /
4. Install the package$ sdb shell rpm -ivh --nodeps --force remote-key-framework-1.2.1.armv7l.rpm
5. Reboot your target board$ adb shell sync; sdb shell reboot -f
Server Service: Install
SKKU Embedded Software Lab.
85
71
SKKU Embedded Software Lab.
• Tizen과 Android 간 Bluetooth 연결– Android phone 검색을 허용
– 해당 phone과 bluetooth 연결
Bluetooth Pairing
Android mobile Tizen Odroid-U3
SKKU Embedded Software Lab.
85
72
SKKU Embedded Software Lab.
• Tizen 장치에 키 입력 명령을 내리는 Android App
• 소스 코드도 제공됨
• 설치하기1. 설정 앱 → 보안 → “알 수 없는 소스” 체크
2. client/android-client/bin/RemoteKeyClient.apk를 Android 장치에넣어서 설치
Client
SKKU Embedded Software Lab.
85
73
SKKU Embedded Software Lab.
• 화면 구성
Client
Control Buttons (Device 목록 갱신, Bluetooth ON/OFF)
Bluetooth로 Pairing된 Device 목록(미리 “설정” 앱에서 대상 장치와 Bluetooth Pairing이끝나 있어야 함)
Key Buttons (Menu key, Home key, Back key)
SKKU Embedded Software Lab.
85
74
SKKU Embedded Software Lab.
1. ODROID와 Bluetooth Pairing
2. Client Application 실행
3. “Update” 버튼 클릭
4. 목록에서 대상 device 선택
5. 키 입력 가능
사용하기
SKKU Embedded Software Lab.
85
76
SKKU Embedded Software Lab.
• Minimum code of Tizen service
• Glib event loop for service lifecycle
– Timeout event occurs in one minute after startup
– Other events can be added for other purposes
• Service is launched on startup
Appendix: Hello Tizen Service
SKKU Embedded Software Lab.
85
77
SKKU Embedded Software Lab.
• Tizen project repository requires following files
– Red files are required at least.
Appendix: Required Files in Repository
• 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.
85
78
SKKU Embedded Software Lab.
• Download Source Code from Github(Link)
– $ git clone https://github.com/SKKU-ESLAB-Tizen/hello-tizen-service
Appendix: Download Service
• AUTHORS: Author list• LICENSE: License information• CMakeLists.txt: cmake configuration file about this directory’s build• hello-tizen-service.manifest: SMACK manifest file• packaging
• hello-tizen-service.manifest: SMACK manifest file• hello-tizen-service.spec: RPM package specification file• hello-tizen-service.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.
85
79
SKKU Embedded Software Lab.
• Build
– *.spec file is required for gbs build
– Build the working directory
• $ gbs build -A armv7l --include-all
– Build the most recent version in Git repository
• $ gbs build -A armv7l
Appendix: Build Service Package
SKKU Embedded Software Lab.
85
80
SKKU Embedded Software Lab.
• Install the package
– Package files are located in:~/GBS-ROOT/local/repos/tizen2.3/armv7l/RPMS/
– Send package files to target board through SDB
– Install the packages by RPM tool
Appendix: Install Service Package
SKKU Embedded Software Lab.
85
81
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$ sdb root on
3. Send package file to target board through SDB$ cd ~/GBS-ROOT/local/repos/tizen2.3/armv7l/RPMS/
$ sdb push hello-tizen-service-1.0.1.armv7l.rpm /
4. Install the package$ sdb shell rpm -ivh --nodeps --force hello-tizen-service-1.0.1.armv7l.rpm
5. Reboot your target board$ adb shell sync; sdb shell reboot -f
Appendix: Install Service Package
SKKU Embedded Software Lab.
85
83
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
SKKU Embedded Software Lab.
85
84
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.3/armv7l/logs/fail/xf86-video-exynos-1.0.0-1/log.txt
Example
[ 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.3/armv7l/logs/fail/xf86-video-exynos-1.0.0-1/log.txt
• You can find the problem on the error log.
SKKU Embedded Software Lab.
85
85
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.3/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.sh