User:Ruskie: Difference between revisions

From Maemo Wiki
Jump to navigationJump to search
4 Kidnapped Kids from same family- Alert
imported>sixwheeledbeast
m Reverted edits by 23.108.75.99 (Talk) to last revision by amigadave
 
Line 1: Line 1:
All 4 of these children were taken from their mother who doesn't have custody and fled out of the county with them.  
= About me =
July 4th they left from Lost Angeles airport and their final destination was Paris France.  
Sometime
We do not know the whereabouts they may be now. They could be anywhere in the world.  
 
https://intersnap.com/Missing-Kona-Kids.jpg
= My repos =
Our Facebook page: https://www.facebook.com/KonasKids/
 
non-optified repo: deb https://repo.codemages.net/ nonopt/
optified repo: deb https://repo.codemages.net/ opt/
 
What do the repos contain?
* zsh - just don't set it as your default shell
* xmms2 with wavpack, mpg123, mpcdec, ogg, flac, etc... support - also updated to not start at max loud
* fcron - requires some manual work after the install(I'll try to give it an event.d script and do that stuff after the fact but not just yet)
* gcoreutils and gtar
* rsyslog
* curl
* djmount
* tinc
* xset and xrdb
 
create a fcron user
chown fcron:fcron /etc/fcron.*
chown -R fcron:fcron /var/spool/fcron
Then edit /etc/event.d/rcS-late
And after initctl emit MOUNTS_OK
put:
/etc/init.d/fcron start
 
= Repartitioning =
Here is what I did to repartition:
http://talk.maemo.org/showpost.php?p=411490&postcount=51
 
Copied from the post by request:
 
 
<source lang="bash">
#!/bin/bash
 
echo "Not for running only REFERENCE!!!"
exit
 
### THIS ALL APPLIES TO ALL PR 1.0 PR 1.0.1 PR 1.1 ###
 
# backup your user
mount /dev/mmcblk1p1 /media/mmc1
cp -a /home/user /media/mmc1/
 
# partitioning
sfdisk -uM --no-reread /dev/mmcblk0 << FDSK
0 2048 c
2049 20544 83
22593 768 82
23361 7170 5
23362 2048 83
25410 5120 83
 
FDSK
 
# REBOOT
 
# do this sometime
mkfs.ext2 /dev/mmcblk0p5
mkfs.ext2 /dev/mmcblk0p2
mkfs.ext2 /dev/mmcblk0p6
mkfs.vfat /dev/mmcblk0p1
mkswap /dev/mmcblk0p3
 
# change /etc/event.d/rcS-late
# comment out generation of fstab
# the following sed command will add a comment character "#"
# at the start of lines 10-20
sed "10,20s:\(.*\):#\1:" /etc/event.d/rcS-late > /etc/event.d/rcS-late.new
cp /etc/event.d/rcS-late.new /etc/event.d/rcS-late
 
# add mount /home/user/MyDocs
# this sed command inserts /bin/mount /home/user/MyDocs || echo 'Failed to mount' on line 23
sed "23i/bin/mount /home/user/MyDocs || echo 'Failed to mount /home/user/MyDocs partition.'" /etc/event.d/rcS-late > /etc/event.d/rcS-late.new
cp /etc/event.d/rcS-late.new /etc/event.d/rcS-late
rm /etc/event.d/rcS-late.new
# change /etc/init.d/rcS
# this sed command starts on line 197 and if it finds: load_extra_module
# it will replace it with: load_extra_module newline and a mount for usr and opt
sed "197s:load_extra_modules:load_extra_modules\nmount /usr || echo 'Failed to mount /usr'\nmount /opt || echo 'Failed to mount /opt':" /etc/init.d/rcS > /etc/init.d/rcS.new
cp /etc/init.d/rcS.new /etc/init.d/rcS
rm /etc/init.d/rcS.new
# fstab
cat << FSTAB > /etc/fstab
rootfs / rootfs defaults,errors=remount-ro,noatime 0 0
/dev/mmcblk0p6 /usr ext2 rw,noatime,nodiratime,errors=continue 0 0
/dev/mmcblk0p5 /opt ext2 rw,noatime,nodiratime,errors=continue 0 0
/dev/mmcblk0p3 none swap sw 0 0
/dev/mmcblk0p2 /home ext2 rw,noatime,nodiratime,errors=continue 0 0
/dev/mmcblk0p1 /home/user/MyDocs vfat noauto,nodev,noexec,nosuid,noatime,nodiratime,utf8,uid=29999,shortname=mixed,dmask=000,fmask=0133,rodir 0 0
 
FSTAB
mkdir /usra
mount /dev/mmcblk0p6 /usra
cp -a /usr/* /usra/
mount /home
mount /home/user/MyDocs
mount /dev/mmcblk1p1 /media/mmc1
cp -a /media/mmc1/user /home/
 
mkdir /tmproot
mount -o bind / /tmproot
</source>
 
Output of df -h
<pre>
Filesystem                Size      Used Available Use% Mounted on
rootfs                  227.8M    142.0M    81.6M  64% /
/dev/mmcblk0p6            4.9G    293.1M      4.4G  6% /usr
/dev/mmcblk0p5            2.0G    198.1M      1.7G  10% /opt
/dev/mmcblk0p2          19.7G      1.2G    17.5G  6% /home
/dev/mmcblk0p1            2.0G    287.4M      1.7G  14% /home/user/MyDocs
</pre>
 
= Setting profile from the terminal =
The reason for fcron in my case was that I wanted the ability to have it set a specific profile at a specific time. This is the script that does this:
cat /home/user/setprofile.sh
#!/bin/sh
profile=$1
dbus-send \
            --print-reply \
            --type=method_call \
            --dest=com.nokia.profiled \
            /com/nokia/profiled com.nokia.profiled.set_profile \
            string:$profile > /dev/null
echo "$(date +%Y-%m-%dT%H:%M) Set profile to $profile" > /tmp/setprofile.sh.log
 
= My remove list =
Stuff I removed by default
 
adobe-flashplayer
amazon-installer
ap-installer
as-config-applet-0
as-daemon-0
camel-as-provider-0
camelisync
ezitext-czech
ezitext-danish
ezitext-dutch
ezitext-english-gb
ezitext-english-us
ezitext-essential-plugins
ezitext-finnish
ezitext-french-ca
ezitext-french-fr
ezitext-german
ezitext-greek
ezitext-italian
ezitext-norwegian
ezitext-polish
ezitext-portuguese-pt
ezitext-russian
ezitext-spanish-es
ezitext-spanish-us
ezitext-swedish
facebook-installer
foreca-installer
google-search-widget
hildon-welcome
hildon-welcome-default-logo
libas-common-utils-0
libas-protocol-0
libas-storage-0
libezitext
libtinymail-1.0-0
libtinymail-camel-1.0-0
libtinymail-gnomevfs-1.0-0
libtinymail-maemo-1.0-0
libtinymailui-1.0-0
libtinymailui-gtk-1.0-0
modest
modest-as-plugin-0
modest-l10n-cscz
modest-l10n-dadk
modest-l10n-dede
modest-l10n-engb
modest-l10n-enus
modest-l10n-eses
modest-l10n-esmx
modest-l10n-fifi
modest-l10n-frca
modest-l10n-frfr
modest-l10n-itit
modest-l10n-mr0
modest-l10n-nlnl
modest-l10n-nono
modest-l10n-plpl
modest-l10n-ptpt
modest-l10n-ruru
modest-l10n-svse
modest-nokiamessaging-plugin-l10n-cscz
modest-nokiamessaging-plugin-l10n-dadk
modest-nokiamessaging-plugin-l10n-dede
modest-nokiamessaging-plugin-l10n-engb
modest-nokiamessaging-plugin-l10n-enus
modest-nokiamessaging-plugin-l10n-eses
modest-nokiamessaging-plugin-l10n-esmx
modest-nokiamessaging-plugin-l10n-fifi
modest-nokiamessaging-plugin-l10n-frca
modest-nokiamessaging-plugin-l10n-frfr
modest-nokiamessaging-plugin-l10n-itit
modest-nokiamessaging-plugin-l10n-mr0
modest-nokiamessaging-plugin-l10n-nlnl
modest-nokiamessaging-plugin-l10n-nono
modest-nokiamessaging-plugin-l10n-plpl
modest-nokiamessaging-plugin-l10n-ptpt
modest-nokiamessaging-plugin-l10n-ruru
modest-nokiamessaging-plugin-l10n-svse
modest-providers-data
nokiamessaging
osso-startup-wizard
osso-tutorial-l10n-cscz
osso-tutorial-l10n-dadk
osso-tutorial-l10n-dede
osso-tutorial-l10n-engb
osso-tutorial-l10n-enus
osso-tutorial-l10n-eses
osso-tutorial-l10n-esmx
osso-tutorial-l10n-fifi
osso-tutorial-l10n-frca
osso-tutorial-l10n-frfr
osso-tutorial-l10n-itit
osso-tutorial-l10n-mr0
osso-tutorial-l10n-nlnl
osso-tutorial-l10n-nono
osso-tutorial-l10n-plpl
osso-tutorial-l10n-ptpt
osso-tutorial-l10n-ruru
osso-tutorial-l10n-svse
ovi-promotion-widget
rtcom-accounts-plugin-gtalk
rtcom-accounts-plugin-nokiachat
sharing-rtcom
sharing-service-flickr
sharing-service-ovi
skyhost-bin
skyhost-vengine
status-area-applet-activesync-0
telepathy-spirit
tutorial-home-applet
dtg-installer
osso-accounts-plugin-skype
rtcom-abook-skype-plugin
hildon-desktop-application-shortcuts-mr0
 
You can check what any of these are with: apt-cache show name
 
 
= Bootmenu =
 
The following is my setup for /bootmenu.sh
 
It is still a work in progress and requires FBCON to be actually usable.
 
umask 022
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MODULES="twl4030-vibra
dspbridge
iommu2
omap3-iommu
omap34xxcam-mod
omap_previewer_hack
board-rx51-camera
et8ek8
ad5820
adp1653
vs6555
uinput"
if [ -L /var/run ]
then
rm -f /var/run
mkdir /var/run
fi
mount -n -t proc proc /proc
mount -n -t sysfs sysfs /sys
mount -n -t tmpfs -o size=1M,noatime tmpfs /tmp
mount -n -t tmpfs -o size=256k,mode=0755,nosuid,noatime tmpfs /var/run
mount_devpts() {
TTYGRP=5
TTYMODE=620
if [ ! -d /dev/pts ]
then
    mkdir /dev/pts
fi
if [ ! -c /dev/ptmx ]
then
    mknod /dev/ptmx c 5 2
chmod 666 /dev/ptmx
fi
mount -n -t devpts -ogid=$TTYGRP,mode=$TTYMODE devpts /dev/pts
rm -rf /var/tmp/*
}
# I hate this hack.  -- Md
make_extra_nodes () {
    if [ "$(echo /lib/udev/devices/*)" != "/lib/udev/devices/*" ]; then
cp -a /lib/udev/devices/* /dev/
    fi
  grep '^[^#]' /etc/udev/links.conf | \
  while read type name arg1; do
    [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue
    case "$type" in
    L)
      ln -s $arg1 /dev/$name
      ;;
    D)
      mkdir -p /dev/$name
      ;;
    M)
      mknod /dev/$name $arg1 && chmod 600 /dev/$name
      ;;
    *)
      echo "unparseable line ($type $name $arg1)"
      ;;
    esac
  done
}
load_extra_modules () {
    echo -n "Loading extra modules..."
    for i in $MODULES; do
echo "Loading $i"
modprobe -q $i ||:
    done
    echo "done."
}
# Mount home and paging partitions if they are available
mount_mmc(){
    device=$1
    swap=$device"p1"
    home=$device"p2"
    test=$device"p3"
    if [ -e $test ]
    then
      echo "Mounting partition $swap for paging"
      # swap disabled as a workaround for Xorg bug, per NB#111807.
      swapon $swap
      modprobe ext3
      echo "Mounting partition $home as home directory"
      mount -t ext3 -o noatime,commit=1,data=writeback $home /home
    else
      echo "No paging partition available as $swap"
      echo "No home partition available as $home"
    fi
}
prepare_start_udev()
{
. /etc/udev/udev.conf
if [ -z "$tmpfs_size" ]; then
tmpfs_size="1M"
fi
ACTION=add
echo -n "Mounting a tmpfs over /dev..."
mount -n -o size=$tmpfs_size,mode=0755,noatime -t tmpfs none /dev
echo "done."
mkdir -p /dev/.udev/db /dev/.udev/queue
echo "" > /sys/kernel/uevent_helper
echo -n "Creating extra device nodes... "
make_extra_nodes
echo "done."
}
start_udev()
{
    prepare_start_udev
/sbin/udevd --daemon
}
make_nodes()
{
echo -n "Creating device nodes... "
if [ -x /sbin/udevtrigger ]; then
/sbin/udevtrigger
else
/sbin/udevadm trigger
#wait for all events
/sbin/udevadm settle
fi
echo "done."
}
start_udev
make_nodes
load_extra_modules
export BOOTSTATE=LOCAL
touch /tmp/$BOOTSTATE
echo $BOOTSTATE > /tmp/STATE
source /etc/resource_limits.conf
echo "About to exec dsme in state '$BOOTSTATE'."
/sbin/dsme -p /usr/lib/dsme/libstartup.so &
e2fsck -vvv -f /dev/mmcblk0p1
e2fsck -vvv -f /dev/mmcblk0p2
e2fsck -vvv -f /dev/mmcblk0p5
e2fsck -vvv -f /dev/mmcblk0p6
mount /usr/local || echo 'Failed to mount /usr/local'
mount /opt || echo 'Failed to mount /opt'
mount_devpts
mount -n -o size=64M,nosuid,nodev,noatime -t tmpfs tmpfs /dev/shm
/sbin/hwclock -s || true
hostname -F /etc/hostname
ifup lo &
ifup usb0 &
echo 0 > /proc/sys/net/ipv4/conf/default/accept_redirects
echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo "49152 65535" > /proc/sys/net/ipv4/ip_local_port_range
echo 6000 > /sys/class/bluetooth/hci0/idle_timeout
# adjust other kernel parameters to minimize memory consumption
# and optimize IO pressure
echo 8 > /proc/sys/kernel/pty/max
echo 1024 > /proc/sys/kernel/threads-max
echo 8192 > /proc/sys/fs/file-max
echo 100 > /proc/sys/vm/swappiness
echo 5 > /proc/sys/vm/page-cluster
echo 500 > /proc/sys/vm/dirty_expire_centisecs
echo 65536 > /proc/sys/net/core/rmem_default
echo 16384 > /proc/sys/net/core/wmem_default
# Disable sysrq to avoid accidental console-carbage resets.
echo 0 > /proc/sys/kernel/sysrq
echo "/what/me/worry" > /proc/sys/kernel/core_pattern
echo 1 > /proc/sys/kernel/panic
echo 1 > /proc/sys/kernel/panic_on_oops
export BOOTSTATE=LOCAL
touch /tmp/$BOOTSTATE
echo $BOOTSTATE > /tmp/STATE
source /etc/resource_limits.conf
echo "About to exec dsme in state '$BOOTSTATE'."
/sbin/dsme -p /usr/lib/dsme/libstartup.so &
if [ ! -d /var/run/sshd ] ; then
  mkdir /var/run/sshd
  chmod 755 /var/run/sshd
  /usr/sbin/sshd -D &
fi
exec /bin/sh

Latest revision as of 09:26, 8 January 2018

About me

Sometime

My repos

non-optified repo: deb https://repo.codemages.net/ nonopt/
optified repo: deb https://repo.codemages.net/ opt/

What do the repos contain?

  • zsh - just don't set it as your default shell
  • xmms2 with wavpack, mpg123, mpcdec, ogg, flac, etc... support - also updated to not start at max loud
  • fcron - requires some manual work after the install(I'll try to give it an event.d script and do that stuff after the fact but not just yet)
  • gcoreutils and gtar
  • rsyslog
  • curl
  • djmount
  • tinc
  • xset and xrdb
create a fcron user
chown fcron:fcron /etc/fcron.*
chown -R fcron:fcron /var/spool/fcron

Then edit /etc/event.d/rcS-late

And after initctl emit MOUNTS_OK

put:
/etc/init.d/fcron start

Repartitioning

Here is what I did to repartition: http://talk.maemo.org/showpost.php?p=411490&postcount=51

Copied from the post by request:


<source lang="bash">

  1. !/bin/bash

echo "Not for running only REFERENCE!!!" exit

      1. THIS ALL APPLIES TO ALL PR 1.0 PR 1.0.1 PR 1.1 ###
  1. backup your user

mount /dev/mmcblk1p1 /media/mmc1 cp -a /home/user /media/mmc1/

  1. partitioning

sfdisk -uM --no-reread /dev/mmcblk0 << FDSK 0 2048 c 2049 20544 83 22593 768 82 23361 7170 5 23362 2048 83 25410 5120 83

FDSK

  1. REBOOT
  1. do this sometime

mkfs.ext2 /dev/mmcblk0p5 mkfs.ext2 /dev/mmcblk0p2 mkfs.ext2 /dev/mmcblk0p6 mkfs.vfat /dev/mmcblk0p1 mkswap /dev/mmcblk0p3

  1. change /etc/event.d/rcS-late
  2. comment out generation of fstab
  3. the following sed command will add a comment character "#"
  4. at the start of lines 10-20

sed "10,20s:\(.*\):#\1:" /etc/event.d/rcS-late > /etc/event.d/rcS-late.new cp /etc/event.d/rcS-late.new /etc/event.d/rcS-late

  1. add mount /home/user/MyDocs
  2. this sed command inserts /bin/mount /home/user/MyDocs || echo 'Failed to mount' on line 23

sed "23i/bin/mount /home/user/MyDocs || echo 'Failed to mount /home/user/MyDocs partition.'" /etc/event.d/rcS-late > /etc/event.d/rcS-late.new cp /etc/event.d/rcS-late.new /etc/event.d/rcS-late rm /etc/event.d/rcS-late.new

  1. change /etc/init.d/rcS
  2. this sed command starts on line 197 and if it finds: load_extra_module
  3. it will replace it with: load_extra_module newline and a mount for usr and opt

sed "197s:load_extra_modules:load_extra_modules\nmount /usr || echo 'Failed to mount /usr'\nmount /opt || echo 'Failed to mount /opt':" /etc/init.d/rcS > /etc/init.d/rcS.new cp /etc/init.d/rcS.new /etc/init.d/rcS rm /etc/init.d/rcS.new

  1. fstab

cat << FSTAB > /etc/fstab rootfs / rootfs defaults,errors=remount-ro,noatime 0 0 /dev/mmcblk0p6 /usr ext2 rw,noatime,nodiratime,errors=continue 0 0 /dev/mmcblk0p5 /opt ext2 rw,noatime,nodiratime,errors=continue 0 0 /dev/mmcblk0p3 none swap sw 0 0 /dev/mmcblk0p2 /home ext2 rw,noatime,nodiratime,errors=continue 0 0 /dev/mmcblk0p1 /home/user/MyDocs vfat noauto,nodev,noexec,nosuid,noatime,nodiratime,utf8,uid=29999,shortname=mixed,dmask=000,fmask=0133,rodir 0 0

FSTAB mkdir /usra mount /dev/mmcblk0p6 /usra cp -a /usr/* /usra/ mount /home mount /home/user/MyDocs mount /dev/mmcblk1p1 /media/mmc1 cp -a /media/mmc1/user /home/

mkdir /tmproot mount -o bind / /tmproot </source>

Output of df -h

Filesystem                Size      Used Available Use% Mounted on
rootfs                  227.8M    142.0M     81.6M  64% /
/dev/mmcblk0p6            4.9G    293.1M      4.4G   6% /usr
/dev/mmcblk0p5            2.0G    198.1M      1.7G  10% /opt
/dev/mmcblk0p2           19.7G      1.2G     17.5G   6% /home
/dev/mmcblk0p1            2.0G    287.4M      1.7G  14% /home/user/MyDocs

Setting profile from the terminal

The reason for fcron in my case was that I wanted the ability to have it set a specific profile at a specific time. This is the script that does this: cat /home/user/setprofile.sh

#!/bin/sh
profile=$1

dbus-send \
           --print-reply \
           --type=method_call \
           --dest=com.nokia.profiled \
           /com/nokia/profiled com.nokia.profiled.set_profile \
           string:$profile > /dev/null
echo "$(date +%Y-%m-%dT%H:%M) Set profile to $profile" > /tmp/setprofile.sh.log

My remove list

Stuff I removed by default

adobe-flashplayer
amazon-installer
ap-installer
as-config-applet-0
as-daemon-0
camel-as-provider-0
camelisync
ezitext-czech
ezitext-danish
ezitext-dutch
ezitext-english-gb
ezitext-english-us
ezitext-essential-plugins
ezitext-finnish
ezitext-french-ca
ezitext-french-fr
ezitext-german
ezitext-greek
ezitext-italian
ezitext-norwegian
ezitext-polish
ezitext-portuguese-pt
ezitext-russian
ezitext-spanish-es
ezitext-spanish-us
ezitext-swedish
facebook-installer
foreca-installer
google-search-widget
hildon-welcome
hildon-welcome-default-logo
libas-common-utils-0
libas-protocol-0
libas-storage-0
libezitext
libtinymail-1.0-0
libtinymail-camel-1.0-0
libtinymail-gnomevfs-1.0-0
libtinymail-maemo-1.0-0
libtinymailui-1.0-0
libtinymailui-gtk-1.0-0
modest
modest-as-plugin-0
modest-l10n-cscz 
modest-l10n-dadk 
modest-l10n-dede
modest-l10n-engb
modest-l10n-enus
modest-l10n-eses
modest-l10n-esmx
modest-l10n-fifi
modest-l10n-frca
modest-l10n-frfr
modest-l10n-itit
modest-l10n-mr0
modest-l10n-nlnl
modest-l10n-nono
modest-l10n-plpl
modest-l10n-ptpt
modest-l10n-ruru
modest-l10n-svse
modest-nokiamessaging-plugin-l10n-cscz
modest-nokiamessaging-plugin-l10n-dadk
modest-nokiamessaging-plugin-l10n-dede
modest-nokiamessaging-plugin-l10n-engb
modest-nokiamessaging-plugin-l10n-enus
modest-nokiamessaging-plugin-l10n-eses
modest-nokiamessaging-plugin-l10n-esmx
modest-nokiamessaging-plugin-l10n-fifi
modest-nokiamessaging-plugin-l10n-frca
modest-nokiamessaging-plugin-l10n-frfr
modest-nokiamessaging-plugin-l10n-itit
modest-nokiamessaging-plugin-l10n-mr0
modest-nokiamessaging-plugin-l10n-nlnl
modest-nokiamessaging-plugin-l10n-nono
modest-nokiamessaging-plugin-l10n-plpl
modest-nokiamessaging-plugin-l10n-ptpt
modest-nokiamessaging-plugin-l10n-ruru
modest-nokiamessaging-plugin-l10n-svse
modest-providers-data
nokiamessaging
osso-startup-wizard
osso-tutorial-l10n-cscz
osso-tutorial-l10n-dadk
osso-tutorial-l10n-dede
osso-tutorial-l10n-engb
osso-tutorial-l10n-enus
osso-tutorial-l10n-eses
osso-tutorial-l10n-esmx
osso-tutorial-l10n-fifi
osso-tutorial-l10n-frca
osso-tutorial-l10n-frfr
osso-tutorial-l10n-itit
osso-tutorial-l10n-mr0
osso-tutorial-l10n-nlnl
osso-tutorial-l10n-nono
osso-tutorial-l10n-plpl
osso-tutorial-l10n-ptpt
osso-tutorial-l10n-ruru
osso-tutorial-l10n-svse
ovi-promotion-widget
rtcom-accounts-plugin-gtalk
rtcom-accounts-plugin-nokiachat
sharing-rtcom
sharing-service-flickr
sharing-service-ovi
skyhost-bin
skyhost-vengine
status-area-applet-activesync-0
telepathy-spirit
tutorial-home-applet
dtg-installer
osso-accounts-plugin-skype
rtcom-abook-skype-plugin
hildon-desktop-application-shortcuts-mr0

You can check what any of these are with: apt-cache show name


Bootmenu

The following is my setup for /bootmenu.sh

It is still a work in progress and requires FBCON to be actually usable.

umask 022
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MODULES="twl4030-vibra
dspbridge
iommu2
omap3-iommu
omap34xxcam-mod
omap_previewer_hack
board-rx51-camera
et8ek8
ad5820
adp1653
vs6555
uinput"

if [ -L /var/run ]
then
	rm -f /var/run
	mkdir /var/run
fi

mount -n -t proc proc /proc
mount -n -t sysfs sysfs /sys
mount -n -t tmpfs -o size=1M,noatime tmpfs /tmp
mount -n -t tmpfs -o size=256k,mode=0755,nosuid,noatime tmpfs /var/run


mount_devpts() {
	TTYGRP=5
	TTYMODE=620

	if [ ! -d /dev/pts ]
	then
	    mkdir /dev/pts
	fi

	if [ ! -c /dev/ptmx ]
	then
	    mknod /dev/ptmx c 5 2
		chmod 666 /dev/ptmx
	fi

	mount -n -t devpts -ogid=$TTYGRP,mode=$TTYMODE devpts /dev/pts
	rm -rf /var/tmp/*
}

# I hate this hack.  -- Md
make_extra_nodes () {
    if [ "$(echo /lib/udev/devices/*)" != "/lib/udev/devices/*" ]; then
	cp -a /lib/udev/devices/* /dev/
    fi
  grep '^[^#]' /etc/udev/links.conf | \
  while read type name arg1; do
    [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue
    case "$type" in
    L)
      ln -s $arg1 /dev/$name
      ;;
    D)
      mkdir -p /dev/$name
      ;;
    M)
      mknod /dev/$name $arg1 && chmod 600 /dev/$name
      ;;
    *)
      echo "unparseable line ($type $name $arg1)"
      ;;
    esac
  done
}

load_extra_modules () {
    echo -n "Loading extra modules..."
    for i in $MODULES; do
	echo "Loading $i"
	modprobe -q $i ||:
    done
    echo "done."
}

# Mount home and paging partitions if they are available
mount_mmc(){
   device=$1
   swap=$device"p1"
   home=$device"p2"
   test=$device"p3"

   if [ -e $test ]
   then
      echo "Mounting partition $swap for paging"
      # swap disabled as a workaround for Xorg bug, per NB#111807.
      swapon $swap
      modprobe ext3
      echo "Mounting partition $home as home directory"
      mount -t ext3 -o noatime,commit=1,data=writeback $home /home
   else
      echo "No paging partition available as $swap"
      echo "No home partition available as $home"
   fi
}

prepare_start_udev()
{
	. /etc/udev/udev.conf

	if [ -z "$tmpfs_size" ]; then
		tmpfs_size="1M"
	fi

	ACTION=add
	echo -n "Mounting a tmpfs over /dev..."
	mount -n -o size=$tmpfs_size,mode=0755,noatime -t tmpfs none /dev
	echo "done."
	mkdir -p /dev/.udev/db /dev/.udev/queue
	echo "" > /sys/kernel/uevent_helper
	echo -n "Creating extra device nodes... "
	make_extra_nodes
	echo "done."
}

start_udev()
{
    	prepare_start_udev
	/sbin/udevd --daemon
}

make_nodes()
{
	echo -n "Creating device nodes... "

	if [ -x /sbin/udevtrigger ]; then
		/sbin/udevtrigger
	else
		/sbin/udevadm trigger
		#wait for all events
		/sbin/udevadm settle
	fi
	echo "done."
}

	start_udev
	make_nodes
	load_extra_modules
export BOOTSTATE=LOCAL
touch /tmp/$BOOTSTATE
echo $BOOTSTATE > /tmp/STATE
source /etc/resource_limits.conf
echo "About to exec dsme in state '$BOOTSTATE'."
/sbin/dsme -p /usr/lib/dsme/libstartup.so &
e2fsck -vvv -f /dev/mmcblk0p1
e2fsck -vvv -f /dev/mmcblk0p2
e2fsck -vvv -f /dev/mmcblk0p5
e2fsck -vvv -f /dev/mmcblk0p6
mount /usr/local || echo 'Failed to mount /usr/local'
mount /opt || echo 'Failed to mount /opt'

mount_devpts
mount -n -o size=64M,nosuid,nodev,noatime -t tmpfs tmpfs /dev/shm

/sbin/hwclock -s || true


hostname -F /etc/hostname
ifup lo &
ifup usb0 &

echo 0 > /proc/sys/net/ipv4/conf/default/accept_redirects
echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo "49152 65535" > /proc/sys/net/ipv4/ip_local_port_range
echo 6000 > /sys/class/bluetooth/hci0/idle_timeout

# adjust other kernel parameters to minimize memory consumption
# and optimize IO pressure
echo 8 > /proc/sys/kernel/pty/max
echo 1024 > /proc/sys/kernel/threads-max
echo 8192 > /proc/sys/fs/file-max
echo 100 > /proc/sys/vm/swappiness
echo 5 > /proc/sys/vm/page-cluster
echo 500 > /proc/sys/vm/dirty_expire_centisecs
echo 65536 > /proc/sys/net/core/rmem_default
echo 16384 > /proc/sys/net/core/wmem_default

# Disable sysrq to avoid accidental console-carbage resets.
echo 0 > /proc/sys/kernel/sysrq

echo "/what/me/worry" > /proc/sys/kernel/core_pattern
echo 1 > /proc/sys/kernel/panic
echo 1 > /proc/sys/kernel/panic_on_oops

export BOOTSTATE=LOCAL
touch /tmp/$BOOTSTATE
echo $BOOTSTATE > /tmp/STATE
source /etc/resource_limits.conf
echo "About to exec dsme in state '$BOOTSTATE'."
/sbin/dsme -p /usr/lib/dsme/libstartup.so &
if [ ! -d /var/run/sshd ] ; then
  mkdir /var/run/sshd
  chmod 755 /var/run/sshd
  /usr/sbin/sshd -D &
fi

exec /bin/sh