#!/bin/sh
im()
{
modname=$1
modsane=${1//-/_}
params=$(eval echo \$OPT_${modsane})
shift
file=/lib/modules/${KVER}/${modname}.ko
# own built modules are in /lib/modules/$KVER/kernel/... subdirectories
# ...but we can override this by putting modules to /lib/modules/$KVER directly
if test -e $file; then
echo "overriding ${modname}.ko from /lib/modules/$KVER ..."
/sbin/insmod $file ${params:-$@}
else
/sbin/modprobe $modname $@
fi
}
# hack, ugly: we should not need to know about neutrino.conf internals
get_vidmode()
{
M=$(grep video_Mode= /var/tuxbox/config/neutrino.conf)
if [ -z "$M" ]; then
echo "1280x720-32@50"
return
fi
M=${M#*=}
if [ $M = 6 ] || [ $M -gt 7 ]; then
echo "1920x1080-32@50"
return
fi
if [ $M -lt 5 ]; then
echo "720x576-32@50"
return
fi
echo "1280x720-32@50"
}
get_cpufreq()
{
F=$(grep ^cpufreq= /var/tuxbox/config/neutrino.conf)
if [ -z "$F" ]; then
return
fi
F=${F#*=}
if [ x$F = x0 ]; then
return
fi
echo initial_pll0_ndiv_mdiv=$(($F/10 * 256 + 3))
}
case $1 in
start)
SPARK7162=false
read a b BOARD < /proc/cpuinfo
test "$BOARD" = hdk7105 && SPARK7162=true
if $SPARK7162; then
STMCORE_DISP=stmcore-display-sti7105
FRONTEND_MOD=spark7162
AVS_PARAM="type=avs_pio"
else
STMCORE_DISP=stmcore-display-sti7111
FRONTEND_MOD=stv090x
AVS_PARAM="type=avs_pio"
fi
read dummy dummy KVER dummy < /proc/version
grep -q uinput /lib/modules/${KVER}/modules.dep || depmod -a
# set all "option foo ..." as OPT_foo="..." variables
eval $(sed -n "/^options\s/{
s/^options\s\(\S\+\)\s\(.*\)\$/OPT_\1=\"\2\"/;
s/^\(\S\+\)-/\1_/g;
s/^\(\S\+\)-/\1_/g;
s/^\(\S\+\)-/\1_/g;
p }" /etc/modprobe.conf)
touch /tmp/.init_loading_firmware
(
ustslave /dev/st231-1 /boot/audio.elf
ustslave /dev/st231-0 /boot/video.elf
rm /tmp/.init_loading_firmware
) &
im cpu_frequ $(get_cpufreq)
im aotom
echo loading > /dev/vfd
im uinput
im e2_proc
im $STMCORE_DISP
MEMSIZE=12m # neutrino now needs 12m for FB scaling backbuffer
VM=$(get_vidmode)
im stmfb.ko display0=$VM:$MEMSIZE:pal:yuv:yuv
im embxshell
im embxmailbox mailbox0=0xfe211000:136:set2 mailbox1=0xfe212000:0
im embxshm mailbox0=shm:0:7:0x60000000:0:256:256:0:512:0x40000000:0x10000000
im mme_host transport0=shm
im avs $AVS_PARAM
im mmelog
im ksound
im p2div64
im stm_v4l2
im stmvout
im stmvbi
im pseudocard
im $FRONTEND_MOD
im pti waitMS=20 videoMem=4096
im stm_monitor
im stmsysfs
im stmdvb
im player2 discardlateframe=0
im sth264pp
im stmalloc
im platform
im silencegen
im bpamem
showiframe -p /boot/bootlogo.mvi &
sleep 8
im smartcard
[ -f /etc/modules.extra ] && eval `sed -e 's/#.*//' -e '/^\s*$/d' -e 's/^\(.*\)/modprobe \0;/' < /etc/modules.extra`
while [ -f /tmp/.init_loading_firmware ] ; do
usleep 100000 # 100ms
done
echo done loading > /dev/vfd
;;
esac
killall -9 showiframe