| 1 | #!/bin/ash |
|---|
| 2 | |
|---|
| 3 | export PATH=/sbin:/bin:/usr/sbin:/usr/bin |
|---|
| 4 | export SYSTEMTYPE=`/bin/cat /etc/systemtype` |
|---|
| 5 | |
|---|
| 6 | # mount rw parts |
|---|
| 7 | echo -n "Mounting /rw-flash ... " |
|---|
| 8 | /bin/mount -o rw,noatime,nodiratime -n -t jffs2 /dev/mtdblock2 /rw-flash |
|---|
| 9 | echo "Done" |
|---|
| 10 | |
|---|
| 11 | # check for first start, factory reset or .nodebug flag |
|---|
| 12 | # something went really bad so enter osd debug mode |
|---|
| 13 | if [ -d /rw-flash/SI -o ! -f /rw-flash/.nodebug ]; then |
|---|
| 14 | export OSDLOG="YES" |
|---|
| 15 | |
|---|
| 16 | /sbin/insmod /lib/modules/2.4.21-xfs/tainted/emma_rtos.o |
|---|
| 17 | /sbin/insmod /lib/modules/2.4.21-xfs/tainted/emma_bios.o |
|---|
| 18 | /sbin/insmod /lib/modules/2.4.21-xfs/tainted/iic_int.o |
|---|
| 19 | /sbin/insmod /lib/modules/2.4.21-xfs/tainted/pic16f73.o |
|---|
| 20 | /sbin/insmod /lib/modules/2.4.21-xfs/tainted/emma_osd.o |
|---|
| 21 | /sbin/insmod /lib/modules/2.4.21-xfs/tainted/emma_av.o |
|---|
| 22 | /sbin/insmod /lib/modules/2.4.21-xfs/tainted/emma_fb.o fb_bpp=8 fb_mem_max=0x100000 |
|---|
| 23 | |
|---|
| 24 | /usr/bin/set-video & |
|---|
| 25 | echo "Enter osd debugging mode" | /usr/bin/osddrawtext -a 8 -c 1 -b 0xFFFF0000 |
|---|
| 26 | source /etc/rc.debug |
|---|
| 27 | fi |
|---|
| 28 | |
|---|
| 29 | # Factory reset |
|---|
| 30 | if [ -d /rw-flash/SI ] ; then |
|---|
| 31 | echo -n "Factory reset: " |
|---|
| 32 | if [ ! -f /rw-flash/SI/.first_run ] ; then |
|---|
| 33 | /bin/cp -af /etc/* /rw-flash/etc |
|---|
| 34 | fi |
|---|
| 35 | /bin/rm -rf /rw-flash/.timer /rw-flash/PLAYLISTS /rw-flash/SI \ |
|---|
| 36 | /rw-flash/EPG /rw-flash/Application |
|---|
| 37 | |
|---|
| 38 | # Set MAC address |
|---|
| 39 | mac_valid=00:01:E3:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F] |
|---|
| 40 | mac=`/usr/sbin/pic_tool get-mac-direct` |
|---|
| 41 | if [ `expr match "${mac}" "${mac_valid}"` != "0" ] ; then |
|---|
| 42 | echo "Setting MAC address direct" |
|---|
| 43 | /bin/sed -i -e "s,^mac=.*,mac=\"${mac}\",g" /rw-flash/etc/rc.local.conf |
|---|
| 44 | else |
|---|
| 45 | mac=`/usr/sbin/pic_tool get-mac` |
|---|
| 46 | if [ `expr match "${mac}" "${mac_valid}"` != "0" ] ; then |
|---|
| 47 | echo "Setting MAC address" |
|---|
| 48 | /bin/sed -i -e "s,^mac=.*,mac=\"${mac}\",g" /rw-flash/etc/rc.local.conf |
|---|
| 49 | else |
|---|
| 50 | echo "Error: Impossible get MAC address" |
|---|
| 51 | fi |
|---|
| 52 | fi |
|---|
| 53 | |
|---|
| 54 | echo "Done" |
|---|
| 55 | fi |
|---|
| 56 | |
|---|
| 57 | # mount var |
|---|
| 58 | echo -n "Mounting /var ... " |
|---|
| 59 | /bin/mount -o rw,noatime,nodiratime,nosuid,nodev -n -t tmpfs tmpfs /var |
|---|
| 60 | /bin/mkdir -p -m 1777 /var/tmp & |
|---|
| 61 | /bin/mkdir -p -m 755 /var/run /var/log /var/media /var/lock |
|---|
| 62 | /bin/touch /var/media/.ignore & |
|---|
| 63 | echo "Done" |
|---|
| 64 | |
|---|
| 65 | echo -n "Binding /etc ... " |
|---|
| 66 | /bin/mount -o bind /rw-flash/etc /etc |
|---|
| 67 | echo "Done" |
|---|
| 68 | |
|---|
| 69 | exec /bin/ash /etc/rc.modules |
|---|