summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog0
-rw-r--r--LICENSE202
-rw-r--r--Makefile.am229
-rw-r--r--NEWS0
-rw-r--r--README0
-rw-r--r--conf/systemd/ignore-units40
-rw-r--r--configure.ac194
-rw-r--r--packaging/system-plugin-common.manifest12
-rw-r--r--packaging/system-plugin-common.spec128
-rw-r--r--scripts/change-booting-mode.sh105
-rw-r--r--scripts/tizen-boot.sh.in76
-rw-r--r--scripts/tizen-fstrim-on-charge.sh20
-rw-r--r--units/check-mount.service14
-rw-r--r--units/systemd-udevd-kill.service8
-rw-r--r--units/systemd-udevd-kill.timer9
-rw-r--r--units/tizen-fstrim-user.service7
-rw-r--r--units/tizen-fstrim-user.timer.m48
-rw-r--r--units/tizen-generate-env.service12
-rw-r--r--units/tizen-init-check.service.in11
-rw-r--r--units/tizen-init-done.service.in11
-rw-r--r--units/tizen-init.target5
-rw-r--r--units/tizen-initial-boot-done.service.in11
-rw-r--r--units/tizen-readahead-collect-stop.service8
-rw-r--r--units/tizen-readahead-collect.service.in17
-rw-r--r--units/tizen-readahead-replay.service.in16
-rw-r--r--units/wm_ready.service11
27 files changed, 1155 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..be9d01b
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+WaLyong Cho <walyong.cho@samsung.com>
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ChangeLog
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..a5376cd
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,229 @@
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+
+SUBDIRS = .
+
+# legacy rc script dir
+rcdir=$(sysconfdir)/rc.d
+
+# Inherit from systemd
+systemdsysconfdir=$(sysconfdir)/systemd
+systemconfigunitdir=$(systemdsysconfdir)/system
+userconfigunitdir=$(systemdsysconfdir)/user
+systemdignoreunitdir=$(systemdsysconfdir)/default-extra-dependencies
+systemunitdir=$(rootprefix)/lib/systemd/system
+userunitdir=$(prefix)/lib/systemd/user
+udevlibexecdir=$(rootprefix)/lib/udev
+udevhomedir=$(udevlibexecdir)
+udevrulesdir=$(udevlibexecdir)/rules.d
+
+# And these are the special ones for /
+rootprefix=@rootprefix@
+rootbindir=$(rootprefix)/bin
+rootlibexecdir=$(rootprefix)/lib/systemd
+
+if WITH_ENGMODE
+engbindir=/opt/usr/devel/$(rootbindir)
+endif
+
+bin_SCRIPTS =
+rc_SCRIPTS =
+SCRIPT_IN_FILES =
+sysconf_DATA =
+systemdsysconf_DATA =
+systemdignoreunit_DATA =
+systemconfigunit_DATA =
+systemunit_DATA =
+udevrules_DATA =
+
+if WITH_ENGMODE
+engbin_PROGRAMS =
+endif
+
+INSTALL_EXEC_HOOKS =
+UNINSTALL_EXEC_HOOKS =
+
+SHUTDOWN_TARGET_WANTS =
+LOCAL_FS_TARGET_WANTS =
+BASIC_TARGET_WANTS =
+SYSINIT_TARGET_WANTS =
+SOCKETS_TARGET_WANTS =
+TIMERS_TARGET_WANTS =
+TIZEN_INIT_TARGET_WANTS =
+TIZEN_BOOT_TARGET_WANTS =
+TIZEN_SYSTEM_TARGET_WANTS =
+TIZEN_RUNTIME_TARGET_WANTS =
+MULTI_USER_TARGET_WANTS =
+DEFAULT_TARGET_WANTS =
+SYSCONF_LOCAL_FS_TARGET_WANTS =
+
+install-target-wants-hook:
+ where=$(systemunitdir) && what="$(SHUTDOWN_TARGET_WANTS)" && wants=shutdown.target && $(add-wants)
+ where=$(systemunitdir) && what="$(LOCAL_FS_TARGET_WANTS)" && wants=local-fs.target && $(add-wants)
+ where=$(systemunitdir) && what="$(BASIC_TARGET_WANTS)" && wants=basic.target && $(add-wants)
+ where=$(systemunitdir) && what="$(MULTI_USER_TARGET_WANTS)" && wants=multi-user.target && $(add-wants)
+ where=$(systemunitdir) && what="$(SYSINIT_TARGET_WANTS)" && wants=sysinit.target && $(add-wants)
+ where=$(systemunitdir) && what="$(SOCKETS_TARGET_WANTS)" && wants=sockets.target && $(add-wants)
+ where=$(systemunitdir) && what="$(TIMERS_TARGET_WANTS)" && wants=timers.target && $(add-wants)
+ where=$(systemunitdir) && what="$(SLICES_TARGET_WANTS)" && wants=slices.target && $(add-wants)
+ where=$(systemunitdir) && what="$(TIZEN_INIT_TARGET_WANTS)" && wants=tizen-init.target && $(add-wants)
+ where=$(systemunitdir) && what="$(TIZEN_BOOT_TARGET_WANTS)" && wants=tizen-boot.target && $(add-wants)
+ where=$(systemunitdir) && what="$(TIZEN_SYSTEM_TARGET_WANTS)" && wants=tizen-system.target && $(add-wants)
+ where=$(systemunitdir) && what="$(TIZEN_RUNTIME_TARGET_WANTS)" && wants=tizen-runtime.target && $(add-wants)
+ where=$(systemunitdir) && what="$(TIZEN_RUNTIME_TARGET_WANTS)" && wants=tizen-runtime.target && $(add-wants)
+ where=$(systemunitdir) && what="$(DEFAULT_TARGET_WANTS)" && wants=default.target && $(add-wants)
+ where=$(systemconfigunitdir) && what="$(SYSCONF_LOCAL_FS_TARGET_WANTS)" && wants=local-fs.target && $(add-wants)
+
+define add-wants
+[ -z "$$what" -o -z "$$where" ] || ( \
+ dir=$(DESTDIR)$$where/$$wants.wants && \
+ $(MKDIR_P) -m 0755 $$dir && \
+ cd $$dir && \
+ rm -f $$what && \
+ for i in $$what; do $(LN_S) ../$$i . || exit $$? ; done )
+endef
+
+INSTALL_EXEC_HOOKS += \
+ install-target-wants-hook
+
+# ------------------------------------------------------------------------------
+# AM_V_M4 = $(AM_V_M4_$(V))
+# AM_V_M4_ = $(AM_V_M4_$(AM_DEFAULT_VERBOSITY))
+# AM_V_M4_0 = @echo " M4 " $@;
+#
+# AM_V_XSLT = $(AM_V_XSLT_$(V))
+# AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
+# AM_V_XSLT_0 = @echo " XSLT " $@;
+#
+# AM_V_GPERF = $(AM_V_GPERF_$(V))
+# AM_V_GPERF_ = $(AM_V_GPERF_$(AM_DEFAULT_VERBOSITY))
+# AM_V_GPERF_0 = @echo " GPERF " $@;
+#
+# AM_V_LN = $(AM_V_LN_$(V))
+# AM_V_LN_ = $(AM_V_LN_$(AM_DEFAULT_VERBOSITY))
+# AM_V_LN_0 = @echo " LN " $@;
+
+# ------------------------------------------------------------------------------
+bin_SCRIPTS += \
+ scripts/change-booting-mode.sh \
+ scripts/tizen-boot.sh \
+ scripts/tizen-fstrim-on-charge.sh
+
+systemunit_DATA += \
+ units/check-mount.service \
+ units/tizen-generate-env.service \
+ units/tizen-readahead-collect.service \
+ units/tizen-readahead-collect-stop.service \
+ units/tizen-readahead-replay.service \
+ units/tizen-fstrim-user.service \
+ units/tizen-fstrim-user.timer \
+ units/tizen-init.target \
+ units/tizen-init-check.service \
+ units/tizen-initial-boot-done.service \
+ units/tizen-init-done.service
+
+systemdignoreunit_DATA += \
+ conf/systemd/ignore-units
+
+BASIC_TARGET_WANTS += \
+ tizen-generate-env.service \
+ tizen-init-check.service
+
+TIZEN_INIT_TARGET_WANTS += \
+ tizen-readahead-collect.service \
+ tizen-init-done.service
+
+TIZEN_SYSTEM_TARGET_WANTS += \
+ check-mount.service
+
+MULTI_USER_TARGET_WANTS += \
+ tizen-readahead-replay.service
+
+DEFAULT_TARGET_WANTS += \
+ tizen-fstrim-user.timer \
+ tizen-initial-boot-done.service
+
+if WITH_UDEVD_KILLER
+systemunit_DATA += \
+ units/systemd-udevd-kill.service \
+ units/systemd-udevd-kill.timer
+
+DEFAULT_TARGET_WANTS += \
+ systemd-udevd-kill.timer
+endif
+
+if WITH_WMREADY
+systemunit_DATA += \
+ units/wm_ready.service
+
+TIZEN_BOOT_TARGET_WANTS += \
+ wm_ready.service
+endif
+
+# ------------------------------------------------------------------------------
+substitutions = \
+ '|rootlibexecdir=$(rootlibexecdir)|' \
+ '|rootbindir=$(rootbindir)|' \
+ '|bindir=$(bindir)|' \
+ '|SYSTEMCTL=$(rootbindir)/systemctl|' \
+ '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \
+ '|systemdsysconfdir=$(systemdsysconfdir)|' \
+ '|SYSTEM_CONFIG_UNIT_PATH=$(systemdsysconfdir)/system|' \
+ '|USER_CONFIG_UNIT_PATH=$(systemdsysconfdir)/user|' \
+ '|pkgdatadir=$(pkgdatadir)|' \
+ '|systemunitdir=$(systemunitdir)|' \
+ '|userunitdir=$(userunitdir)|' \
+ '|systempresetdir=$(systempresetdir)|' \
+ '|userpresetdir=$(userpresetdir)|' \
+ '|udevhwdbdir=$(udevhwdbdir)|' \
+ '|udevrulesdir=$(udevrulesdir)|' \
+ '|catalogdir=$(catalogdir)|' \
+ '|tmpfilesdir=$(tmpfilesdir)|' \
+ '|sysctldir=$(sysctldir)|' \
+ '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
+ '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
+ '|PACKAGE_URL=$(PACKAGE_URL)|' \
+ '|RANDOM_SEED=$(localstatedir)/lib/random-seed|' \
+ '|prefix=$(prefix)|' \
+ '|exec_prefix=$(exec_prefix)|' \
+ '|libdir=$(libdir)|' \
+ '|includedir=$(includedir)|' \
+ '|VERSION=$(VERSION)|' \
+ '|rootprefix=$(rootprefix)|' \
+ '|udevlibexecdir=$(udevlibexecdir)|' \
+ '|SUSHELL=$(SUSHELL)|' \
+ '|DEBUGTTY=$(DEBUGTTY)|' \
+ '|KILL=$(KILL)|' \
+ '|KMOD=$(KMOD)|' \
+ '|MKDIR_P=$(MKDIR_P)|' \
+ '|QUOTAON=$(QUOTAON)|' \
+ '|QUOTACHECK=$(QUOTACHECK)|' \
+ '|SYSTEM_SYSVINIT_PATH=$(sysvinitdir)|' \
+ '|VARLOGDIR=$(varlogdir)|' \
+ '|RC_LOCAL_SCRIPT_PATH_START=$(RC_LOCAL_SCRIPT_PATH_START)|' \
+ '|RC_LOCAL_SCRIPT_PATH_STOP=$(RC_LOCAL_SCRIPT_PATH_STOP)|' \
+ '|PYTHON=$(PYTHON)|' \
+ '|PYTHON_BINARY=$(PYTHON_BINARY)|' \
+ '|INITAILBOOT_DONE=$(INITAILBOOT_DONE)|' \
+ '|INITIALIZE_DONE=$(INITIALIZE_DONE)|' \
+ '|READAHEAD_DIR=$(READAHEAD_DIR)|'
+
+SED_PROCESS = \
+ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
+ $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
+ < $< > $@
+
+units/%: units/%.in Makefile
+ $(SED_PROCESS)
+
+%.rules: %.rules.in Makefile
+ $(SED_PROCESS)
+
+%.sh: %.sh.in Makefile
+ $(SED_PROCESS)
+ $(AM_V_GEN)chmod +x $@
+
+units/%: units/%.m4 Makefile
+ $(AM_V_M4)$(MKDIR_P) $(dir $@)
+ $(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_SYSTEM=1 < $< > $@
+
+install-exec-hook: $(INSTALL_EXEC_HOOKS)
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/NEWS
diff --git a/README b/README
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/README
diff --git a/conf/systemd/ignore-units b/conf/systemd/ignore-units
new file mode 100644
index 0000000..df8bd62
--- /dev/null
+++ b/conf/systemd/ignore-units
@@ -0,0 +1,40 @@
+ac.service
+alarm-server.service
+boot-osp.service
+check-mount.service
+crash-daemon.service
+csc-starter.service
+dbus.service
+factory-pretest.service
+factory-reset.service
+immvibed.service
+indicator.service
+irsc_util.service
+launchpad-preload.service
+messagebus.service
+ode-server.service
+opt-usr-fsck.service
+osp-tmpdir-setup.service
+pkgmgr_recovery.service
+power_qcom_init.service
+pulseaudio.service
+qmuxd.service
+qseecom_ready.service
+recovery-update.service
+reset-verify.service
+rmt_storage.service
+samsung-secure-storage.service
+secure-storage.service
+security-server.service
+slp-pkgmgr.service
+smack-rules.service
+sound-server.service
+starter.service
+system-server.service
+tee-qsee.service
+telephony-daemon.service
+time.service
+trm.service
+wifi-module-check.service
+wm_ready.service
+wrt-security-daemon.service
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..499dcc2
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,194 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.68])
+AC_INIT(system-plugin-common, 0.0.01, [BUG-REPORT-ADDRESS])
+
+AC_CONFIG_MACRO_DIR([m4])
+AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
+AC_PREFIX_DEFAULT([/usr])
+AM_INIT_AUTOMAKE([foreign])
+
+# Checks for programs.
+AC_PROG_MKDIR_P
+AC_PROG_LN_S
+AC_PROG_SED
+AC_PROG_GREP
+AC_PROG_AWK
+#AC_PROG_INSTALL
+AC_PATH_PROG([M4], [m4])
+
+# ------------------------------------------------------------------------------
+AC_ARG_ENABLE([xattr],
+ AS_HELP_STRING([--disable-xattr],[Disable optional XATTR support]),
+ [case "${enableval}" in
+ yes) have_xattr=yes ;;
+ no) have_xattr=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --disable-xattr) ;;
+ esac],
+ [have_xattr=auto])
+
+if test "x${have_xattr}" != xno ; then
+ AC_CHECK_HEADERS(
+ [attr/xattr.h],
+ [have_xattr=yes],
+ [if test "x$have_xattr" = xyes ; then
+ AC_MSG_ERROR([*** XATTR headers not found.])
+ fi])
+
+ AC_CHECK_LIB(
+ [attr],
+ [fsetxattr],
+ [have_xattr=yes],
+ [if test "x$have_xattr" = xyes ; then
+ AC_MSG_ERROR([*** libattr not found.])
+ fi])
+
+ if test "x$have_xattr" = xyes ; then
+ XATTR_LIBS="-lattr"
+ AC_DEFINE(HAVE_XATTR, 1, [XATTR available])
+ else
+ have_xattr=no
+ fi
+else
+ XATTR_LIBS=
+fi
+AC_SUBST(XATTR_LIBS)
+AM_CONDITIONAL([HAVE_XATTR], [test "x$have_xattr" != xno])
+
+# ------------------------------------------------------------------------------
+AC_ARG_ENABLE([smack], AS_HELP_STRING([--disable-smack],[Disable optional SMACK support]),
+ [case "${enableval}" in
+ yes) have_smack=yes ;;
+ no) have_smack=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --disable-smack) ;;
+ esac],
+ [have_smack=auto])
+
+if test "x${have_xattr}" = xno; then
+ if test "x${have_smack}" = xyes; then
+ AC_MSG_ERROR(SMACK requires xattr support)
+ else
+ have_smack=no
+ fi
+else
+ if test "x${have_smack}" = xauto; then
+ have_smack=yes
+ fi
+fi
+
+if test "x${have_smack}" = xyes ; then
+ AC_DEFINE(HAVE_SMACK, 1, [Define if SMACK is available])
+fi
+
+# ------------------------------------------------------------------------------
+AC_ARG_WITH([rootprefix],
+ AS_HELP_STRING([--with-rootprefix=DIR],
+ [rootfs directory prefix for config files and kernel modules]),
+ [], [with_rootprefix=${ac_default_prefix}])
+AC_SUBST([rootprefix], [$with_rootprefix])
+
+# ------------------------------------------------------------------------------
+AC_ARG_ENABLE([wmready],
+ AS_HELP_STRING([--disable-wmready], [without window manager waiting]),
+ [case "${enableval}" in
+ yes) have_winmgr=yes ;;
+ no) have_winmgr=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --disable-wmready) ;;
+ esac],
+ have_winmgr=yes)
+AC_SUBST(WITH_WMREADY)
+AM_CONDITIONAL([WITH_WMREADY], [test "x$have_winmgr" != xno])
+
+# ------------------------------------------------------------------------------
+AC_ARG_ENABLE([engmode],
+ AS_HELP_STRING([--disable-engmode], [disable engineer mode]),
+ [case "${enableval}" in
+ yes) with_engmode=yes ;;
+ no) with_engmode=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --disable-engmode) ;;
+ esac],
+ with_engmode=no)
+AC_SUBST(WITH_ENGMODE)
+AM_CONDITIONAL([WITH_ENGMODE], [test "x$with_engmode" != xno])
+
+# ------------------------------------------------------------------------------
+AC_ARG_WITH(initial-boot,
+ AS_HELP_STRING([--with-initialbootdone=PATH],
+ [tizen system initial boot done]),
+ [INITAILBOOT_DONE="$withval"],
+ [INITAILBOOT_DONE="/opt/etc/.initialboot_done"])
+AC_SUBST(INITAILBOOT_DONE)
+
+AC_ARG_WITH(need-initialized,
+ AS_HELP_STRING([--with-initializedone=PATH],
+ [tizen system need initialized done]),
+ [INITIALIZE_DONE="$withval"],
+ [INITIALIZE_DONE="/opt/etc/.initialize_done"])
+AC_SUBST(INITIALIZE_DONE)
+
+# ------------------------------------------------------------------------------
+AC_ARG_WITH(tizen-readahead,
+ AS_HELP_STRING([--with-tizenreadaheaddir=PATH],
+ [tizen readahead dir]),
+ [READAHEAD_DIR="$withval"],
+ [READAHEAD_DIR="/opt/etc"])
+AC_SUBST(READAHEAD_DIR)
+
+# ------------------------------------------------------------------------------
+AC_ARG_ENABLE([udevd-killer],
+ AS_HELP_STRING([--enable-udevd-killer],
+ [install udevd killer service]),
+ [case "${enableval}" in
+ yes) enable_udevd_killer=yes ;;
+ no) enable_udevd_killer=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-udevd-killer) ;;
+ esac],
+ enable_udevd_killer=no)
+AC_SUBST(WITH_UDEVD_KILLER)
+AM_CONDITIONAL([WITH_UDEVD_KILLER], [test "x$enable_udevd_killer" != xno])
+
+# ------------------------------------------------------------------------------
+M4_DEFINES=
+AC_ARG_ENABLE([frequent-fstrim],
+ AS_HELP_STRING([--enable-frequent-fstrim],
+ [use more frequently fstrim timer]),
+ [case "${enableval}" in
+ yes) enable_frequent_fstrim=yes ;;
+ no) enable_frequent_fstrim=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-frequent-fstrim) ;;
+ esac],
+ enable_frequent_fstrim=no)
+if test "x$enable_frequent_fstrim" == "xyes"; then
+ M4_DEFINES="$M4_DEFINES -DWITH_FREQUENT_FSTRIM"
+fi
+AC_SUBST(M4_DEFINES)
+AC_SUBST(WITH_FREQUENT_FSTRIM)
+AM_CONDITIONAL([WITH_FREQUENT_FSTRIM], [test "x$enable_frequent_fstrim" != xno])
+
+# ------------------------------------------------------------------------------
+AC_CONFIG_FILES([Makefile])
+
+AC_OUTPUT
+AC_MSG_RESULT([
+ $PACKAGE_NAME $VERSION
+
+ engineer mode: ${with_engmode}
+
+ XATTR: ${have_xattr}
+ SMACK: ${have_smack}
+
+ window manager: ${have_winmgr}
+ udevd killer: ${enable_udevd_killer}
+ frequent fstrim: ${enable_frequent_fstrim}
+
+ prefix: ${prefix}
+ rootprefix: ${with_rootprefix}
+ sysconf dir: ${sysconfdir}
+ datarootdir: ${datarootdir}
+ lib dir: ${libdir}
+ rootlib dir: ${with_rootlibdir}
+ initial boot done flag: ${INITAILBOOT_DONE}
+ inialized done flag: ${INITIALIZE_DONE}
+])
diff --git a/packaging/system-plugin-common.manifest b/packaging/system-plugin-common.manifest
new file mode 100644
index 0000000..93c2194
--- /dev/null
+++ b/packaging/system-plugin-common.manifest
@@ -0,0 +1,12 @@
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+ <assign>
+ <filesystem path="/bin/*" label="_" exec_label="none" />
+ <filesystem path="/sbin/*" label="_" exec_label="none" />
+ <filesystem path="/usr/bin/*" label="_" exec_label="none" />
+ <filesystem path="/usr/sbin/*" label="_" exec_label="none" />
+ <filesystem path="/etc/rc.d/*" label="_" exec_label="none" />
+ </assign>
+</manifest>
diff --git a/packaging/system-plugin-common.spec b/packaging/system-plugin-common.spec
new file mode 100644
index 0000000..b94b675
--- /dev/null
+++ b/packaging/system-plugin-common.spec
@@ -0,0 +1,128 @@
+###########################
+# Default feature config. #
+###########################
+# SMACK
+%define WITH_SMACK 1
+# udev daemon killer unit
+%define WITH_UDEVD_KILLER 0
+# If window manager exist then waiting unit will be installed.
+%define WITH_WMREADY 1
+
+%define WITH_FREQUENT_FSTRIM 0
+
+%if "%{_repository}" == "wearable"
+%define WITH_FREQUENT_FSTRIM 1
+%endif
+
+%define _prefix_devel /opt/usr/devel
+
+Name: system-plugin-common
+Summary: system common file of system
+Version: 0.0.01
+Release: 1
+License: Apache License v2
+Group: System/Base
+ExclusiveArch: %arm
+Source: %{name}-%{version}.tar.gz
+Source1001: %{name}.manifest
+
+BuildRequires: autoconf
+BuildRequires: automake
+%if %{WITH_SMACK}
+BuildRequires: libacl-devel
+BuildRequires: smack-devel
+%endif
+
+Requires: e2fsprogs
+Requires: /bin/grep
+Requires: /usr/bin/awk
+Requires: psmisc
+Requires(post): coreutils
+
+%description
+Startup files
+
+%prep
+%setup -q
+
+%build
+cp %{SOURCE1001} .
+
+aclocal
+automake --add-missing
+autoconf
+%configure \
+ --prefix=%{_prefix} \
+%if 0%{?tizen_build_binary_release_type_eng:1}
+ --enable-engmode \
+%endif
+%if %{WITH_SMACK}
+ --enable-smack \
+%endif
+%if ! %{WITH_WMREADY}
+ --disable-wmready \
+%endif
+%if %{WITH_UDEVD_KILLER}
+ --enable-udevd-killer \
+%endif
+%if %{WITH_FREQUENT_FSTRIM}
+ --enable-frequent-fstrim \
+%endif
+
+make %{?_smp_mflags}
+
+%install
+%make_install
+
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/license
+cat LICENSE > $RPM_BUILD_ROOT%{_datadir}/license/%{name}
+
+%post
+touch %{_sysconfdir}/ld.so.nohwcap
+
+%files
+%defattr(-,root,root,-)
+%{_datadir}/license/%{name}
+%{_sysconfdir}/systemd/default-extra-dependencies/ignore-units
+%{_bindir}/change-booting-mode.sh
+%{_bindir}/tizen-boot.sh
+
+# systemd service units
+%{_libdir}/systemd/system/tizen-generate-env.service
+%{_libdir}/systemd/system/basic.target.wants/tizen-generate-env.service
+%if %{WITH_WMREADY}
+%{_libdir}/systemd/system/wm_ready.service
+%{_libdir}/systemd/system/tizen-boot.target.wants/wm_ready.service
+%endif
+%{_libdir}/systemd/system/check-mount.service
+%{_libdir}/systemd/system/tizen-system.target.wants/check-mount.service
+
+# system initialize units
+%{_libdir}/systemd/system/tizen-init.target
+%{_libdir}/systemd/system/tizen-init-check.service
+%{_libdir}/systemd/system/basic.target.wants/tizen-init-check.service
+%{_libdir}/systemd/system/tizen-init-done.service
+%{_libdir}/systemd/system/tizen-init.target.wants/tizen-init-done.service
+%{_libdir}/systemd/system/tizen-initial-boot-done.service
+%{_libdir}/systemd/system/default.target.wants/tizen-initial-boot-done.service
+
+# fstrim units
+%{_bindir}/tizen-fstrim-on-charge.sh
+%{_libdir}/systemd/system/default.target.wants/tizen-fstrim-user.timer
+%{_libdir}/systemd/system/tizen-fstrim-user.service
+%{_libdir}/systemd/system/tizen-fstrim-user.timer
+
+# readahead units
+%{_libdir}/systemd/system/tizen-readahead-collect.service
+%{_libdir}/systemd/system/tizen-readahead-collect-stop.service
+%{_libdir}/systemd/system/tizen-init.target.wants/tizen-readahead-collect.service
+%{_libdir}/systemd/system/tizen-readahead-replay.service
+%{_libdir}/systemd/system/multi-user.target.wants/tizen-readahead-replay.service
+
+# udev daemon killer
+%if %{WITH_UDEVD_KILLER}
+%{_libdir}/systemd/system/default.target.wants/systemd-udevd-kill.timer
+%{_libdir}/systemd/system/systemd-udevd-kill.service
+%{_libdir}/systemd/system/systemd-udevd-kill.timer
+%endif
+%manifest %{name}.manifest
diff --git a/scripts/change-booting-mode.sh b/scripts/change-booting-mode.sh
new file mode 100644
index 0000000..cf5a119
--- /dev/null
+++ b/scripts/change-booting-mode.sh
@@ -0,0 +1,105 @@
+#!/bin/sh
+#
+# Copyright 2010
+# Read the file COPYING
+#
+# Authors: Yeongil Jang
+#
+# Copyright Samsung Electronics
+#
+
+# print help message
+do_help()
+{
+ /bin/cat >&2 <<EOF
+change-booting-mode: usage:
+ -?/--help this message
+ --fota reboot for fota update (Firmware update On The Air)
+ --fus reboot for fus update (Firmware Update Service)
+ --update change system state for developer update
+EOF
+}
+
+# get and check specified options
+do_options()
+{
+ # note: default settings have already been loaded
+
+ while [ "$#" -ne 0 ]
+ do
+ arg=`/usr/bin/printf %s $1 | /bin/awk -F= '{print $1}'`
+ val=`/usr/bin/printf %s $1 | /bin/awk -F= '{print $2}'`
+ shift
+ if test -z "$val"; then
+ local possibleval=$1
+ /usr/bin/printf %s $1 "$possibleval" | /bin/grep ^- >/dev/null 2>&1
+ if test "$?" != "0"; then
+ val=$possibleval
+ if [ "$#" -ge 1 ]; then
+ shift
+ fi
+ fi
+ fi
+
+ case "$arg" in
+
+ --fota)
+ echo "Setting fota update mode" >&2
+ STATUS_DIR=/opt/data/recovery
+ DELTA_PATH_FILE=${STATUS_DIR}/DELTA.PATH
+ if [ ! -d ${STATUS_DIR} ]; then
+ echo ">> ${STATUS_DIR} does not exist. create one"
+ if [ -f ${STATUS_DIR} ]; then
+ /bin/rm -f ${STATUS_DIR}
+ fi
+ /bin/mkdir -p ${STATUS_DIR}
+ fi
+ echo $val > ${DELTA_PATH_FILE}
+ cmd="fota"
+ ;;
+ --fus)
+ echo "Setting fus update mode" >&2
+ cmd="download"
+ echo "kill mtp-ui, data-router" >> /opt/var/log/fus_update.log 2>&1
+ /usr/bin/killall mtp-ui >> /opt/var/log/fus_update.log 2>&1
+ /usr/bin/killall data-router >> /opt/var/log/fus_update.log 2>&1
+ /bin/umount /dev/gadget >> /opt/var/log/fus_update.log 2>&1
+ /sbin/lsmod >> /opt/var/log/fus_update.log 2>&1
+ /sbin/rmmod g_samsung >> /opt/var/log/fus_update.log 2>&1
+ ;;
+ --update)
+ echo "Setting update mode for engineers" >&2
+# echo 1 > /sys/power/noresume
+# touch /opt/etc/.hib_capturing # make fastboot image again on next booting
+ /bin/mount -o remount,rw /
+ if [ -f /usr/share/usr_share_locale.squash ]; then
+ /bin/umount -l /usr/share/locale
+ /bin/rm -rf /usr/share/locale
+ /usr/bin/unsquashfs -d /usr/share/locale /usr/share/usr_share_locale.squash
+ /bin/rm -rf /usr/share/usr_share_locale.squash
+ fi
+ exit
+ ;;
+ -?|--help)
+ do_help
+ exit 0
+ ;;
+ *)
+ echo "Unknown option \"$arg\". See --help" >&2
+ do_help
+ exit 0
+ ;;
+ esac
+ done
+}
+
+## main
+
+if test -z "$1"; then
+ do_help
+ exit 0
+fi
+
+do_options $@
+/bin/sync
+/sbin/reboot $cmd
diff --git a/scripts/tizen-boot.sh.in b/scripts/tizen-boot.sh.in
new file mode 100644
index 0000000..941afc1
--- /dev/null
+++ b/scripts/tizen-boot.sh.in
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+EMMC_DEVICE="/dev/mmcblk0"
+RET_PARTX=$(/usr/sbin/partx -s ${EMMC_DEVICE})
+ROOTFS_PART=${EMMC_DEVICE}p$(IFS=; echo $RET_PARTX | /bin/awk 'tolower($6) == "rootfs" {print $1}')
+SYSTEM_DATA_PART=${EMMC_DEVICE}p$(IFS=; echo $RET_PARTX | /bin/awk 'tolower($6) == "system-data" {print $1}')
+USER_PART=${EMMC_DEVICE}p$(IFS=; echo $RET_PARTX | /bin/awk 'tolower($6) == "user" {print $1}')
+CSC_PART=${EMMC_DEVICE}p$(IFS=; echo $RET_PARTX | /bin/awk 'tolower($6) == "csc" {print $1}')
+MODULES_PART=${EMMC_DEVICE}p$(IFS=; echo $RET_PARTX | /bin/awk 'tolower($6) == "module" {print $1}')
+
+TIZEN_LABEL="tizen"
+
+# rootfs partition
+PART_LABEL="$(/sbin/e2label $ROOTFS_PART)"
+if [ "z${PART_LABEL}" != "z${TIZEN_LABEL}" ]; then
+ /bin/mount -o remount,rw /
+ /sbin/resize2fs -f $ROOTFS_PART
+ /bin/mount -o remount,ro /
+ /sbin/e2label $ROOTFS_PART $TIZEN_LABEL
+fi
+
+# system-data partition
+PART_LABEL="$(/sbin/e2label $SYSTEM_DATA_PART)"
+if [ "z${PART_LABEL}" != "z${TIZEN_LABEL}" ]; then
+ /bin/grep "$SYSTEM_DATA_PART" /proc/mounts || /sbin/e2fsck -y -f "$SYSTEM_DATA_PART"
+ /sbin/resize2fs -f $SYSTEM_DATA_PART
+ if [ $? -ne 0 ]; then
+ /sbin/e2fsck -y -f $SYSTEM_DATA_PART
+ /sbin/resize2fs -f $SYSTEM_DATA_PART
+ fi
+ /sbin/e2label $SYSTEM_DATA_PART $TIZEN_LABEL
+fi
+
+# CSC partition
+PART_LABEL="$(/sbin/e2label $CSC_PART)"
+if [ "z${PART_LABEL}" != "z${TIZEN_LABEL}" ]; then
+ /bin/grep "$CSC_PART" /proc/mounts || /sbin/e2fsck -y -f "$CSC_PART"
+ /sbin/resize2fs -f $CSC_PART
+ if [ $? -ne 0 ]; then
+ /sbin/e2fsck -y -f $CSC_PART
+ /sbin/resize2fs -f $CSC_PART
+ fi
+ /sbin/e2label $CSC_PART $TIZEN_LABEL
+fi
+
+# user partition
+PART_LABEL="$(/sbin/e2label $USER_PART)"
+if [ "z${PART_LABEL}" != "z${TIZEN_LABEL}" ]; then
+ /bin/grep "$USER_PART" /proc/mounts || /sbin/e2fsck -y -f "$USER_PART"
+ /sbin/resize2fs -f $USER_PART
+ if [ $? -ne 0 ]; then
+ /sbin/e2fsck -y -f $USER_PART
+ /sbin/resize2fs -f $USER_PART
+ fi
+ /sbin/e2label $USER_PART $TIZEN_LABEL
+fi
+
+# Mount system-data(/opt) partition.
+if [ "z$SYSTEM_DATA_PART" != "z${EMMC_DEVICE}p" ]; then
+ CHECK_ERR=`/sbin/dumpe2fs $SYSTEM_DATA_PART | /bin/grep "Filesystem state" | /bin/grep "error"`
+ if [ "z$CHECK_ERR" != "z" ]; then
+ /sbin/e2fsck -y -f $SYSTEM_DATA_PART
+ fi
+ /bin/mount -t ext4 $SYSTEM_DATA_PART /opt -o errors=panic,nosuid
+ # If /opt partition is not mounted by crashing file system,
+ # then check partition using e2fsck and re-mount it.
+ if [ $? -ne 0 ]; then
+ /sbin/e2fsck -y -f $SYSTEM_DATA_PART
+ /bin/mount -t ext4 $SYSTEM_DATA_PART /opt -o errors=panic,nosuid
+ fi
+fi
+
+# Mount modules(/lib/modules) partition.
+if [ "z$MODULES_PART" != "z${EMMC_DEVICE}p" ]; then
+ /bin/mount -t ext4 $MODULES_PART /lib/modules -o ro &
+fi
diff --git a/scripts/tizen-fstrim-on-charge.sh b/scripts/tizen-fstrim-on-charge.sh
new file mode 100644
index 0000000..2ee30eb
--- /dev/null
+++ b/scripts/tizen-fstrim-on-charge.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+if [ "$#" -ne 1 ];then
+ echo "Argument was missed."
+ exit 1
+fi
+
+CHARGE_NOW_FILE=`/usr/bin/find /sys/devices -path */power_supply/battery/charge_now`
+if [ "x$CHARGE_NOW_FILE" == "x" ]; then
+ echo "Can not find 'charge_now'."
+ exit 1
+else
+ CHARGE_NOW_VALUE=`/bin/cat $CHARGE_NOW_FILE`
+fi
+
+if [ "$CHARGE_NOW_VALUE" -gt 0 ];then
+ /sbin/fstrim $*
+else
+ exit 1
+fi
diff --git a/units/check-mount.service b/units/check-mount.service
new file mode 100644
index 0000000..9eede2a
--- /dev/null
+++ b/units/check-mount.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Check Mount
+ConditionPathIsMountPoint=!/opt/usr
+After=tizen-boot.target starter.service
+Requires=tizen-boot.target
+Before=tizen-system.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c 'while [ "z`/bin/grep /opt/usr /proc/mounts`" == "z" ]; do /bin/sleep 0.5; done'
+ExecStartPost=/bin/sleep 3
+
+[Install]
+WantedBy=tizen-system.target
diff --git a/units/systemd-udevd-kill.service b/units/systemd-udevd-kill.service
new file mode 100644
index 0000000..609d0f4
--- /dev/null
+++ b/units/systemd-udevd-kill.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Stop systemd-udevd service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/systemctl stop systemd-udevd.service
+ExecStartPost=/usr/bin/systemctl stop systemd-udevd-control.socket
+ExecStartPost=/usr/bin/systemctl stop systemd-udevd-kernel.socket
diff --git a/units/systemd-udevd-kill.timer b/units/systemd-udevd-kill.timer
new file mode 100644
index 0000000..85624e7
--- /dev/null
+++ b/units/systemd-udevd-kill.timer
@@ -0,0 +1,9 @@
+[Unit]
+Description=Stop systemd-udevd 30s After Completed Startup
+DefaultDependencies=no
+Conflicts=shutdown.target
+After=default.target
+Before=shutdown.target
+
+[Timer]
+OnActiveSec=30s
diff --git a/units/tizen-fstrim-user.service b/units/tizen-fstrim-user.service
new file mode 100644
index 0000000..d92f210
--- /dev/null
+++ b/units/tizen-fstrim-user.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Discard unused blocks on user partition
+Requires=opt-usr.mount
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/tizen-fstrim-on-charge.sh /opt/usr
diff --git a/units/tizen-fstrim-user.timer.m4 b/units/tizen-fstrim-user.timer.m4
new file mode 100644
index 0000000..8ebabf3
--- /dev/null
+++ b/units/tizen-fstrim-user.timer.m4
@@ -0,0 +1,8 @@
+[Unit]
+Description=Timer for tizen-fstrim
+
+[Timer]
+m4_ifdef(`WITH_FREQUENT_FSTRIM',
+`OnBootSec=30
+OnUnitActiveSec=3h',
+`OnCalendar=*-*-* 06:00:00')
diff --git a/units/tizen-generate-env.service b/units/tizen-generate-env.service
new file mode 100644
index 0000000..ae5bc98
--- /dev/null
+++ b/units/tizen-generate-env.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Generate environment from /etc/profile.d
+DefaultDependencies=no
+After=opt.mount
+Before=basic.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/env -i sh -c 'source /etc/profile; env | /bin/egrep -v "^(HOME|PWD|SHLVL|_)=" > /run/tizen-mobile-env'
+
+[Install]
+WantedBy=basic.target
diff --git a/units/tizen-init-check.service.in b/units/tizen-init-check.service.in
new file mode 100644
index 0000000..31ec3ca
--- /dev/null
+++ b/units/tizen-init-check.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=Tizen Initialized check
+DefaultDependencies=no
+After=opt.mount
+Before=tizen-init-done.service tizen-initial-boot-done.service
+ConditionPathExists=@INITAILBOOT_DONE@
+ConditionPathExists=!@INITIALIZE_DONE@
+RefuseManualStart=yes
+
+[Service]
+ExecStart=/usr/bin/systemctl start tizen-init.target
diff --git a/units/tizen-init-done.service.in b/units/tizen-init-done.service.in
new file mode 100644
index 0000000..df4c5c1
--- /dev/null
+++ b/units/tizen-init-done.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=Tizen initialized flag done
+After=default.target
+ConditionPathExists=!@INITIALIZE_DONE@
+RefuseManualStart=yes
+
+[Service]
+ExecStart=/bin/touch @INITIALIZE_DONE@
+
+[Install]
+WantedBy=tizen-init.target
diff --git a/units/tizen-init.target b/units/tizen-init.target
new file mode 100644
index 0000000..8c7ce15
--- /dev/null
+++ b/units/tizen-init.target
@@ -0,0 +1,5 @@
+[Unit]
+Description=Tizen Initialization
+Conflicts=emergency.service emergency.target
+Wants=local-fs.target swap.target
+After=local-fs.target swap.target emergency.service emergency.target
diff --git a/units/tizen-initial-boot-done.service.in b/units/tizen-initial-boot-done.service.in
new file mode 100644
index 0000000..7e8ae55
--- /dev/null
+++ b/units/tizen-initial-boot-done.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=Tizen initial boot flag generate
+After=default.target
+ConditionPathExists=!@INITAILBOOT_DONE@
+RefuseManualStart=yes
+
+[Service]
+ExecStart=/bin/touch @INITAILBOOT_DONE@
+
+[Install]
+WantedBy=default.target
diff --git a/units/tizen-readahead-collect-stop.service b/units/tizen-readahead-collect-stop.service
new file mode 100644
index 0000000..fd59c5f
--- /dev/null
+++ b/units/tizen-readahead-collect-stop.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Stop Collecting Read-Ahead Data
+After=tizen-readahead-collect.service boot-animation.service
+Before=tizen-system.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/systemctl stop tizen-readahead-collect.service
diff --git a/units/tizen-readahead-collect.service.in b/units/tizen-readahead-collect.service.in
new file mode 100644
index 0000000..bec9d73
--- /dev/null
+++ b/units/tizen-readahead-collect.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=Collect Read-Ahead Data
+DefaultDependencies=no
+Conflicts=shutdown.target
+After=smack.service smack_pre_labeling_priv.service tizen-readahead-replay.service
+Before=sysinit.target shutdown.target
+Wants=tizen-readahead-collect-stop.service
+ConditionPathExists=!@READAHEAD_DIR@/.readahead
+
+[Service]
+Type=notify
+ExecStart=/usr/lib/systemd/systemd-readahead collect --savedir=@READAHEAD_DIR@
+RemainAfterExit=yes
+StandardOutput=null
+
+[Install]
+WantedBy=tizen-init.target
diff --git a/units/tizen-readahead-replay.service.in b/units/tizen-readahead-replay.service.in
new file mode 100644
index 0000000..fa6e9f4
--- /dev/null
+++ b/units/tizen-readahead-replay.service.in
@@ -0,0 +1,16 @@
+[Unit]
+Description=Replay Read-Ahead Data
+DefaultDependencies=no
+Conflicts=shutdown.target
+After=smack.service smack_pre_labeling_priv.service
+Before=sysinit.target shutdown.target
+ConditionPathExists=@READAHEAD_DIR@/.readahead
+
+[Service]
+Type=notify
+ExecStart=/usr/lib/systemd/systemd-readahead replay --savedir=@READAHEAD_DIR@
+RemainAfterExit=yes
+StandardOutput=null
+
+[Install]
+WantedBy=multi-user.target
diff --git a/units/wm_ready.service b/units/wm_ready.service
new file mode 100644
index 0000000..d8c182f
--- /dev/null
+++ b/units/wm_ready.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=waiting for window mananger
+After=xorg.service
+Before=tizen-boot.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c 'while [ ! -e /tmp/.wm_ready ]; do sleep 0.1 ; done'
+
+[Install]
+WantedBy=tizen-boot.target