## via boot params or /etc/oztivo.conf
## If TiVo doesn't find eth0, then it tries to find a ppp server
#if `cat /proc/net/dev |grep eth0` ; then
# NETCARDIP=`ifconfig eth0|grep "inet addr" |cut -d: -f2|cut -d' ' -f1`
# if [ $NETCARDIP == "0.0.0.0" ]
# then
# echo "$netcard driver loaded but no DHCP server found"
# kill -9 `cat /var/run/dhclient.pid`
# ifconfig eth0 down
# unset DYNAMIC_NET_DEV
# else
# echo IP for $netcard is $NETCARDIP
# fi
#else
#echo "No Network Card Present"
#fi
## If TiVo doesn't find eth0, then it tries to find a ppp server
#if [ "$DYNAMIC_NET_DEV" == "" ]
#then
# echo "Trying PPP over serial"
# /etc/rc.d/rc.ppp &
# export DYNAMIC_NET_DEV=ppp0
#fi
#Start the telnet server listener
tnlited.sh &
### End oztivo networking hacks #####
# Add second disk if there and uninitialized. No, we didn't take this out...
echo "Checking for additional disk..."
mfsadd
if [ $do_mfs_cleanup -eq 1 ] ; then
echo "Initiating MFS cleanup"
/tvbin/fsfix -nokill -splash -uncollide -rehash -salvage -reboot
fi
# Start the EventSwitcher and MfsDaemon
echo "Starting EventSwitcher..."
/tvbin/switcherstart -m
if [ $do_mfs_assert -eq 1 ] ; then
echo "Rebooting to perform MFS and database check"
/tvbin/mfsassert -please
/tvbin/reboot
fi
# Start the fan control process.
echo "Start fan control..."
fancontrol &
# Let him get started ??
sleep 1
# Run the Phase 2 (MFS is up) scripts
runme phase2
# Check for Diagnostics.
dodiag=false
case $asicversion in
2|3|4)
# this is ppc combo :
# The authserial program detects the presence of a diagnostics test fixture.
if [ ! -x /tvbin/genkey ] ; then
echo "Essential diagnostic file missing"
/tvbin/reboot
fi
/tvbin/genkey 128 1 > /var/tmp/challenge.dat
if [ "$runfactorydiag" = true ] ; then
if [ ! -x /diag/tvbin/authserial -o \
! -r /diag/tvlib/misc/diagkey.pub ] ; then
echo "Essential diagnostic file missing"
/tvbin/reboot
fi
dodiag=true
# the "runfactorydiag" bootparam indicates that we are in the factory
# with a brand new disk. Don't quit until we've established link
# with diag station
while ! /diag/tvbin/authserial -authslave /diag/tvlib/misc/diagkey.pub /var/tmp/challenge.dat ; do
echo Diagnostics station not found, trying again
sleep 1
done
else
if [ ! -x /diag/tvbin/authserial -o \
! -r /diag/tvlib/misc/diagkey.pub ] ; then
echo "Can not check for Test Master"
else
# Check whether we should enter diagnostics
# The authserial program detects the presence of a diagnostics test fixture.
if /diag/tvbin/authserial -authslave /diag/tvlib/misc/diagkey.pub /var/tmp/challenge.dat ; then
echo Diagnostics station present and authenticated
dodiag=true
fi
fi
fi
rm -f /var/tmp/challenge.dat
;;
0|1|5)
# this is ppc or mips standalone.
if [ "$runfactorydiag" = true ] ; then
dodiag=true
# we will just enter diagnostics
echo "Standalone diagnostics"
fi
;;
esac
# Run factory diagnostics?
if [ "$dodiag" = true ] ; then
if [ ! -x /diag/tvbin/factorydiag ] ; then
echo "No factorydiag TCL script!"
else
echo Entering diagnostics...
if /diag/tvbin/factorydiag ; then
echo "Diagnostics passed"
else
echo "Error running factory diagnostics"
reboot
fi
fi
fi
# Run the final test?
if [ "$runfinaltest" = true ] ; then
if [ -x /var/diag/finaltest ] ; then
if /tvbin/crypto -vfs /var/diag/finaltest.sig /var/diag/finaltest /tvlib/misc/service-v3-s.pub ; then
/var/diag/finaltest
else
echo "/var/diag/finaltest failed signature check."
reboot
fi
elif [ -x /diag/finaltest ] ; then
/diag/finaltest
else
echo "Final test not found!"
fi
fi
# see if we need to check the battery
if [ -f /var/log/battery-check-needed ] ; then
if [ -x /var/diag/batterycheck ] ; then
if /tvbin/crypto -vfs /var/diag/batterycheck.sig /var/diag/batterycheck /tvlib/misc/service-v3-s.pub ; then
/var/diag/batterycheck
else
echo "/var/diag/batterycheck failed signature check."
reboot
fi
elif [ -x /diag/batterycheck ] ; then
/diag/batterycheck
else
echo "Battery check not found!"
fi
fi
# combo diagnostics testmaster starts here
if [ "$testmaster" = true ]; then
if [ -f /etc/rc.d/rc.sysinit.diag ]; then
echo "Starting Diagnostic Test Master"
source /etc/rc.d/rc.sysinit.diag
else
echo "rc.sysinit.diag not found"
fi
fi
# Check for software upgrade
if [ "$swupgrade" = true ]; then
/tvlib/tcl/updateSoftware.tcl
fi
if [ "$runwriteback" = true ]; then
/diag/writeback /dev/hda11 256 -a2 &
/diag/writeback /dev/hdb3 256 -a2 &
while true; do sleep 1000; done
fi
if [ "$rundriverstress" = true ]; then
if [ -x /diag/SimpleStress ]; then
echo "Running SimpleStress"
/diag/SimpleStress
echo "SimpleStress exited"
reboot
fi
fi
if [ "$testmodemDSS" = true ]; then
echo "Connecting modem to DSS serial port, 115K baud"
/tvbin/modemtest -forward /dev/ttyDSS
handcraft=true
fi
# System Statistics to "messages" log file.
syslog -t Stats "== System startup resource statistics =="
syslog -t Stats "++ System build version numbers ++"
syslog -t Stats -f /etc/build-version
getprom -version | syslog -t Stats
echo `getprom -checksum` | syslog -t Stats
IRvers=`irtest -t /dev/ttyS0 -V`
syslog -t Stats "IR version $IRvers"
syslog -t Stats "System Serial Number: $SysSerial"
syslog -t Stats -f /proc/version
syslog -t Stats "++ Memory usage ++"
syslog -t Stats -f /proc/meminfo
syslog -t Stats "++ CPU info ++"
syslog -t Stats -f /proc/cpuinfo
syslog -t Stats "++ Module info ++"
syslog -t Stats -f /proc/modules
syslog -t Stats "++ Device info ++"
syslog -t Stats -f /proc/devices
syslog -t Stats "++ Network device info ++"
syslog -t Stats -f /proc/net/dev
# Database conversions must happen before myworld, mcp, etc. are started.
if [ "$handcraft" != true ]; then
echo "Checking for database conversions..."
convert-db
fi
if [ "$upgradesoftware" = false ]; then
echo "Not upgrading software"
else
# TODO... Find another way to do this...
tivosh /etc/rc.d/finishInstall.tcl
export -n EMERGENCY_REINSTALL
fi
# Run the Phase 3 (MyWorld is starting) scripts
runme phase3
cd /var/tmp
# Launch MyWorld and other services (apg, mcp, tcphonehome, dbgc) by telling
# the eventswitcher to launch it (via "switcherstart -l").
if [ "$handcraft" = true ]; then
echo "Running without services."
else
echo "Starting Services."
switcherstart -l
fi
if [ "$audiostress" = true ]; then
echo "Starting audio stress"
if [ -x /devbin/audiostress ]; then
audiostress &
else
echo "Could not find audio stress prog"
fi
fi
if [ "$maintuner" = "1" ]; then
echo "Starting camtest for dual verifier mode"
camtest &
else
maintuner=0
fi
# Run the Phase 4 (background tasks have been started) scripts
runme phase4
if [ ! "$NDS" = "" ]; then
echo "Sleeping before enabling NDS sniffer output"
sleep 120
echo "Enabling NDS sniffer output"
/tvbin/send5505 "sniff 1"
fi
if [ ! "$BERR" = "" ]; then
echo "Sleeping before enabling Tuner BERR Test"
sleep 60
echo "Enabling Tuner BERR Test"
/tvbin/send5505 "wr299 28 40"
/tvbin/send5505 -i1 "wr299 28 40"
fi
if [ ! "$vmstat" = "" ]; then
echo "Starting memory statistic gathering"
vmstat 10 &
fi
# Set a few useful things up to use Service Emulator instead of TiVo mothership
# Set the DialConfig to use our mothership emulator
#DialConfig127.tcl
dbsetx /State/PhoneConfig DialConfig 127
# This will make TiVo try a daily call over the network or modem depending on
# the setting in /etc/oztivo.conf.
if [ "$modem" = "1" ] ; then
dbrm /State/PhoneConfig DialPrefix
# This will make the modem behave better in Oz
dbsetx /State/PhoneConfig DialToneCheck 0
#dbsetx /State/PhoneConfig CallWaitingPrefix *44 # #87 for Optus and *11*3# for faxtream duet
#dbsetx /State/PhoneConfig TollFreeNum 99990000
#dbsetx /State/PhoneConfig DialInNum 99990000
else
dbsetx /State/PhoneConfig DialPrefix ',#401'
fi
# We tell TiVo we are in UTC
dbsetx /State/LocationConfig TimeZoneOld 7
# Tivo cannot handle all Daylight Savings Policies, especially those
# of the Southern Hemishphere. See /etc/postcodezones for for info on keeping time
dbsetx /State/LocationConfig DaylightSavingsPolicy 0
GSSTATE=`dbget /State/GeneralConfig Complete`
BOOTARGS=`bootpage -p /dev/hda`
NEWBOOTARGS=`echo $BOOTARGS |sed 's/GS=1/GS=0/g'`
#echo $NEWBOOTARGS
# Get rid of Guided Setup Hack on next reboot if is complete,
# or it will cause the "jitters"
if [ "$GSSTATE" = "7" ] || [ "$GSSTATE" = "6" ] || [ "$GSSTATE" = "3" ] ; then
echo "Guided Setup at sufficient State. Clearing GS flag"
bootpage -P "$NEWBOOTARGS" /dev/hda
fi
# Check to see if this is UK tivo, and if so, enable scart
if [ $videoconfig = 7 ]; then
echo "UK box, enable SCART"
scartctl.tcl &
fi
# Enable both remotes
# OzTivos images should support both remotes out of the box.
# This should be done on the master image, but its here in case somebody
# starts from scratch and wants to do it this way instead.
# If you want your TiVo to obey only one...
# run /hack/bin/selectremote.tcl from a telnet or bash on serial session
#
# setbothremotes.tcl
[ ! -f /etc/rc.d/rc.sysinit.author ] || /etc/rc.d/rc.sysinit.author
echo "rc.sysinit is complete"
Bookmarks