Belgacom TV (Mood 337) Box ========================== This is the Freifunk addon to the softs installed on the Belgacom Mood 300 IPTV box. Here in germany, you cannot use the TV receiver functions, because belgacom ADSL is not available here. But we can use the box as Freifunk Router. I use a RaLink RT73 USB WLAN Stick for Wireless, but you can use others - if you can grab / compile a mips driver. As a preview, why you want this: View this "Screenshots": http://www.muhri.net/skipstone/page.php3?node=screenshots Here's a short intro on how to install Freifunk on the box, without (hopefully) loosing the original functions. You need a serial cable for your first steps: * Solder on a Max232 voltage converter to the serial pins on the main board (see seriell.jpg). If your Max232 adapter needs a 3.3 volts supply, this is available from the bottom/right pin (on the seriall.jpg under the letter "g" from "debug"). If you have no Max232: you may link with another box (e.g. wrt54gl) with also has a 3.3 Volts serial connector (use x-cross pinouts). * Enter minicom, 115 kbaud,n,8,1 (no handshake!). The during power on, connect the debug pin to ground. The u-boot loader will wait for 1 second for a [return key] on startup. To have a prompt from the pre-installed linux software enter: setenv bootargs $(bootargs) init=/bin/sh boot * Start some basic init scripts in order to mount the HDD: mount /dev/ram0 / -t ext2 -o remount /etc/init.d/checkroot.sh start /etc/init.d/flashconfig start flashfiles list which sould show "mood.conf", "release", and "remote.cfg". Otherwise you need to do emergency recovery first (see readme-details.txt). Note, that after restoring those three files it's best to restart by pulling the plug... * Configure the eth network and mount the hard disks: ifconfig eth0 192.168.1.2 up route add default gw 192.168.1.1 echo "nameserver 81.169.139.12" > /etc/resolv.conf mount -a (should mount /dev/hda2 on AUX, /dev/hda3 on PVR) mkdir /media/hdd/PVR/install cd /media/hdd/PVR/install (now grab necessary bits) wget http://download.berlin.freifunk.net/sven-ola/mood-300/boxnew/hda2.tar.gz wget http://download.berlin.freifunk.net/sven-ola/mood-300/nylon-for-mood-AUX.tgz wget http://download.berlin.freifunk.net/sven-ola/mood-300/chroot.tgz * You may want to make the network config of the box permanent. It's okay to stay with DHCP, but you can also switch to a static IP config, e.g: sysflash -w staticip -v true sysflash -w ip -v 192.168.1.2 sysflash -w mask -v 255.255.255.0 sysflash -w gateway -v 192.168.1.1 sysflash -w dns -v 81.169.139.12 * You need another kernel, because the original 2.4.30 does not offer wireless extensions, iptables, traffic shaping, hotplug and so on. cd /media/hdd/PVR/install wget http://download.berlin.freifunk.net/sven-ola/mood-300/kernel/mood300_recover_MH02.img md5sum mood300_recover_MH02.img (should show ad091759cb2ea8d5ee3da22553d1e3fd) uname -a (should show linux-2.4.30) flash_eraseall /dev/mtd5 nandwrite /dev/mtd5 mood300_recover_MH02.img Note: the *.img file name is also ok for bootp/tftp (see readme-details.txt) * I normally start with a fresh copy of the orig softs, but you may skip this if the original soft is on the system. If you are connected via serial start as described above. Otherwise use the chroot-environment: cd / tar xvzf media/hdd/PVR/install/chroot.tgz chroot /media/hdd mount -t proc proc proc mount (should show 8 lines) cd /AUX ls (should show old hard disk contents, last chance to abort!) rm -r * tar xvzf ../PVR/install/hda2.tar.gz * Unpack Nylon addon. Nylon is a linux based on openembeeded for the 4G meshcube: (if you have skipped the above step:) cd /media/hdd/AUX tar xvzf ../PVR/install/nylon-for-mood-AUX.tgz * Restart with: cd / sync umount -a (Now pull the plug) * After some minutes (the ssh_keygen needs time, TV show "500") you can login via "ssh root@192.168.1.2" without password. If the box shows the "tilgin" display, something is wrong and you *need* serial. Your next steps: passwd (Enter your root pw) killall -KILL start-daemon killall mini_httpd killall siege (To save CPU and stop mini_httpd from interfering) ipkg update (Grabs the software lists) ipkg -force-overwrite -force-depends install mood-ff (Installs a lot of stuff. Shortcut is: mood-ffx, see below. Note that only minihttpd will be disabled, the the original TV shoul function as ususal) vi /etc/network/interfaces (To set the Mesh IP and wifi parms) vi /etc/olsrd.conf (To set the hostname, geopos for olsrd nameservice, to cut the Interfaces section down to "wlan0" or so) vi /usr/bin/nvram (To add your contact info, replace the [...] marks) sysflash -w gateway -v 0.0.0.0 (You do not want a static default route, because it interferes with the OLSR defroute as well it blocks other users from using your box as intermediate gw) reboot That's it. After the reboot, the USB RT73 should start to blink and hopefully other OLSR mesh routers show up. Note, that the http (port 80) belgacom remote service access via mini_httpd and the standard java TV app is disabled now. To re-enable, move the link files from /etc/rc2.d-disabled to /etc/rc2.d. Note, that doing so prevents the new cron-controlled HDD spindown function because the TV apps access the harddisk every now and then. Tip: to kill all TV-related processes, use the "killallmood" shell script. Further steps: * The hda1 partition is unused. You can use it as swap partition: vi /etc/fstab (Insert the next line:) /dev/hda1 swap swap defaults 0 0 mkswap /dev/hda1 swapon -a free (Should show more memory) * Until now, the stock mood TV programs should run because none of the critial libraries where update / changed. To use the box with Xorg, we need to upgrade a lot more stuff which may break compat with the mood TV apps (don't have belgacom access, so no TV). To install X: ipkg -force-overwrite install mood-ffx During install, you are prompted for libc and timezone. Answer "Y" and configure the timezone as needed. When prompted for X-Screen resolution: you may disable all but 640x480. The generated xorg.conf will be over- written anyhow: cp /etc/X11/xorg.conf-mood /etc/X11/xorg.conf /etc/init.d/xdm restart You may now login on xdm as root with your root password.* You may want to install gcc and gdb, e.g. to compile OLSRD you need: ipkg -force-overwrite install make gcc flex bison * To create deb packages, you need to debianize completely. For some reason, the cpio package does not like to be installed. To overcome I use this: vi /usr/lib/ipkg/lists/freifunk-mood (Search ': cpio', add an 'x' -> Package: cpiox ipkg -force-overwrite install cpiox for i in /usr/lib/ipkg/info/cpiox.*;do mv $i ${i/x./.};done ipkg update (Then continue installing, see also note on stdc++ below!) ipkg -force-overwrite -force-depends install build-essential ipkg -force-overwrite install automake automake1.9 libacl1 coreutils mktemp (The df and readlink programs do not work. We re-link to busybox) rm /bin/df ln -s busybox.nylon /bin/df rm /usr/bin/readlink (Then test whith a test build) mkdir /usr/src/diffstat cd /usr/src/diffstat (Browse to http://packages.debian.org/source/etch/diffstat to grab url's) wget http://ftp.de.debian.org/debian/pool/main/d/diffstat/diffstat_1.43.orig.tar.gz wget http://ftp.de.debian.org/debian/pool/main/d/diffstat/diffstat_1.43-2.diff.gz tar xvzf diffstat_1.43.orig.tar.gz zcat diffstat_1.43-2.diff.gz | patch -p1 -d diffstat-1.43/ cd diffstat-1.43/ chmod +x debian/rules (dpkg is not our package manager, so this will output whats missing) dpkg-buildpackage -b -uc -us ipkg -force-overwrite install debhelper (Now do the real build) dpkg-buildpackage -d -b -uc -us * You may want some programs. These if have tried: ipkg -force-overwrite dillo (sometimes oopses, buggy web site display) ipkg -force-overwrite skipstone (really runs fine) ipkg -force-overwrite mplayer (runs, use "gmplayer -ac mad abc.mp3") ipkg -force-overwrite vlc (a bit too slow) ipkg -force-overwrite xmms (damn slow, xmms-mad buggy, don't use) ipkg -force-overwrite streamtuner (rather slow but ok) ipkg -force-overwrite streamripper (fine) ipkg -force-overwrite rexima (cmdline mixer, works) ipkg -force-overwrite madplay (cmdline mp3 player, works) ipkg -force-overwrite mpd (sound daemon, works) ipkg -force-overwrite gmpc (gnome frontend for mpd, works) ipkg -force-overwrite sylpheed (mail prog, under eval, may work) ipkg -force-overwrite xfonts-100dpi ttf-freefont (you may want this) * My own installation normally includes this (a "reboot" now prevents /tmp from overflowing): ipkg -force-overwrite install skipstone mplayer streamtuner streamripper madplay mpd gmpc sylpheed (Answer "Y" for mplayer-cfg, also something is wrong with ca-certificates but install is ok. Do "vi /usr/lib/ipkg/status", search for "ca-cert" and change from "install ok unpacked" to "install ok installed") Xfce/Tips & Trick intro screen=Off Xfce/Top bar/Contextmenu/Customize Panel/Autohide=On (to gain more screen space) Xfce/Settings/User Interface/Font=Sans 10pt (better readability) Xfce/Settings/Splash Screen/None (faster startup) Xfce/Settings/Desktop/Show image=off (faster display, click [x] corner to close) Xfce/Lower Panel/Rightclick on xfce menu/Remove item (Removes the main menu for more speed, you may also remove the separator bar. Note: rm $(find /usr/share/icons -iname "*.svg") will get you even more speed. Same but no SVG support then: "ipkg remove ipkg remove librsvg2-2 librsvg2-common") Xfce/streamtuner (simply start to generate ~/.streamtuner/config) (If something is wrong with python-cairo: do "pycentral pkginstall python-cairo") vi ~/.streamtuner/config (Change "record-stream" from "streamripper %q" to "streamripper %q -d /srv/mpd/music -u xmms-mad/0.1", change "play-m3u" to "streamtuner.play %q", change "play-stream" to "streamtuner.play %q" I have placed that script in mood-ffx.ipk; it calls gmplayer instead of xmms) rmdir /srv/mpd/music;mkdir /media/hdd/PVR/music;ln -s /media/hdd/PVR/music /srv/mpd/music (Move all your music to the larger PVR partition, then restart mpd with /etc/init.d/mpd stop /etc/init.d/mpd start Xfce/Multimedia/Gnome Music Player Client/Configure icon (Click [Connect]. If ok - activate "autoconnect") Xfce/Lower Panel/Rightclick/Additem/Volume Control (if you need it) Xfce/Multimedia/Mplayer cd /usr/share/mplayer/skins/ wget http://www.mplayerhq.hu/MPlayer/skins/XFce4-1.0.tar.bz2 tar xvjf XFce4-1.0.tar.bz2 (switch back to mplayer, press [c] and choose Xfce4. Note: [9] and [0] for volume) Xfce/Start/[sylpheed]/Configuration/Edit accounts Basic/Name=GMX, Fullname, Mailaddr=sven-ola-aet-gmx.de Basic/Server=pop.gmx.net, SMTP=mail.gmx.net, Userid=sven-ola-aet-gmx.de, Password Receive/Use APOP=Yes, Remove msgs from server=No Send/SMTP Auth=Yes, Method=CRAM-MD5, id+pw=empty SSL/POP3=UseSSL, SSL/SMTP/UseTLS (Ready. You may want "Config/Common/Display/Message/Display short head=no") ...Have fun. * Note1: the *.deb in the ./feed/ subdir are grabbed from the debian site http://packages.debian.org/ with the ./debian-fetch.pl script, e.g. "./debian-fetch.pl -d xmms". Then the packet index is generated with "ipkg index" (see mk.sh), visit http://handhelds.org/moin/moin.cgi/Ipkg for that. * Note2: To enable xdmcp, e.g. to "Xnest :1 -kb -query [mood-ip]": vi /etc/passwd (For user nobody, change shell from "/bin/false" to "/bin/sh" vi /etc/X11/xdm/Xaccess (Uncomment the "* #any host can get...) vi /etc/X11/xdm/xdm-config (Prepend an exclamation mark in front of the last line) /etc/init.d/xdm restart * Note3: The critical stuff is the transp byte in /dev/fb0. Xorg doesn't really handle transparency - the highest byte of the 4 byte color is 0x00. Which shows black-on-black. I recompiled xorg-server_1.1.1 on the box and changed this in /usr/lib/xorg/modules/libshadow.so: diff -Nur xorg-server-1.1.1.orig/miext/shadow/shpacked.c xorg-server-1.1.1/miext/shadow/shpacked.c --- xorg-server-1.1.1.orig/miext/shadow/shpacked.c +++ xorg-server-1.1.1/miext/shadow/shpacked.c @@ -104,7 +104,7 @@ scr += i; #define PickBit(a,i) (((a) >> (i)) & 1) while (i--) - *win++ = *sha++; + *win++ = *sha++ ~ 0xff000000; } shaLine += shaStride; y++; * Note4: If you want to compile c++, something is wrong with libstdc++6-4.1-dev. Use: ipkg -force-overwrite install g++ mkdir /tmp/bla cd /tmp/bla wget http://download.berlin.freifunk.net/sven-ola/mood-300/feed/libstdc++6-4.1-dev_4.1.1-21_mipsel.deb ar x libstdc++6-4.1-dev_4.1.1-21_mipsel.deb tar -C / -xvzf data.tar.gz * Note5: How to enable a local autologin (but keep remote X-login possible) vi /etc/X11/xdm/Xservers (prepend '#' to last line) vi /etc/init.d/xlogin (paste following script, no-root not working now) #!/bin/sh USER=root case "$1" in start) echo "Starting xlogin" test -c /dev/tty2 || mknod /dev/tty2 c 4 2 ls -l /dev/console > /tmp/bla.txt sh -c "chown $USER /dev/console;su - $USER startx>/dev/console 2>&1;xhalt"& ls -l /dev/console >> /tmp/bla.txt echo "done." ;; *) echo "Usage: $0 {start}" >&2 exit 1 ;; esac exit 0 chmod +x /etc/init.d/xlogin update-rc.d xlogin defaults 90 * Note6: You cannot simply install another hard disk. The disk type is queried during boot and compared to /etc/hd.conf. Also a hard disk specific file is located in /etc/hd.layout. I have added a 250Gb WD2500 drive which I own, but you need to change the initrd and recompile/reflash the kernel if you have another model... * Note7: Enabling shutdown/userlogin with xfce Because the sudo command is not pre-installed, the shutdown and reboot buttons are greyed. The following steps will install sudo for this: ipkg -force-overwrite install sudo (For some reason, the /usr/bin/sudo is not there, so we add it manually) cd /tmp wget http://download.berlin.freifunk.net/sven-ola/mood-300/feed/sudo_1.6.8p12-4_mipsel.deb ar -x sudo_1.6.8p12-4_mipsel.deb tar xvzf data.tar.gz mv usr/bin/sudo /usr/bin/ (Now enable sudo for all users) vi /etc/sudoers (Add "%users ALL=(ALL) ALL" at end of file, without quotes of course) adduser [yourlogin] vi /etc/group (Add [yourlogin] to the "users:*:100:" line. Alternatively, remove the [yourlogin] group and change the gid in /etc/passwd to 100, and do not forget to "chgrp -R users /home/[yourlogin];chmod og-wrxs /home/[yourlogin]) find /media/hdd/PVR/music -type d -printf "chmod g+w \"%p\";chgrp users \"%p\"\n"|sh (To have write access as normal user) * Note8: If you are nerve wrecked by the constant hard disk clicking sound, enable acoustic management (the setting seems to survive a power cycle): hdparm -M 128 /dev/hda tune2fs -c 999 /dev/hda2 tune2fs -c 999 /dev/hda3 * Note9: Install MPD daemon with web UI (you can also install and use gmpc) ipkg -force-overwrite install mpd mpc then link /srv/mpd/music to /hdd/media/PVR/music downloads those from cpan and do Makefile.PL && make install: 521 cd Audio-MPD-Common-0.1.2 523 perl Makefile.PL 525 make install 526 cd ../Audio-MPD-0.19.1 527 perl Makefile.PL 528 make install 529 cd .. 532 cd Class-Accessor-0.31 533 perl Makefile.PL;make install 538 cd ../Readonly-1.03 539 perl Makefile.PL;make install 540 cd .. 542 cd URI-1.35 543 perl Makefile.PL;make install 544 cd - 546 cd HTTP-Server-Simple-0.26 547 perl Makefile.PL;make install 548 cd - 550 cd JSON-XS-1.0 551 perl Makefile.PL;make install 552 cd .. 553 cd davemp-1.23 560 mv davemp* lib themes/ /usr/libexec/ 561 cd /usr/libexec/ 564 ./davempd.pl davemp.conf &