From 865cf1ee7c6f62c328cf012c6dde21859c571008 Mon Sep 17 00:00:00 2001 From: Zhang Qiang Date: Fri, 18 May 2012 19:55:31 +0800 Subject: [PATCH] Initial code release --- etc/fstab | 15 +++ etc/inittab | 31 ++++++ etc/mtools.conf | 66 ++++++++++++ etc/profile.d/system.sh | 2 + etc/rc.d/rc.emul | 42 ++++++++ etc/rc.d/rc.entersleep | 20 ++++ etc/rc.d/rc.firstboot | 38 +++++++ etc/rc.d/rc.leavesleep | 5 + etc/rc.d/rc.network | 11 ++ etc/rc.d/rc.shutdown | 31 ++++++ etc/rc.d/rc.sysinit | 186 ++++++++++++++++++++++++++++++++ packaging/system-plugin-ia-generic.spec | 42 ++++++++ 12 files changed, 489 insertions(+) create mode 100644 etc/fstab create mode 100755 etc/inittab create mode 100755 etc/mtools.conf create mode 100755 etc/profile.d/system.sh create mode 100755 etc/rc.d/rc.emul create mode 100755 etc/rc.d/rc.entersleep create mode 100755 etc/rc.d/rc.firstboot create mode 100755 etc/rc.d/rc.leavesleep create mode 100755 etc/rc.d/rc.network create mode 100755 etc/rc.d/rc.shutdown create mode 100755 etc/rc.d/rc.sysinit create mode 100644 packaging/system-plugin-ia-generic.spec diff --git a/etc/fstab b/etc/fstab new file mode 100644 index 0000000..cf8be1a --- /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 +#tmpfs /var tmpfs defaults 0 0 +none /sys sysfs defaults 0 0 + +#/dev/mmcblk0p2 /boot vfat defaults 0 0 +#/dev/mmcblk0p5 / ext4 defaults 0 0 +/dev/sda1 / auto defaults 0 0 +LABEL=boot /boot auto defaults 0 0 +LABEL=opt /opt auto defaults 0 0 +#/dev/mmcblk0p6 /opt ext4 defaults 0 0 +#/dev/mmcblk0p7 /mnt/csc ext4 defaults 0 0 +#/dev/mmcblk0p8 /mnt/ums vfat uid=0,gid=0,dmask=0000,fmask=0000,iocharset=iso8859-1,utf8,shortname=mixed 0 0 diff --git a/etc/inittab b/etc/inittab new file mode 100755 index 0000000..d9e9077 --- /dev/null +++ b/etc/inittab @@ -0,0 +1,31 @@ +#System startup +si::sysinit:/etc/rc.d/rc.sysinit +net::once:/etc/rc.d/rc.network + +id:1:initdefault: + +# tty +1:12345:respawn:/sbin/mingetty --noclear tty1 +2:12345:respawn:/sbin/mingetty tty2 + +# serial console +#ttyS0::respawn:/bin/sh +#s1:12345:respawn:/sbin/getty -L 115200 ttyS0 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/profile.d/system.sh b/etc/profile.d/system.sh new file mode 100755 index 0000000..642717f --- /dev/null +++ b/etc/profile.d/system.sh @@ -0,0 +1,2 @@ + +export PWROFF_DUR=3 diff --git a/etc/rc.d/rc.emul b/etc/rc.d/rc.emul new file mode 100755 index 0000000..304bf22 --- /dev/null +++ b/etc/rc.d/rc.emul @@ -0,0 +1,42 @@ +#!/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.emul : script start ${C_}]" + +echo -e "[${_G}chmod +x /opt/media for various apps ${C_}]" +chmod -R 777 /opt/media + +echo -e "[${_G}make symbolic link ${C_}]" +ln -sf /mnt/mmc /sdcard +ln -sf /proc/mounts /etc/mtab + +echo -e "[${_G}Setting power manager state value ${C_}]" +/usr/bin/vconftool set -t int memory/pwrmgr/state 1 + +echo -e "[${_G}Initialize battery level ${C_}]" +/usr/bin/vconftool set -t int memory/Battery/Level 5 +/usr/bin/vconftool set -t int memory/Battery/Status/Low 4 + +echo -e "[${_G}Mount SD card ${C_}]" +mount /dev/mmcblk0 /mnt/mmc + +MMC_MOUNT=`/bin/mount | grep mmc` +if [ -n "$MMC_MOUNT" ]; then + echo -e "[${_G}MMC storage detected ${C_}]" + /usr/bin/vconftool set -t int memory/Device/Mmc 1 + /usr/bin/vconftool set -t int memory/filemanager/Mmc 2 +fi + +echo -e "[${_G}Initialize display setting value${C_}]" +/usr/bin/vconftool set -t int db/setting/Brightness "24" +/usr/bin/vconftool set -t int db/MainLCD/Backlight/Normal "600" + +echo -e "[${_G}For menu_screen booting..${C_}]" +/usr/bin/vconftool set -t int memory/startapps/sequence 1 + +echo -e "[${_G}rc.emul : script end ${C_}]" diff --git a/etc/rc.d/rc.entersleep b/etc/rc.d/rc.entersleep new file mode 100755 index 0000000..2d92be8 --- /dev/null +++ b/etc/rc.d/rc.entersleep @@ -0,0 +1,20 @@ +export DISPLAY=:0 + +echo "Kill all running applications" +/usr/bin/enter_deepsleep + +echo "Reload Menuscreen" +vconftool -t int set memory/menuscreen/reload 3 + +echo "Stoppping Boot animation..." +nice -n -15 /usr/bin/boot-animation --off & + +CHK_ANI=0 +while [ "$CHK_ANI" != "1" ]; do + echo "waiting animation finished.." + sleep 0.5 + CHK_ANI=`vconftool get memory/boot-animation/finished | awk '{print $4}'` +done + +#echo 4 > /sys/class/graphics/fb0/blank + diff --git a/etc/rc.d/rc.firstboot b/etc/rc.d/rc.firstboot new file mode 100755 index 0000000..3ba64b4 --- /dev/null +++ b/etc/rc.d/rc.firstboot @@ -0,0 +1,38 @@ +#!/bin/sh + +#/sbin/ldconfig -f /opt/etc/ld.so.conf -C /opt/etc/ld.so.cache +/sbin/ldconfig + +# Check 3-touchkey firmware +/lib/firmware/firmware_upgrade_touchkey.sh + +#Check machine is P1P2 +MACHINE=`grep Hardware /proc/cpuinfo|cut -d ":" -f 2|tr -d " "` +if [ $MACHINE == "P1P2" ];then + ln -s /opt/etc/X11/xorg.conf.d.p1p2 /opt/etc/X11/xorg.conf.d + # motor sensor has not been implemented yet + rm -f /usr/driver/tspdrv.ko +else + ln -s /opt/etc/X11/xorg.conf.d.default /opt/etc/X11/xorg.conf.d +fi + +# Copy alsa scenario file for sound temporary +if [ ! -e /opt/etc/sound ]; then + mkdir -p /opt/etc/sound +fi + +if [ $MACHINE == "F1" ]; then + cp -r /usr/share/ascenario/mc1n2 /opt/etc/sound/default + cp -r /usr/share/ascenario/mc1n2.conf /opt/etc/sound/default.conf +else + cp -r /usr/share/ascenario/wm8994 /opt/etc/sound/default + cp -r /usr/share/ascenario/wm8994.conf /opt/etc/sound/default.conf +fi + +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 +fi +sync diff --git a/etc/rc.d/rc.leavesleep b/etc/rc.d/rc.leavesleep new file mode 100755 index 0000000..c781c87 --- /dev/null +++ b/etc/rc.d/rc.leavesleep @@ -0,0 +1,5 @@ +export DISPLAY=:0 + +echo "Stoppping Boot animation..." +vconftool set -t string memory/boot-animation/restart start:restart + diff --git a/etc/rc.d/rc.network b/etc/rc.d/rc.network new file mode 100755 index 0000000..bd34e43 --- /dev/null +++ b/etc/rc.d/rc.network @@ -0,0 +1,11 @@ + +[ -x /usr/sbin/sshd-hostkeys ] && /usr/sbin/sshd-hostkeys + +[ -x /sbin/wpa_supplicant ] && /sbin/wpa_supplicant -u & + +[ -x /usr/sbin/bluetoothd ] && /usr/sbin/bluetoothd & + +ifconfig lo 127.0.0.1 up + +[ -x /usr/sbin/sshd ] && /usr/sbin/sshd + diff --git a/etc/rc.d/rc.shutdown b/etc/rc.d/rc.shutdown new file mode 100755 index 0000000..c4e4c1f --- /dev/null +++ b/etc/rc.d/rc.shutdown @@ -0,0 +1,31 @@ +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 " " & +sleep 1 + +echo "Stopping menu screen..." +killall -9 menu_screen + +echo "Stopping all applications..." +/usr/bin/enter_deepsleep + +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 + +#echo 4 > /sys/class/graphics/fb0/blank + diff --git a/etc/rc.d/rc.sysinit b/etc/rc.d/rc.sysinit new file mode 100755 index 0000000..6d478b7 --- /dev/null +++ b/etc/rc.d/rc.sysinit @@ -0,0 +1,186 @@ +#!/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 -n -t proc none /proc +mount -n -t tmpfs tmpfs /tmp +mount -n -t sysfs none /sys + +touch /dev/.in_sysinit >/dev/null 2>&1 + +nice -n 20 /sbin/start_udev + +mount -n /dev/pts >/dev/null 2>&1 + +remount_needed() { + local state oldifs + state=`LC_ALL=C awk '/ \/ / && ($3 !~ /rootfs/) { print $4 }' /proc/mounts` + oldifs=$IFS + IFS="," + for opt in $state ; do + if [ "$opt" = "rw" ]; then + IFS=$oldifs + return 1 + fi + done + IFS=$oldifs + return 0 +} + +# Remount the root filesystem read-write. +if remount_needed ; then + ionice -t -c 1 -n 0 mount -n -o remount,rw / +fi + + + +# Clear mtab +(> /etc/mtab) &> /dev/null + +# Remove stale backups +rm -f /etc/mtab~ /etc/mtab~~ + + +# Clean up various /tmp bits +rm -f /tmp/.X*-lock /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.* +rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \ + /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \ + /tmp/scrollkeeper-* /tmp/ssh-* + +# Enter mounted filesystems into /etc/mtab +mount -f / +mount -f /proc >/dev/null 2>&1 +mount -f /sys >/dev/null 2>&1 +mount -f /dev/pts >/dev/null 2>&1 +mount -f /proc/bus/usb >/dev/null 2>&1 + +# /var/{lock,run} +mount -t tmpfs tmpfs /var/lock -o size=4m +mount -t tmpfs tmpfs /var/run -o size=4m +mkdir /var/run/console +mkdir -p /var/lock/subsys + +# Mount all other filesystems (except for NFS and /proc, which is already +# mounted). Contrary to standard usage, +# filesystems are NOT unmounted in single user mode. +mount -a -t nonfs,nfs4,smbfs,cifs -O no_netdev +mount -t debugfs none /sys/kernel/debug/ + + +echo -e "[${_G}create base directory in /opt, /var${C_}]" +#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 + + if [ -e /etc/rc.d/rc.run_hibernation ]; then + touch /opt/etc/.hib_capturing + fi +fi + +echo -e "[${_G}set device node perm & security${C_}]" +# Set device node permissions for security +test -c /dev/video0 && chown 0:6501 /dev/video0 +test -c /dev/s3c-jpg && chown 0:6501 /dev/s3c-jpg +test -c /dev/pvrsrvkm && chmod 666 /dev/pvrsrvkm +test -c /dev/log_main && chown 0:6509 /dev/log_main +test -c /dev/log_events && chown 0:6509 /dev/log_events +test -c /dev/log_radio && chown 0:6509 /dev/log_radio +test -c /dev/snd/ && chown :audio /dev/snd/ +test -c /dev/snd/ && chmod 775 /dev/snd/ +test -c /dev/snd/controlC0 && chown :audio /dev/snd/controlC0 +test -c /dev/snd/pcmC0D0p && chown :audio /dev/snd/pcmC0D0p +test -c /dev/snd/pcmC0D1p && chown :audio /dev/snd/pcmC0D1p +test -c /dev/snd/pcmC0D2p && chown :audio /dev/snd/pcmC0D2p +test -c /dev/snd/pcmC0D3p && chown :audio /dev/snd/pcmC0D3p +test -c /dev/snd/timer && chown :audio /dev/snd/timer +test -c /dev/snd/pcmC0D0c && chown 0:6508 /dev/snd/pcmC0D0c +test -c /dev/snd/pcmC0D1c && chown 0:6508 /dev/snd/pcmC0D1c +test -c /dev/snd/pcmC0D2c && chown 0:6508 /dev/snd/pcmC0D2c +test -c /dev/snd/pcmC0D3c && chown 0:6508 /dev/snd/pcmC0D3c +test -c /dev/s3c-mfc && chown 0:6510 /dev/s3c-mfc +test -c /dev/random && chmod 666 /dev/random +test -c /dev/urandom && chmod 666 /dev/urandom +test -c /dev/fb0 && chown :video /dev/fb0 +test -c /dev/video1 && chown :video /dev/video1 +test -c /dev/video2 && chown :video /dev/video2 +test -c /dev/radio0 && chown :6512 /dev/radio0 +chown :6702 /sys/class/backlight/*/brightness +chmod 664 /sys/class/backlight/*/brightness + +ln -sf /dev/rtc0 /dev/rtc1 + +# Modem power on +if [ ! -f /opt/etc/.hib_capturing ]; then + echo -e "[${_Y}modem power on${C_}]" + echo on > /sys/devices/platform/modemctl/exec_util +else + echo "dont execute util in fastboot..." +fi + +#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 + +# Check rw mode +DEVEL_UPDATE_MODE=`grep devel_update_boot /proc/cmdline` +if [ -f /opt/etc/.devel_update ] && [ -z "$DEVEL_UPDATE_MODE" ]; then + touch /opt/etc/.hib_capturing + rm /opt/etc/.devel_update +fi + + # force to use x11 engine for now, since gl random segfault + export LAUNCHER_ENGINE=x11 + + # 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 + + echo -e "[${_G}set cpufreq governor${C_}]" + # Set default cpufreq governor + echo slp > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + if [ $? -ne 0 ];then + echo -e "\t[${_Y}slp not exits, set default ondemand${C_}]" + echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + fi + +# symbolic link +if [ ! -e /opt/apps ]; then + echo -e "[${_G}link /opt/apps -> /mnt/ums/apps${C_}]" + ln -s /mnt/ums/apps /opt/apps +fi + + +/etc/rc.d/rc.emul diff --git a/packaging/system-plugin-ia-generic.spec b/packaging/system-plugin-ia-generic.spec new file mode 100644 index 0000000..0341c2c --- /dev/null +++ b/packaging/system-plugin-ia-generic.spec @@ -0,0 +1,42 @@ +Summary: The inittab file and the /etc/init.d scripts +Name: system-plugin-ia-generic +Version: 0.0.10 +License: TO BE FILLED IN +Group: System/Base +Release: 1 +Source: %{name}-%{version}.tar.bz2 +# >> gbp-patch-tags # auto-added by gbp +# << gbp-patch-tags # auto-added by gbp +Requires: udev +ExclusiveArch: %ix86 x86_64 +Requires: sysvinit +Requires: sysvinit-utils + + +%description +Startup files + +%prep +%setup -q +# >> gbp-apply-patches # auto-added by gbp +# << gbp-apply-patches # auto-added by gbp + +%build + +%install +cp -a etc %{buildroot} + + + + +%files +/etc/fstab +%config(noreplace) /etc/inittab +%exclude %config(noreplace) /etc/mtools.conf +/etc/profile.d/system.sh +/etc/rc.d/rc.entersleep +/etc/rc.d/rc.firstboot +/etc/rc.d/rc.leavesleep +/etc/rc.d/rc.shutdown +/etc/rc.d/rc.sysinit +/etc/rc.d/rc.* -- 2.7.4