summaryrefslogtreecommitdiffstats
path: root/build/rootfs/init
blob: ca938af887eabb2bc0c6a9074ef5bbcafaa7af27 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/ash
# sc2010 Init 

#############################################################################
# PreBoot init main part

# device files get their own filesystem
devdir="/dev"

mkdir -p /tmp /sys /proc

mount -n -t tmpfs -o 'size=25%,mode=0755' mdev ${devdir}
mount -t tmpfs tmpfs /tmp
mkdir -p /dev/pts
mount -t devpts devpts /dev/pts
mount -t proc proc /proc
mount -t sysfs sysfs /sys
echo /sbin/mdev > /proc/sys/kernel/hotplug
cat > /etc/mdev.conf << "EOF"
sda* 0:6 0660
sdb* 0:6 0660
sg* 0:6 0660
hda* 0:6 0660
hdb* 0:6 0660
EOF

mdev -s

export PATH=/bin:/sbin:/usr/bin/:/usr/sbin

export DEBUGLEVEL=0

read KCMDLINE < /proc/cmdline
export KCMDLINE
# read the system wide initramfs-setup and then the kernel commandline
for opts in ${KCMDLINE} ; do
case ${opts} in
 # single token for debugging ...
    debug)
      DEBUGLEVEL=1
    ;;
    # ... or a specified debug level
    debug=*)
      DEBUGLEVEL=${opts#debug=}
      syslogd -C2048
      klogd
    ;;
esac
done


# create basic device files an directories in dev
for i in "/dev/mem c 1 1" "/dev/null c 1 3" "/dev/zero c 1 5" \
         "/dev/urandom c 1 9" "/dev/kmsg c 1 11" "/dev/tty0 c 4 0" \
         "/dev/tty1 c 4 1" "/dev/tty2 c 4 2" "/dev/tty3 c 4 3" \
         "/dev/tty4 c 4 4" "/dev/tty5 c 4 5" "/dev/tty6 c 4 6" \
         "/dev/tty7 c 4 7" "/dev/tty8 c 4 8" "/dev/tty9 c 4 9" \
         "/dev/tty10 c 4 10" "/dev/tty c 5 0" "/dev/console c 5 1" \
         "/dev/ptmx c 5 2" "/dev/psaux c 10 1" "/dev/agpgart c 10 175" \
         "/dev/fb0 c 29 0" "/dev/bootsplash p" "/dev/xconsole p"; do
  [ -e $(echo $i | awk ' {print $1}') ] || mknod $i
done
mkdir -p ${devdir}/pts ${devdir}/shm

loadkmap < /etc/keymaps/de_DE
echo "1" > /dev/mouse0
echo "1" > /dev/tty0

echo "Starting shell, leaving it would continue init."
getty -i -n -l /bin/cat 38400 tty10 &
setlogcons 10

# initramfs-setup configuration (common settings for all clients using a
# certain InitRamFS generated by slxmkramfs/mkdxsinitrd)
[ -f /etc/initramfs-setup ] && . /etc/initramfs-setup 2>/dev/null

# set a default LAN interface, has to be modified for WLAN or on machines
# with more than one ethernet card built in
nwif="eth0"

# mount the important standard directories
[ ! -f /proc/cpuinfo ] && mount -n -t proc proc /proc
[ ! -d /sys/class ] && mount -n -t sysfs sysfs /sys

# set up loopback networking and power up ethernet
ip link set dev lo up
ip addr add 127.0.0.1/8 dev lo
ip link set dev $nwif up || echo "I did not find any usable network adaptor."

echo "/sbin/udhcpc -f -n -q -s /etc/udhcpc.default.script -i $nwif &>/dev/null &" \
 >> /bin/run_udhcpc.sh

cat /etc/issue

#ntbdate time.uni-freiburg.de

if [ $DEBUGLEVEL -ge 1 ]; then
echo "DEBUGLEVEL=$DEBUGLEVEL" > /tmp/debuglevel
echo -n "Starting debug shell: "
echo "CTRL + D will start fbgui"
/bin/sh
fi

echo "Start init" > /dev/klog
exec /sbin/init