#!/bin/sh

. /etc/init.d/functions

##### Basic initialization

milestone "Mounting /proc and /sys filesystems"
mount -n -t proc  none /proc
mount -n -t sysfs none /sys

##### Device infrastructure initialization (support for devfs and udev)

milestone "Initializing device infrastructure"

mount -n -o mode=0755 -t tmpfs none /dev
mknod /dev/console c 5 1
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mkdir /dev/pts
mkdir /dev/shm

sysctl -w kernel.hotplug=/sbin/mdev
mdev -s

##### Miscellaneous initializations

milestone "Loading modules"
for i in $(cat /etc/modules); do modprobe $i; done

#milestone "Launching watchdog"
#if [ ! -c /dev/watchdog ]; then sleep 1; fi
#if [   -c /dev/watchdog ]; then watchdog -t 2 /dev/watchdog; fi

milestone "Populating /dev/shm"
for i in lock pcmcia run run/ppp run/usb spool tmp; do
	mkdir -p /dev/shm/$i;
done

milestone "Mounting other core filesystems"
mount -n -o mode=0620 -t devpts none /dev/pts

##### Setup system parameters (from /etc/sysctl.conf)

milestone "Setting up system parameters"
sysctl -p

##### Local stuff

mknod /dev/ttygserial c 127 0

