How to get root access on a C series TV


From SamyGO
Jump to: navigation, search

I created this "how to" because it took me quite a long time to get root access on my TV using the existing information spread over the wiki, forum, etc. Hopefully this page helps people to get there a bit faster. I want to thank all people that helped making all this possible at all: The authors of all the scripts and tools (Perforator, LX, card2000, all SamyGO developers and contributors, ...) and especially juuso and arris69 for helping me with problems!


Feel free to make corrections to this page but please try to Keep It Short and Simple :-)


What You Need

First of all you need some basic Linux and network knowledge.

You need the following hardware:

  • A C series TV with Internet@TV functionality, plugged to your local network
  • An ext3-formatted USB stick and a FAT32-formatted USB stick
  • A computer with access to your local network and being able to read/write on the USB sticks (a Linux OS is recommended because the line breaks in the scripts must be LF characters)

You need the following software:


Setup

On your computer:

  • Make the contents of TodayModifiedWidget.7z available on a local web server, e.g. by using XAMPP (after installation open the control panel and make sure apache is running => extract TodayModifiedWidget.7z into the htdocs folder of your XAMPP installation)
  • You should now be able to access widgetlist.xml by typing http://localhost/widgetlist.xml in your web browser
  • Make sure the IP address in widgetlist.xml is your computer's IP address

On your TV:

  • Go to Internet@TV and create a new user called "develop"
  • Log in with that user, choose settings => on the left there is now a menu item "development"
  • Type your computer's IP address as the server IP address


Get usb_hotplug.sh from TV

  • In your ext3 USB stick's root directory create two folders "test" and "usb_mount" and make sure their permissions are 777 (rwxrwxrwx)
  • Turn on your TV, plug in the ext3 USB stick and wait until the notification on your TV disappears
  • Go to Internet@TV, log in as "develop", go to "development" in the settings and choose to synchronize with the server => the modified widget will be installed
  • Go back to the home page of Internet@TV and execute the newly installed widget (there is no icon) => you should see a black screen and after a while the actual widget
  • Plugging the USB stick in your computer again you should now see files and folders in the "test" folder

Put Modified usb_hotplug.sh to TV

Get the script usb_hotplug.sh from test/sbin/usb_mount on your USB stick and copy it into your own "usb_mount" folder. Edit the copied script as follows: Find the line where the variable "PARTITION" is set (something like "PARTITION=`echo $DEVPATH | sed 's/^\/[^\/]*\///g' | sed 's/^[^\/]*\///g'`") and put the following code directly after that line:

if [ -e $MOUNTBASEDIR/$PARTITION/run.sh ]; then
	chmod 777 $MOUNTBASEDIR/$PARTITION/run.sh
	sh +x $MOUNTBASEDIR/$PARTITION/run.sh $MOUNTBASEDIR/$PARTITION
fi

Make sure your modified script has all permissions (chmod 777).

  • Again, turn on your TV, plug in the USB stick, await the notification and go to Internet@TV.
  • After some seconds your TV may tell you it has to update the widgets => click through until the widget has been deleted => get the widget again via developer menu > synchronize => execute it again and wait again until the black screen disappears
  • Now you can verify if your modified script has been copied by checking if test/mtd_rwarea/usb_mount also contains your modified script (the widget first copies your script to the TV and then again makes a dump to your USB stick)

Now you should be able to run any script named run.sh being in the root directory of a USB stick. To test it create such a script with the following content:

#!/bin/sh
date > $1/ScriptOK

Put it on your FAT32 formatted USB stick, turn on your TV, plug in the FAT32 USB stick, wait until the notification disappears (do not press anything), wait some more seconds, remove the USB stick and check if the file ScriptOK has been created.


Install SamyGO Extensions and Get Root Access

Now we're ready to install the great SamyGO extensions which provide ssh access! You can use the FAT32 USB stick again:

  • Extract the extensions pack to the USB stick (so that the folder "SamyGO" is in the root directory)
  • Add the following lines to your run.sh script from above:
rm -f /mtd_rwarea/profile
$1/SamyGO/rcSGO $1/SamyGO > $1/rcSGO_out 2>&1 &
  • Turn on your TV, plug in the USB stick, wait for the notification to disappear, wait some (say 30) more seconds
  • On your computer try to establish an ssh connection (e.g. using PuTTY) to your TV (you have to know your TV's IP address) using username "root" and password "SamyGO"

If it does not work, the file rcSGO_out on your USB stick could help identifying the problem.


Enjoy!

I hope you got it working in less time than I needed (because that's the intention of this "how to"). Feel free to do whatever you like with your TV, now that you can. For example, if you've got a samba-shared network drive (like me), you could add the following lines to your run.sh script, so that after installing SamyGO extensions, the network drive is mounted on the USB stick and you can access it as if everything was on the USB stick itself:

insmod $1/SamyGO/lib/modules/2.6.24_SELP.4.3.x-Cortex-A8/kernel/fs/cifs/cifs.ko
mount -o user=john,password=doe -t cifs //192.168.x.z/MyDrive $1/MyDrive

You have to adapt the IP address etc., of course. Note also that the path to cifs.ko may differ, depending on which SamyGO extensions pack version you use.

Now you can leave the USB stick plugged in all the time: the script will be automatically executed every time you turn on your TV and thus, after approx. 30 - 60 seconds, you always have ssh access and your network drive mounted when your TV is on.

Things to keep in mind

  • Always make sure to set permissions to 777
  • When editing scripts, always make sure line breaks are done with unix style "LF", NOT windows' "CRLF"!
  • Not all shell commands are working/available for the scripts. E.g. $(readlink -f $0) does not work, that's why we pass the USB stick's location as an argument to run.sh, so it is available with $1