From 496010eceba87605a96465d3cfb603c0523a3cb9 Mon Sep 17 00:00:00 2001 From: "subham.sen" Date: Mon, 29 Jul 2013 17:12:41 +0530 Subject: [PATCH 1/1] HS-IVI2.0 release - initial commit Change-Id: Ia6015f9f83d8cd6d5fb0823ea853dab857f507a2 Signed-off-by: subham.sen --- CMakeLists.txt | 3 + LICENSE | 204 ++++++++++++++++++++++++++ NOTICE | 1 + bin/check-booting-mode.sh | 13 ++ debian/README.Debian | 6 + debian/changelog | 116 +++++++++++++++ debian/compat | 1 + debian/control | 15 ++ debian/copyright | 23 +++ debian/info | 3 + debian/postinst | 8 + debian/rules | 91 ++++++++++++ debian/system-plugin-slp.install.in | 1 + etc/fstab | 15 ++ etc/fta_version.txt | 2 + etc/inittab | 28 ++++ etc/mtools.conf | 66 +++++++++ etc/rc.d/rc.firstboot | 26 ++++ etc/rc.d/rc.shutdown | 25 ++++ etc/rc.d/rc.sysinit | 191 ++++++++++++++++++++++++ mount-generator.pl | 81 ++++++++++ packaging/system-plugin-slp.spec | 58 ++++++++ src/CMakeLists.txt | 5 + src/with-dev-root-do.c | 115 +++++++++++++++ usr/bin/save_blenv | 49 +++++++ usr/lib/systemd/system/resize2fs-root.service | 16 ++ usr/lib/systemd/system/resize2fs@.service | 14 ++ 27 files changed, 1176 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 LICENSE create mode 100644 NOTICE create mode 100755 bin/check-booting-mode.sh create mode 100644 debian/README.Debian create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100755 debian/control create mode 100644 debian/copyright create mode 100644 debian/info create mode 100644 debian/postinst create mode 100755 debian/rules create mode 100644 debian/system-plugin-slp.install.in create mode 100755 etc/fstab create mode 100644 etc/fta_version.txt create mode 100755 etc/inittab create mode 100755 etc/mtools.conf create mode 100755 etc/rc.d/rc.firstboot create mode 100755 etc/rc.d/rc.shutdown create mode 100755 etc/rc.d/rc.sysinit create mode 100755 mount-generator.pl create mode 100755 packaging/system-plugin-slp.spec create mode 100644 src/CMakeLists.txt create mode 100644 src/with-dev-root-do.c create mode 100755 usr/bin/save_blenv create mode 100755 usr/lib/systemd/system/resize2fs-root.service create mode 100755 usr/lib/systemd/system/resize2fs@.service 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/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 +------------------------------- + + + + -- unknown Mon, 16 Nov 2009 15:13:09 +0900 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..f0118d8 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,116 @@ +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 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 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 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 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 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 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 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 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 Wed, 22 Feb 2012 08:58:42 +0900 + +system-plugin-slp (0.0.1-5) unstable; urgency=low + + * Fix build and clean error + * Git: slp/pkgs/s/system-plugin-slp + * Tag: system-plugin-slp_0.0.1-5 + + -- Wonil Choi Fri, 03 Feb 2012 09:57:58 +0900 + +system-plugin-slp (0.0.1-4) unstable; urgency=low + + * Code cleanup: remove an unnecesary file + * Git: slp/pkgs/s/system-plugin-slp + * Tag: system-plugin-slp_0.0.1-4 + + -- Wonil Choi Thu, 02 Feb 2012 16:10:06 +0900 + +system-plugin-slp (0.0.1-3) unstable; urgency=low + + * Code cleanup: remove unnecesary and commented codes + * Git: slp/pkgs/s/system-plugin-slp + * Tag: system-plugin-slp_0.0.1-3 + + -- Wonil Choi Thu, 22 Dec 2011 18:25:01 +0900 + +system-plugin-slp (0.0.1-2) unstable; urgency=low + + * Release 0.0.1-2 + * Boot modem on background to reduce booting time + * Git: 165.213.180.234:slp/pkgs/s/system-plugin-slp + * Tag: system-plugin-slp_0.0.1-2 + + -- Yeongil Jang Thu, 17 Nov 2011 15:09:29 +0900 + +system-plugin-slp (0.0.1-1) unstable; urgency=low + + * Initial release. Copied from system-plugin-sdk + * Git: 165.213.180.234:slp/pkgs/s/system-plugin-slp + * Tag: system-plugin-slp_0.0.1-1 + + -- Hyunsuk Oh Mon, 31 Oct 2011 16:50:38 +0900 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100755 index 0000000..97334ee --- /dev/null +++ b/debian/control @@ -0,0 +1,15 @@ +Source: system-plugin-slp +Section: misc +Priority: extra +Maintainer: Wonil Choi +Uploaders: Wonil Choi , KwangHui Cho +Build-Depends: debhelper (>= 5) +Standards-Version: 3.7.2 + +Package: system-plugin-slp +Architecture: armel +Depends: ${shlibs:Depends}, ${misc:Depends} +Pre-Depends: base-files, sysvinit +Replaces: base-files, sysvinit +Description: system-plugin for Clean SDK + system-plugin for Clean SDK diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..a814ddb --- /dev/null +++ b/debian/copyright @@ -0,0 +1,23 @@ +This is system-plugin-slp, written and maintained by Jongwoo Chae +on Wed Aug 18 16:08:53 KST 2010. + +Copyright Holder: unknown + +License: + + 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. + + 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/info b/debian/info new file mode 100644 index 0000000..fb2beba --- /dev/null +++ b/debian/info @@ -0,0 +1,3 @@ +etc/.info +etc/.info/system.info +etc/.info/rootfs.info diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..a0e82a4 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +if [ "$1" = "configure" ]; then + cp -af /usr/share/system-plugin-slp/* / +fi + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..5ea81dc --- /dev/null +++ b/debian/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +PREFIX ?= +DATADIR ?= /opt + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + cat $$f > $${f%.in}; \ + sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ + done + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. +# -$(MAKE) clean + + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ + rm -f $${f%.in}; \ + done + + dh_clean + +install: build + dh_testdir + dh_testroot + 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. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install --sourcedir=debian/tmp +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link +# dh_strip + dh_compress + dh_fixperms +# dh_perl + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/debian/system-plugin-slp.install.in b/debian/system-plugin-slp.install.in new file mode 100644 index 0000000..f4bee4c --- /dev/null +++ b/debian/system-plugin-slp.install.in @@ -0,0 +1 @@ +@PREFIX@/* diff --git a/etc/fstab b/etc/fstab new file mode 100755 index 0000000..880ffb7 --- /dev/null +++ b/etc/fstab @@ -0,0 +1,15 @@ +# +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/mmcblk0p1 /boot vfat defaults 0 2 +#/dev/mmcblk0p4 /mnt/csc ext4 defaults,noauto 0 2 +/dev/mmcblk0p2 / ext4 defaults 0 1 +/dev/mmcblk0p3 /opt ext4 defaults 0 2 +/dev/mmcblk0p4 /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..f22402a --- /dev/null +++ b/etc/rc.d/rc.sysinit @@ -0,0 +1,191 @@ +#!/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/mmcblk0p3 b 179 6 + +# mount opt partition +mount -t ext4 /dev/mmcblk0p3 /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/mmcblk0p3 /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 + +if [ -e /opt/etc/.coredump ]; then + # enable coredump + echo "/opt/usr/share/crash/core/%p_%s_%e.core" > /proc/sys/kernel/core_pattern + ulimit -c unlimited +else + 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" + # 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 +# +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=<", $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..23ab501 --- /dev/null +++ b/packaging/system-plugin-slp.spec @@ -0,0 +1,58 @@ +Name: system-plugin-slp +Summary: system-plugin for Clean SDK +Version: 0.0.1 +License: Apache-2.0 +Group: System/Base +Release: 64 +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 + +%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 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 + * + */ + +#include +#include +#include +#include +#include +#include +#include + +void usage() { + fprintf(stderr, "Usage:\n\n with-dev-root-do \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 -- 2.7.4