SKKU Embedded Software Lab.
79
1
Porting Tizen v2.3 on ODROID U3
SKKU Embedded Software Lab.
79
2
• Tizen Device Partitioning
• Tizen U-Boot
• Building the Kernel
• Flashing a Tizen Platform Image
• Tizen Platform Configuration
• Troubleshootings
Index
SKKU Embedded Software Lab.
79
3
Tizen Device Partitioning
SKKU Embedded Software Lab.
79
4
• Tizen Partitions layout– 7 partitions : mmcblk0p1 ~ mmcblk0p7
– MBR(Master Boot Record) supports only up to four partitions
Tizen Partition Layout
PartitionMountPoint
Option Description
/dev/mmcblk0p1 /csa Rw Configuration Saved Area
/dev/mmcblk0p2 /boot Ro Kernel image
/dev/mmcblk0p3 - - Reserved
/dev/mmcblk0p4 /mnt/csc RwCustomer Software Configuration , default language, time, etc.
/dev/mmcblk0p5 / Ro Platform
/dev/mmcblk0p6 /opt Rw Data, App, etc
/dev/mmcblk0p7 /opt/usr rw User space
Use 4 important partitions
SKKU Embedded Software Lab.
79
5
• Use SD card, VMWare, and SD card reader
Connect SD Card Reader with VMWare
SKKU Embedded Software Lab.
79
6
• Set partitions using Gparted– Install Gparted
• sudo apt-get install gparted
– Create all partitions except the first 2MB of space
• First 2MB : Space for bootloader (U-Boot)
Tizen Device Partitioning [1/3]
Gparted
SKKU Embedded Software Lab.
79
7
• Delete the existing partition on SD card
Tizen Device Partitioning [2/3]
[Example]SD card size : 8GBDevice node : /dev/sdb
SKKU Embedded Software Lab.
79
8Tizen Device Partitioning [3/3]
Leave 2MB for U-Boot
Partition Label• boot• rootfs• system-data• user
SKKU Embedded Software Lab.
79
9
Tizen U-Boot
SKKU Embedded Software Lab.
79
10
• Boot process– Rom(In SOC) → bl1 → bl2 (→ uboot.bin)
U-boot Bootloader
SKKU Embedded Software Lab.
79
11
• U-boot Files
• Download Hardkernel U-boot bl1, bl2 – https://github.com/hardkernel/U-Boot/raw/odroid-v2010.12/sd_fuse/bl1.HardKernel
– https://github.com/hardkernel/U-Boot/raw/odroid-v2010.12/sd_fuse/bl2.HardKernel
– https://github.com/hardkernel/U-Boot/raw/odroid-v2010.12/sd_fuse/tzsw.HardKernel
– https://github.com/hardkernel/U-Boot/raw/odroid-v2010.12/sd_fuse/sd_fusing.sh
• Download Tizen U-boot binary– https://download.tizen.org/lecture/Tizen_Porting/Tizen%20v2.3%20Porting/Bootloader/u-boot-mmc.bin
Binary Download
BL1, BL2, signature from HardKernelTizen U-boot Binary
SKKU Embedded Software Lab.
79
12
• Extract u-boot-mmc.bin file from RPM package
• Modify sd_fusing.sh script
Fusing [1/2]
Change file name and path
SKKU Embedded Software Lab.
79
13
• Check device nodes after connecting SD card reader– ls /dev/sd*
– Typically the name of device node is /dev/sdb
• Set the excution permission– chmod +x sd_fusing.sh
• Fusing – sudo ./sd_fusing.sh /dev/sdb
Fusing [2/2]
SKKU Embedded Software Lab.
79
14
• Connect UART– U-Boot operation message will be printed out.
Check System Operation
U-boot
Partition 2 Partition 3 Partition 3
Storage (SD Card)
SKKU Embedded Software Lab.
79
15
• Change boot arguments of U-Boot– Set “read and write” option for root file system
• setenv kernel_args "setenv bootargs root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw console=ttySAC1,115200n8"
• saveenv
– Expand boot delay time (can be skipped)
• setenv bootdelay 3
• saveenv
Change Mount Option On U-Boot
SKKU Embedded Software Lab.
79
16
Building the Kernel
SKKU Embedded Software Lab.
79
17
• Setting for kernel build– Installing required libraries
• Enter the following command in terminal
• sudo apt-get install libncurses5-dev build-essential
Default Environment Setting
SKKU Embedded Software Lab.
79
18
• Use Gerrit (https://review.tizen.org/gerrit/#/)
Kernel Download
SKKU Embedded Software Lab.
79
19
• Download Kernel source code– git clone tizen:platform/kernel/linux-3.10
Kernel Download
• Set branch– Check branch list
• “git branch –a” (Run in target directory)
– Checkout “Tizen” branch
• git checkout tizen
SKKU Embedded Software Lab.
79
20
• Cross Toolchain– To build the kernel targeting for ARM architecture in the X86
environment
– Default toolchain of Tizen 2.x is “arm-linux-gnueabi-gcc-4.5"
• Automatically installed with Tizen SDK
Ex) /TIZEN_SDK_PATH/tool/arm-linux-gnueabi-gcc-4.5
– Install 64bit compatible library (If you use a 64bit system)
• Sudo apt-get install libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 zlib1g:i386
Cross Compiler (Toolchain)
SKKU Embedded Software Lab.
79
21
• Two Options1. Manual configuration – Export cross compile information
• export ARCH=arm
• export CROSS_COMPILE=/TOOLCHAIN_PATH/arm-linux-gnueabi-gcc-4.5/bin/arm-linux-gnueabi-
2. Modify “Makefile“
• Various configuration options for compile or build
• Edit makefile in kernel directory
• Edit ARCH & CROSS_COMPILE
Cross Compiler Configuration
SKKU Embedded Software Lab.
79
22
• defconfig– Kernel configuration file
– In ./arch/arm/configs/
– Default Tizen defconfig is “tizen_defconfig”
• Apply ODROID defconfig– make tizen_odroid_defconfig
Apply Defconfig
SKKU Embedded Software Lab.
79
23
• Change kernel configurations using “make menuconfig”
Kernel Configuration
SKKU Embedded Software Lab.
79
24
• There is a temperature problem in the default configuration– The temperature is too high in performance governor
– Change governor from performance to ondemad– CPU Power Management -> CPU Frequency scaling -> Default CPUFreq
governor
CPU Governor 변경
SKKU Embedded Software Lab.
79
25
• Enable RTL8192 WiFi module support– Networking support -> Wireless
• Enable 80211 protocol
– Device Driver -> Network device support -> Wireless LAN
• Wireless device driver configuration
WiFi Support
SKKU Embedded Software Lab.
79
26
• Enable Bluetooth support for Tizen– Networking support > Bluetooth subsystem support
– Bluetooth device drivers
Bluetooth Support [1/2]
SKKU Embedded Software Lab.
79
27
• Enable Rfkill– Userspace tool to query the state of the rfkill switches,
buttons and subsystem interfaces
– Networking support
Bluetooth Support [2/2]
SKKU Embedded Software Lab.
79
28
• cgroup(Control Group) limits and isolates the resource usage (CPU, memory, etc.) of a collection of processes.– The error is occurred at default configuration
– General setup -> Control Group support
cgroup Configuration
SKKU Embedded Software Lab.
79
29
• Default GPU driver version is changed in the latest version from R3P2 to R4P0– Current CPU Driver version does not match with DDK
Change Default GPU Driver [1/3]
SKKU Embedded Software Lab.
79
30Change Default GPU Driver [2/3]
- Graphics support
- ARM GPU configuration
- Mali-400 support
SKKU Embedded Software Lab.
79
31Change Default GPU Driver [3/3]
Change from R4P0 to R3P2
- Select Mali Version
①
②
SKKU Embedded Software Lab.
79
32
• Make zImage– sudo make zImage –j 4
– Set the number of thread with the option of “-j 4”• Typically set about 1.5 times the number of CPU threads
Kernel Build
SKKU Embedded Software Lab.
79
33
• Device tree– Data structure for describing hardware
– Can be described in a data structure that is passed to the operating system at boot time
– Data structure itself is a simple tree of named nodes and properties
– File organization
• dtsi : platform common
• dts : board specific
• dtb : binary file
Device Tree
SKKU Embedded Software Lab.
79
34
• Make Device Tree– make exynos4412-odroidu3.dtb
• Make final zIamge– cat arch/arm/boot/zImage arch/arm/boot/dts/exynos4412-
odroidu3.dtb > ./zImage
– zImage is created in the root directory of the kernel
Kernel Build
SKKU Embedded Software Lab.
79
35
• Copy kernel zImage into 1st partition of SD card– Make a temporary directory to mount the partition.
• mkdir boot
• sudo mount /dev/sdb1 ./boot/
– Copy zImage• cp ./zImage ./boot/
– You can use prebuild kernel image• https://download.tizen.org/lecture/Tizen_Porting/Tizen%20v2.3%20Por
ting/Kernel%20Image/zImage
Kernel Image Copy
SKKU Embedded Software Lab.
79
36
• Check kernel message
Check System Operation
U-boot
Partition 2 Partition 3 Partition 3
Kernel
SKKU Embedded Software Lab.
79
37
Platform Image Flash
SKKU Embedded Software Lab.
79
38
• Three platform images– Can download the released version from Tizen download site
(Tizen 2.3 for RD-PQ)• https://download.tizen.org/lecture/Tizen_Porting/Tizen%20v2.3%20Porting/Platform%20Image/rootfs.img
• https://download.tizen.org/lecture/Tizen_Porting/Tizen%20v2.3%20Porting/Platform%20Image/system-data.img
• https://download.tizen.org/lecture/Tizen_Porting/Tizen%20v2.3%20Porting/Platform%20Image/user.img
Tizen Platform Image
Root Filesystem2nd Partition
App Data3rd Partition
User Area4th Partition
SKKU Embedded Software Lab.
79
39
• Connect SD card at VMware
• Use dd command – sudo dd if=./rootfs.img of=/dev/sdb2 bs=512k
– sudo dd if=./system-data.img of=/dev/sdb3 bs=512k
– sudo dd if=./user.img of=/dev/sdb4 bs=512k
Image Flash
Check the device node of SD card
SKKU Embedded Software Lab.
79
40
• Resolve the partition size problem by gparted– Partition size is not displayed properly
– sudo gparted
– Use check function of gparted
Partition Resize
SKKU Embedded Software Lab.
79
41
• Perform the same work for other partitions
Partition Resize
SKKU Embedded Software Lab.
79
42
• Partition mount problem will be shown
– Partition label is not recognized properly in the mounting process (rootfs, system-data, user)
• This issue will be solved at the next step.
Check System Operation
U-boot Kernel
Rootfs System-data User
SKKU Embedded Software Lab.
79
43
Tizen Platform Configuration
SKKU Embedded Software Lab.
79
44
• Change mount option in systemd– Path : ROOTFS_OF_SDCARD/etc/systemd/system/local-
fs.target.wants
– Delete unused mount services
• csa.mount, opt-system-csc.mount
– Modify App data and user partitions
• opt.mount, opt-user.mount
Partition Mount Option
EditEditDelete Delete
SKKU Embedded Software Lab.
79
45
• Change mount partition name– Data partition (opt.mount)
• dev-disk-by\x2dpartlabel-system\x2ddata → dev-mmcblk0p3
• /dev/disk/by-partlabel/system-data → /dev/mmcblk0p3
– User partition (opt-usr.mount)
• dev-disk-by\x2dpartlabel-user → dev-mmcblk0p4
• /dev/disk/by-partlabel/user → /dev/mmcblk0p4
Partition Mount Option
SKKU Embedded Software Lab.
79
46
• Edit fstab– Specify the required mount operations
– Path : /etc/fstab
• Change mount option of rootfs
• Annotating module image mount
Mount Option
Original
Modified
SKKU Embedded Software Lab.
79
47
• Do not need additional partition resize process– Path : ROOTFS_OF_SDCARD/usr/lib/systemd/system/local-
fs.target.wants
– Remove “resize2fs-root.service” file.
Resize Service
resize2fs-root.service
SKKU Embedded Software Lab.
79
48
• If battery capacity is low, the system forced to shut down device.
• Change the batter capacity threshold value– File : /etc/battery.conf
Deviced Configuration [1/2]
[LOWBAT]#low battery levelNormal=100Warning=15Critical=5PowerOff=1RealOff=0
[LOWBAT]#low battery levelNormal=0Warning=0Critical=0PowerOff=0RealOff=0
SKKU Embedded Software Lab.
79
49
• Should prevent ODROID-U3 from entering the SLEEP state
• Change the timeout values– File : /etc/display.conf
Deviced Configuration[2/2]
# display state is changed to SLEEP state after this time.# If this value is large, it causes power consumption problem.LCDOffTimeout=180000 # milli second
# If this value is yes, LCD is always on except pressing power key.# Default value is no, LCD is turned off by lcd timeout.LCDAlwaysOn=yes # yes or no
SKKU Embedded Software Lab.
79
50
• UART Message
– Login ID is “root”
Check System Operation
SKKU Embedded Software Lab.
79
51
Troubleshootings
SKKU Embedded Software Lab.
79
52
• Index1. Sound Problem
2. Activate SDB
3. Display Output - Xorg DDX
4. Booting Animation
5. Touch Screen Calibration
6. Adjust UI Size
7. Wi-Fi
8. Bluetooth
9. Pop-up Window
10. OpenGL Acceleration
• You can download files related to troubleshooting – https://download.tizen.org/lecture/Tizen_Porting/Tizen%20v2.3%20
Porting/Troubleshooting/
Troubleshooting
SKKU Embedded Software Lab.
79
53
• Tizen Sound System – Pulse Audio : Third-party open-source framework to provide
more sound-related functions
– ALSA : Kernel-level subsystems for sound support
1. Sound Problem [1/3]
SKKU Embedded Software Lab.
79
54
• Reference phone and ODROID-U3 have different sound output devices– Pulseaudio service is failed
• Check ODROID U3 sound device– “aplay –l”
1. Sound Problem [2/3]
Card : 0 / Device : 1
SKKU Embedded Software Lab.
79
55
• Change the default output device in Pulse Audio setting – File : /etc/pulse/system.pa
– Change the output device from hw:0,3 to hw:0,1
1. Sound Problem [3/3]
SKKU Embedded Software Lab.
79
56
• Samsung Debug Bridge (Similar function with ADB) – Can connect ODROID-U3 with Host PC
• Tizen on ODROID-U3:– Need to set SDB daemon.
2. Activate SDB [1/3]
SKKU Embedded Software Lab.
79
57
1. Create a script to activate USB host device– Make a script file
– chmod +x pre-sdbd.sh
2. Activate SDB [2/3]
#!/bin/bashecho sdb > /sys/class/usb_mode/usb0/funcs_fconfecho 1 > /sys/class/usb_mode/usb0/enablesdbd
/bin/pre-sdbd.sh
SKKU Embedded Software Lab.
79
58
2. Change SDBD service file– Delete service dependencies
– Add script execute command
– Activate SDBD service then reboot the system
2. Activate SDB [3/3]
[Unit]Description=sdbdAfter=default.target[Service]Type=forkingEnvironment=DISPLAY=:0PIDFile=/tmp/.sdbd.pidRemainAfterExit=yesExecStartPre=/bin/bash /bin/pre-sdbd.shExecStart=/usr/sbin/sdbd
/usr/lib/systemd/system/sdbd.service
script to activate USB device
Delete
Make symbolic link
SKKU Embedded Software Lab.
79
59
• Device Dependent X – DDX is connected to the display on the Xorg
– If device has no LCD, DDX does not operated properly.
3. Display Output - Xorg DDX [1/4]
SKKU Embedded Software Lab.
79
60
• Download source code from Gerrit– git clone git://git.tizen.org/adaptation/ap_samsung/xserver-
xorg-video-exynos
• Change branch – git checkout tizen_2.3
• Modify code– Path : ./src/crtcconfig (Perform display configuration)
– Sec_display.c
• _secSetMainMode (ScrnInfoPtr pScrn, SECModePtr pSecMode)
• Determine main output display
3. Display Output - Xorg DDX [2/4]
SKKU Embedded Software Lab.
79
613. Display Output - Xorg DDX [3/4]
Original code
Modified code
HDMI device cannot be a main output device
Add HDMI device
SKKU Embedded Software Lab.
79
62
• Build with GBS
• Install RPM package
– Copy RPM package into Odroid-U3
• sdb root on
• sdb push ./PACKAGE_FILENAME /LOCATION
– Install
• rpm –Uvh --force --nodeps PACKAGE_FILENAME
3. Display Output - Xorg DDX [4/4]
SKKU Embedded Software Lab.
79
63
• If there are no LVDS devoce (LCD), the booting animation program does not work. – Source code
• git clone git://git.tizen.org/apps/home/boot-animation
– File : ./src/animation.c
4. Booting Animation
Delete device check process
SKKU Embedded Software Lab.
79
64
• With ODROID-Vu, touch-coordinate error
• Xorg provides its own touch calibration function– Path : /etc/X11/xorg.conf.d/input.conf
– Add calibaration option to InputClass
• If you use other input device, you can know the correct values using xinput_calibrator
5. Touch Screen Calibration
Section "InputClass"Identifier "evdev touchscreen catchall"MatchIsTouchScreen "on"MatchDevicePath "/dev/input/event*"Driver "evdevmultitouch“Option "MultiTouch" "10"Option "Calibration" "9 1274 2 801"
EndSection
SKKU Embedded Software Lab.
79
65
• Text and some UI will be too small in the default configuration– Change the display configuration of EFL enlightenment
– File : /etc/profile.d/elm.sh
6. Adjust UI Size
export ELM_PROFILE="mobile"export ELM_SCALE=1.5export SCALE_FACTOR=1.5
Add this options
Size is changed
SKKU Embedded Software Lab.
79
66
• Copy WiFi firmware – The WiFi device will load the firmware during the device
initialization phase
• Copy rtl8192 firmware to /lib/firmware directory
• In ODROID : lib/firmware/rtlwifi/
• Modify a shell script – /usr/bin/wlan.sh
7. Platform Setting for WiFi [1/3]
SKKU Embedded Software Lab.
79
67
• wlan.sh [start] [stop] [softap] [p2p] [check_hw]– Can support hotspot / Wi-Di
– Apply only the regular net functionalities
7. Modify wlan.sh [2/3]
#!/bin/shIFACE_NAME=wlan0start(){
/sbin/ifconfig ${IFACE_NAME} up}
stop(){
/sbin/ifconfig ${IFACE_NAME} down}
case $1 in"start")start;;"stop")stop;;*)/bin/echo wlan.sh [start] [stop]exit 1;;esac
SKKU Embedded Software Lab.
79
68
• wpa_supplicant supports various network connections
• Default wpa_supplicant of Tizen 2.3 generates an error at SSID connection– File : /usr/sbin/wpa_supplicant
– Change the file to the old version of Tizen 2.2 or Tizen 2.2.1
7. Change wpa_supplicant [3/3]
SKKU Embedded Software Lab.
79
69
• Scripts for Bluetooth – Path
• ./usr/etc/Bluetooth
– Need to modify the following files
• bt-stack-up.sh
– Bluetooth activation
• bt-stack-down.sh
– Bluetooth deactivation
8. Platform Setting for Bluetooth [1/3]
SKKU Embedded Software Lab.
79
70
• Need the device initialization for USB type BT– Device-specific initialization is not required
8. Bt-stack-up.sh [2/3]
#!/bin/sh
## Script for executing Bluetooth stack#
# Activate BT Devicerfkill unblock bluetooth/usr/sbin/hciconfig hci0 up
# dbus path settingexport DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/app/dbus/user_bus_socket
# Execute BlueZ BT stackecho "Run bluetoothd"/usr/lib/bluetooth/bluetoothd -d -C &/usr/bin/bluetooth-share &
exit 0
Device activation -> Dbus Settings -> Start Daemon
SKKU Embedded Software Lab.
79
718. Bt-stack-down.sh [3/3]
#!/bin/sh
## Script for stopping Bluetooth stack#
# Remove BT device/usr/sbin/hciconfig hci0 downrfkill block bluetooth
# Kill BlueZ bluetooth stackkillall obexd obex-clientkillall bt-syspopupkillall bluetooth-sharekillall bluetooth-pb-agentkillall bluetooth-map-agentkillall bluetooth-hfp-agentkillall bluetoothd
# resultexit 0
Device Deactivation-> Stop Daemon & Services
SKKU Embedded Software Lab.
79
72
• Two message pop-up windows– Low battery warning
• ODROID device has no battery
– SD card mount fail (External SD card)
• ODROID use SD card for main storage
9. Pop-up Window [1/3]
SKKU Embedded Software Lab.
79
73
• Modify deviced (Device Daemon)– Download source code
• git clone git://git.tizen.org/framework/system/deviced
– File : ./src/core/power-supply.c• Vconf_set_int()
– modify all values relevant to the battery configuration.
– File : ./src/battery/lowbat-handler.c• Vconf_set_int()
– Modify the setting value about battery state or level
• Lowbat_read() – Modify the return value to fully-charged(100%)
Refer to the appended source files
9. Battery Problem [2/3]
SKKU Embedded Software Lab.
79
74
• Modify deviced– File : ./src/mmc/mmc-handler.c
– Modify code to not call the mount code
9. SD Card Mount Fail [3/3]
SKKU Embedded Software Lab.
79
75
• OpenGL library should be installed in order to use the OpenGL
10. Install OpenGL Library for 3D Acceleration [1/2]
platform-independent API
Open Graphics Library for Embedded System
SKKU Embedded Software Lab.
79
76
• Copy DDK files
– Remove Virtual driver• rpm -e --nodeps opengl-es-virtual-drv
– Install new package• rpm –Uvh –force *.rpm
– Sync & reboot • sync
• reboot -f
10. Install OpenGL Library for 3D Acceleration [2/2]
SKKU Embedded Software Lab.
79
77Etc. Application Install Error
• Error occurs when a new application is installed with Tizen IDE or “sdb install” command
• Tizen checks the current time in the installing step
– Need to change the current time with date command
– date -s ‘YYYY-MM-DD hh:mm:ss'
SKKU Embedded Software Lab.
79
78Etc. Input Control
• Tizen 2.3 has no software keys like HOME / MENU / BACK
– You can use USB mouse for hardware key input
Right button- Back
Wheel button- Home
SKKU Embedded Software Lab.
79
79Porting Complete
Tizen 2.3 lock screen