2015-03-27 21:55:18 +01:00
|
|
|
#!/bin/busybox sh
|
|
|
|
|
2015-08-04 19:42:35 +02:00
|
|
|
busybox mount -t proc proc /proc
|
|
|
|
|
2015-08-04 18:38:54 +02:00
|
|
|
AXECFG=$(busybox awk 'match($0, /axecfg=[^ ]*/) {print substr($0,RSTART,RLENGTH)}' /proc/cmdline)
|
|
|
|
busybox echo "Welcome to SATIP-AXE Linux! $AXECFG"
|
|
|
|
AXECFG=${AXECFG:7:255}
|
2015-03-27 21:55:18 +01:00
|
|
|
|
|
|
|
# remount root filesystem in rw mode
|
|
|
|
busybox mount -o remount,rw /
|
|
|
|
# Create all symbolic links.
|
2015-04-08 13:54:26 +02:00
|
|
|
/bin/busybox --install -s
|
|
|
|
|
|
|
|
# Date
|
|
|
|
date 010112002015 >/dev/null
|
2015-03-27 21:55:18 +01:00
|
|
|
|
|
|
|
# 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
|
2015-04-10 15:08:02 +02:00
|
|
|
mkdir -p /lib/modules/$(uname -r)
|
2015-03-27 21:55:18 +01:00
|
|
|
mount -t sysfs sysfs /sys
|
2015-04-08 13:54:26 +02:00
|
|
|
touch /dev/mdev.seq
|
|
|
|
mkdir -p /media
|
2015-03-27 21:55:18 +01:00
|
|
|
echo /sbin/mdev > /proc/sys/kernel/hotplug
|
|
|
|
mdev -s
|
|
|
|
|
|
|
|
# make /tmp as tmpfs
|
2015-04-08 17:30:03 +02:00
|
|
|
mount -t tmpfs -o size=4M tmpfs /tmp
|
2015-04-08 13:54:26 +02:00
|
|
|
mv /var /var.2
|
|
|
|
mkdir /tmp/var
|
|
|
|
ln -s /tmp/var /var
|
|
|
|
rm -rf /var.2
|
2015-04-21 14:54:49 +02:00
|
|
|
mkdir -p /tmp/var/run /tmp/var/log /tmp/var/spool /var/lib/nfs
|
|
|
|
mount -t nfsd nfsd /proc/fs/nfsd
|
2015-03-27 21:55:18 +01:00
|
|
|
|
2015-04-09 10:47:49 +02:00
|
|
|
# sysctl.conf
|
|
|
|
sysctl -q -p
|
|
|
|
|
2015-03-28 20:33:17 +01:00
|
|
|
# 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
|
2015-08-04 18:38:54 +02:00
|
|
|
if test "$AXECFG" = "reset"; then
|
|
|
|
mv /etc/sysconfig/config.old /etc/sysconfig/config.old1 2> /dev/null
|
|
|
|
mv /etc/sysconfig/config /etc/sysconfig/config.old 2> /dev/null
|
|
|
|
mv /etc/sysconfig/passwd.old /etc/sysconfig/passwd.old1 2> /dev/null
|
|
|
|
mv /etc/sysconfig/passwd /etc/sysconfig/passwd.old 2> /dev/null
|
2015-08-04 19:42:35 +02:00
|
|
|
fi
|
|
|
|
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
|
2015-03-31 16:39:17 +02:00
|
|
|
fi
|
2015-03-28 20:33:17 +01:00
|
|
|
|
2015-08-04 18:38:54 +02:00
|
|
|
# load config
|
|
|
|
test -r /etc/sysconfig/config && . /etc/sysconfig/config
|
|
|
|
|
2018-01-25 09:00:55 +01:00
|
|
|
# start syslogd
|
|
|
|
syslogd -C256 $SYSLOGD_OPTS
|
|
|
|
|
2015-04-10 15:08:02 +02:00
|
|
|
# loopback
|
|
|
|
ifconfig lo 127.0.0.1 netmask 255.255.255.0
|
|
|
|
|
|
|
|
# AXE modules and AXE hw initialization
|
2015-04-20 15:43:32 +02:00
|
|
|
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"
|
2015-04-14 10:14:19 +02:00
|
|
|
d=/lib/modules/axe
|
|
|
|
insmod $d/stapi_core_stripped.ko
|
|
|
|
insmod $d/stapi_ioctl_stripped.ko
|
|
|
|
insmod $d/axe_i2c.ko
|
2015-04-20 15:43:32 +02:00
|
|
|
insmod $d/i2c_mangle.ko
|
2015-04-14 10:14:19 +02:00
|
|
|
insmod $d/axe_fe.ko
|
|
|
|
insmod $d/axe_fp.ko
|
|
|
|
insmod $d/axe_dmx.ko
|
2015-08-04 18:38:54 +02:00
|
|
|
if test "$AXECFG" = "demuxts_old" -o "$DEMUXTS_OLD" = "yes"; then
|
|
|
|
insmod $d/axe_dmxts_std.ko
|
|
|
|
else
|
|
|
|
insmod $d/axe_dmxts.ko
|
|
|
|
fi
|
2015-04-14 10:14:19 +02:00
|
|
|
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
|
2015-08-03 16:57:27 +02:00
|
|
|
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
|
2015-04-14 10:14:19 +02:00
|
|
|
elif test "$i" = "demuxts"; then
|
2015-08-03 16:57:27 +02:00
|
|
|
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
|
2015-04-14 10:14:19 +02:00
|
|
|
fi
|
|
|
|
maj=
|
|
|
|
done
|
2015-04-10 15:08:02 +02:00
|
|
|
/etc/init.d/axe &
|
2015-04-20 15:43:32 +02:00
|
|
|
nc -l 127.0.0.1:1001 -e /bin/true
|
2015-04-10 15:08:02 +02:00
|
|
|
rm -f /root/main_init.sh /tmp/axe-done
|
2015-04-20 15:43:32 +02:00
|
|
|
logger -p local0.notice "AXE drivers load finish"
|
2015-04-10 15:08:02 +02:00
|
|
|
|
2015-05-24 20:30:36 +02:00
|
|
|
# localtime
|
|
|
|
if test -r /etc/sysconfig/localtime; then
|
|
|
|
ln -s sysconfig/localtime /etc/localtime
|
|
|
|
fi
|
|
|
|
|
2015-04-08 13:54:26 +02:00
|
|
|
# hostname
|
|
|
|
test -n "$HOSTNAME" && hostname "$HOSTNAME"
|
|
|
|
test -z "$HOSTNAME" && hostname satip-axe
|
|
|
|
|
2015-04-08 17:30:03 +02:00
|
|
|
# modules
|
|
|
|
if test -n "$KMODULES"; then
|
|
|
|
for m in $KMODULES; do
|
|
|
|
insmod "/lib/modules/$m"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2015-03-27 21:55:18 +01:00
|
|
|
# basic network
|
2015-04-14 09:27:46 +02:00
|
|
|
ifconfig eth0 txqueuelen 2000 up
|
2015-03-27 21:55:18 +01:00
|
|
|
route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
|
2015-03-31 16:39:17 +02:00
|
|
|
|
2016-02-25 18:48:35 +01:00
|
|
|
# unpack extra packages
|
|
|
|
for package in /mnt/data/satip-axe/packages/*.tar.gz; do
|
|
|
|
if test -r "$package"; then
|
|
|
|
logger -p local0.notice "Unpacking package $package"
|
|
|
|
tar xz -C / -f "$package"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
for package in /mnt/data/satip-axe/packages/*.tar.bz2; do
|
|
|
|
if test -r "$package"; then
|
|
|
|
logger -p local0.notice "Unpacking package $package"
|
|
|
|
tar xj -C / -f "$package"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# run extra services
|
|
|
|
inithup=
|
|
|
|
for prg in /etc/init.extra/*; do
|
|
|
|
if test -x "$prg"; then
|
|
|
|
if test -z "$inithup"; then
|
|
|
|
echo "# Added by /etc/init.d/rcS - init.extra" >> /etc/inittab
|
|
|
|
fi
|
|
|
|
echo "::respawn:${prg}" >> /etc/inittab
|
|
|
|
inithup=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if test -n "$inithup"; then
|
|
|
|
kill -SIGHUP 1
|
|
|
|
fi
|
|
|
|
|
2015-03-31 16:39:17 +02:00
|
|
|
# local boot
|
|
|
|
if test -x /etc/sysconfig/localboot ; then
|
|
|
|
/etc/sysconfig/localboot
|
|
|
|
fi
|