NetworkedMediaTank
Note:
Some of the links may no longer work.
Contents |
Networked Media Tank -- Popcorn Hour (PCH) A110
More or less interesting and useful stuff I use on/with my Networked Media Tank Popcorn Hour A-110.
Questions or Feedback --> nmt (at) holyhead.de
Unmount USB drives
Inspired by Automatic Acoustic Management setting changer, I have created a html-file to manually unmount USB drives without telnet access.
Just put the files usb_unmount.html and usb_unmount.cgi (usb_unmount.zip) to your share directory.
To unmount an USB drive, just open usb_unmount.html and invoke usb_unmount.cgi using the link "USB unmount". The CGi shows a list of all mounted USB drives is shown (/dev/sda1 for USB-DRIVE A1, etc). Select the corresponding link to unmount.
My Busybox
I have compiled my own busybox. My latest build is busybox 1.13.3, the files can be found here.
To compile your own version
- Install and compile the NMT (SMP8634) toolchain.
For further hints, please refer to the Cross-compilation Toolchain
Note: It's been quite a while that I compiled stuff for my PCH... the above toolchain might no longer work with newer linuxes.
- Configure your cross-compile environment:
This is most easily be done by creating a file export_env which sets all environment paths and then importing the settings to your bash using
$ . /path_to/export_env
Sample export_env (adapt TOOLCHAIN path to your needs):
TOOLCHAIN=~/PCH/smp86xx_toolchain.20080505/build_mipsel_nofpu/staging_dir/ export PATH=${TOOLCHAIN}/bin:${PATH} export CC=${TOOLCHAIN}/bin/mipsel-linux-uclibc-gcc export LDFLAGS=-L${TOOLCHAIN}/lib export CPPFLAGS=-I${TOOLCHAIN}/include export CPP=${TOOLCHAIN}/bin/mipsel-linux-uclibc-cpp export CROSS_COMPILE=mipsel-linux-uclibc- export ARCH=mipsel-linux
- Change to your busybox-directory, and issue
make menuconfig
to configure your busybox (you may use my .config file linked above as a start). A simple
make
compiles your busybox. If everything went well, you ./busybox is your own busy-box.
Note: to avoid problems, make root the owner of your busybox binary and give everyone execution rights after installation on your PCH:
chown root: busybox chmod a+x busybox
My autostart (and autostop) solution
My autostart solution contains the following enhancements
- enable telnet login (using login shell)
- set /bin/sh shell and password for user root
- enhance shell usability: install enhanced busybox, set aliases, etc
- add editor pico
- save and restore mono settings and bookmarks
- adjust power management settings of my internal hard disc
To achieve this, I have added the following code to the beginning of the start() function in /mnt/syb8634/etc/smb.sh (since I have samba always enabled, if you always run the ftpserver, user ftpserver.sh instead; however, it does not make sense to run startup.sh multiple times)
if [ -x /opt/sybhttpd/localhost.drives/HARD_DISK/.bin/startup.sh ]; then /opt/sybhttpd/localhost.drives/HARD_DISK/.bin/startup.sh fi
Analogously, I have added the following code to the beginning of the stop() function in /mnt/syb8634/etc/smb.sh
if [ -x /opt/sybhttpd/localhost.drives/HARD_DISK/.bin/stop.sh ]; then /opt/sybhttpd/localhost.drives/HARD_DISK/.bin/stop.sh fi
My .bin/startup.sh:
#!/bin/sh cd /opt/sybhttpd/localhost.drives/HARD_DISK/.bin/ # chsh sed -e 's#root:x:0:0:root:/root:/bin/true#root:x:0:0:root:/root:/bin/sh#' -i /etc/passwd mv /etc/profile /etc/profile_orig cat > /etc/profile <<EOF test -r \$HOME/.profile && . \$HOME/.profile EOF cat > /root/.profile <<EOF alias la="ls -la" alias cdhd="cd /opt/sybhttpd/localhost.drives/HARD_DISK/" alias pico="/opt/sybhttpd/localhost.drives/HARD_DISK/.bin/nano" export TERM=linux EOF rm /root/.bash* cp ./busybox-1.13.3 /bin/busybox # install all applets to /usr/bin /bin/busybox --install -s # acoustic management: quiet ./hdparm -M 128 /dev/hda # Advanced Power Management setting (1: max, 254: min, 255: off) ./hdparm -B 254 /dev/hda # Standby: 10 min ./hdparm -S 120 /dev/hda busybox telnetd -l /bin/login & #restore mono settings if [ -e mono_bookmark ]; then cp mono_bookmark /tmp fi if [ -e mono_settings ]; then cp mono_settings /tmp fi # now, enable telnet, (change dir -> //pch/share/) #cd .. #busybox telnetd &
The line
sed -e 's#root:x:0:0:root:/root:/bin/true#root:x:0:0:root:/root:/bin/sh#' -i /etc/passwd
can be enhanced to also set a root-password. Simply replace the second ':x:' by ':PasswordHash:'. The PasswordHash can be calcuated by the unix command mkpasswd. Exmaple: the following line sets the password '1234':
sed -e 's#root:x:0:0:root:/root:/bin/true#root:HX7YXGspliajE:0:0:root:/root:/bin/sh#' -i /etc/passwd
And my .bin/stop.sh:
#!/bin/sh cd /opt/sybhttpd/localhost.drives/HARD_DISK/.bin/ cp -a /tmp/setting.txt /tmp/mono_bookmark /tmp/mono_settings .
Applications
Nano editor (a pico clone)
Since I am not very used to vi, I have compiled nano for the PCH. The binary can be found here.
You may need to set a valid terminal before starting nano, for example
export TERM=vt100
(TERM=linux should also work).
Lynx (text browser)
I have also successfully compiled lynx for the PCH. The files can be found here. Extract all files of one of the bin-* archives to /share/.bin/ Do not change the path, otherwise lynx will not find its files lynx.cfg and lynx.lss. (The location is hard-coded, and I did not want them to be on the tmpfs or /mnt path.)
Screen
If you need screen, here's my binary.
In case of problems, you might try setting the TERM variable to linux or xterm:
export TERM=linux
I set TERM=linux in my .profile, see my startup.sh above.
Further links
Forum
Wiki and tool-collections
- Networked Media Tank Wiki
- ... there were more links here, but they do no longer work ...
Misc tips
- Simple Save&Restore of PCH settings (German)
- Persistent settings are stored in /dev/mtd1 and can be read/modified using pflash
- How to access the popcorn hour from your webbrowser
- Web browser access to the PCH from your PC
- Gaya remote control