tizen sdk & app development · system user session for app privilege daemons such as...
TRANSCRIPT
Tizen logical layers
OSP(Open Services Platform, C++ APIs)
Tizen physical partitions
Storage partitions
Tizen filesystems
File system is a user interface
5
Mount point
6
Write file system into partitions
Write file system into partitions
Write file system into partitions
How system know file systems
10
In u-boot source code, root file system type is specified: include/configs/tizen.h
Root file system mounted by kernel
Call stack
init/main.c kernel_init_freeable
init/do_mounts.c prepare_namespace
init/do_mounts.c mount_root_block
In this function, the argument “root”,
“rootfstype” are recognized,and call
do_mount_root to mount the root
Create the first process
12
Kernel source : init/main.c kernel_init
User space—prepare for init
The first process with task id 1
Root of the process tree
Take over the orphan process
Power off the system
……
What’s in /sbin/init
14
systemd
What is systemd?
• Sysvinit
– userspace launch (PID 1)
– Only one process at a time running
– Simply starting the system and then going to sleep
until the next reboot• Systemd
– Default init in Fedora 15 and later Leonard Poettering
(2009)
– improve the software framework for expressing
dependencies
– allow more processing to be done concurrently or in
parallel during system booting
– reduce the computational overhead of the shell.
Platform bootup
https://wiki.tizen.org/wiki/Porting_Guide
entry point
.target vs .service• .target; service grouping• .service; process run
Parsing unit file – example (8/8)
• User awareness unit name = “System Initialization”• If emergency is running, wait• Run with local-fs.target, swap.target, sysinit.target.wants• Run after local-fs.target, swap.target, emergency.service, emergency.target• User can control service start and stop
local-fs.target
/usr/lib/systemd/system/local-fs.target.wants
opt.mount
[Mount]
What=/dev/mmcblk0p6
Where=/opt
Type=ext4
Options=defaults
Systemd other features
Demo
What is systemd?
Systemd in Tizen
System and service manager for tizen systemd
Ver. 43 (download
http://www.freedesktop.org/software/systemd/)
Parallelizes service execution
Socket and D-Bus activation for starting services and
daemon
on-demand starting of daemons
Managing the service processes as a group using Linux
cgroup
Supporting automount points
Snapshotting and restoring of services
systemd architecture
systemd architecture
• systemd Utility
– monitoring and controlling systemd itself and its services
– 'systemctl' developers can query or send control commend to the systemd
service manager
– 'systemd-journalctl' utility to see log message
• systemd target
– Tizen boot-up process is split up in various discrete steps and each step are
grouped its unit using 'Target' unit to synchronize point
– The boot-up process is highly parallelized in each target so that the order in
which specific target units are reached in not deterministic
• systemd daemon
– system and service manager for Tizen platform
– acts as init system
– 'systemd' daemonruns as user session with '--user' option
– 'systemd-journald' is a system service that collects and stores log data from the
Kernel, from user processes via syslog or STDOUT/STDERR
systemd architecture
systemd core
manages all units such as service, socket, mount and so on,
stores all log data.
controlled by using systemd utility like 'systemctl'
systemd library & Linux Kernel
systemd requires to enable 'cgroup' and 'autofs' option in Kernel
configuration
It also depends on dbus and some libraries such as libnotify,
libudev
Platform bootup – sysinit.target
Early boot-up scripts
Most of file system are mounted and systemd related daemons are launched
basic.target
sysinit.target
multi-user.target
graphical.target
bootmode.target
Kernel
local-fs.target
swap.target
socket.target
-.mountboot.mountcsa.mountfsck-root.servicemedia.mountopt-usr.mountopt.mountremount-rootfs.serviceresize2fs-root.servicesystemd-remount-api-vfs.servicevar-run.mount
dev-hugepages.mountdev-mqueue.mountproc-sys-fs-binfmt_misc.automountsys-fs-fuse-connections.mountsys-kernel-config.mountsys-kernel-debug.mountsys-kernel-security.mountsystemd-ask-password-console.pathsystemd-binfmt.servicesystemd-journald.servicesystemd-modules-load.servicesystemd-random-seed-load.servicesystemd-readahead-collect.servicesystemd-readahead-replay.servicesystemd-sysctl.servicesystemd-tmpfiles-setup.service
dbus.socketsystemd-initctl.socketsystemd-journald.socketsystemd-shutdownd.sockettelnetd.socketudev-control.socketudev-kernel.socket
Platform bootup – basic.target
Basic boot-up
All necessary initialization for general purpose daemons are completed
basic.target
sysinit.target
multi-user.target
graphical.target
bootmode.target
Kernel
opt-var-kdb-db-libsqlfs.serviceopt-var-kdb-db-smack-labels.servicesmack-default-labeling.servicesystemd-tmpfiles-clean.timertizen-debug-level.serviceudev-trigger.serviceudev.servicevconf-setup.service
Platform bootup – bootmote.target
Select boot mode
If kernel boot parameter has ‘charger_detect_boot’, the platform boots up as charging
mode
basic.target
sysinit.target
multi-user.target
graphical.target
bootmode.target
Kernel
bootmode-charging.servicebootmode-graphical.service
Platform bootup – multi-user.target
Setup a multi-user system which is non-graphical support
Launching platform infrastructure daemons (such as dbus, power manager, gps
manager, telephony daemon, WRT security daemon, media server, systemd-related
daemons)
basic.target
sysinit.target
multi-user.target
graphical.target
bootmode.target
Kernelalarm-server.serviceavsystem.servicebluetooth-address.servicebluetooth-frwk-service.servicebluetooth.servicedbus.servicedlog-main.servicedlog-radio.servicegetty.targetgps-manager.servicemedia-server.servicenfc-manager.servicepower-manager.servicepulseaudio.servicesecure-storage.servicesensor-framework.servicesystem-server.servicesystemd-ask-password-wall.pathsystemd-logind.servicesystemd-user-sessions.servicetelephony.service
Platform bootup – graphical.target
Setup a graphical environment
System user session for app privilege daemons such as Enlightenment (window
manager)
Special target for middleware & mobile service
basic.target
sysinit.target
multi-user.target
graphical.target
bootmode.target
Kernel
core-efl.target
tizen-middleware.target
boot-animation.servicecbhm.servicee17.serviceindicator.serviceosp-app-service.servicequickpanel.servicescim.servicestarter.pathxmodmap.servicexrdb.service
[email protected]@[email protected]
calendar.servicecontacts-service.servicedownload-provider.serviceemail.servicemsg-service.servicepushd.servicesound-server.service
tizen-mobile-session.target
wrt-preinstall-widgets.service
xorg.target
xorg.service
Systemd parsing
Platform bootup
systemd
Control is moved from initramfs to systemd of Tizen platform
Run hardware init and fs mount, etc services
Bootup process run several units (.target)
Different target can be run in parallel
Many linux distributions adopt systemd as default
Red Hat Enterprise Linux, CentOS, Fedora, Arch Linux,
openSUSE
Do not use daemon control script (/sbin/init, /etc/init.d/*, /etc/rc*.d)
/usr/lib/systemd
unit files: service, target, socket, device, mount, automount,
path, snapshot, swap, timer
systemd utilities: systemctl, notify, analyze, cgis, cgtop,
logictl, journalctl, nspawn
Parsing unit file – example (1/8)
/usr/lib/systemd/system
cat sysinit.target
target to parse
Parsing unit file – example (2/8)
Website
http://www.freedesktop.org/wiki/software/systemd/
systemd download
http://www.freedesktop.org/software/systemd/
manpage
Parsing unit file – example (3/8)
Can search all function and unit, configuration of systemd
enter target index
Parsing unit file – example (4/8)
target unit file
Parsing unit file – example (5/8)
Description on unit file option
Parsing unit file – example (6/8)
Parsing unit file – example (7/8)
Parsing unit file – example (8/8)
• User awareness unit name = “System Initialization”• If emergency is running, wait• Run with local-fs.target, swap.target, sysinit.target.wants• Run after local-fs.target, swap.target, emergency.service, emergency.target• User can control service start and stop
Different Sessions
[Unit], [Service], [Install], [Socket], [Swap], [Mount], …
example; telephony.service
[Unit]; general options
unit name = Telephony daemon
Run after modem.service
[Service]; process options
Run telephony-daemon as main process
[Install]; actual work of unit excute
Create telephony.service symlink at multi-user.target.wants
References
systemd official Site
http://www.freedesktop.org/wiki/Software/systemd/
systemd FAQ (written by developer)
http://0pointer.de/blog/projects/the-biggest-myths
Homework
Finish porting Tizen to Odroid-U3
Submit a report about your porting procedure
Reference http://nyx.skku.ac.kr/?page_id=201 for
troubleshooting
Acknowledgement
This project is partially sponsored by Tianjin Samsung
Electronics Co., Ltd.
Special thanks to SKKU Embedded Software Laboratory. This
material is based on the lecture provided by them, and the
credit goes to the original authors.