… its time…

About 2 years ago I got a Playtime HV0103. Updated the firmware, bricked it, recovered it, and its been giving hassles ever since. The problem is that the current firmware (zionnet_basic_1_08) has bugs and the older firmware (which I lost somehow) didn’t have half the features. Recently I started hacking away at the firmware update file to see if I can resolve some of the issues.

See my earlier post here for more on the above.

So far, with a lot of google translate, I’ve managed to unpack the important bits from the file.

Here are some notes so far:

Process of unpacking suza_1_64.bin to compare against the unpacked zionnet_basic_1_08.bin
1: Use “decrypt-aivx.exe” to extract update-plain.bin from suza_1_64.bin
2: Use hexeditor to search for “Compressed”, start of Cramfs will be about 16 bytes earlier (HEX: 45 3D CD 28).
3: wine copy_file_part.exe update-plain.bin cramfs.bin 0 524556
4: mkdir cramfs && sudo mount -o loop -t cramfs cramfs.bin cramfs

5: find “temp.bin” and go back to hex “1F 8B”. This marks the start of temp.bin.gz (524)
6.1: wine copy_file_part.exe update-plain.bin temp.bin.gz 524556 524
6.2: gunzip temp.bin.gz (will say ignoring trailing garbage, this is a hack till I can figure out exact gzip end point)
6.3: gzip temp.bin && ls -l temp.bin (read size, this is actual end of file)
6.4: wine copy_file_part.exe update-plain.bin temp.bin.gz 478148 524 (Re-extract with correct size)
7: gunzip temp.bin.gz
8: hexedit temp.bin and search for “53 EF”, then go back 1080 bytes. This is start point of initrd, everything before is kernel
9: wine copy_file_part.exe temp.bin kernel 1012304 0
10: wine copy_file_part.exe temp.bin initrd.bin 0 1012304

Todo:
Figure out the boot loader and other headers in the firmware file so that we can pack it all back together.

Notes:
0 – Firmware file is encrypted with TEA?
1 – Look for the bytes “1F 8B 08″. All gzip files start with this set of bytes.
2- Look for the bytes “45 3D CD 28 00″. All CramFS images start with these bytes and usually follow with text “Compressed”.

Tools used:
I use an Ubuntu workstation, so I use wine to run DOS exes.
aivx_extract_tools.zip – Has decrypt-aivx.exe and copy_file_part.exe
ghex2 – average hex editor for Ubuntu.

I often use dd to backup partitions and sometimes end up converting them to VMWare disks.
Its time to reinstall a few machines since Ubuntu 9.04 is now here.

Found a usefull article on getting around the 2Gig filesize limitaitions of smbfs (writing to windows shares) over here thanks to a quick fgi.

In short the commands to use are:

To backup: 

dd if=/dev/sdc1 | gzip -c | split -b 2000m – /mnt/smbfs/backup.img.gz.

And restore: 

cat /mnt/smbfs/backup.img.gz.* | gzip -dc | dd of=/dev/sdc1

Setting up a VLC Streaming Server

In a previous post I got the TV Card to work. Its great, recording from the video camera is a dream in Ubuntu.

We have a TV in the lounge with DSTV, a PC in the ‘study’ (corner of the lounge) and on the other side of the house a media PC in the bedroom. Its time to get the DSTV into the bedroom since we spend more time watching stuff there than in the lounge. I have the extra-view port of the DSTV decorder plugged into the TV card in the lounge and I can watch DSTV on the PC now.  So to get the ‘signal’ to the bedroom the logical solution was to stream it over the LAN rather than run a new RF cable and move the TV card into the other machine. Some research on the interwebs revealed vlc to be the popular choice.

More »

Getting the Chronos TV Card (Phillips SAA7130HL) to work in Ubuntu (8.04):

There are several generic TV Cards based on the SAA713x that do not have an eeprom with product ID. This causes the card to be detected as generic and most of the features are not enabled. In order to get these cheaper TV cards to work, you have to pull a few tricks out the sleeve. The first thing to do is to identify the features on the card.

More »

I prefer to use rsync to scp as it allows you to both resume downloads, or re-copy content while only transfering the changed files. Often though, you need to have root priv on the remote machine.
I found the following quick fix to work wonders.

Step 1: Enter your sudo password on the remote machine:

stty -echo; ssh user@remote-host sudo -v; stty echo

Thanks to the per tty ticketing in sudo, subsequent connections within a short timeout will not need to re-enter the sudo password.

Step 2: rsync your files:

rsync -avP –rsync-path=’sudo rsync’ user@remote-host:dir .

Minimal Ubuntu Installs:
My preferred installation these days is absolute minimal. Basically it involves booting from CD, hit F4 right after the language prompt and then choose the minimum install option. There are a few main reasons for this:

1. Quicker Install

The installation is quicker which for me means less time in the fridge (server room).

2. Smaller/Quicker Post-install Updates

Installation CD’s are generally out of date the moment you burn them. Installing a full install from a CD will then mean updating most of the packages that shipped on the CD right from the get go. This is undesirable due to both the volume of updates required and the time it takes to update.

