Tricks

Last Updated on Thursday, 12 January 2012 05:55 Written by admin

Vairous tricks and customization you can do to NeTV.

Open a secure shell (SSH) console on NeTV

See also USB Ethernet support
- Go to Control Panel of NeTV with infrared remote control
- Under Settings menu, select Enable SSH
- Find out NeTV’s IP address under System Info menu
- Using an SSH client (Windows users can use PuTTY, Mac/Linux users can use ssh from a terminal window), log in as the user root with no password. e.g. ssh root@192.168.1.100
- You should see a message showing your last login time.

Launching sshd at startup

WARNING – doing this will reduce the level of security on your chumby, and may allow unauthorized access
- Open up a console on the chumby
- At the console, type: touch /psp/start_sshd
- Now sshd will be started when NeTV boots
- To stop this behavior in the future, type: rm /psp/start_sshd

Changing bootloader Screen

- Prepare a PNG image with 1280×720 resolution.
- Copy it to the device, (eg. /tmp/bootlogo.png)
- Stop the NeTVBrowser from drawing to the screen killall NeTVBrowser
- Splash the logo image on to framebuffer
  SCREEN_X_RES=1280 SCREEN_Y_RES=720 imgtool --bitfmt=rgb565 /tmp/bootlogo.png
- Capture the framebuffer to config block
  dd if=/dev/fb0 bs=$((1280*720*2)) count=1 | gzip -c | config_util --cmd=putblock --block=logo
- Reboot and check that it’s changed
Note: /boot/logo.raw.gz is a distraction. It doesn’t do any good :)

Using an external URL as Control Panel

To to have NeTV goes to a particular Url on boot
- Open up a console on the chumby
- At the console, type: vi /psp/homepage
- Enter a full HTTP URL (eg. http://www.your_fancy_ui.com)
- Now NeTV’s browser will be redirected to your page when NeTV boots
- To stop this behavior in the future, type: rm /psp/homepage

Using a local custom Control Panel

To to have NeTV use a certain local folder as docroot on boot
- Open up a console on the chumby
- At the console, type: vi /psp/homepage
- Enter a valid folder path (eg. /media/storage/myfancyui)
- Now NeTV’s browser will be redirected to your page on next boot
- To stop this behavior in the future, type: rm /psp/homepage
The path must be an valid absolute path & must exists for this to take effect. It will fallback to default /usr/share/netvdocroot otherwise.
NeTVServer will first look for files in this custom folder, and fallback to default folder in /usr/share/netvdocroot if the file doesn’t exists.
This behavior was design for life support stuff such as Update UI, WiFi config UI, supporting shell scripts; so you don’t have to copy those to your new folder.
This behavior is also useful if you need to overwrite only certain files in the default docroot tree (eg. an single image or single css stylesheet)
For whatever reason, if you want it to happen manually on-demand (switching it manually on every boot), please see SetDocroot API.

Local compilation (gcc)

To do local development, you will need to install gcc.
First, connect to the network using the NeTV UI. Once you are connected to the network, ssh into the device.
Then, execute this series of commands to create a unionfs that unlocks the free space on the microSD card:

 mkdir /tmp/roroot
 mount / /tmp/roroot -o bind
 mkdir /tmp/unionroot
 mkdir /media/storage/newroot
 mount -w -t unionfs -o dirs=/media/storage/newroot=rw:/tmp/roroot=ro unionfs /tmp/unionroot
 mount /var/volatile /tmp/unionroot/var/volatile -o bind
 chroot /tmp/unionroot /bin/bash
 mount -a
 mkdir /dev/pts
 mkdir /dev/shm
 mount devpts /dev/pts -t devpts
 mount tmpfs /dev/shm -t tmpfs -o rw,mode=777

Finally, download and install the package to the new unionfs root:

 opkg update
 opkg install task-sdk-native
 opkg install libgcc-dev

This process will download all of the files, headers, and executables required to do C development. It takes a while, maybe a half hour or so. It’s recommended to kill the NeTVBrowser and NeTVServer before running this to free up RAM.
Once this process is done, you can now use gcc:

gcc -o hello hello.c
./hello
Hello, world!

The total space consumed by the toolchain is currently around 380 MB.
Important note: every time the device is rebooted, you need to re-do the unionfs. You do not need to re-install the toolchain, as it is already there, but you do need to chroot into the unionroot.


2 Comments

  1. The UI | Kosagi Blog   |  Thursday, 12 January 2012 at 6:00 am

    [...] Tricks [...]

  2. BobNo Gravatar   |  Friday, 16 November 2012 at 10:06 am

    Can the gcc compiler still be installed on NeTV?

Leave a Reply