summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinkun Jang <jinkun.jang@samsung.com>2013-03-13 01:36:18 +0900
committerJinkun Jang <jinkun.jang@samsung.com>2013-03-13 01:36:18 +0900
commit7f021ded4b6aff1e786a67ee764f73baaeb67b6d (patch)
treec43c9b4212b5184692a907cd30705b470c667caa
parentaba1c934183a8aba3a58b6d05c736e650a1d1f5e (diff)
downloadsystem-plugin-slp-7f021ded4b6aff1e786a67ee764f73baaeb67b6d.tar.gz
system-plugin-slp-7f021ded4b6aff1e786a67ee764f73baaeb67b6d.tar.bz2
system-plugin-slp-7f021ded4b6aff1e786a67ee764f73baaeb67b6d.zip
Tizen 2.1 base
-rw-r--r--CMakeLists.txt3
-rwxr-xr-xbin/check-booting-mode.sh13
-rw-r--r--debian/README.Debian6
-rw-r--r--debian/changelog80
-rwxr-xr-xdebian/control2
-rw-r--r--debian/copyright30
-rwxr-xr-xdebian/rules5
-rwxr-xr-xetc/fstab17
-rw-r--r--etc/fta_version.txt2
-rwxr-xr-xetc/inittab3
-rwxr-xr-xetc/rc.d/rc.firstboot23
-rwxr-xr-xetc/rc.d/rc.shutdown7
-rwxr-xr-xetc/rc.d/rc.sysinit89
-rwxr-xr-xmount-generator.pl81
-rwxr-xr-xpackaging/system-plugin-slp.spec40
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/with-dev-root-do.c115
-rwxr-xr-xusr/lib/systemd/system/resize2fs-root.service16
-rwxr-xr-xusr/lib/systemd/system/resize2fs@.service14
19 files changed, 463 insertions, 88 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/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/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..08af8b0
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,6 @@
+default-files-aquila for Debian
+-------------------------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- unknown <youmin.ha@samsung.com> Mon, 16 Nov 2009 15:13:09 +0900
diff --git a/debian/changelog b/debian/changelog
index 53fa76d..f0118d8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,86 @@
+system-plugin-slp (0.0.1-14) unstable; urgency=low
+
+ * Add resizing ext4 partitions on the first boot.
+ * Git: slp/pkgs/s/system-plugin-slp
+ * Tag: system-plugin-slp_0.0.1-14
+
+ -- Wonil Choi <wonil22.choi@samsung.com> Thu, 29 Mar 2012 14:47:21 +0900
+
+system-plugin-slp (0.0.1-13) unstable; urgency=low
+
+ * Remove /opt/drvier directory and files
+ - instead of /opt/driver, /lib/modules is used.
+ * spec file update for obs packaging
+ * change the path of fw_printenv
+ * Git: slp/pkgs/s/system-plugin-slp
+ * Tag: system-plugin-slp_0.0.1-13
+
+ -- Wonil Choi <wonil22.choi@samsung.com> Wed, 28 Mar 2012 18:26:22 +0900
+
+system-plugin-slp (0.0.1-12) unstable; urgency=low
+
+ * Remove mdev: udev can work same jobs
+ * Git: slp/pkgs/s/system-plugin-slp
+ * Tag: system-plugin-slp_0.0.1-12
+
+ -- Wonil Choi <wonil22.choi@samsung.com> Wed, 28 Mar 2012 13:40:23 +0900
+
+system-plugin-slp (0.0.1-11) unstable; urgency=low
+
+ * Revert the last change
+ * Git: slp/pkgs/s/system-plugin-slp
+ * Tag: system-plugin-slp_0.0.1-11
+
+ -- Wonil Choi <wonil22.choi@samsung.com> Tue, 27 Mar 2012 09:57:48 +0900
+
+system-plugin-slp (0.0.1-10) unstable; urgency=low
+
+ * copying modules instead of symlinks due to duplucated wifi insmod
+ * Git: slp/pkgs/s/system-plugin-slp
+ * Tag: system-plugin-slp_0.0.1-10
+
+ -- Wonil Choi <wonil22.choi@samsung.com> Tue, 20 Mar 2012 19:24:35 +0900
+
+system-plugin-slp (0.0.1-9) unstable; urgency=low
+
+ * Revert the last change.
+ * Git: slp/pkgs/s/system-plugin-slp
+ * Tag: system-plugin-slp_0.0.1-9
+
+ -- Wonil Choi <wonil22.choi@samsung.com> Mon, 19 Mar 2012 19:56:06 +0900
+
+system-plugin-slp (0.0.1-8) unstable; urgency=low
+
+ * Remove mdev: udev can work same jobs.
+ * Git: slp/pkgs/s/system-plugin-slp
+ * Tag: system-plugin-slp_0.0.1-8
+
+ -- Wonil Choi <wonil22.choi@samsung.com> Tue, 13 Mar 2012 17:19:17 +0900
+
+system-plugin-slp (0.0.1-7) unstable; urgency=low
+
+ * Add to mount modules.img to fstab for driver modules(ko)
+ * Add to make symlinks for driver modules(ko)
+ * Git: slp/pkgs/s/system-plugin-slp
+ * Tag: system-plugin-slp_0.0.1-7
+
+ -- Wonil Choi <wonil22.choi@samsung.com> Wed, 07 Mar 2012 18:04:55 +0900
+
+system-plugin-slp (0.0.1-6) unstable; urgency=low
+
+ * Remove alsa scenario copy in rc.firstboot
+ * Git: slp/pkgs/s/system-plugin-slp
+ * Tag: system-plugin-slp_0.0.1-6
+
+ -- KwangHui Cho <kwanghui.cho@samsung.com> Wed, 22 Feb 2012 08:58:42 +0900
+
system-plugin-slp (0.0.1-5) unstable; urgency=low
- * Modify license file
+ * Fix build and clean error
* Git: slp/pkgs/s/system-plugin-slp
* Tag: system-plugin-slp_0.0.1-5
- -- Yeongil Jang <yg0577.jang@samsung.com> Mon, 20 Feb 2012 11:36:15 +0900
+ -- Wonil Choi <wonil22.choi@samsung.com> Fri, 03 Feb 2012 09:57:58 +0900
system-plugin-slp (0.0.1-4) unstable; urgency=low
diff --git a/debian/control b/debian/control
index 02c879a..97334ee 100755
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: system-plugin-slp
Section: misc
Priority: extra
Maintainer: Wonil Choi <wonil22.choi@samsung.com>
-Uploaders: Wonil Choi <wonil22.choi@samsung.com>
+Uploaders: Wonil Choi <wonil22.choi@samsung.com>, KwangHui Cho <kwanghui.cho@samsung.com>
Build-Depends: debhelper (>= 5)
Standards-Version: 3.7.2
diff --git a/debian/copyright b/debian/copyright
index 8da86e2..a814ddb 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,15 +1,23 @@
-Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+This is system-plugin-slp, written and maintained by Jongwoo Chae <jongwoo.chae@samsung.com>
+on Wed Aug 18 16:08:53 KST 2010.
-Contact: Wonil Choi <wonil22.choi@samsung.com>
+Copyright Holder: unknown
-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
+License:
-http://www.apache.org/licenses/LICENSE-2.0
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-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.
+ 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 package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
diff --git a/debian/rules b/debian/rules
index 05beb4b..5ea81dc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -37,18 +37,19 @@ clean:
rm -f $${f%.in}; \
done
- dh_clean
+ dh_clean
install: build
dh_testdir
dh_testroot
- dh_clean -k
+ dh_clean -k
dh_installdirs
mkdir -p $(CURDIR)/debian/tmp$(PREFIX)
mkdir -p debian/tmp/usr/share/system-plugin-slp
cp -a $(CURDIR)/etc debian/tmp/usr/share/system-plugin-slp
cp -a $(CURDIR)/usr debian/tmp
+ cp -a $(CURDIR)/bin debian/tmp
cp -a $(CURDIR)/lib debian/tmp
# Build architecture-independent files here.
diff --git a/etc/fstab b/etc/fstab
index 63d5d5d..99cf69f 100755
--- a/etc/fstab
+++ b/etc/fstab
@@ -2,13 +2,14 @@
none /proc proc defaults 0 0
#none /dev/pts devpts mode=0622 0 0
tmpfs /tmp tmpfs defaults 0 0
-tmpfs /var tmpfs defaults 0 0
+/opt/var /var bind bind 0 0
none /sys sysfs defaults 0 0
-# For new partition - 2011/10/06
-/dev/mmcblk0p1 /csa ext4 defaults 0 0
-/dev/mmcblk0p2 /boot ext4,vfat defaults 0 0
-/dev/mmcblk0p5 / ext4 defaults 0 0
-/dev/mmcblk0p6 /opt ext4 defaults 0 0
-/dev/mmcblk0p7 /mnt/csc ext4 defaults,noauto 0 0
-/dev/mmcblk0p8 /opt/media vfat uid=0,gid=0,dmask=0000,fmask=0000,iocharset=iso8859-1,utf8,shortname=mixed 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
index efced0c..300c9e5 100755
--- a/etc/inittab
+++ b/etc/inittab
@@ -6,7 +6,8 @@ id:1:initdefault:
# Console
#ttyS0::respawn:/bin/sh
-con:12345:respawn:/sbin/getty -L 115200 ttySAC2 vt100
+#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
diff --git a/etc/rc.d/rc.firstboot b/etc/rc.d/rc.firstboot
index 87e7947..6c7edc2 100755
--- a/etc/rc.d/rc.firstboot
+++ b/etc/rc.d/rc.firstboot
@@ -6,20 +6,19 @@
# for /etc/.info/system.info
/bin/sysinfo
-# Check 3-touchkey firmware
-/lib/firmware/firmware_upgrade_touchkey.sh
-
-ln -s /opt/etc/X11/xorg.conf.d.default /opt/etc/X11/xorg.conf.d
-
-# Copy alsa scenario file for sound path temporary
-if [ ! -e /opt/etc/sound ]; then
- mkdir -p /opt/etc/sound
+#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
-cp -r /usr/share/ascenario/default /opt/etc/sound/default
-cp -r /usr/share/ascenario/default.conf /opt/etc/sound/default.conf
-chown root:soundpath /opt/etc/sound/default.conf
-chown -R root:soundpath /opt/etc/sound/default
if [ -e /opt/system/csc/.factoryreset ]; then
rm -f /opt/system/csc/.factoryreset
diff --git a/etc/rc.d/rc.shutdown b/etc/rc.d/rc.shutdown
index ada6bf6..274baa1 100755
--- a/etc/rc.d/rc.shutdown
+++ b/etc/rc.d/rc.shutdown
@@ -3,13 +3,14 @@
export DISPLAY=:0
killall power_manager
killall -9 udevd
+#killall -9 system_server
killall -9 xinit
-rm -rf /tmp/vip/*
-rm -rf /tmp/permanent/*
+rm -rf /tmp/vip/*
+rm -rf /tmp/permanent/*
echo "Run Shutdown animation..."
-nice -n -15 /usr/bin/boot-animation --offmsg " " &
+nice -n -15 /usr/bin/boot-animation --offmsg " " --clear &
sleep 1
echo "Stopping indicator..."
diff --git a/etc/rc.d/rc.sysinit b/etc/rc.d/rc.sysinit
index 9f7c1f6..d49044d 100755
--- a/etc/rc.d/rc.sysinit
+++ b/etc/rc.d/rc.sysinit
@@ -11,23 +11,52 @@ 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 tmpfs tmpfs /var
mount -t sysfs none /sys
-mount -t tmpfs tmpfs /dev # remount dev to make it writable
+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
-echo -e "[${_G}prepare device node${C_}]"
-if [ ! -e /dev/snd ]; then
- mkdir /dev/snd
+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
-mdev -s
-mknod /dev/ttySAC1 c 204 65 # UART1 device node for GPS (requested by youngae.kang)
-mknod /dev/ttySAC2 c 204 66
+mount /var
# check special booting mode.
/bin/check-booting-mode.sh
@@ -40,30 +69,17 @@ if [ $? -eq 0 ]; then
exit 0
fi
-# mount
+# mount all partitions
mount -a
-
-echo -e "[${_G}udev start${C_}]"
-/sbin/udevd --daemon
-/sbin/udevadm trigger --subsystem-match=iio
+mount --bind /run/ /var/run/
echo -e "[${_G}create base directory in /opt, /var${C_}]"
# construct directory hierarchy
mkdir -p /opt/var/log/apt
-ln -s /opt/var/log /var/log
mkdir -p /opt/var/lib
-ln -s /opt/var/lib /var/lib # for apt
mkdir -p /opt/var/cache
-ln -s /opt/var/cache /var/cache # for apt
-mkdir -p /var/run
-if [ ! -e /opt/etc/.firstboot ]; then
- echo -e "[${_Y}rc.firstboot${C_}]"
- /etc/rc.d/rc.firstboot
- touch /opt/etc/.firstboot
-fi
-
echo -e "[${_G}set device node perm & security${C_}]"
# Set device node permissions for security
chown 0:6501 /dev/video1
@@ -84,7 +100,7 @@ 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/s5p-mfc
+chown 0:6510 /dev/s3c-mfc
chown 0:6510 /dev/video5
chown 0:6510 /dev/video6
chmod 666 /dev/random
@@ -93,6 +109,7 @@ 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
@@ -101,6 +118,7 @@ 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
@@ -115,26 +133,24 @@ 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/xmm6260-boot &
+/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
+if [ -e /opt/etc/.coredump ]; then
# enable coredump
- echo "/opt/bs/core/core.%p" > /proc/sys/kernel/core_pattern
+ echo "/opt/usr/share/crash/core/%p_%s_%e.core" > /proc/sys/kernel/core_pattern
ulimit -c unlimited
else
- echo "debug mode disabled"
+ echo "core dump disabled"
+ ulimit -c 0
fi
+echo -e "[${_G}run profile${C_}]"
+# Run profile
+. /etc/profile
+
/usr/bin/press 1 # wait input to stop running scripts
if [ $? -eq 0 ]; then
echo "script is stopped"
@@ -157,6 +173,9 @@ else
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
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
index c674256..23ab501 100755
--- a/packaging/system-plugin-slp.spec
+++ b/packaging/system-plugin-slp.spec
@@ -1,11 +1,14 @@
Name: system-plugin-slp
Summary: system-plugin for Clean SDK
Version: 0.0.1
-License: TO BE FILLED IN
+License: Apache-2.0
Group: System/Base
-Release: 60
+Release: 64
ExclusiveArch: %arm
Source: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: perl
+BuildRequires: pkgconfig(libudev)
Requires: udev
Requires: sysvinit
@@ -16,29 +19,40 @@ Startup files
%setup -q
%build
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DSYSCONFDIR=%{_sysconfdir}
+make %{?_smp_mflags}
+./mount-generator.pl etc/fstab usr/lib/systemd/system
%install
-rm -rf %{buildroot}
+%make_install
-mkdir -p %{buildroot}
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
%files
-/bin/change-booting-mode.sh
+/bin/with-dev-root-do
/etc/fstab
-/etc/init.d/csa-tools
+/etc/fta_version.txt
/etc/inittab
-/etc/mdev.conf
/etc/mtools.conf
-/etc/rc.d/rc5.d/S99zzzbackup_csa
/etc/rc.d/rc.firstboot
/etc/rc.d/rc.shutdown
/etc/rc.d/rc.sysinit
-/usr/bin/mount_slp.sh
/usr/bin/save_blenv
-/lib/udev/rules.d/99-serial-console.rules
-/lib/systemd/system/mnt-csc.automount
-/lib/systemd/system/local-fs.target.wants/mnt-csc.automount
-
+/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
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/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