3. Smaller drive foot print

Installing just the base packages keeps the foot print (disk usage) down to about 600Mb. When working with older machines or virtual machines this is very useful.

4. Security

The easiest way to secure a machine is not to spend days on firewall and policy management, but simply to not have things you don’t need installed.

I’ve been playing with VMWare alot recently and I find having a few minimal install machines lying around as templates is very useful. Copy the files, boot the copy, change its name and IP and you are good to go with a new machine.

So what happens then, if you have one of these minimal installs and you want to re-purpose the machine for something else (like an apache, mysql and php webserver for example).  Previously I would curse profusely and start apt-get install’ing all the packages one by one until the machine was where I needed it.

tasksel:
tasksel is a life saver. After the minimal install is done, dusted and updated. And having set the apt sources.list to your local mirror, you can simply ask tasksel to add all the extras you need to convert your minimal install to a fully operational LAMP (or other) box.

To see what options are available to you:

sudo apt-get update
tasksel –list-tasks

And then to commit the your choice:

sudo tasksel install lamp-server

tasksel will then spawn its blue screen of ugliness and install everything needed and ask for things like mysql root passwords (as needed).

Since this is all done via apt (which you should be keeping updated anyway) you will have the latest ubuntu version and ready to deploy.

NFS in Ubuntu

nstalling the NFS Server
Install and configure nfs-server and portmap (all on one line)

sudo apt-get install nfs-kernel-server nfs-common portmap

Make sure that portmap is not bound to localloop/127.0.0.1

sudo vi /etc/default/portmap
sudo /etc/init.d/portmap restart

NFS Server Configuration
NFS exports from a server are controlled by the file /etc/exports. Each line begins with the absolute path of a directory to be exported, followed by a space-seperated list of allowed clients.

Here are some quick examples of what you could add to your /etc/exports
For Full Read Write Permissions allowing any computer from 192.168.1.1 through 192.168.1.255

/files 192.168.1.1/24(rw,no_root_squash,sync)

Or for Read Only from a single machine

/files 192.168.1.2 (ro,sync)

Note: A client can be specified either by name or IP address. Wildcards (*) are allowed in names, as are netmasks (e.g. /24) following IP addresses, but should usually be avoided for security reasons. A client specification may be followed by a set of options, in parenthesis. It is important not to leave any space between the last client specification character and the opening parenthesis, since spaces are intrepreted as client seperators.

After editing exports, using the following command

sudo exportfs -a

To see what you are exporting

sudo showmount –exports

To see what mounts are currently being used

sudo showmount –all

Install NFS client support in Ubuntu

sudo apt-get install portmap nfs-common

This will install all the required packages for nfs client
You can then mount a share by hand using the following command

sudo mount server.mydomain.com:/files /files

Or you can add it to your /etc/fstab like this (on one line)

server.mydomain.com:/files /files nfs rsize=8192,wsize=8192,timeo=14,intr

Once added to your fstab you can mount it like this

sudo mount /files

Firewall Ports for NFS
If you have a firewall you need to make sure ports 32771, 111 and 2049 are open

Sources:

1. www.ubuntugeek.com
2. man exports

ISOs in Ubuntu

To make an ISO from CD/DVD
Place the media in your drive but do not mount it. If it automounts, unmount it.

dd if=/dev/dvd of=dvd.iso # for dvd
dd if=/dev/cdrom of=cd.iso # for cdrom
dd if=/dev/scd0 of=cd.iso # if cdrom is scsi

To make an ISO from files on Hard Drive
Create a directory with the files you want.

mkisofs -r -J -o /tmp/cd.iso /tmp/directory/

To mount an ISO

mount -oloop /path/to/cd.iso /mnt/image

Sources:
1. nawsher.wordpress.com
2. ubuntuforums.org
3. www.tldp.org

SMTP Relay:
Many hosting providers (including the one I work for) no longer allowing open relay from their web servers. Open relay allows for spammers to find holes and bugs in code and then inject mail via a vulnerable website to the service providers mail server. This mail gets accepted and sent on to various recipients as the mail is assumed to have come from a valid/trusted source.

This motivated me to created a plugin for bbpress to enable SMTP Authentication by using PEAR Mail.php
If you would like to make use of this plugin, please feel free to grab a copy.

More »

A little while ago I built a USB programmer for Atmel AVR controllers.

It is a fairly simple project, and I found it to be extremely useful for programming some of the other ATMega8/16s I’ve been playing with. It has a few limitations, in particular, limited software support (choice of programmer) and no support for programming ATtiny’s.

The programmer is designed by Thomas Fischl, uses the Firmware only USB Driver from obdev.com
I chose the usbasp_gr by J.A. de Groot for the layout as it uses no pesky surface mount components.
At build time, I had not yet played with any surface mount kit, and my soldering iron can be classified as a spade. At some point I hope to revisit the build and go for something much smaller. Hannes Östlund’s layout( Doubleside-Side PCB with SMD components) is small enough to fit into an old USB Memory stick case which is great.

More »

« Previous Articles    
www.hartzenberg.net is based on WordPress platform, RSS tech , RSS comments design by Gx3.