satip-axe/fs-add/etc/init.d/rcS
2015-08-03 16:57:27 +02:00

138 lines
3.5 KiB
Plaintext
Executable File

#!/bin/busybox sh
busybox echo "Welcome to SATIP-AXE Linux!"
busybox mount -t proc proc /proc
# remount root filesystem in rw mode
busybox mount -o remount,rw /
# Create all symbolic links.
/bin/busybox --install -s
# Date
date 010112002015 >/dev/null
# mount /dev and devpts to allow logging in
mount -t tmpfs -o size=64k,mode=0755 tmpfs /dev
mkdir /dev/pts /dev/input
mount -t devpts none /dev/pts -ogid=5,mode=620
# use mdev/sysfs
mkdir -p /lib/modules/$(uname -r)
mount -t sysfs sysfs /sys
touch /dev/mdev.seq
mkdir -p /media
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s
# make /tmp as tmpfs
mount -t tmpfs -o size=4M tmpfs /tmp
mv /var /var.2
mkdir /tmp/var
ln -s /tmp/var /var
rm -rf /var.2
mkdir -p /tmp/var/run /tmp/var/log /tmp/var/spool /var/lib/nfs
mount -t nfsd nfsd /proc/fs/nfsd
# sysctl.conf
sysctl -q -p
# start syslogd
syslogd -C256
# config/data storage
mkdir -p /mnt/data
mount -t jffs2 /dev/mtdblock4 /mnt/data/
mkdir -p /mnt/data/satip-axe/sysconfig
ln -s /mnt/data/satip-axe/sysconfig /etc/sysconfig
if ! test -r /etc/sysconfig/config ; then
cp /etc/config.default /etc/sysconfig/config
fi
if test -r /etc/sysconfig/passwd ; then
cp /etc/sysconfig/passwd /etc/passwd
fi
# loopback
ifconfig lo 127.0.0.1 netmask 255.255.255.0
# AXE modules and AXE hw initialization
logger -p local0.notice "AXE drivers load start"
axehelper i2c_reg_read 0xd0 0xf000 > /dev/null 2> /dev/null || logger -p local0.notice "I2C Demod #1(D0) failed"
axehelper i2c_reg_read 0xd2 0xf000 > /dev/null 2> /dev/null || logger -p local0.notice "I2C Demod #2(D2) failed"
d=/lib/modules/axe
insmod $d/stapi_core_stripped.ko
insmod $d/stapi_ioctl_stripped.ko
insmod $d/axe_i2c.ko
insmod $d/i2c_mangle.ko
insmod $d/axe_fe.ko
insmod $d/axe_fp.ko
insmod $d/axe_dmx.ko
#insmod $d/axe_dmxts.ko
insmod $d/axe_dmxts_std.ko
mkdir -p /dev/axe /dev/stapi
maj=
for i in $(cat /proc/devices); do
if test -z "$maj"; then
if test "$i" = "Block"; then
break
fi
maj=$i
continue
fi
if test -z "$i"; then
maj=
continue
elif test "${i::2}" = "st" -a "${i:$(expr ${#i} - 6)}" = "_ioctl"; then
mknod /dev/stapi/$i c $maj 0
elif test "$i" = "i2c_drv"; then
mknod /dev/axe/i2c_drv-0 c $maj 0
elif test "$i" = "fp"; then
mknod /dev/axe/fp-0 c $maj 0
elif test "$i" = "frontend"; then
mknod /dev/axe/frontend-0 c $maj 0
mknod /dev/axe/frontend-1 c $maj 1
mknod /dev/axe/frontend-2 c $maj 2
mknod /dev/axe/frontend-3 c $maj 3
elif test "$i" = "demux"; then
mknod /dev/axe/demux-0 c $maj 1
mknod /dev/axe/demux-1 c $maj 0
mknod /dev/axe/demux-2 c $maj 3
mknod /dev/axe/demux-3 c $maj 2
elif test "$i" = "demuxts"; then
mknod /dev/axe/demuxts-0 c $maj 1
mknod /dev/axe/demuxts-1 c $maj 0
mknod /dev/axe/demuxts-2 c $maj 3
mknod /dev/axe/demuxts-3 c $maj 2
fi
maj=
done
/etc/init.d/axe &
nc -l 127.0.0.1:1001 -e /bin/true
rm -f /root/main_init.sh /tmp/axe-done
logger -p local0.notice "AXE drivers load finish"
# localtime
if test -r /etc/sysconfig/localtime; then
ln -s sysconfig/localtime /etc/localtime
fi
# hostname
test -r /etc/sysconfig/config && . /etc/sysconfig/config
test -n "$HOSTNAME" && hostname "$HOSTNAME"
test -z "$HOSTNAME" && hostname satip-axe
# modules
if test -n "$KMODULES"; then
for m in $KMODULES; do
insmod "/lib/modules/$m"
done
fi
# basic network
ifconfig eth0 txqueuelen 2000 up
route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
# local boot
if test -x /etc/sysconfig/localboot ; then
/etc/sysconfig/localboot
fi