Reply
Thread Tools
Posts: 543 | Thanked: 181 times | Joined on Aug 2009 @ Universe,LocalCluster.MilkyWay.Sol.Earth.Europe.Slovenia.Ljubljana
#1
NOTE: you need a fbcon enabled kernel to get any decent use out of this.

Well I wanted an emergency console and came up with this

my /bootmenu.sh
Code:
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
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
This will enable me to almost always get a console. Need to get a separate busybox install as well which would be staticaly linked and set in it's own space. That way I could generally bypass most boot issues. It doesn't help with some things though.

If anyone knows how to make a smallish initramfs I'd appreciate it needs to be 200kb since apparently the kernel limitation is 2MB.
__________________
For any repos or anything else I might have working on my N900 see:
http://wiki.maemo.org/User:Ruskie
A quick list of what I have in the repos
zsh|xmms2|fcron|gtar|gcoreutils

Last edited by ruskie; 2010-02-10 at 08:23.
 

The Following User Says Thank You to ruskie For This Useful Post:
ArnimS's Avatar
Posts: 1,107 | Thanked: 720 times | Joined on Mar 2007 @ Germany
#2
very exciting work ruskie, thanks. need to install a diff kernel and will ty it out
__________________
find . -name \*.mp3 -exec mplayer -quiet -shuffle "{}" +
das ist your media player, and yuu vill like it
 
Reply


 
Forum Jump


All times are GMT. The time now is 03:58.