summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjy910.yun <jy910.yun@samsung.com>2014-02-19 16:30:23 +0900
committerjy910.yun <jy910.yun@samsung.com>2014-02-19 16:31:27 +0900
commit76dae1ddbf8632f7572ac923c25bb2b9f05c434d (patch)
tree33c269d8f6f55a6a241d43b9b030408b6e33a278
parentf7397fd87b651e8bdc554bf757a60c21f9af5904 (diff)
parentd5b7e1dac8bbc1b4cc8228e9b21bd1def4060163 (diff)
downloadsystem-plugin-mount-accepted/tizen/mobile.tar.gz
system-plugin-mount-accepted/tizen/mobile.tar.bz2
system-plugin-mount-accepted/tizen/mobile.zip
Merge remote-tracking branch 'tizen_2.2/tizen_2.2' into tizensubmit/tizen/20140219.075608accepted/tizen/mobile/20140224.101642accepted/tizen/mobile
Change-Id: Iaba1c934183a8aba3a58b6d05c736e650a1d1f5e
-rw-r--r--CMakeLists.txt3
-rw-r--r--LICENSE204
-rw-r--r--NOTICE1
-rwxr-xr-xbin/check-booting-mode.sh13
-rwxr-xr-xetc/fstab15
-rw-r--r--etc/fta_version.txt2
-rwxr-xr-xetc/inittab28
-rwxr-xr-xetc/mtools.conf66
-rwxr-xr-xetc/rc.d/rc.firstboot26
-rwxr-xr-xetc/rc.d/rc.shutdown25
-rwxr-xr-xetc/rc.d/rc.sysinit193
-rwxr-xr-xmount-generator.pl81
-rwxr-xr-xpackaging/system-plugin-slp.spec62
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/with-dev-root-do.c115
-rwxr-xr-xusr/bin/save_blenv49
-rwxr-xr-xusr/lib/systemd/system/resize2fs-root.service16
-rwxr-xr-xusr/lib/systemd/system/resize2fs@.service14
18 files changed, 918 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..c920d57
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project (system-plugin-slp)
+add_subdirectory(src)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..a06208b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+ 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/NOTICE b/NOTICE
new file mode 100644
index 0000000..ded3804
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. \ No newline at end of file
diff --git a/bin/check-booting-mode.sh b/bin/check-booting-mode.sh
new file mode 100755
index 0000000..4ec61dc
--- /dev/null
+++ b/bin/check-booting-mode.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+# Checking special mode booting.
+# * Charging mode: Turn the phone on with the charger connection.
+# * FOTA mode: Firmware update On-The-Air
+#
+
+for i in `/bin/cat /proc/cmdline` ; do
+ echo $i
+ if [ "$i" = "charger_detect_boot" ] || [ "$i" = "fota_update_boot" ]; then
+ exit 0
+ fi
+done
+exit 1
diff --git a/etc/fstab b/etc/fstab
new file mode 100755
index 0000000..99cf69f
--- /dev/null
+++ b/etc/fstab
@@ -0,0 +1,15 @@
+#<file system> <mount point> <type> <options> <dump> <pass>
+none /proc proc defaults 0 0
+#none /dev/pts devpts mode=0622 0 0
+tmpfs /tmp tmpfs defaults 0 0
+/opt/var /var bind bind 0 0
+none /sys sysfs defaults 0 0
+
+# For new partition - 2012/08
+/dev/mmcblk0p1 /csa ext4 defaults 0 2
+/dev/mmcblk0p2 /boot ext4 defaults 0 2
+/dev/mmcblk0p4 /mnt/csc ext4 defaults,noauto 0 2
+/dev/mmcblk0p5 / ext4 defaults 0 1
+/dev/mmcblk0p6 /opt ext4 defaults 0 2
+/dev/mmcblk0p7 /opt/usr ext4 defaults 0 2
+/boot/modules.img /lib/modules ext4 loop 0 0
diff --git a/etc/fta_version.txt b/etc/fta_version.txt
new file mode 100644
index 0000000..0a7cc87
--- /dev/null
+++ b/etc/fta_version.txt
@@ -0,0 +1,2 @@
+FTA HW VERSION : REV0.0
+FTA SW VERSION : TRAST.001
diff --git a/etc/inittab b/etc/inittab
new file mode 100755
index 0000000..300c9e5
--- /dev/null
+++ b/etc/inittab
@@ -0,0 +1,28 @@
+#System startup
+si::sysinit:/etc/rc.d/rc.sysinit
+net::once:/etc/rc.d/rc.network
+
+id:1:initdefault:
+
+# Console
+#ttyS0::respawn:/bin/sh
+#command was changed from getty in busybox to agetty in coreutils
+con:12345:respawn:/sbin/agetty -L 115200 ttySAC2 vt100
+#::askfirst:/bin/sh
+
+#Logging , move to rc.sysinit
+#::sysinit:/bin/cp -rf /var/log/messages /var/log/messages.prev
+#::sysinit:/bin/cp -rf /var/log/messages.0 /var/log/messages.0.prev
+#::sysinit:/bin/touch /var/log/messages
+#::once:/sbin/syslogd
+#::once:/sbin/klogd
+
+#System shutdown
+#ca:12345:ctrlaltdel:/sbin/reboot
+bye:06:wait:/etc/rc.d/rc.shutdown
+rebt:6:wait:/sbin/reboot -d -f -i
+
+# Frambuffer Console
+#ttyS1::respawn:/bin/sh
+#tty1::respawn:/bin/sh
+#tty2::respawn:/bin/sh
diff --git a/etc/mtools.conf b/etc/mtools.conf
new file mode 100755
index 0000000..3cf0aa7
--- /dev/null
+++ b/etc/mtools.conf
@@ -0,0 +1,66 @@
+# Example mtools.conf files. Uncomment the lines which correspond to
+# your architecture and comment out the "SAMPLE FILE" line below
+# SAMPLE FILE
+
+# # Linux floppy drives
+# drive a: file="/dev/fd0" exclusive
+# drive b: file="/dev/fd1" exclusive
+
+# # First SCSI hard disk partition
+# drive c: file="/dev/sda1"
+
+# # First IDE hard disk partition
+# drive c: file="/dev/hda1"
+
+# # dosemu floppy image
+# drive m: file="/var/lib/dosemu/diskimage"
+
+# # dosemu hdimage
+# drive n: file="/var/lib/dosemu/diskimage" offset=3840
+
+# # Atari ramdisk image
+# drive o: file="/tmp/atari_rd" offset=136
+
+# # ZIP disk for Solaris:
+# Drive X is ZIP-100 at target 5
+# drive X: file="/dev/rdsk/c0t5d0s2" partition=4 scsi=1 nodelay
+
+# # ZIP disk for SunOS:
+# # Zip drive is at target 5, which default kernel calls tape st1 !!
+# drive Y: file="/dev/rsd5c" partition=4 scsi=1 nodelay
+
+# # autoselect zip drive/floppy on HP-UX 9/10
+# drive a: file="/dev/rdsk/c201d5" exclusive partition=4
+# drive a: file="/dev/rdsk/c201d5s0" exclusive partition=4
+# drive a: file="/dev/rfloppy/c201d0s0" exclusive
+
+# A/UX target 5 on 1st scsi bus jaz or zip
+# drive X: file="/dev/rdsk/c105d0s31" partition=4
+
+
+# Some examples for BeOS.
+# floppy drive. hardcoded in devices.c, so no real need to define it here
+#drive a: file="/dev/floppy_disk" exclusive
+# ZIP drive on SCSI ID 6
+#drive z: file="/dev/scsi_disk_060" offset=16384 fat_bits=16
+
+# SCO Unix 3.2v4
+# # Floppy disk drives
+#
+# drive a: file="/dev/install" exclusive
+# drive b: file="/dev/install1" exclusive
+#
+# # SCSI hard disk partitions
+#
+# drive c: file="/dev/dsk/0sC"
+# drive d: file="/dev/dsk/0sD"
+# drive e: file="/dev/dsk/0sE"
+drive f: file="/dev/mmcblk0p1"
+# drive g: file="/dev/dsk/0sG"
+# drive h: file="/dev/dsk/0sH"
+
+mtools_skip_check=1
+
+# # uncomment the following line to display all file names in lower
+# # case by default
+# mtools_lower_case=1
diff --git a/etc/rc.d/rc.firstboot b/etc/rc.d/rc.firstboot
new file mode 100755
index 0000000..6c7edc2
--- /dev/null
+++ b/etc/rc.d/rc.firstboot
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+#/sbin/ldconfig -f /opt/etc/ld.so.conf -C /opt/etc/ld.so.cache
+/sbin/ldconfig
+
+# for /etc/.info/system.info
+/bin/sysinfo
+
+#Check machine is SLP7_C210
+MACHINE=`grep Hardware /proc/cpuinfo|cut -d ":" -f 2|tr -d " "`
+if [ $MACHINE == "SLP7_C210" ];then
+ ln -s /opt/etc/X11/xorg.conf.d.slp7 /opt/etc/X11/xorg.conf.d
+else
+ #Check machine is SLP10_C210
+ if [ $MACHINE == "SLP10_C210" ];then
+ ln -s /opt/etc/X11/xorg.conf.d.slp10 /opt/etc/X11/xorg.conf.d
+ else
+ ln -s /opt/etc/X11/xorg.conf.d.default /opt/etc/X11/xorg.conf.d
+ fi
+fi
+
+
+if [ -e /opt/system/csc/.factoryreset ]; then
+ rm -f /opt/system/csc/.factoryreset
+fi
+sync
diff --git a/etc/rc.d/rc.shutdown b/etc/rc.d/rc.shutdown
new file mode 100755
index 0000000..274baa1
--- /dev/null
+++ b/etc/rc.d/rc.shutdown
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+export DISPLAY=:0
+killall power_manager
+killall -9 udevd
+#killall -9 system_server
+killall -9 xinit
+
+rm -rf /tmp/vip/*
+rm -rf /tmp/permanent/*
+
+echo "Run Shutdown animation..."
+nice -n -15 /usr/bin/boot-animation --offmsg " " --clear &
+sleep 1
+
+echo "Stopping indicator..."
+killall -9 indicator
+
+# factory resetting...
+# flag set by factory-reset.sh
+if [ -f /opt/.factoryreset ]; then
+ /usr/bin/run-factory-reset.sh
+fi
+
+
diff --git a/etc/rc.d/rc.sysinit b/etc/rc.d/rc.sysinit
new file mode 100755
index 0000000..ee2c286
--- /dev/null
+++ b/etc/rc.d/rc.sysinit
@@ -0,0 +1,193 @@
+#!/bin/sh
+
+# Color set for ANSI TERM
+_R='\033[0;31;1m' #Red
+_G='\033[0;32;1m' #Green
+_Y='\033[0;33;1m' #Yellow
+C_='\033[0m' #Color off
+
+
+echo -e "[${_G}rc.sysinit : script starts${C_}]"
+echo -e "[${_G}mount...${C_}]"
+mount -t proc none /proc
+mount -t tmpfs tmpfs /tmp
+mount -t sysfs none /sys
+mount -t tmpfs runfs /run
+mkdir -p /dev/pts
+mkdir -p /dev/shm
+mount -t tmpfs none /dev/shm
+mount -t devpts devpts /dev/pts
+mount -t debugfs none /sys/kernel/debug
+
+mknod /dev/null c 1 3
+mknod /dev/mmcblk0 b 179 0
+mknod /dev/mmcblk0p6 b 179 6
+
+# mount opt partition
+mount -t ext4 /dev/mmcblk0p6 /opt
+
+echo -e "[${_G}udev start${C_}]"
+/sbin/udevd --daemon
+/sbin/udevadm trigger
+
+if [ ! -e /opt/etc/.firstboot ]; then
+ umount /opt
+# find rootfs partition for resizing and remounting
+ for param in `cat /proc/cmdline`; do
+ if [ "${param:0:5}" = "root=" ]; then
+ rootfs_part=${param#root=}
+ break
+ fi
+ done
+ ext4_parts=`grep ext4 /etc/fstab | grep mmcblk0 | awk '{print $1};'`
+ for part in $ext4_parts; do
+# check all RW partitions in order to resize it withtout mounting excepting rootfs.
+ if [ "$part" != "$rootfs_part" ]; then
+ e2fsck -y -f $part
+ fi
+ echo "resize $part"
+ resize2fs $part
+ done
+
+ mount -t ext4 /dev/mmcblk0p6 /opt
+ echo -e "[${_Y}rc.firstboot${C_}]"
+ /etc/rc.d/rc.firstboot
+ touch /opt/etc/.firstboot
+ sync
+fi
+
+mount /var
+
+# check special booting mode.
+/bin/check-booting-mode.sh
+if [ $? -eq 0 ]; then
+ echo -e "${_R}[ Special Booting mode ]${C_}"
+ for i in /etc/rc.d/rc2.d/*; do
+ echo -e "${_G}[${i} start]${C_}"
+ $i start
+ done
+ exit 0
+fi
+
+# mount all partitions
+mount -a
+mount --bind /run/ /var/run/
+
+echo -e "[${_G}create base directory in /opt, /var${C_}]"
+# construct directory hierarchy
+mkdir -p /opt/var/log/apt
+mkdir -p /opt/var/lib
+mkdir -p /opt/var/cache
+
+
+echo -e "[${_G}set device node perm & security${C_}]"
+# Set device node permissions for security
+chown 0:6501 /dev/video1
+chown 0:6501 /dev/s3c-jpg
+#chmod 666 /dev/pvrsrvkm
+chown 0:6509 /dev/log_main
+chown 0:6509 /dev/log_events
+chown 0:6509 /dev/log_radio
+chown :audio /dev/snd/
+chmod 775 /dev/snd/
+chown :audio /dev/snd/controlC0
+chown :audio /dev/snd/pcmC0D0p
+chown :audio /dev/snd/pcmC0D1p
+chown :audio /dev/snd/pcmC0D2p
+chown :audio /dev/snd/pcmC0D3p
+chown :audio /dev/snd/timer
+chown 0:6508 /dev/snd/pcmC0D0c
+chown 0:6508 /dev/snd/pcmC0D1c
+chown 0:6508 /dev/snd/pcmC0D2c
+chown 0:6508 /dev/snd/pcmC0D3c
+chown 0:6510 /dev/s3c-mfc
+chown 0:6510 /dev/video5
+chown 0:6510 /dev/video6
+chmod 666 /dev/random
+chmod 666 /dev/urandom
+chown :video /dev/fb0
+chown :video /dev/video0
+chown :video /dev/video2
+chown :video /dev/video3
+chown :video /dev/s3c-mem
+chown :6512 /dev/radio0
+chown :6702 /sys/class/backlight/*/brightness
+# change node's owner for torch light
+chown :6703 /sys/class/leds/leds-torch/brightness
+chmod 664 /sys/class/backlight/*/brightness
+# change files permission for 3D application
+chmod 666 /dev/ump
+chmod 666 /dev/mali
+chmod 666 /dev/slp_global_lock
+
+# Set gst-openmax configure file
+export OMX_CONFIG=/opt/etc/gst-openmax.conf
+
+echo -e "[${_G}make gstreamer registery${C_}]"
+# Make gst registry
+export GST_REGISTRY=/opt/etc/.gstreamer-0.10/registry.bin.arm
+gst-inspect 1> /dev/null
+chmod 655 /opt/etc/.gstreamer-0.10
+chmod 644 /opt/etc/.gstreamer-0.10/registry.bin.arm
+
+# Modem power on
+echo -e "[${_Y}modem power on${C_}]"
+ln -s /boot/modem.bin /modem/modem.bin
+/usr/bin/xmm6262-boot &
+
+#touch sensor start
+echo 1 > /sys/class/i2c-adapter/i2c-2/2-004a/touchstart
+
+echo -e "[${_G}run profile${C_}]"
+# Run profile
+. /etc/profile
+
+if [ -e /opt/etc/.debugmode ]; then
+ echo "debug mode enabled"
+ # for bluescreen
+ export LD_PRELOAD=/usr/lib/libsys-assert.so
+ # enable coredump
+ echo "/opt/bs/core/core.%p" > /proc/sys/kernel/core_pattern
+ ulimit -c unlimited
+else
+ echo "debug mode disabled"
+fi
+
+/usr/bin/press 1 # wait input to stop running scripts
+if [ $? -eq 0 ]; then
+ echo "script is stopped"
+ # prepare usbnet before exit
+ insmod /usr/driver/g_ether.ko
+ sleep 1
+ ifconfig usb0 192.168.129.3 netmask 255.255.255.0
+ # Run all rc0 scripts
+ for i in /etc/rc.d/rc0.d/*; do
+ echo -e "[${_G}${i} start${C_}]"
+ $i start
+ done
+else
+ # Run all rc3 scripts
+ echo -e "[${_G}run all rc3 scripts${C_}]"
+ echo "normal boot"
+ for i in /etc/rc.d/rc3.d/*; do
+ echo -e "[${_G}${i} start${C_}]"
+ $i start
+ done
+fi
+
+# change owner and group about /opt/media directory
+chown 5000:5000 /opt/media
+
+echo -e "[${_G}set cpufreq governor${C_}]"
+# Set default cpufreq governor
+echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+
+# symbolic link
+if [ ! -e /opt/apps ]; then
+ echo -e "[${_G}link /opt/apps -> /opt/media/apps${C_}]"
+ ln -s /opt/media/apps /opt/apps
+fi
+
+# inhouse home-directory
+chown 5000:5000 /home/inhouse
+
diff --git a/mount-generator.pl b/mount-generator.pl
new file mode 100755
index 0000000..4e118a9
--- /dev/null
+++ b/mount-generator.pl
@@ -0,0 +1,81 @@
+#!/usr/bin/perl -w
+#
+# Generate systemd mount units based on information from fstab file.
+#
+# Copyright (C) 2012 Samsung Electronics
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# version 2 as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Łukasz Stelmach <l.stelmach@samsung.com>
+#
+use strict;
+use Cwd 'abs_path';
+
+my $out_dir = pop @ARGV;
+my ($fs_dev, $fs_dir, $fs_type, $fs_opts, $fs_dump, $fs_pass);
+
+sub name_from_path($) {
+ my $dev=shift;
+ $dev =~ s:/+:-:g;
+
+ if ($dev=~m/^-$/) {
+ return $dev;
+ }
+
+ $dev =~ s/^-|-$//g;
+ return $dev;
+}
+
+while(<>) {
+ chomp;
+ ($fs_dev, $fs_dir, $fs_type, $fs_opts, $fs_dump, $fs_pass)=split;
+ next unless ($fs_dev=~m/mmcblk/);
+ next unless ($fs_type=~m/ext[234]/);
+
+ my $fs_tab=abs_path $ARGV;
+ my $unit_name=$out_dir ."/". name_from_path($fs_dir) . ".mount";
+ my $devname=name_from_path $fs_dev;
+ my ($after,$req,$wants);
+ if ($fs_dir eq "/") {
+ $after = "fsck-root.service resize2fs-root.service";
+ $req = "fsck-root.service";
+ $wants = "resize2fs-root.service";
+ } else {
+ $after = "fsck\@$devname.service resize2fs\@$devname.service";
+ $req = "fsck\@$devname.service";
+ $wants = "resize2fs\@$devname.service";
+ }
+
+ my $unit=<<EOF;
+# Automaticall generated by mount-generator.pl
+
+[Unit]
+# FIXME: Is this required?
+#SourcePath=$fs_tab
+DefaultDependencies=no
+Before=local-fs.target
+Requires=$req
+After=local-fs-pre.target $after
+Wants=$wants
+
+[Mount]
+What=$fs_dev
+Where=$fs_dir
+Type=$fs_type
+Options=$fs_opts
+EOF
+ open (UNIT, ">", $unit_name) || die $!;
+ print UNIT $unit,"\n";
+ close UNIT;
+}
diff --git a/packaging/system-plugin-slp.spec b/packaging/system-plugin-slp.spec
new file mode 100755
index 0000000..f9f03dd
--- /dev/null
+++ b/packaging/system-plugin-slp.spec
@@ -0,0 +1,62 @@
+Name: system-plugin-slp
+Summary: system-plugin for Clean SDK
+Version: 0.0.1
+License: Apache-2.0
+Group: System/Base
+Release: 62
+ExclusiveArch: %arm
+Source: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: perl
+BuildRequires: pkgconfig(libudev)
+Requires: udev
+Requires: sysvinit
+
+%description
+Startup files
+
+%prep
+%setup -q
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DSYSCONFDIR=%{_sysconfdir}
+make %{?_smp_mflags}
+./mount-generator.pl etc/fstab usr/lib/systemd/system
+
+%install
+%make_install
+
+cp -a etc usr bin %{buildroot}
+
+mkdir -p %{buildroot}/usr/lib/systemd/system/local-fs.target.wants
+for mount in usr/lib/systemd/system/*.mount; do
+ if grep -q '^Options[[:space:]]*=.*noauto' $mount; then continue; fi
+ m=$(basename $mount)
+ ln -s ../$m %{buildroot}/usr/lib/systemd/system/local-fs.target.wants/$m
+done
+mkdir -p %{buildroot}/%{_libdir}/systemd/system/local-fs.target.wants
+ln -s ../resize2fs-root.service %{buildroot}/%{_libdir}/systemd/system/local-fs.target.wants
+
+mkdir -p %{buildroot}/lib/modules
+
+mkdir -p %{buildroot}/usr/share/license
+cp -f LICENSE %{buildroot}/usr/share/license/%{name}
+
+%files
+/bin/with-dev-root-do
+/etc/fstab
+/etc/fta_version.txt
+/etc/inittab
+/etc/mtools.conf
+/etc/rc.d/rc.firstboot
+/etc/rc.d/rc.shutdown
+/etc/rc.d/rc.sysinit
+/usr/bin/save_blenv
+/bin/check-booting-mode.sh
+/usr/lib/systemd/system/resize2fs-root.service
+/usr/lib/systemd/system/resize2fs@.service
+/usr/lib/systemd/system/*.mount
+/usr/lib/systemd/system/local-fs.target.wants/*.mount
+/usr/lib/systemd/system/local-fs.target.wants/resize2fs-root.service
+/lib/modules
+/usr/share/license/%{name}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..d7e0452
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,5 @@
+INCLUDE(FindPkgConfig)
+pkg_search_module(libudev REQUIRED libudev)
+add_executable(with-dev-root-do with-dev-root-do.c)
+target_link_libraries(with-dev-root-do ${libudev_LIBRARIES})
+install(PROGRAMS with-dev-root-do DESTINATION /bin)
diff --git a/src/with-dev-root-do.c b/src/with-dev-root-do.c
new file mode 100644
index 0000000..e822d00
--- /dev/null
+++ b/src/with-dev-root-do.c
@@ -0,0 +1,115 @@
+/* -*- c-basic-offset: 8 -*- */
+/*
+ * Query udev for the real name of the device currently mounted
+ * as root filesystem and use it as an argument for a command.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author: Łukasz Stelmach <l.stelmach@samsung.com>
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <libudev.h>
+#include <stdlib.h>
+#include <string.h>
+
+void usage() {
+ fprintf(stderr, "Usage:\n\n with-dev-root-do <cmdline>\n\n");
+ fprintf(stderr, "Execute the cmdline with the real name of the device currently mounted\n");
+ fprintf(stderr, "as root file-system appended at the end or substituted for '{}'. Examples\n");
+ fprintf(stderr, "assuming /dev/sda1 holds root file-system:\n\n");
+ fprintf(stderr, " with-dev-root-do /sbin/fsck\n\n");
+ fprintf(stderr, "runs \"/sbin/fsck /dev/sda1\"\n\n");
+ fprintf(stderr, " with-dev-root-do /sbin/e2image {} /tmp/root.e2img\n\n");
+ fprintf(stderr, "runs \"/sbin/e2image /dev/sda1 /tmp/root.e2img\"\n");
+}
+
+const char* find_node() {
+ struct stat s;
+ struct udev* udev=NULL;
+ struct udev_device *udev_device = NULL;
+ const char* node=NULL;
+
+ if(stat("/", &s) < 0) {
+ perror("stat");
+ return NULL;
+ }
+
+ if (s.st_dev == 0)
+ return NULL;
+
+ udev=udev_new();
+ if(udev==NULL) {
+ fprintf(stderr, "I don't remember.\n");
+ return NULL;
+ }
+
+ udev_device=udev_device_new_from_devnum(udev, 'b', s.st_dev);
+ if(udev_device==NULL) {
+ fprintf(stderr, "Where do we come from?\n");
+ return NULL;
+ }
+
+ node=udev_device_get_devnode(udev_device);
+ if(node==NULL) {
+ fprintf(stderr, "Where are we going to?\n");
+ return NULL;
+ }
+ return node;
+}
+
+int main(int argc, char* argv[]) {
+ const char** cmdline;
+ const char* node;
+ int i;
+ int placeholder_found=0;
+
+ if(argc < 2) {
+ usage();
+ fprintf(stderr, "\nI don't want to be alone.\n");
+ exit(1);
+ }
+
+ cmdline=malloc((1+argc) * sizeof(char*));
+ if(cmdline==NULL) {
+ perror("malloc");
+ exit(1);
+ }
+ memset((char*)cmdline, 0, (1+argc) * sizeof(char*));
+
+ if((node=find_node())==NULL) {
+ free(cmdline);
+ exit(1);
+ }
+
+ for (i=0; i < argc && argv[i+1]; i++) {
+ if(strncmp("{}", argv[i+1], 3)==0) {
+ placeholder_found=1;
+ cmdline[i] = node;
+ } else
+ cmdline[i] = argv[i+1];
+ }
+
+ if (!placeholder_found)
+ cmdline[i]=node;
+
+ execv(cmdline[0], (char**) cmdline);
+ return 1;
+}
diff --git a/usr/bin/save_blenv b/usr/bin/save_blenv
new file mode 100755
index 0000000..75a1efe
--- /dev/null
+++ b/usr/bin/save_blenv
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# save_blenv: Save env variables of bootloader
+# Usage) save_blenv VARIABLE_NAME VALUE
+#
+# This script is for saving variables of bootloader which is required to be
+# shared between bootloader and platform. (ex) display brightness level)
+#
+# Manufacturer SHOULD modify this file adapted to their target and bootloader.
+# (If there is no shared variables, this file can be removed.)
+
+usage () {
+ echo "Not supported variable(s) or wrong usage"
+ echo "Usage: $0 NAME VALUE"
+ exit 1
+}
+
+_val="$2"
+case "$1" in
+# Supported variables for SLP : usbpath, uartpath, SLP_LCD_BRIGHT
+ usbpath | uartpath)
+ case "$2" in
+ AP | ap)
+ _val="ap"
+ ;;
+ CP | cp)
+ _val="cp"
+ ;;
+ *)
+ usage
+ ;;
+ esac
+ ;;
+ SLP_LCD_BRIGHT)
+ if [ "z$2" == "z" ]; then
+ usage
+ fi
+ ;;
+# NOT SUPPOTED
+ *)
+ usage
+ ;;
+esac
+
+# This is for uboot. If you don't use uboot, change following command.
+/usr/bin/fw_setenv $1 $_val
+
+exit 0
+
diff --git a/usr/lib/systemd/system/resize2fs-root.service b/usr/lib/systemd/system/resize2fs-root.service
new file mode 100755
index 0000000..aeb9435
--- /dev/null
+++ b/usr/lib/systemd/system/resize2fs-root.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Resize of File System on the Root Device
+DefaultDependencies=no
+Requires=fsck-root.service
+After=fsck-root.service
+Before=remount-rootfs.service local-fs.target shutdown.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=no
+ExecStartPre=/bin/mount -o remount,rw /
+ExecStart=/bin/with-dev-root-do /sbin/resize2fs
+ExecStartPost=/bin/ln -s /dev/null /etc/systemd/system/resize2fs-root.service
+ExecStartPost=/bin/mount -o remount /
+StandardOutput=journal+console
+TimeoutSec=0
diff --git a/usr/lib/systemd/system/resize2fs@.service b/usr/lib/systemd/system/resize2fs@.service
new file mode 100755
index 0000000..c203742
--- /dev/null
+++ b/usr/lib/systemd/system/resize2fs@.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Resize of File System on %f
+DefaultDependencies=no
+BindTo=%i.device
+After=fsck@%i.service
+Requires=fsck@%i.service
+Before=local-fs.target shutdown.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=no
+ExecStart=/sbin/resize2fs %f
+StandardOutput=journal+console
+TimeoutSec=0